Skip to contentSkip to conversation

iptables-test: Support testing host binaries

PATCH In review Phil Sutter 2 participants 2 messages Sep 14, 2019 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 iptables-test: Support testing host binaries

Introduce --host parameter to run the testsuite against host's binaries instead of built ones.

---
 iptables-test.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
iptables-test.py +6 -2
index dc5f0ead2f0eb..2aac8ef2256dc 100755
@@ -314,6 +314,8 @@ def main():
     parser.add_argument('filename', nargs='?',
                         metavar='path/to/file.t',
                         help='Run only this test')
+    parser.add_argument('-H', '--host', action='store_true',
+                        help='Run tests against installed binaries')
     parser.add_argument('-l', '--legacy', action='store_true',
                         help='Test iptables-legacy')
     parser.add_argument('-m', '--missing', action='store_true',
@@ -340,8 +342,10 @@ def main():
         print("You need to be root to run this, sorry")
         return
 
-    os.putenv("XTABLES_LIBDIR", os.path.abspath(EXTENSIONS_PATH))
-    os.putenv("PATH", "%s/iptables:%s" % (os.path.abspath(os.path.curdir), os.getenv("PATH")))
+    if not args.host:
+        os.putenv("XTABLES_LIBDIR", os.path.abspath(EXTENSIONS_PATH))
+        os.putenv("PATH", "%s/iptables:%s" % (os.path.abspath(os.path.curdir),
+                                              os.getenv("PATH")))
 
     test_files = 0
     tests = 0
Signature · 1 line
2.22.0