diff options
Diffstat (limited to 'debian/patches/fix-test-running-tests-no-longer-requires-to-be-root.patch')
-rw-r--r-- | debian/patches/fix-test-running-tests-no-longer-requires-to-be-root.patch | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/debian/patches/fix-test-running-tests-no-longer-requires-to-be-root.patch b/debian/patches/fix-test-running-tests-no-longer-requires-to-be-root.patch new file mode 100644 index 0000000..0dc6e44 --- /dev/null +++ b/debian/patches/fix-test-running-tests-no-longer-requires-to-be-root.patch @@ -0,0 +1,107 @@ +From: Laszlo Gombos <laszlo.gombos@gmail.com> +Date: Tue, 21 Feb 2023 00:20:29 +0000 +Subject: fix(test): running tests no longer requires to be root + +Origin: upstream, https://github.com/dracutdevs/dracut/pull/2429 +--- + Makefile | 1 - + docs/HACKING.md | 10 +++++----- + test/Makefile | 1 - + test/test-functions | 12 ------------ + 4 files changed, 5 insertions(+), 19 deletions(-) + +--- a/Makefile ++++ b/Makefile +@@ -264,7 +264,6 @@ + endif + + check: all syncheck +- @[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; } + @$(MAKE) -C test check + + testimage: all +--- a/docs/HACKING.md ++++ b/docs/HACKING.md +@@ -253,27 +253,27 @@ + mentioned in the `test/container` Dockerfiles. + + ``` +-$ sudo make clean check ++$ make clean check + ``` + + in verbose mode: + ``` +-$ sudo make V=1 clean check ++$ make V=1 clean check + ``` + + only specific test: + ``` +-$ sudo make TESTS="01 20 40" clean check ++$ make TESTS="01 20 40" clean check + ``` + only runs the 01, 20 and 40 tests. + + debug a specific test case: + ``` + $ cd TEST-01-BASIC +-$ sudo make clean setup run ++$ make clean setup run + ``` + ... change some kernel parameters in `test.sh` ... + ``` +-$ sudo make run ++$ make run + ``` + to run the test without doing the setup. +--- a/test/Makefile ++++ b/test/Makefile +@@ -1,7 +1,6 @@ + .PHONY: all check clean $(wildcard TEST-??-*) + + $(wildcard TEST-??-*): +- @[ "$(shell id -u)" = 0 ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; } + @{ \ + [ -d $@ ] || exit 0; \ + [ -f $@/Makefile ] || exit 0; \ +--- a/test/test-functions ++++ b/test/test-functions +@@ -52,15 +52,6 @@ + COLOR_WARNING='\033[0;33m' + COLOR_NORMAL='\033[0;39m' + +-check_root() { +- if ((EUID != 0)); then +- SETCOLOR_FAILURE +- echo "Tests must be run as root! Please use 'sudo'." +- SETCOLOR_NORMAL +- exit 1 +- fi +-} +- + # generate qemu arguments for named raw disks + # + # qemu_add_drive_args <index> <args> <filename> <id-name> [<bootindex>] +@@ -122,13 +113,11 @@ + while (($# > 0)); do + case $1 in + --run) +- check_root + echo "TEST RUN: $TEST_DESCRIPTION" + test_check && test_run + exit $? + ;; + --setup) +- check_root + echo "TEST SETUP: $TEST_DESCRIPTION" + test_check && test_setup + exit $? +@@ -141,7 +130,6 @@ + exit $? + ;; + --all) +- check_root + if ! test_check 2 &> test${TEST_RUN_ID:+-$TEST_RUN_ID}.log; then + echo -e "TEST: $TEST_DESCRIPTION " "$COLOR_WARNING" "[SKIPPED]" "$COLOR_NORMAL" + exit 0 |