[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 07] Use append mode to capture parallel test output.
From: |
Ralf Wildenhues |
Subject: |
Re: [PATCH 07] Use append mode to capture parallel test output. |
Date: |
Sat, 14 Mar 2009 13:34:13 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
* Akim Demaille wrote on Sat, Mar 14, 2009 at 01:24:28PM CET:
> Le 14 mars 09 à 11:56, Ralf Wildenhues a écrit :
>
>> D'oh. Wonder how often we will keep encountering this.
> I have not understood what's going on here. Are these files running
> concurrently in the same pwd?
No. The issue is different. Whenever you have
$program > file
and $program itself spawns other processes which inherit the file
descriptor to 'file', and write to it concurrently, then POSIX does
not guarantee that those writes are atomic. More specifically, while
it guarantees that all writes happen, there may be a time at which one
of the processes has already written, but not updated the file offset.
When another process then starts a write, it will happen at the old
offset, and overwrite the output from the first process.
Using O_APPEND avoids this race: POSIX guarantees atomicity in this
case, for writes below (depending on the file type, there may be a limit
on the maximum number of bytes guaranteed to be written atomically).
An alternative to O_APPEND is to use a pipe:
make -j | cat > file
works just as well. Or a named pipe, I guess.
This issue really shows up in practice, but is probably very hard to
reproduce on systems with only one processor (I've never seen that).
Hope that helps.
Cheers,
Ralf
>> Use append mode to capture parallel test output.
>>
>> * tests/lisp8.test: Use append mode for output from `make -j',
>> to avoid dropped lines.
>> * tests/parallel-tests3.test: Likewise.
>>
>> diff --git a/tests/lisp8.test b/tests/lisp8.test
>> index 578cd9c..3e4981c 100755
>> --- a/tests/lisp8.test
>> +++ b/tests/lisp8.test
>> @@ -39,7 +39,8 @@ $AUTOCONF
>> $AUTOMAKE --add-missing
>> ./configure
>>
>> -$MAKE -j >stdout || { cat stdout; Exit 1; }
>> +: >stdout
>> +$MAKE -j >>stdout || { cat stdout; Exit 1; }
>>
>> cat stdout
>> test 1 -eq `grep 'Warnings can be ignored' stdout | wc -l`
>> @@ -51,7 +52,8 @@ test -f elc-stamp
>>
>> rm -f am-*.elc
>>
>> -$MAKE -j >stdout
>> +: >stdout
>> +$MAKE -j >>stdout
- [PATCH 0/N] parallel tests execution in Automake, Ralf Wildenhues, 2009/03/14
- Re: [PATCH 0/N] parallel tests execution in Automake, Ralf Wildenhues, 2009/03/14
- [PATCH 02] parallel-tests: Ensure backward-compatible semantics., Ralf Wildenhues, 2009/03/14
- [PATCH 03] New tests for `parallel-tests'., Ralf Wildenhues, 2009/03/14
- Re: [PATCH 04] Documentation for the parallel-tests driver., Ralf Wildenhues, 2009/03/14
- Re: [PATCH 05] Overhaul of tests/README., Ralf Wildenhues, 2009/03/14
- Re: [PATCH 06] parallel-tests: Fix summary output., Ralf Wildenhues, 2009/03/14
- [PATCH 07] Use append mode to capture parallel test output., Ralf Wildenhues, 2009/03/14
- [PATCH 08] Match XFAIL_TESTS correctly with Solaris make., Ralf Wildenhues, 2009/03/14
- [PATCH 09] Mark check-html and check-TESTS as recursive for BSD make., Ralf Wildenhues, 2009/03/14
- [PATCH 10] Fix parallel-tests with empty $(TESTS) for BSD make., Ralf Wildenhues, 2009/03/14
- Re: [PATCH 11] Fix LAZY_TEST_SUITE handling and $(TEST_SUITE_LOG) recreation., Ralf Wildenhues, 2009/03/14