Page MenuHomeFreeBSD

tftp: Add tests.
ClosedPublic

Authored by des on Mar 7 2023, 11:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 9 2024, 6:33 AM
Unknown Object (File)
Mar 9 2024, 6:33 AM
Unknown Object (File)
Mar 9 2024, 6:33 AM
Unknown Object (File)
Mar 9 2024, 6:33 AM
Unknown Object (File)
Mar 9 2024, 6:33 AM
Unknown Object (File)
Mar 9 2024, 6:21 AM
Unknown Object (File)
Feb 28 2024, 2:13 PM
Unknown Object (File)
Feb 18 2024, 10:50 PM
Subscribers

Details

Reviewers
imp
jhb
asomers
Group Reviewers
Klara
tests
Commits
rG64c2a712d661: tftp: Add tests.
Summary

Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Mar 7 2023, 11:05 PM
des created this revision.
asomers requested changes to this revision.Mar 7 2023, 11:43 PM
asomers added a subscriber: asomers.
asomers added inline comments.
usr.bin/tftp/tests/Makefile
7

You need this, since you can only have one instance of inetd running at a time.

usr.bin/tftp/tests/tftp_test.sh
13

It's racy to check the port here, then start inetd below and assume that it will work. Can you start inetd first, and then check its return code instead?

This revision now requires changes to proceed.Mar 7 2023, 11:43 PM
des marked 2 inline comments as done.Mar 8 2023, 12:10 AM
des added inline comments.
usr.bin/tftp/tests/Makefile
7

That's not true. You can have as many as you want as long as they don't try to use the same PID file or bind to the same ports.

usr.bin/tftp/tests/tftp_test.sh
13

No, because it doesn't try to bind until after it has daemonized.

des marked 2 inline comments as done.Mar 8 2023, 12:12 AM
usr.bin/tftp/tests/Makefile
7

But in this case, they _are_ trying to bind to the same ports, right?

usr.bin/tftp/tests/tftp_test.sh
8

Kyua runs each test case in its own temporary directory, and automatically cleans it up when done. So you should put all of these temporary files in PWD instead of TMPDIR.

13

Annoying. Can you think of any other way to close the race? Would it be worthwhile to write a "mini-inetd" just for this test suite, which knows only how to invoke tftpd? That could fix the exclusivity problem too, by using a different port for each test case.

des marked 3 inline comments as done.Mar 8 2023, 1:05 AM
des added inline comments.
usr.bin/tftp/tests/Makefile
7

As each other, sure, but ATF does not run them concurrently.

usr.bin/tftp/tests/tftp_test.sh
8

Kyua sets TMPDIR correctly, so this is a non-issue.

13

No, and it's really not an issue. The check is intended to catch the case where someone tries to run the test manually and already have tftpd enabled for some reason.

We can't use a different port for each test case because the client doesn't fully support alternate ports.

des marked 3 inline comments as done.Mar 8 2023, 1:05 AM
kevans added inline comments.
usr.bin/tftp/tests/Makefile
7

atf executes an individual test, it does not do orschestration of multiple tests. People do regularly run parallelized kyua runs (see kyua.conf(5), parallelism), so this is needed.

des marked an inline comment as done.Mar 8 2023, 1:21 AM
asomers requested changes to this revision.Mar 9 2023, 6:30 PM
asomers added inline comments.
usr.bin/tftp/tests/tftp_test.sh
101

You should skip if IPv6 is unsupported. See tests/etc/rc.d/routing_test.sh for an example. Also, in tftp_put_ipv6_body .

This revision now requires changes to proceed.Mar 9 2023, 6:30 PM

Skip IPv6 tests if IPv6 is disabled.

des marked an inline comment as done.Mar 10 2023, 12:33 PM
This revision is now accepted and ready to land.Mar 10 2023, 1:00 PM
This revision was automatically updated to reflect the committed changes.