racy tests

Brooks Davis brooks at freebsd.org
Tue Apr 25 23:02:50 UTC 2017


I've been running the FreeBSD test suite for mips64 under qemu.  As a
result, I'm seeing some tests fail due to assumptions about timing producing
test races.  For example one of the pwait tests does this:

timeout_many_body()
{
        sleep 1 &  
        p1=$!

        sleep 5 &
        p5=$!

        sleep 10 & 
        p10=$!

        atf_check \
                -o empty \
                -e empty \
                -s exit:124 \
                timeout --preserve-status 7.5 pwait -t 6 $p1 $p5 $p10
}

Under emulation, particularly if the host disks are busy, it's easily
possible for the first sleep to exit before pwait actually runs.
In practice, we could probably get away with cranking up the times a
fair bit, but that would make the test slow and the race would still
exist.

Any thoughts about the right solution?  Something not time based would
be ideal, but then it seems like we'd need a parallel process to kill
some of the waited for victims we quickly end up with something more
complicated than pwait that also needs testing...

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20170425/6ec749d7/attachment.sig>


More information about the freebsd-hackers mailing list