On Fri, May 03, 2024 at 03:49:39PM -0700, Jakub Kicinski wrote:
On Thu, 2 May 2024 21:20:11 +0000 Joe Damato wrote:
--- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -84,6 +84,7 @@ TEST_GEN_FILES += sctp_hello TEST_GEN_FILES += csum TEST_GEN_FILES += ip_local_port_range TEST_GEN_FILES += bind_wildcard +TEST_GEN_FILES += epoll_busy_poll
"GEN" is for files which are built for other tests to use. IOW unless there's also a wrapper script under TEST_PROGS (or the C code is itself under TEST_PROGS) this test won't be executed by most CIs.
Ah, I see. OK.
If I decided to go with the kselftest_harness as mentioned below, I'd need to include a wrapper script to run the binary with the right cmd line arg(s) and put that in TEST_PROGS?
FWIW here's how we run the tests in our CI upstream CI: https://github.com/linux-netdev/nipa/wiki/How-to-run-netdev-selftests-CI-sty...
Thanks for the link, I'll give this a close read.
TEST_PROGS += test_vxlan_mdb.sh TEST_PROGS += test_bridge_neigh_suppress.sh TEST_PROGS += test_vxlan_nolocalbypass.sh
+static void do_simple_test(void) +{
- int fd;
- fd = epoll_create1(0);
- if (fd == -1)
error(1, errno, "epoll_create");
- do_simple_test_invalid_fd();
- do_simple_test_invalid_ioctl(fd);
- do_simple_test_get_params(fd);
- do_simple_test_set_invalid(fd);
- do_simple_test_set_and_get_valid(fd);
You don't want to use the kselftest_harness for this? No strong preference here, but seems like you could pop the epoll_create1 into a FIXTURE() and then the test cases into TEST_F() and we'd get the KTAP output formatting, ability to run the tests selectively etc. for free.
I have no preference. I looked at some random .c file test in the directory and it wasn't using the kselftest_harness stuff so I just went with that.
The advantages of kselftest_harness make sense, so I can give it a rewrite to use kselftest_harness in v2.
tools/testing/selftests/net/tap.c is probably a good example to take a look at
Thanks, I'll look at that one. I had previously just kinda scanned reuseaddr_conflict.c and rxtimestamp.c and some other ones. Seemed like a bunch were just regular C programs so I went that route, but the advantages you list make a lot of sense.