From 904ce10112c9d1c5a751dee214860d43b08b569d Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 31 Aug 2023 12:50:54 +0200 Subject: [PATCH] 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 --- tests/json_echo/run-test.py | 4 ++++ 1 file changed, 4 insertions(+) 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/')) -- 2.47.3