]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests: py: allow to run tests with other nft binaries
authorArturo Borrero <arturo.borrero.glez@gmail.com>
Thu, 21 Apr 2016 09:43:54 +0000 (11:43 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 27 Apr 2016 17:24:56 +0000 (19:24 +0200)
Allow to run tests with other nft binaries by reading a 'NFT'
environment variable, allowing arbitrary locations for the nft binary.

This is what the tests/shell/run-tests.sh script does.

Among other thing, this allow us to properly hook this testsuite
from the Debian CI environment (https://ci.debian.net) where we can perform
tests for packages 'as installed'.

Examples:

 # run with default config (ie src/nft)
 % ./nft-test.py

 # run with installed binary (ie /usr/sbin/nft)
 % NFT=/usr/sbin/nft ./nft-test.py

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/py/nft-test.py

index bba91beacf76db555d8ec94b93272ab3f432fead..fc7ae608b46b209ab5ff981ba2d3196a1abe2f61 100755 (executable)
@@ -19,7 +19,7 @@ import subprocess
 import argparse
 import signal
 
-NFT_BIN = "src/nft"
+NFT_BIN = os.getenv('NFT', "src/nft")
 TESTS_PATH = os.path.dirname(os.path.abspath(__file__))
 TESTS_DIRECTORY = ["any", "arp", "bridge", "inet", "ip", "ip6"]
 LOGFILE = "/tmp/nftables-test.log"