70 строки
2.6 KiB
Diff
70 строки
2.6 KiB
Diff
From 6096c50caaf1322a572efb88d76872bb3bc2242f Mon Sep 17 00:00:00 2001
|
|
From: Phil Sutter <phil@nwl.cc>
|
|
Date: Thu, 6 Feb 2020 01:36:01 +0100
|
|
Subject: [PATCH] tests: py: Support testing host binaries
|
|
|
|
Support -H/--host option to use host's libnftables.so.1. Alternatively
|
|
users may specify a custom library path via -l/--library option.
|
|
|
|
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
(cherry picked from commit 5f2746205e50c77295d0f84f8178ee3a1ce15407)
|
|
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
---
|
|
tests/py/nft-test.py | 22 ++++++++++++++++++----
|
|
1 file changed, 18 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py
|
|
index 6edca3c6a5a2f..01ee6c980ad4a 100755
|
|
--- a/tests/py/nft-test.py
|
|
+++ b/tests/py/nft-test.py
|
|
@@ -1357,10 +1357,16 @@ def main():
|
|
dest='force_all_family',
|
|
help='keep testing all families on error')
|
|
|
|
+ parser.add_argument('-H', '--host', action='store_true',
|
|
+ help='run tests against installed libnftables.so.1')
|
|
+
|
|
parser.add_argument('-j', '--enable-json', action='store_true',
|
|
dest='enable_json',
|
|
help='test JSON functionality as well')
|
|
|
|
+ parser.add_argument('-l', '--library', default=None,
|
|
+ help='path to libntables.so.1, overrides --host')
|
|
+
|
|
parser.add_argument('-s', '--schema', action='store_true',
|
|
dest='enable_schema',
|
|
help='verify json input/output against schema')
|
|
@@ -1388,9 +1394,17 @@ def main():
|
|
# Change working directory to repository root
|
|
os.chdir(TESTS_PATH + "/../..")
|
|
|
|
- if not os.path.exists('src/.libs/libnftables.so'):
|
|
- print("The nftables library does not exist. "
|
|
- "You need to build the project.")
|
|
+ check_lib_path = True
|
|
+ if args.library is None:
|
|
+ if args.host:
|
|
+ args.library = 'libnftables.so.1'
|
|
+ check_lib_path = False
|
|
+ else:
|
|
+ args.library = 'src/.libs/libnftables.so.1'
|
|
+
|
|
+ if check_lib_path and not os.path.exists(args.library):
|
|
+ print("The nftables library at '%s' does not exist. "
|
|
+ "You need to build the project." % args.library)
|
|
return
|
|
|
|
if args.enable_schema and not args.enable_json:
|
|
@@ -1398,7 +1412,7 @@ def main():
|
|
return
|
|
|
|
global nftables
|
|
- nftables = Nftables(sofile = 'src/.libs/libnftables.so')
|
|
+ nftables = Nftables(sofile = args.library)
|
|
|
|
test_files = files_ok = run_total = 0
|
|
tests = passed = warnings = errors = 0
|
|
--
|
|
2.28.0
|
|
|