bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

misc/cat-buf test failure


From: Jim Meyering
Subject: misc/cat-buf test failure
Date: Mon, 07 Sep 2009 20:21:50 +0200

Hi Pádraig,

On my 6th run of "make check", the cat-buf test failed.
It's an inherently racy test.

If the dd process is starved until "2" is printed,
it will end up printing both lines to "out".

Here's the code:

    # Use a fifo rather than a pipe in the tests below
    # so that the producer (cat) will wait until the
    # consumer (dd) opens the fifo therefore increasing
    # the chance that dd will read the data from each
    # write separately.
    mkfifo fifo || framework_failure

    echo '1' > exp

    dd count=1 if=fifo > out &
    (echo '1'; sleep .2; echo '2') | cat -v > fifo
    wait #for dd to complete

    compare out exp || fail=1

    Exit $fail

We could allow either one line or both,
but then how can the test fail?

Alternatives: print a warning (a la skip_test_)
and pass the test, or just skip it when we lose the race.

No big deal.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]