Page MenuHomeFreeBSD

uniq tests: Make uniq_test:stdout more reliable
ClosedPublic

Authored by markj on Jun 7 2024, 7:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 9, 1:17 AM
Unknown Object (File)
Aug 28 2025, 11:37 AM
Unknown Object (File)
Aug 26 2025, 1:36 PM
Unknown Object (File)
Aug 20 2025, 2:14 PM
Unknown Object (File)
Aug 19 2025, 10:22 AM
Unknown Object (File)
Aug 14 2025, 3:59 AM
Unknown Object (File)
Aug 9 2025, 10:32 PM
Unknown Object (File)
Aug 7 2025, 10:22 PM
Subscribers

Details

Summary

When running regression tests in paralle, this one occasionally fails
because uniq exits with status 0. I believe this is because the test is
a bit racy: it assumes that true(1) will exit before uniq writes to
standard out.

It is easy to reproduce this failure by running the test in a loop and
running a buildkernel in the background. Make the race smaller by
sleeping for a bit. Maybe there's a cleverer way to handle this?

Diff Detail

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

Event Timeline

markj requested review of this revision.Jun 7 2024, 7:33 PM
usr.bin/uniq/tests/uniq_test.sh
171

I would increase this to 1 in case the test is ever ported to a platform where sleep(1) doesn't take fractional values. It's not like anyone will notice the delay.

174

replacing true with : (which is a shell builtin, while true may or may not be) might also help.

usr.bin/uniq/tests/uniq_test.sh
174

Unfortunately, that doesn't do the trick.

Apply feedback, don't use fractional times.

This revision is now accepted and ready to land.Jun 10 2024, 3:39 PM