Skip to contentSkip to conversation

tests: use common shebang in "packetpath/flowtables" test

PATCH In review Thomas Haller 2 participants 2 messages Feb 9, 2024 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: use common shebang in "packetpath/flowtables" test

"./tools/check-tree.sh" checks for a certain shebang. Either /bin/bash or /bin/bash -e. No other are currently allowed, because it makes sense to be strict/consistent and there is no need such flexibility.

Move the "-x" to a later command.

Note that "set -x" may not be a good choice anyway. If you want to debug a test and see the shell commands, you could just run

  $ ./tests/shell/run-tests.sh tests/shell/testcases/packetpath/flowtables -x

That will automatically use /bin/bash -x as interpreter. And that works for all tests the same. This is also the reason why "check-tree.sh" checks for a well-known shebang. Because the "-x" option of the test runner mangles the shebang, but for that it needs to understand it.

---
Btw, "check-tree.sh" also complains about lack of .nft/.nodump file. The test should get one of these (depending on what's appropriate). You can generate them with

    $ ./tests/shell/run-tests.sh tests/shell/testcases/packetpath/flowtables -g
 tests/shell/testcases/packetpath/flowtables | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/shell/testcases/packetpath/flowtables +3 -1
index 852a05c6d0ab..b962984fb6ec 100755
@@ -1,7 +1,9 @@
-#! /bin/bash -x
+#!/bin/bash
 
 # NFT_TEST_SKIP(NFT_TEST_SKIP_slow)
 
+set -x
+
 rnd=$(mktemp -u XXXXXXXX)
 R="flowtable-router-$rnd"
 C="flowtable-client-$rnd"
Signature · 1 line
2.43.0
reviewer
#1 lore raw
Quoted 3 lines · Thomas Haller

"./tools/check-tree.sh" checks for a certain shebang. Either /bin/bash or /bin/bash -e. No other are currently allowed, because it makes sense to be strict/consistent and there is no need such flexibility.

Why be picky about extra flags to /bin/bash? If you assert the first "word" after #! is as expected, the remaining bits are known to be bash-compatible at least, no?

Quoted 6 lines

Move the "-x" to a later command.

Note that "set -x" may not be a good choice anyway. If you want to debug a test and see the shell commands, you could just run

  $ ./tests/shell/run-tests.sh tests/shell/testcases/packetpath/flowtables -x

Please document such things before denying other ways to achieve the same. ;)
Seriously, if this is the way to run the tests with tracing enabled, it should be explained in tests/shell/README.

Cheers, Phil