summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo M. Bermudo Garay <pablombg@gmail.com>2015-11-19 19:51:49 +0100
committerFlorian Westphal <fw@strlen.de>2015-11-19 22:52:29 +0100
commit6d46f18fdf7554fa39b50405358fd0772b14581e (patch)
treef4a0f2dd65a324f8a208d926ca85e5d5757dc07c
parentc72c2ec73c48556970c1360d2ae82049ec4223d3 (diff)
tests: regression: allow to run tests from anywhere
Since 357d8cf "tests: use the src/nft binary instead of $PATH one", the tests script needs to be executed from nftables repository root. Now the script can be run from any location and also checks the binary existence. To run a single test file, the path must be relative from the directory where you launch the script. Signed-off-by: Pablo M. Bermudo Garay <pablombg@gmail.com> Signed-off-by: Florian Westphal <fw@strlen.de>
-rwxr-xr-xtests/regression/nft-test.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/regression/nft-test.py b/tests/regression/nft-test.py
index ed9653d2..0b0be5dd 100755
--- a/tests/regression/nft-test.py
+++ b/tests/regression/nft-test.py
@@ -20,7 +20,7 @@ import argparse
import signal
TERMINAL_PATH = os.getcwd()
-NFT_BIN = TERMINAL_PATH + "/src/nft"
+NFT_BIN = "src/nft"
TESTS_PATH = os.path.dirname(os.path.abspath(__file__))
TESTS_DIRECTORY = ["any", "arp", "bridge", "inet", "ip", "ip6"]
LOGFILE = "/tmp/nftables-test.log"
@@ -908,9 +908,11 @@ def main():
print "You need to be root to run this, sorry"
return
- if not os.path.isdir("tests/regression/"):
- print "You have to run nft-test.py from the repository root directory, eg.\n\n" + \
- " nftables# python tests/regression/nft-test.py\n"
+ # Change working directory to repository root
+ os.chdir(TESTS_PATH + "/../..")
+
+ if not os.path.isfile(NFT_BIN):
+ print "The nft binary does not exist. You need to build the project."
return
test_files = files_ok = run_total = 0