Page MenuHomeFreeBSD

sh/tests: Cut down builtins/read12.0 by 2 seconds
Needs ReviewPublic

Authored by jilles on Feb 8 2026, 11:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 18, 9:43 PM
Unknown Object (File)
Fri, Apr 17, 8:57 AM
Unknown Object (File)
Sat, Apr 11, 7:29 PM
Unknown Object (File)
Sun, Apr 5, 3:21 PM
Unknown Object (File)
Sun, Apr 5, 1:06 PM
Unknown Object (File)
Sun, Apr 5, 1:05 PM
Unknown Object (File)
Sat, Apr 4, 1:20 PM
Unknown Object (File)
Sun, Mar 29, 12:49 PM
Subscribers

Details

Reviewers
des
bdrewery
Summary

Since the test assumes a 250 ms response time, the test delay can be 1
second instead of 3.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 70533
Build 67416: arc lint + arc unit

Event Timeline

Since the test assumes a 250 ms response time, the test delay can be 1 second instead of 3.

That is a complete non sequitur.

Why does the test need to be shortened?

In D55191#1261862, @des wrote:

Since the test assumes a 250 ms response time, the test delay can be 1 second instead of 3.

That is a complete non sequitur.

Why does the test need to be shortened?

To make it nicer to develop sh(1), I have gone to great lengths to make its tests fast. Avoiding sleeps also improves reliability of the tests.

I am aware that tests for other parts of the system may be unnecessarily slow.

This revision is now accepted and ready to land.Wed, Apr 22, 12:44 AM
des requested changes to this revision.Wed, Apr 22, 8:05 AM

I'm still waiting for someone to explain what this is supposed to mean:

Since the test assumes a 250 ms response time, the test delay can be 1 second instead of 3.

This revision now requires changes to proceed.Wed, Apr 22, 8:05 AM
bdrewery added inline comments.
bin/sh/tests/builtins/read12.0
31

This would need to change too to 1000 / 1250.

In D55191#1294886, @des wrote:

I'm still waiting for someone to explain what this is supposed to mean:

Since the test assumes a 250 ms response time, the test delay can be 1 second instead of 3.

read -t 0.250 isn't supported. Best we can do is 1 second. One of the reads does not time out while the other does. So this change reduces 2 seconds of sleep in the test suite.

read -t 0.250 isn't supported. Best we can do is 1 second. One of the reads does not time out while the other does. So this change reduces 2 seconds of sleep in the test suite.

This does not answer the question.

Jilles wants tests to run quickly. I want tests that produce results I can trust.

@jilles, please try this instead, it will save you considerably more than two seconds:

echo parallelism=$(nproc) | sudo tee -a /etc/kyua/kyua.conf

Fix assertions; correct assertion

If set -e is in effect, foo in foo && bar is considered tested and
therefore a failure does not cause the shell to exit.

Due to this, a wrong assertion in builtins/read12.0 was not detected.
Fix that one too.

In D55191#1296317, @des wrote:

read -t 0.250 isn't supported. Best we can do is 1 second. One of the reads does not time out while the other does. So this change reduces 2 seconds of sleep in the test suite.

This does not answer the question.

Jilles wants tests to run quickly. I want tests that produce results I can trust.

I did consider this, but changing 1 second to 3 does not improve things much given that the test checks that it takes between 3001 and 3250 milliseconds. So if the test gets "stuck" for more than 250 milliseconds, the result is still wrong.

Pretty much all other tests in sh follow the rule that sleep can be used but a successful test must not wait for it to complete. This avoids both sleeping for too long and wasting time and sleeping for not enough and breaking when the computer is busy. I accept that this makes the test code more complex (often involving fifos). Perhaps some of the sleeps in those tests can be made longer, given that.

@jilles, please try this instead, it will save you considerably more than two seconds:

echo parallelism=$(nproc) | sudo tee -a /etc/kyua/kyua.conf

I will try that, but I want both tests that don't waste time and running them as fast as possible.