From: Phil Sutter Date: Thu, 31 Aug 2023 10:50:54 +0000 (+0200) Subject: tests: json_echo: Skip if run as non-root X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=904ce10112c9d1c5a751dee214860d43b08b569d;p=thirdparty%2Fnftables.git 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 --- diff --git a/tests/json_echo/run-test.py b/tests/json_echo/run-test.py index a6bdfc61a..a3085b35a 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/'))