]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: json_echo: Skip if run as non-root
authorPhil Sutter <phil@nwl.cc>
Thu, 31 Aug 2023 10:50:54 +0000 (12:50 +0200)
committerPhil Sutter <phil@nwl.cc>
Thu, 11 Sep 2025 16:11:53 +0000 (18:11 +0200)
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>
tests/json_echo/run-test.py

index a6bdfc61afd7bfc35dd51b664c8fd2113942fcef..a3085b35ade6b04e0c407d3615e36ec7a024b92e 100755 (executable)
@@ -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/'))