On 06.10.2021 17:54, David Ahern wrote:
On 10/6/21 5:47 AM, Leonard Crestez wrote:
The -k switch makes the server fork into the background after the listen call is succesful, this can be used to replace most of the `sleep 1` statements in this script.
Change performed with a vim command:
s/nettest (.*-s.*) &\n\s*sleep 1\n/nettest \1 -k\r
Signed-off-by: Leonard Crestez cdleonard@gmail.com
tools/testing/selftests/net/fcnal-test.sh | 641 ++++++++-------------- 1 file changed, 219 insertions(+), 422 deletions(-)
I have a change from January [1] that runs the tests with 1 binary - takes both client and server side arguments, does the server setup, switches namespaces as needed and then runs the client side. I got bogged down validating the before and after which takes a long time given the number of tests. The output in verbose mode is as important as the pass / fail. Many of the tests document existing behavior as well as intended behavior.
You used a search and replace to update the tests. Did you then do the compare of test results - not pass / fail but output?
I counted the [FAIL] or [ OK ] markers but not the output of nettest itself. I don't know what to look for, I guess I could diff the outputs?
Shouldn't it be sufficient to compare the exit codes of the nettest client?
The output is also modified by a previous change to not capture server output separately and instead let it be combined with that of the client. That change is required for this one, doing out=$(nettest -k) does not return on fork unless the pipe is also closed.
I did not look at your change, mine is relatively minimal because it only changes who decide when the server goes into the background: the shell script or the server itself. This makes it work very easily even for tests with multiple server instances.
-- Regards, Leonard