summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2023-08-31 12:50:54 +0200
committerPhil Sutter <phil@nwl.cc>2025-09-11 18:11:53 +0200
commit904ce10112c9d1c5a751dee214860d43b08b569d (patch)
treeb429961a8ceebc30be1993751ad55f4f22106dd1
parent15c01d744a6b8f428e785a36687e7ecdbc3e7a15 (diff)
tests: json_echo: Skip if run as non-root
The test suite manipulates the kernel ruleset. Use the well-known return code 77 to indicate test execution being skipped. Signed-off-by: Phil Sutter <phil@nwl.cc>
-rwxr-xr-xtests/json_echo/run-test.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/json_echo/run-test.py b/tests/json_echo/run-test.py
index a6bdfc61..a3085b35 100755
--- a/tests/json_echo/run-test.py
+++ b/tests/json_echo/run-test.py
@@ -6,6 +6,10 @@ import os
import json
import argparse
+if os.getuid() != 0:
+ print("You need to be root to run this, sorry")
+ sys.exit(77)
+
TESTS_PATH = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(TESTS_PATH, '../../py/'))