]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
tests: iptables-test: Fix for 'make distcheck'
authorPhil Sutter <phil@nwl.cc>
Wed, 6 Nov 2024 14:18:36 +0000 (15:18 +0100)
committerPhil Sutter <phil@nwl.cc>
Wed, 6 Nov 2024 15:09:52 +0000 (16:09 +0100)
This was a tricky one: Since called from VPATH topdir, extensions/ do
not contain test files at all. The script consequently passed since 0
tests failed (of 0 in total).

Fix this by introducing TESTS_PATH which is extensions/ below the directory
of the running iptables-test.py. Keep EXTENSIONS_PATH as-is: The built
extensions are indeed there and XTABLES_LIBDIR must point to them.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables-test.py

index 141fec7b4ed1605b580be86a6941e999155aa28f..66db552185bc348d6b7b315cf3857fb04ba7e2bf 100755 (executable)
@@ -30,6 +30,7 @@ EBTABLES_SAVE = "ebtables-save"
 #IP6TABLES_SAVE = ['xtables-save','-6']
 
 EXTENSIONS_PATH = "extensions"
+TESTS_PATH = os.path.join(os.path.dirname(sys.argv[0]), "extensions")
 LOGFILE="/tmp/iptables-test.log"
 log_file = None
 
@@ -558,7 +559,7 @@ def show_missing():
     '''
     Show the list of missing test files
     '''
-    file_list = os.listdir(EXTENSIONS_PATH)
+    file_list = os.listdir(TESTS_PATH)
     testfiles = [i for i in file_list if i.endswith('.t')]
     libfiles = [i for i in file_list
                 if i.startswith('lib') and i.endswith('.c')]
@@ -669,8 +670,8 @@ def main():
         if args.filename:
             file_list = args.filename
         else:
-            file_list = [os.path.join(EXTENSIONS_PATH, i)
-                         for i in os.listdir(EXTENSIONS_PATH)
+            file_list = [os.path.join(TESTS_PATH, i)
+                         for i in os.listdir(TESTS_PATH)
                          if i.endswith('.t')]
             file_list.sort()