Skip to contentSkip to conversation

tests/shell: Restore testcases/sets/0036add_set_element_expiration_0

PATCH In review Phil Sutter 2 participants 5 messages Oct 28, 2020 – Oct 29, 2020 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 tests/shell: Restore testcases/sets/0036add_set_element_expiration_0

This reverts both commits 46b54fdcf266d3d631ffb6102067825d7672db46 and 0e258556f7f3da35deeb6d5cfdec51eafc7db80d.

With both applied, the test succeeded *only* if 'nft monitor' was running in background, which is equivalent to the original problem (where the test succeeded only if *no* 'nft monitor' was running).

The test merely exposed a kernel bug, so in fact it is correct.

Fixes 46b54fdcf266d ("Revert "monitor: do not print generation ID with --echo"")
---
 tests/shell/testcases/sets/0036add_set_element_expiration_0 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/shell/testcases/sets/0036add_set_element_expiration_0 +1 -1
index 7b2e39a3f0406..51ed0f2c1b3e8 100755
@@ -6,7 +6,7 @@ RULESET="add table ip x
 add set ip x y { type ipv4_addr; flags dynamic,timeout; } 
 add element ip x y { 1.1.1.1 timeout 30s expires 15s }"
 
-test_output=$($NFT -e -f - <<< "$RULESET" 2>&1 | head -n -1)
+test_output=$($NFT -e -f - <<< "$RULESET" 2>&1)
 
 if [ "$test_output" != "$RULESET" ] ; then
 	$DIFF -u <(echo "$test_output") <(echo "$RULESET")
Signature · 1 line
2.28.0
#1 lore raw

Hi Phil,

Quoted 8 lines · Phil Sutter

This reverts both commits 46b54fdcf266d3d631ffb6102067825d7672db46 and 0e258556f7f3da35deeb6d5cfdec51eafc7db80d.

With both applied, the test succeeded *only* if 'nft monitor' was running in background, which is equivalent to the original problem (where the test succeeded only if *no* 'nft monitor' was running).

The test merely exposed a kernel bug, so in fact it is correct.

Please, do not revert this.

This kernel patch needs this fix:

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/

Thanks.

Quoted 22 lines
Fixes 46b54fdcf266d ("Revert "monitor: do not print generation ID with --echo"")
---
 tests/shell/testcases/sets/0036add_set_element_expiration_0 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/shell/testcases/sets/0036add_set_element_expiration_0 +1 -1
index 7b2e39a3f0406..51ed0f2c1b3e8 100755
@@ -6,7 +6,7 @@ RULESET="add table ip x
 add set ip x y { type ipv4_addr; flags dynamic,timeout; } 
 add element ip x y { 1.1.1.1 timeout 30s expires 15s }"
 
-test_output=$($NFT -e -f - <<< "$RULESET" 2>&1 | head -n -1)
+test_output=$($NFT -e -f - <<< "$RULESET" 2>&1)
 
 if [ "$test_output" != "$RULESET" ] ; then
 	$DIFF -u <(echo "$test_output") <(echo "$RULESET")
Signature · 1 line
2.28.0
#2 lore raw
Quoted 10 lines · Pablo Neira Ayuso

Hi Phil,

Quoted 7 lines · Phil Sutter

This reverts both commits 46b54fdcf266d3d631ffb6102067825d7672db46 and 0e258556f7f3da35deeb6d5cfdec51eafc7db80d.

With both applied, the test succeeded *only* if 'nft monitor' was running in background, which is equivalent to the original problem (where the test succeeded only if *no* 'nft monitor' was running).

Quoted 7 lines
Quoted 1 line

The test merely exposed a kernel bug, so in fact it is correct.

Please, do not revert this.

This kernel patch needs this fix:

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/

With the kernel patch above, this test does not break anymore.

ie. --echo is not printing the generation ID because kernel bug.

Quoted 22 lines
Quoted 22 lines
Fixes 46b54fdcf266d ("Revert "monitor: do not print generation ID with --echo"")
---
 tests/shell/testcases/sets/0036add_set_element_expiration_0 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/shell/testcases/sets/0036add_set_element_expiration_0 +1 -1
index 7b2e39a3f0406..51ed0f2c1b3e8 100755
@@ -6,7 +6,7 @@ RULESET="add table ip x
 add set ip x y { type ipv4_addr; flags dynamic,timeout; } 
 add element ip x y { 1.1.1.1 timeout 30s expires 15s }"
 
-test_output=$($NFT -e -f - <<< "$RULESET" 2>&1 | head -n -1)
+test_output=$($NFT -e -f - <<< "$RULESET" 2>&1)
 
 if [ "$test_output" != "$RULESET" ] ; then
 	$DIFF -u <(echo "$test_output") <(echo "$RULESET")
Signature · 1 line
2.28.0
author reviewer
#3 lore raw

Hi Pablo,

Quoted 15 lines · Pablo Neira Ayuso
Quoted 14 lines · Pablo Neira Ayuso

Hi Phil,

Quoted 8 lines · Phil Sutter

This reverts both commits 46b54fdcf266d3d631ffb6102067825d7672db46 and 0e258556f7f3da35deeb6d5cfdec51eafc7db80d.

With both applied, the test succeeded *only* if 'nft monitor' was running in background, which is equivalent to the original problem (where the test succeeded only if *no* 'nft monitor' was running).

The test merely exposed a kernel bug, so in fact it is correct.

Please, do not revert this.

Quoted 7 lines
Quoted 3 lines

This kernel patch needs this fix:

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/

With the kernel patch above, this test does not break anymore.

ie. --echo is not printing the generation ID because kernel bug.

Oh, I mis-read the kernel patch, sorry for the mess. I would suggest to change your test case fix into this though:

| -test_output=$($NFT -e -f - <<< "$RULESET" 2>&1 | head -n -1)
| +test_output=$($NFT -e -f - <<< "$RULESET" 2>&1 | grep -v '# new generation')

This makes it clear what is to be omitted and also makes the test work with unpatched kernels as well. Fine with you?

Thanks, Phil

#4 lore raw
Quoted 26 lines · Phil Sutter

Hi Pablo,

Quoted 15 lines · Pablo Neira Ayuso
Quoted 14 lines · Pablo Neira Ayuso

Hi Phil,

Quoted 8 lines · Phil Sutter

This reverts both commits 46b54fdcf266d3d631ffb6102067825d7672db46 and 0e258556f7f3da35deeb6d5cfdec51eafc7db80d.

With both applied, the test succeeded *only* if 'nft monitor' was running in background, which is equivalent to the original problem (where the test succeeded only if *no* 'nft monitor' was running).

The test merely exposed a kernel bug, so in fact it is correct.

Please, do not revert this.

Quoted 7 lines
Quoted 3 lines

This kernel patch needs this fix:

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/

With the kernel patch above, this test does not break anymore.

ie. --echo is not printing the generation ID because kernel bug.

Quoted 8 lines

Oh, I mis-read the kernel patch, sorry for the mess. I would suggest to change your test case fix into this though:

| -test_output=$($NFT -e -f - <<< "$RULESET" 2>&1 | head -n -1)
| +test_output=$($NFT -e -f - <<< "$RULESET" 2>&1 | grep -v '# new generation')

This makes it clear what is to be omitted and also makes the test work with unpatched kernels as well. Fine with you?

That's fine indeed and more readable indeed.