netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nft PATCH] tests/shell: Restore testcases/sets/0036add_set_element_expiration_0
@ 2020-10-28 17:03 Phil Sutter
  2020-10-28 19:05 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 5+ messages in thread
From: Phil Sutter @ 2020-10-28 17:03 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

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"")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 tests/shell/testcases/sets/0036add_set_element_expiration_0 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/shell/testcases/sets/0036add_set_element_expiration_0 b/tests/shell/testcases/sets/0036add_set_element_expiration_0
index 7b2e39a3f0406..51ed0f2c1b3e8 100755
--- a/tests/shell/testcases/sets/0036add_set_element_expiration_0
+++ b/tests/shell/testcases/sets/0036add_set_element_expiration_0
@@ -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")
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [nft PATCH] tests/shell: Restore testcases/sets/0036add_set_element_expiration_0
  2020-10-28 17:03 [nft PATCH] tests/shell: Restore testcases/sets/0036add_set_element_expiration_0 Phil Sutter
@ 2020-10-28 19:05 ` Pablo Neira Ayuso
  2020-10-28 19:08   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Neira Ayuso @ 2020-10-28 19:05 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netfilter-devel

Hi Phil,

On Wed, Oct 28, 2020 at 06:03:38PM +0100, Phil Sutter wrote:
> 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/20201022204032.28904-1-pablo@netfilter.org/

Thanks.

> Fixes: 46b54fdcf266d ("Revert "monitor: do not print generation ID with --echo"")
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
>  tests/shell/testcases/sets/0036add_set_element_expiration_0 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/shell/testcases/sets/0036add_set_element_expiration_0 b/tests/shell/testcases/sets/0036add_set_element_expiration_0
> index 7b2e39a3f0406..51ed0f2c1b3e8 100755
> --- a/tests/shell/testcases/sets/0036add_set_element_expiration_0
> +++ b/tests/shell/testcases/sets/0036add_set_element_expiration_0
> @@ -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")
> -- 
> 2.28.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [nft PATCH] tests/shell: Restore testcases/sets/0036add_set_element_expiration_0
  2020-10-28 19:05 ` Pablo Neira Ayuso
@ 2020-10-28 19:08   ` Pablo Neira Ayuso
  2020-10-29 11:18     ` Phil Sutter
  0 siblings, 1 reply; 5+ messages in thread
From: Pablo Neira Ayuso @ 2020-10-28 19:08 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netfilter-devel

On Wed, Oct 28, 2020 at 08:05:38PM +0100, Pablo Neira Ayuso wrote:
> Hi Phil,
> 
> On Wed, Oct 28, 2020 at 06:03:38PM +0100, Phil Sutter wrote:
> > 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/20201022204032.28904-1-pablo@netfilter.org/

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

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

> > Fixes: 46b54fdcf266d ("Revert "monitor: do not print generation ID with --echo"")
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> > ---
> >  tests/shell/testcases/sets/0036add_set_element_expiration_0 | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/shell/testcases/sets/0036add_set_element_expiration_0 b/tests/shell/testcases/sets/0036add_set_element_expiration_0
> > index 7b2e39a3f0406..51ed0f2c1b3e8 100755
> > --- a/tests/shell/testcases/sets/0036add_set_element_expiration_0
> > +++ b/tests/shell/testcases/sets/0036add_set_element_expiration_0
> > @@ -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")
> > -- 
> > 2.28.0
> > 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [nft PATCH] tests/shell: Restore testcases/sets/0036add_set_element_expiration_0
  2020-10-28 19:08   ` Pablo Neira Ayuso
@ 2020-10-29 11:18     ` Phil Sutter
  2020-10-29 11:44       ` Pablo Neira Ayuso
  0 siblings, 1 reply; 5+ messages in thread
From: Phil Sutter @ 2020-10-29 11:18 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

Hi Pablo,

On Wed, Oct 28, 2020 at 08:08:47PM +0100, Pablo Neira Ayuso wrote:
> On Wed, Oct 28, 2020 at 08:05:38PM +0100, Pablo Neira Ayuso wrote:
> > Hi Phil,
> > 
> > On Wed, Oct 28, 2020 at 06:03:38PM +0100, Phil Sutter wrote:
> > > 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/20201022204032.28904-1-pablo@netfilter.org/
> 
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [nft PATCH] tests/shell: Restore testcases/sets/0036add_set_element_expiration_0
  2020-10-29 11:18     ` Phil Sutter
@ 2020-10-29 11:44       ` Pablo Neira Ayuso
  0 siblings, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2020-10-29 11:44 UTC (permalink / raw)
  To: Phil Sutter, netfilter-devel

On Thu, Oct 29, 2020 at 12:18:24PM +0100, Phil Sutter wrote:
> Hi Pablo,
> 
> On Wed, Oct 28, 2020 at 08:08:47PM +0100, Pablo Neira Ayuso wrote:
> > On Wed, Oct 28, 2020 at 08:05:38PM +0100, Pablo Neira Ayuso wrote:
> > > Hi Phil,
> > > 
> > > On Wed, Oct 28, 2020 at 06:03:38PM +0100, Phil Sutter wrote:
> > > > 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/20201022204032.28904-1-pablo@netfilter.org/
> > 
> > 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?

That's fine indeed and more readable indeed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-29 11:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-28 17:03 [nft PATCH] tests/shell: Restore testcases/sets/0036add_set_element_expiration_0 Phil Sutter
2020-10-28 19:05 ` Pablo Neira Ayuso
2020-10-28 19:08   ` Pablo Neira Ayuso
2020-10-29 11:18     ` Phil Sutter
2020-10-29 11:44       ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).