tests/monitor: Print error "this requires root" and exit
PATCH 1/1 tests/monitor: Print error "this requires root" and exit
If executed without root privileges, print error "this requires root!" and exit.
Signed-off-by Harsha Sharma <[email protected]>
--- tests/monitor/run-tests.sh | 5 +++++ 1 file changed, 5 insertions(+)
tests/monitor/run-tests.sh +5 -0
@@ -8,6 +8,11 @@ mydiff() { diff -w -I '^# ' "$@" } +if [ "$(id -u)" != "0" ] ; then + echo "this requires root!" + exit 1 +fi + testdir=$(mktemp -d) if [ ! -d $testdir ]; then echo "Failed to create test directory" >&2
Signature · 1 line
2.11.0
Quoted 2 lines · Harsha Sharma
If executed without root privileges, print error "this requires root!" and exit.
Applied, thanks Harsha.