Page MenuHomeFreeBSD

tests/unix_passfd: compile SOCK_STREAM and SOCK_DGRAM versions
ClosedPublic

Authored by glebius on Jun 7 2022, 1:20 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 8 2024, 6:09 PM
Unknown Object (File)
Feb 23 2024, 5:27 AM
Unknown Object (File)
Jan 14 2024, 9:59 AM
Unknown Object (File)
Dec 28 2023, 7:09 PM
Unknown Object (File)
Dec 28 2023, 7:06 PM
Unknown Object (File)
Dec 20 2023, 5:48 AM
Unknown Object (File)
Dec 19 2023, 10:32 AM
Unknown Object (File)
Nov 7 2023, 6:47 AM
Subscribers

Details

Summary

This review is a WIP, it is not final! It is request for comments
and request for help.

The plan is to compile two versions of this file into two tests.

Most test pass identically on different kinds of sockets. However,
few edge cases work differently on stream and datagram sockets. We
want to exercise this and document.

The current patch has code under ifdef OLD_UNIX_DGRAM that will make
the test pass on FreeBSD CURRENT. With new implementation 2 edge cases
would behave differently. You are welcome to disagree and prove me
wrong :)

This revision is planned to be committed after the new implementation
and with OLD_UNIX_DGRAM code removed.

The final requirement to get it committed is the make(1) glue. This is
where I'm seeking for a help! I need somehow to modify tests Makefile,
so that it compiles unix_passfd_test.c twice resulting in two different
test binaries, that would be appropriately added to the test list and
installed.

Diff Detail

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

Event Timeline

Instead of doing anything fancy in the Makefile, how about you just create two separate test files named unix_passfd_dgram_test.c and unix_passfd_stream_test.c with contents like this:

#define TEST_PROTO SOCK_STREAM
#include <unix_passfd_test.c>

Instead of doing anything fancy in the Makefile, how about you just create two separate test files named unix_passfd_dgram_test.c and unix_passfd_stream_test.c with contents like this:

#define TEST_PROTO SOCK_STREAM
#include <unix_passfd_test.c>

Great idea! If no make guru comes with a good advice, I'm going to follow this suggestion. Thanks!

  • Implement per Alan's suggestion.
  • Clear OLD_UNIX_DGRAM cruft
ngie added inline comments.
tests/sys/kern/Makefile
40–44

This could be done this way instead.. it would require __XSTRING(TEST_PROTO) be set and queried in the test.

tests/sys/kern/Makefile
40–44

The provided example would not compile either version. I tried something like that, but adding unix_passfd_stream and unix_passfd_dgram to ATF_TESTS_C. This works neither - make would still builds unix_passfd_test twice.

This revision was not accepted when it landed; it landed in state Needs Review.Jun 24 2022, 4:11 PM
This revision was automatically updated to reflect the committed changes.
tests/sys/kern/Makefile
40–44

You have to pick different executable names mapping to the same SRCS, but with different CFLAGS as I described above.

tests/sys/kern/Makefile
40–44

I tried that, and it didn't work :( You are more than welcome just to commit the improvement once you achieve a working version.