1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
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(-)
diff --git a/Makefile b/Makefile
index 333cd68..10a8e63 100644
--- a/Makefile
+++ b/Makefile
@@ -264,7 +264,6 @@ endif
endif
check: all syncheck
- @[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
@$(MAKE) -C test check
testimage: all
diff --git a/docs/HACKING.md b/docs/HACKING.md
index 6a19434..2e3d614 100644
--- a/docs/HACKING.md
+++ b/docs/HACKING.md
@@ -253,27 +253,27 @@ For the testsuite to pass, you will have to install at least the software packag
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.
diff --git a/test/Makefile b/test/Makefile
index dfaa450..518e7d6 100644
--- 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; \
diff --git a/test/test-functions b/test/test-functions
index f76d930..f28e30a 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -52,15 +52,6 @@ COLOR_FAILURE='\033[0;31m'
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 @@ test_marker_check() {
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 @@ while (($# > 0)); do
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
|