]> git.ipfire.org Git - thirdparty/nftables.git/commit
tests: shell: change all test scripts to return 0
authorFlorian Westphal <fw@strlen.de>
Fri, 4 Jan 2019 14:57:00 +0000 (15:57 +0100)
committerFlorian Westphal <fw@strlen.de>
Fri, 4 Jan 2019 15:00:31 +0000 (16:00 +0100)
commit4d26b6dd3c4c8354a88c4a1aef8ea33229f0a4cc
tree1e82c9b480038033c65cd7d17b08f24e149bcd82
parenteb49882deb3e9ec5eccd6e6106b454e3a6394408
tests: shell: change all test scripts to return 0

The shell-based tests currently encode a return value in the
file name, i.e. foo_1 expects that the script should return '1'
for the test case to pass.

This is very error prone, and one test case is even broken (i.e.,
it returns 1, but because of a different, earlier error).

do_something || exit 1
or
'set -e'

are both pretty common patterns, in both cases tests should fail.

In those test-cases that deliberately test for an error,
nft something_should_fail || exit 0
nft something_should_fail && exit 1

or a similar constructs should be used.

This initial commit modififies all '_1' scripts to return 0 on
success, usually via 'nft wrong || exit 0'.

All tests pass, except the one broken test case that hasn't worked
before either, but where 'set -e' use made it pass (the failing command
is supposed to work, and the command that is supposed to fail is never
run).

Signed-off-by: Florian Westphal <fw@strlen.de>
47 files changed:
tests/shell/run-tests.sh
tests/shell/testcases/chains/0002jumps_1
tests/shell/testcases/chains/0003jump_loop_1
tests/shell/testcases/chains/0004busy_1
tests/shell/testcases/chains/0005busy_map_1
tests/shell/testcases/chains/0007masquerade_1
tests/shell/testcases/chains/0008masquerade_jump_1
tests/shell/testcases/chains/0009masquerade_jump_1
tests/shell/testcases/chains/0010endless_jump_loop_1
tests/shell/testcases/chains/0011endless_jump_loop_1
tests/shell/testcases/chains/0012reject_in_prerouting_1
tests/shell/testcases/chains/0015check_jump_loop_1
tests/shell/testcases/chains/0017masquerade_jump_1
tests/shell/testcases/chains/0018check_jump_loop_1
tests/shell/testcases/chains/0019masquerade_jump_1
tests/shell/testcases/chains/0020depth_1
tests/shell/testcases/chains/0022prio_dummy_1
tests/shell/testcases/chains/0023prio_inet_srcnat_1
tests/shell/testcases/chains/0024prio_inet_dstnat_1
tests/shell/testcases/chains/0025prio_arp_1
tests/shell/testcases/chains/0026prio_netdev_1
tests/shell/testcases/chains/0027prio_bridge_dstnat_1
tests/shell/testcases/chains/0028prio_bridge_out_1
tests/shell/testcases/chains/0029prio_bridge_srcnat_1
tests/shell/testcases/flowtable/0005delete_in_use_1
tests/shell/testcases/flowtable/0008prio_1
tests/shell/testcases/include/0004endlessloop_1
tests/shell/testcases/include/0009glob_nofile_1
tests/shell/testcases/include/0010glob_broken_file_1
tests/shell/testcases/include/0012glob_dependency_1
tests/shell/testcases/maps/different_map_types_1
tests/shell/testcases/nft-f/0007action_object_set_segfault_1
tests/shell/testcases/nft-f/0013defines_1
tests/shell/testcases/nft-f/0014defines_1
tests/shell/testcases/nft-f/0015defines_1
tests/shell/testcases/nft-f/0016redefines_1
tests/shell/testcases/optionals/handles_1
tests/shell/testcases/rule_management/0002addinsertlocation_1
tests/shell/testcases/rule_management/0005replace_1
tests/shell/testcases/rule_management/0006replace_1
tests/shell/testcases/rule_management/0008delete_1
tests/shell/testcases/rule_management/0009delete_1
tests/shell/testcases/sets/0018set_check_size_1
tests/shell/testcases/transactions/0014chain_1
tests/shell/testcases/transactions/0022rule_1
tests/shell/testcases/transactions/0023rule_1
tests/shell/testcases/transactions/0036set_1