Skip to contentSkip to conversation

tests: shell: README: copy edit

PATCH Superseded Štěpán Němec 3 participants 17 messages Oct 20, 2021 – Nov 5, 2021 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 tests: shell: README: copy edit

---
 tests/shell/README | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
tests/shell/README +12 -11
index e0279bbdc30c..35f6e3785f0e 100644
@@ -1,16 +1,17 @@
-This test-suite is intended to perform tests of higher level than
-the other regression test-suite.
+This test suite is intended to perform tests on a higher level
+than the other regression test suites.
 
-It can run arbitrary executables which can perform any test apart of testing
-the nft syntax or netlink code (which is what the regression tests does).
+It can run arbitrary executables which can perform any test, not
+limited to testing the nft syntax or netlink code (which is what
+the regression tests do).
 
 To run the test suite (as root):
  $ cd tests/shell
  # ./run-tests.sh
 
-Test files are executables files with the pattern <<name_N>>, where N is the
-expected return code of the executable. Since they are located with `find',
-test-files can be spread in any sub-directories.
+Test files are executable files matching the pattern <<name_N>>,
+where N is the expected return code of the executable. Since they
+are located with `find', test files can be put in any subdirectory.
 
 You can turn on a verbose execution by calling:
  # ./run-tests.sh -v
@@ -18,11 +19,11 @@ You can turn on a verbose execution by calling:
 And generate missing dump files with:
  # ./run-tests.sh -g <TESTFILE>
 
-Before each call to the test-files, `nft flush ruleset' will be called.
-Also, test-files will receive the environment variable $NFT which contains the
-path to the nftables binary being tested.
+Before each test file invocation, `nft flush ruleset' will be called.
+Also, test file process environment will include the variable $NFT
+which contains the path to the nft binary being tested.
 
 You can pass an arbitrary $NFT value as well:
  # NFT=/usr/local/sbin/nft ./run-tests.sh
 
-By default the tests are run with the nft binary at '../../src/nft'
+By default, the tests are run with the nft binary at '../../src/nft'

base-commit: 2139913694a9850c9160920b2c638aac4828f9bb

Signature · 1 line
2.33.1
#1 lore raw

PATCH 2/3 tests: shell: README: $NFT does not have to be a path to a binary

Fixes 7c8a44b25c22 ("tests: shell: Allow wrappers to be passed as nft command")
---
 tests/shell/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/shell/README +1 -1
index 35f6e3785f0e..4dd595d99556 100644
@@ -21,7 +21,7 @@ And generate missing dump files with:
 
 Before each test file invocation, `nft flush ruleset' will be called.
 Also, test file process environment will include the variable $NFT
-which contains the path to the nft binary being tested.
+which contains the nft command being tested.
 
 You can pass an arbitrary $NFT value as well:
  # NFT=/usr/local/sbin/nft ./run-tests.sh
Signature · 1 line
2.33.1
#2 lore raw

PATCH 3/3 tests: shell: README: clarify test file name convention

In reply to Štěpán Němec
Fixes 4d26b6dd3c4c ("tests: shell: change all test scripts to return 0")
---
 tests/shell/README | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tests/shell/README +6 -2
index 4dd595d99556..07d5cc2e3e7c 100644
@@ -10,8 +10,12 @@ To run the test suite (as root):
  # ./run-tests.sh
 
 Test files are executable files matching the pattern <<name_N>>,
-where N is the expected return code of the executable. Since they
-are located with `find', test files can be put in any subdirectory.
+where N used to be the expected return code of the executable.
+(After commit 4d26b6dd3c4c, all tests should return 0 on success,
+no matter the test file name.)
+
+Since they are located with `find', test files can be put in any
+subdirectory.
 
 You can turn on a verbose execution by calling:
  # ./run-tests.sh -v
Signature · 1 line
2.33.1
reviewer
#3 lore raw
In reply to Štěpán Němec

Hi,

What you you mean with 'copy edit'? Please make subject line a bit more comprehensible. Also, adding at least a single line of description is mandatory, even if the subject speaks for itself.

The actual changes look good to me, though!

Thanks, Phil

#4 lore raw
Quoted 1 line · On Wed, 20 Oct 2021 17:04:02 +0200 Phil Sutter wrote:

What you you mean with 'copy edit'?

https://en.wikipedia.org/wiki/Copy_editing

Quoted 1 line

Please make subject line a bit more comprehensible.

Would "fix language issues" work for you? Or, could we perhaps keep the original subject, and add "fix language issues" in the body, to address your other concern?

Quoted 2 lines

Also, adding at least a single line of description is mandatory, even if the subject speaks for itself.

Commit messages consisting of only the subject and trailers (SOB et al.) are quite common, both in this project and elsewhere. [1]

I suppose that as someone responsible for reviewing and applying patches, you're free to install any hoops you see fit for contributors to jump through, but if it is the project's and contributors' best interest you have in mind, I think it would be better if you mentioned the "description is always mandatory" rule explicitly in patch submission guidelines [2] (providing a rationale and being consistent about it in reality would be better still).

Thanks,

Štěpán

[1] To get some picture, you can pipe output of the attached script to 'git log --stdin --no-walk', or further pipe that to 'git shortlog -ns' for a summary.

[2] https://wiki.nftables.org/wiki-nftables/index.php/Portal:DeveloperDocs/Patch_submission_guidelines

#!/usr/bin/env perl

use strict;
use warnings;

my $log_cmd = "git log -z --pretty=format:'%H\n%b'";

local $/ = "\0";

open(my $log_fh, '-|', $log_cmd) or die "Can't start git log: $!";

while (<$log_fh>) {
chomp;
my ($hash, $body) = split(/\n/, $_, 2);
print($hash, "\n") if ($body =~ /\A\s*(?:[^:\n]+: +[^\n]+\n?)*\s*\Z/);
}

reviewer
#5 lore raw

Hi,

Quoted 6 lines · Štěpán Němec
Quoted 1 line · On Wed, 20 Oct 2021 17:04:02 +0200 Phil Sutter wrote:

What you you mean with 'copy edit'?

https://en.wikipedia.org/wiki/Copy_editing

Ah, thanks! I didn't know the term.

Quoted 5 lines
Quoted 1 line

Please make subject line a bit more comprehensible.

Would "fix language issues" work for you? Or, could we perhaps keep the original subject, and add "fix language issues" in the body, to address your other concern?

Yes, I'm fine with keeping the subject if a description is added.

Quoted 5 lines
Quoted 2 lines

Also, adding at least a single line of description is mandatory, even if the subject speaks for itself.

Commit messages consisting of only the subject and trailers (SOB et al.) are quite common, both in this project and elsewhere. [1]

Well yes, roughly 10% of all commits in nftables repo are. In iptables repo it's even worse with close to 50%. Thanks a lot for providing the script, BTW! :)

Quoted 7 lines

I suppose that as someone responsible for reviewing and applying patches, you're free to install any hoops you see fit for contributors to jump through, but if it is the project's and contributors' best interest you have in mind, I think it would be better if you mentioned the "description is always mandatory" rule explicitly in patch submission guidelines [2] (providing a rationale and being consistent about it in reality would be better still).

Sorry for not checking the guideline but quoting advice I once received from the top of my head instead. Maybe I was incorrect and in obvious cases the description is optional. The relevant text in [2] at least doesn't explicitly state it is, while being pretty verbose about it regarding cover letters.

Cheers, Phil

Quoted 1 line

[2] https://wiki.nftables.org/wiki-nftables/index.php/Portal:DeveloperDocs/Patch_submission_guidelines

#6 lore raw
Quoted 5 lines · On Thu, 21 Oct 2021 12:26:44 +0200 Phil Sutter wrote:

Sorry for not checking the guideline but quoting advice I once received from the top of my head instead. Maybe I was incorrect and in obvious cases the description is optional. The relevant text in [2] at least doesn't explicitly state it is, while being pretty verbose about it regarding cover letters.

Does this mean that you retract your requirement? If not, could you please make sure that you and the other maintainers are on the same page about this, and document the requirement?

Regarding this patch series (if it is to be resent, in part or as a whole): we've discussed the first patch so far; the other two patches have no description, either. Do they need one? If so, could you provide some suggestions? I can't think of anything sensible that isn't already said in the subject, Fixes:, or the modified README text itself.

Thanks,

Štěpán

#7 lore raw
Quoted 13 lines · Štěpán Němec
Quoted 5 lines · On Thu, 21 Oct 2021 12:26:44 +0200 Phil Sutter wrote:

Sorry for not checking the guideline but quoting advice I once received from the top of my head instead. Maybe I was incorrect and in obvious cases the description is optional. The relevant text in [2] at least doesn't explicitly state it is, while being pretty verbose about it regarding cover letters.

Does this mean that you retract your requirement? If not, could you please make sure that you and the other maintainers are on the same page about this, and document the requirement?

Quoted 5 lines

Regarding this patch series (if it is to be resent, in part or as a whole): we've discussed the first patch so far; the other two patches have no description, either. Do they need one? If so, could you provide some suggestions? I can't think of anything sensible that isn't already said in the subject, Fixes:, or the modified README text itself.

I also prefer if there is oneline description in the patch. My suggestions:

* patch 1/3, not clear to me what "copy edit" means either.

* patch 2/3, what is the intention there? a path to the nft executable is most generic way to refer how you use $NFT, right?

* patch 3/3, I'd add a terse sentence so I do not need to scroll down and read the update to README to understand what this patch updates. I'd suggest: "Test files are located with find, so they can be placed in any location."

Regarding reference to 4d26b6dd3c4c, not sure it is worth to add this to the README file. The test infrastructure is only used for internal development use, this is included in tarballs but distributors do not package this.

So please address Phil's feedback.

Thanks.

#8 lore raw
Quoted 4 lines · On Wed, 27 Oct 2021 11:06:00 +0200 Pablo Neira Ayuso wrote:

I also prefer if there is oneline description in the patch. My suggestions:

* patch 1/3, not clear to me what "copy edit" means either.

Description proposal:

Grammar, wording, formatting fixes (no substantial change of meaning).

Quoted 2 lines

* patch 2/3, what is the intention there? a path to the nft executable is most generic way to refer how you use $NFT, right?

No, not since 7c8a44b25c22. I've always thought that 'Fixes:' is mostly or at least also meant for humans, i.e., that the person reading the commit message and wanting to better understand the change would look at the referenced commit, but if that is a wrong assumption to make, I propose to add the following description:

Since commit 7c8a44b25c22, $NFT can contain an arbitrary command, e.g. 'valgrind nft'.

Quoted 4 lines

* patch 3/3, I'd add a terse sentence so I do not need to scroll down and read the update to README to understand what this patch updates. I'd suggest: "Test files are located with find, so they can be placed in any location."

That text was just split to a separate paragraph, it has nothing to do with the actual change.

Quoted 4 lines

Regarding reference to 4d26b6dd3c4c, not sure it is worth to add this to the README file. The test infrastructure is only used for internal development use, this is included in tarballs but distributors do not package this.

IMO this argument should speak _for_ including the commit reference rather than omitting it, as the developer is more likely to be interested in the commit than the consumer.

I thought about making the wording simply describe the current state without any historical explanations, but saying "Test files are executable files matching the pattern <<name_N>>, where N doesn't mean anything." seemed weird.

Please advise.

Signature · 1 line
Štěpán
#9 lore raw
Quoted 15 lines · Štěpán Němec
Quoted 4 lines · On Wed, 27 Oct 2021 11:06:00 +0200 Pablo Neira Ayuso wrote:

I also prefer if there is oneline description in the patch. My suggestions:

* patch 1/3, not clear to me what "copy edit" means either.

Description proposal:

Grammar, wording, formatting fixes (no substantial change of meaning).

Quoted 2 lines

* patch 2/3, what is the intention there? a path to the nft executable is most generic way to refer how you use $NFT, right?

Quoted 8 lines

No, not since 7c8a44b25c22. I've always thought that 'Fixes:' is mostly or at least also meant for humans, i.e., that the person reading the commit message and wanting to better understand the change would look at the referenced commit, but if that is a wrong assumption to make, I propose to add the following description:

Since commit 7c8a44b25c22, $NFT can contain an arbitrary command, e.g. 'valgrind nft'.

OK, but why the reader need to know about former behaviour? The git repository already provides the historical information if this is of his interest. To me, the README file should contain the most up to date information that is relevant to run the test infrastructure.

Quoted 7 lines
Quoted 4 lines

* patch 3/3, I'd add a terse sentence so I do not need to scroll down and read the update to README to understand what this patch updates. I'd suggest: "Test files are located with find, so they can be placed in any location."

That text was just split to a separate paragraph, it has nothing to do with the actual change.

OK, then please document every update in your patch.

Quoted 5 lines
Quoted 4 lines

Regarding reference to 4d26b6dd3c4c, not sure it is worth to add this to the README file. The test infrastructure is only used for internal development use, this is included in tarballs but distributors do not package this.

Quoted 8 lines

IMO this argument should speak _for_ including the commit reference rather than omitting it, as the developer is more likely to be interested in the commit than the consumer.

I thought about making the wording simply describe the current state without any historical explanations, but saying "Test files are executable files matching the pattern <<name_N>>, where N doesn't mean anything." seemed weird.

For historical explanations, you can dig into git.

Thanks.

#10 lore raw
Quoted 10 lines · On Wed, 27 Oct 2021 12:13:57 +0200 Pablo Neira Ayuso wrote:
Quoted 8 lines · Štěpán Němec
Quoted 2 lines

* patch 2/3, what is the intention there? a path to the nft executable is most generic way to refer how you use $NFT, right?

No, not since 7c8a44b25c22. I've always thought that 'Fixes:' is mostly or at least also meant for humans, i.e., that the person reading the commit message and wanting to better understand the change would look at the referenced commit, but if that is a wrong assumption to make, I propose to add the following description:

Quoted 7 lines
Quoted 2 lines

Since commit 7c8a44b25c22, $NFT can contain an arbitrary command, e.g. 'valgrind nft'.

OK, but why the reader need to know about former behaviour? The git repository already provides the historical information if this is of his interest. To me, the README file should contain the most up to date information that is relevant to run the test infrastructure.

I agree, and that's what the patch does: 'a path to the nft executable' is the former behaviour, arbitrary command is the most up to date information. (The "Since..." text above is my proposal for the commit description, not for the README file.)

Quoted 19 lines
Quoted 7 lines
Quoted 4 lines

* patch 3/3, I'd add a terse sentence so I do not need to scroll down and read the update to README to understand what this patch updates. I'd suggest: "Test files are located with find, so they can be placed in any location."

That text was just split to a separate paragraph, it has nothing to do with the actual change.

OK, then please document every update in your patch.

Quoted 9 lines
Quoted 4 lines

Regarding reference to 4d26b6dd3c4c, not sure it is worth to add this to the README file. The test infrastructure is only used for internal development use, this is included in tarballs but distributors do not package this.

IMO this argument should speak _for_ including the commit reference rather than omitting it, as the developer is more likely to be interested in the commit than the consumer.

Quoted 6 lines
Quoted 4 lines

I thought about making the wording simply describe the current state without any historical explanations, but saying "Test files are executable files matching the pattern <<name_N>>, where N doesn't mean anything." seemed weird.

For historical explanations, you can dig into git.

Would the following README text work for you?

Test files are executable files matching the pattern <<name_N>>, where N has no meaning. All tests should return 0 on success.

Since they are located with `find', test files can be put in any subdirectory.

Maybe saying "where N should be 0 in all new tests" would be less strange?

I think both are significantly less helpful than my original version, but at least they aren't wrong like the current text.

Proposed commit description, based on your comments:

Since commit 4d26b6dd3c4c, test file name suffix no longer reflects expected exit code in all cases.

Move the sentence "Since they are located with `find', test files can be put in any subdirectory." to a separate paragraph.

Signature · 1 line
Štěpán
#11 lore raw
Quoted 21 lines · Štěpán Němec
Quoted 10 lines · On Wed, 27 Oct 2021 12:13:57 +0200 Pablo Neira Ayuso wrote:
Quoted 8 lines · Štěpán Němec
Quoted 2 lines

* patch 2/3, what is the intention there? a path to the nft executable is most generic way to refer how you use $NFT, right?

No, not since 7c8a44b25c22. I've always thought that 'Fixes:' is mostly or at least also meant for humans, i.e., that the person reading the commit message and wanting to better understand the change would look at the referenced commit, but if that is a wrong assumption to make, I propose to add the following description:

Quoted 7 lines
Quoted 2 lines

Since commit 7c8a44b25c22, $NFT can contain an arbitrary command, e.g. 'valgrind nft'.

OK, but why the reader need to know about former behaviour? The git repository already provides the historical information if this is of his interest. To me, the README file should contain the most up to date information that is relevant to run the test infrastructure.

Quoted 4 lines

I agree, and that's what the patch does: 'a path to the nft executable' is the former behaviour, arbitrary command is the most up to date information. (The "Since..." text above is my proposal for the commit description, not for the README file.)

OK, this slightly more verbose description in the paragraph above LGTM.

[...]

Quoted 16 lines
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines

Regarding reference to 4d26b6dd3c4c, not sure it is worth to add this to the README file. The test infrastructure is only used for internal development use, this is included in tarballs but distributors do not package this.

IMO this argument should speak _for_ including the commit reference rather than omitting it, as the developer is more likely to be interested in the commit than the consumer.

Quoted 6 lines
Quoted 4 lines

I thought about making the wording simply describe the current state without any historical explanations, but saying "Test files are executable files matching the pattern <<name_N>>, where N doesn't mean anything." seemed weird.

For historical explanations, you can dig into git.

Quoted 7 lines

Would the following README text work for you?

Test files are executable files matching the pattern <<name_N>>, where N has no meaning. All tests should return 0 on success.

Since they are located with `find', test files can be put in any subdirectory.

LGTM.

Quoted 2 lines

Maybe saying "where N should be 0 in all new tests" would be less strange?

This is also OK, we can probably remove the trailing 0 at some point given it has no meaning anymore.

Quoted 2 lines

I think both are significantly less helpful than my original version, but at least they aren't wrong like the current text.

Makes sense.

Quoted 7 lines

Proposed commit description, based on your comments:

Since commit 4d26b6dd3c4c, test file name suffix no longer reflects expected exit code in all cases.

Move the sentence "Since they are located with `find', test files can be put in any subdirectory." to a separate paragraph.

LGTM.

Thanks.

#12 lore raw

PATCH v2 1/4 tests: shell: README: copy edit

Grammar, wording, formatting fixes (no substantial change of meaning).

---
 tests/shell/README | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)
tests/shell/README +12 -11
index e0279bbdc30c..35f6e3785f0e 100644
@@ -1,16 +1,17 @@
-This test-suite is intended to perform tests of higher level than
-the other regression test-suite.
+This test suite is intended to perform tests on a higher level
+than the other regression test suites.
 
-It can run arbitrary executables which can perform any test apart of testing
-the nft syntax or netlink code (which is what the regression tests does).
+It can run arbitrary executables which can perform any test, not
+limited to testing the nft syntax or netlink code (which is what
+the regression tests do).
 
 To run the test suite (as root):
  $ cd tests/shell
  # ./run-tests.sh
 
-Test files are executables files with the pattern <<name_N>>, where N is the
-expected return code of the executable. Since they are located with `find',
-test-files can be spread in any sub-directories.
+Test files are executable files matching the pattern <<name_N>>,
+where N is the expected return code of the executable. Since they
+are located with `find', test files can be put in any subdirectory.
 
 You can turn on a verbose execution by calling:
  # ./run-tests.sh -v
@@ -18,11 +19,11 @@ You can turn on a verbose execution by calling:
 And generate missing dump files with:
  # ./run-tests.sh -g <TESTFILE>
 
-Before each call to the test-files, `nft flush ruleset' will be called.
-Also, test-files will receive the environment variable $NFT which contains the
-path to the nftables binary being tested.
+Before each test file invocation, `nft flush ruleset' will be called.
+Also, test file process environment will include the variable $NFT
+which contains the path to the nft binary being tested.
 
 You can pass an arbitrary $NFT value as well:
  # NFT=/usr/local/sbin/nft ./run-tests.sh
 
-By default the tests are run with the nft binary at '../../src/nft'
+By default, the tests are run with the nft binary at '../../src/nft'

base-commit: 6ad2058da66affc105d325e45ff82fd5b5cac41e

Signature · 1 line
2.33.1
#13 lore raw

PATCH v2 2/4 tests: shell: README: $NFT does not have to be a path to a binary

Since commit 7c8a44b25c22, $NFT can contain an arbitrary command, e.g. 'valgrind nft'.

Fixes 7c8a44b25c22 ("tests: shell: Allow wrappers to be passed as nft command")
---
 tests/shell/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/shell/README +1 -1
index 35f6e3785f0e..4dd595d99556 100644
@@ -21,7 +21,7 @@ And generate missing dump files with:
 
 Before each test file invocation, `nft flush ruleset' will be called.
 Also, test file process environment will include the variable $NFT
-which contains the path to the nft binary being tested.
+which contains the nft command being tested.
 
 You can pass an arbitrary $NFT value as well:
  # NFT=/usr/local/sbin/nft ./run-tests.sh
Signature · 1 line
2.33.1
#14 lore raw

PATCH v2 3/4 tests: shell: README: clarify test file name convention

In reply to Štěpán Němec

Since commit 4d26b6dd3c4c, test file name suffix no longer reflects expected exit code in all cases.

Move the sentence "Since they are located with `find', test files can be put in any subdirectory." to a separate paragraph.

Fixes 4d26b6dd3c4c ("tests: shell: change all test scripts to return 0")
---
 tests/shell/README | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tests/shell/README +5 -2
index 4dd595d99556..ea2b0b98f95f 100644
@@ -10,8 +10,11 @@ To run the test suite (as root):
  # ./run-tests.sh
 
 Test files are executable files matching the pattern <<name_N>>,
-where N is the expected return code of the executable. Since they
-are located with `find', test files can be put in any subdirectory.
+where N should be 0 in all new tests. All tests should return 0 on
+success.
+
+Since they are located with `find', test files can be put in any
+subdirectory.
 
 You can turn on a verbose execution by calling:
  # ./run-tests.sh -v
Signature · 1 line
2.33.1
#15 lore raw

PATCH v2 4/4 tests: shell: $NFT needs to be invoked unquoted

In reply to Štěpán Němec

The variable has to undergo word splitting, otherwise the shell tries to find the variable value as an executable, which breaks in cases that 7c8a44b25c22 ("tests: shell: Allow wrappers to be passed as nft command") intends to support.

Mention this in the shell tests README.

Fixes d8ccad2a2b73 ("tests: cover baecd1cf2685 ("segtree: Fix segfault when restoring a huge interval set")")
---
 tests/shell/README                                       | 3 +++
 tests/shell/testcases/sets/0068interval_stack_overflow_0 | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
tests/shell/README +3 -0
index ea2b0b98f95f..3af17a9e72ca 100644
@@ -29,4 +29,7 @@ which contains the nft command being tested.
 You can pass an arbitrary $NFT value as well:
  # NFT=/usr/local/sbin/nft ./run-tests.sh
 
+Note that, to support usage such as NFT='valgrind nft', tests must
+invoke $NFT unquoted.
+
 By default, the tests are run with the nft binary at '../../src/nft'
tests/shell/testcases/sets/0068interval_stack_overflow_0 +1 -1
index 134282de2826..6620572449c3 100755
@@ -26,4 +26,4 @@ table inet test68_table {
 }
 EOF
 
-( ulimit -s 128 && "$NFT" -f "$ruleset_file" )
+( ulimit -s 128 && $NFT -f "$ruleset_file" )
Signature · 1 line
2.33.1