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)
Sun, Nov 23, 6:11 AM
Unknown Object (File)
Nov 10 2025, 2:50 AM
Unknown Object (File)
Nov 3 2025, 8:00 PM
Unknown Object (File)
Oct 29 2025, 11:44 AM
Unknown Object (File)
Oct 29 2025, 9:47 AM
Unknown Object (File)
Oct 29 2025, 9:40 AM
Unknown Object (File)
Oct 29 2025, 9:28 AM
Unknown Object (File)
Oct 28 2025, 8:49 AM
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 58114
Build 55002: arc lint + arc unit

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