tests: shell: Add test for incomplete set add set command
PATCH 1/2 tests: shell: Add test for incomplete set add set command
Before the [Test] commit if we run nft with incomplete "add set" command it caused segmentation fault and exit with error code 139 and further it didn't throw any error message.
For example:
$ sudo nft add set t s
But after the [Test] commit it throws syntax error message and exits with return value 1.
For example:
$ sudo nft add set t s
<cmdline>:1:12-12: Error: syntax error, unexpected newline, expecting '{'
add set t s
^This commit tests changes made in the [Test] commit.
Test:c6cd7c22548a ( "src: fix crash when inputting an incomplete set add command" )
--- .../testcases/sets/0023incomplete_add_set_command_0 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 tests/shell/testcases/sets/0023incomplete_add_set_command_0
tests/shell/testcases/sets/0023incomplete_add_set_command_0 new file +16 -0
@@ -0,0 +1,16 @@ +#!/bin/bash + +# This testscase checks bug identified and fixed in the commit Id "c6cd7c22548a" +# Before the commit c6cd7c22548a, nft returns 139 (i.e, segmentation fault) which +# indicates the bug but after the commit it returns 1. + +$NFT add table t +$NFT add set t c + +ret=$? +if [ $ret -ne 1 ] ; +then + echo "E: returned $ret instead of 1" >&2 + exit 1 +fi +
Signature · 1 line
1.9.1
PATCH 2/2 tests: shell: Test input descriptors for included files
Before the [Test] commit, nft error message was pointing to wrong file.
But after the commit it points to right file. This commit test the changes made in the [Test] commit.
Test:b14572f72aac (" erec: Fix input descriptors for included files ")
--- .../include/0013input_descriptors_included_files_0 | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 tests/shell/testcases/include/0013input_descriptors_included_files_0
tests/shell/testcases/include/0013input_descriptors_included_files_0 new file +52 -0
@@ -0,0 +1,52 @@ +#!/bin/bash + +# This test the changes made in commit id "b14572f72aac". +# When the commit was not applied, nft pointed to wrong files name. +# As the commit only fixes the error messages and hence does not change the +# return value so, we need to compare the "file name" in the error message +# instead of return value of nft. + + +tmpfile1=$(mktemp -p .) +if [ ! -w $tmpfile1 ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +tmpfile2=$(mktemp -p .) +if [ ! -w $tmpfile2 ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +tmpfile3=$(mktemp -p .) +if [ ! -w $tmpfile3 ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +tmpfile4=$(mktemp -p .) +if [ ! -w $tmpfile4 ]; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +trap "rm -rf $tmpfile1 $tmpfile2 $tmpfile3 $tmpfile4" EXIT # cleanup if aborted + +RULESET1="include \"$tmpfile2\"" +RULESET2="include \"$tmpfile3\"" +RULESET3="add rule x y anything everything" # wrong nft syntax + + +echo "$RULESET1" > $tmpfile1 +echo "$RULESET2" >> $tmpfile1 +echo "$RULESET3" > $tmpfile2 + +$NFT -f $tmpfile1 2> $tmpfile4 + +var=$(awk -F: '$4==" Error"{print $1;exit;}' $tmpfile4) + +if [ $var == "$tmpfile3" ]; then + echo "E: Test failed" >&2 + exit 1 +fi
Signature · 1 line
1.9.1
Pablo Neira Ayuso
maintainerRe: [PATCH 2/2] tests: shell: Test input descriptors for included files
Quoted 5 lines · Shyam Saini
Before the [Test] commit, nft error message was pointing to wrong file.
But after the commit it points to right file. This commit test the changes made in the [Test] commit.
Also applied, thanks.
Quoted 10 lines · Shyam Saini
Before the [Test] commit if we run nft with incomplete "add set" command it caused segmentation fault and exit with error code 139 and further it didn't throw any error message.
For example:
$ sudo nft add set t sBut after the [Test] commit it throws syntax error message and exits with return value 1.
Quoted 7 lines
For example:
$ sudo nft add set t s <cmdline>:1:12-12: Error: syntax error, unexpected newline, expecting '{' add set t s ^This commit tests changes made in the [Test] commit.
Applied, thanks.
I have reworked a bit your commit message, it looks a bit convoluted. No worries, have a look at what I pushed out for reference.
Quoted 17 lines · Pablo Neira Ayuso
Quoted 16 lines · Shyam Saini
Before the [Test] commit if we run nft with incomplete "add set" command it caused segmentation fault and exit with error code 139 and further it didn't throw any error message.
For example:
$ sudo nft add set t sBut after the [Test] commit it throws syntax error message and exits with return value 1.
For example:
$ sudo nft add set t s <cmdline>:1:12-12: Error: syntax error, unexpected newline, expecting '{' add set t s ^
Quoted 5 lines
Quoted 1 line
This commit tests changes made in the [Test] commit.
Applied, thanks.
I have reworked a bit your commit message, it looks a bit convoluted.
Thanks a lot :)
Quoted 1 line
No worries, have a look at what I pushed out for reference.
Shouldn't we follow conventions mentioned in "scripts/checkpatch.pl" ?
Thanks,
shyam
Pablo Neira Ayuso
maintainerQuoted 22 lines · Shyam Saini
Quoted 21 lines · Pablo Neira Ayuso
Quoted 10 lines · Shyam Saini
Before the [Test] commit if we run nft with incomplete "add set" command it caused segmentation fault and exit with error code 139 and further it didn't throw any error message.
For example:
$ sudo nft add set t sBut after the [Test] commit it throws syntax error message and exits with return value 1.
Quoted 7 lines
For example:
$ sudo nft add set t s <cmdline>:1:12-12: Error: syntax error, unexpected newline, expecting '{' add set t s ^This commit tests changes made in the [Test] commit.
Applied, thanks.
Quoted 7 lines
Quoted 1 line
I have reworked a bit your commit message, it looks a bit convoluted.
Thanks a lot :)
Quoted 1 line
No worries, have a look at what I pushed out for reference.
Shouldn't we follow conventions mentioned in "
scripts/checkpatch.pl" ?
Interesting.
So the [test] thing is something that checkpatch.pl suggests, right?
I would like to know more about that new thing, do you have documentation about this?
I just tend to like that commit message are human-readable. I understand this structure makes it easier for robots, more simple to parse.
So don't take checkpatch too seriously, probably too much engineering is going on there ;-)
Quoted 27 lines · Pablo Neira Ayuso
Quoted 26 lines · Shyam Saini
Quoted 17 lines · Pablo Neira Ayuso
Quoted 16 lines · Shyam Saini
Before the [Test] commit if we run nft with incomplete "add set" command it caused segmentation fault and exit with error code 139 and further it didn't throw any error message.
For example:
$ sudo nft add set t sBut after the [Test] commit it throws syntax error message and exits with return value 1.
For example:
$ sudo nft add set t s <cmdline>:1:12-12: Error: syntax error, unexpected newline, expecting '{' add set t s ^Quoted 5 lines
Quoted 1 line
This commit tests changes made in the [Test] commit.
Applied, thanks.
I have reworked a bit your commit message, it looks a bit convoluted.
Thanks a lot :)
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
No worries, have a look at what I pushed out for reference.
Shouldn't we follow conventions mentioned in "
scripts/checkpatch.pl" ?Interesting.
So the [test] thing is something that checkpatch.pl suggests, right?
yes something like that.
Quoted 2 lines
I would like to know more about that new thing, do you have documentation about this?
No documentation but yeah it throws following error when convention is not followed.
"ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit c6cd7c22548a ("src: fix crash when inputting an incomplete set add command")'"
Quoted 6 lines
I just tend to like that commit message are human-readable. I understand this structure makes it easier for robots, more simple to parse.
So don't take checkpatch too seriously, probably too much engineering is going on there ;-)
Sure,
Thanks for the correction
Pablo Neira Ayuso
maintainerQuoted 40 lines · Shyam Saini
Quoted 27 lines · Pablo Neira Ayuso
Quoted 26 lines · Shyam Saini
Quoted 17 lines · Pablo Neira Ayuso
Quoted 16 lines · Shyam Saini
Before the [Test] commit if we run nft with incomplete "add set" command it caused segmentation fault and exit with error code 139 and further it didn't throw any error message.
For example:
$ sudo nft add set t sBut after the [Test] commit it throws syntax error message and exits with return value 1.
For example:
$ sudo nft add set t s <cmdline>:1:12-12: Error: syntax error, unexpected newline, expecting '{' add set t s ^Quoted 5 lines
Quoted 1 line
This commit tests changes made in the [Test] commit.
Applied, thanks.
I have reworked a bit your commit message, it looks a bit convoluted.
Thanks a lot :)
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
No worries, have a look at what I pushed out for reference.
Shouldn't we follow conventions mentioned in "
scripts/checkpatch.pl" ?Interesting.
So the [test] thing is something that checkpatch.pl suggests, right?
yes something like that.
Quoted 2 lines
I would like to know more about that new thing, do you have documentation about this?
Quoted 6 lines
No documentation but yeah it throws following error when convention is not followed.
"ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit
c6cd7c22548a("src: fix crash when inputting an incomplete set add command")'"
Ah, that's different thing.
so no need for the [Test] tag you are adding.
This means that:
commit c6cd7c22548a ("src: fix crash when inputting an incomplete set add command")
is the right way to refer to commits. That's a valid thing indeed, we should stick to that.
Let's stick to this in follow up patches, OK?
Quoted 44 lines · Pablo Neira Ayuso
Quoted 43 lines · Shyam Saini
Quoted 27 lines · Pablo Neira Ayuso
Quoted 26 lines · Shyam Saini
Quoted 17 lines · Pablo Neira Ayuso
Quoted 16 lines · Shyam Saini
Before the [Test] commit if we run nft with incomplete "add set" command it caused segmentation fault and exit with error code 139 and further it didn't throw any error message.
For example:
$ sudo nft add set t sBut after the [Test] commit it throws syntax error message and exits with return value 1.
For example:
$ sudo nft add set t s <cmdline>:1:12-12: Error: syntax error, unexpected newline, expecting '{' add set t s ^Quoted 5 lines
Quoted 1 line
This commit tests changes made in the [Test] commit.
Applied, thanks.
I have reworked a bit your commit message, it looks a bit convoluted.
Thanks a lot :)
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
No worries, have a look at what I pushed out for reference.
Shouldn't we follow conventions mentioned in "
scripts/checkpatch.pl" ?Interesting.
So the [test] thing is something that checkpatch.pl suggests, right?
yes something like that.
Quoted 2 lines
I would like to know more about that new thing, do you have documentation about this?
No documentation but yeah it throws following error when convention is not followed.
Quoted 7 lines
Quoted 3 lines
"ERROR: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit
c6cd7c22548a("src: fix crash when inputting an incomplete set add command")'"Ah, that's different thing.
so no need for the [Test] tag you are adding.
Sure
Quoted 6 lines
This means that:
commit
c6cd7c22548a("src: fix crash when inputting an incomplete set add command")is the right way to refer to commits. That's a valid thing indeed, we should stick to that.
After adding "commit" keyword in the same commit message the error gone . Sorry, my bad.
Quoted 1 line
Let's stick to this in follow up patches, OK?
Sure
Thanks a lot