diff options
author | Harsha Sharma <harshasharmaiitr@gmail.com> | 2017-11-06 21:04:05 +0530 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-11-06 16:42:34 +0100 |
commit | ec93f80c18f883ecf51ec487c2064d79147f3913 (patch) | |
tree | 54d36bded302da9f68735af52e046d1bdf117a69 /tests/monitor/run-tests.sh | |
parent | 7462ef9269ebc98dcddd6a2c2f61dbd3457a777d (diff) |
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 <harshasharmaiitr@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/monitor/run-tests.sh')
-rwxr-xr-x | tests/monitor/run-tests.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/monitor/run-tests.sh b/tests/monitor/run-tests.sh index 23d4e212..1adabda1 100755 --- a/tests/monitor/run-tests.sh +++ b/tests/monitor/run-tests.sh @@ -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 |