Re: [PATCH,testsuite] Print markers to stderr to avoid races with sanitizer output

2016-03-01 Thread Bernd Schmidt

On 03/01/2016 02:20 PM, Maxim Kuvyrkov wrote:

On Mar 1, 2016, at 12:31 PM, Maxim Kuvyrkov  wrote:

This patch improves sanitizer testsuite to avoid sporadic failures, especially 
when [cross-]testing on a remote machine.

There are several unstable sanitizer tests in GCC testsuite (e.g., 
g++.dg/tsan/aligned_vs_unaligned_race.C), and the instability comes from the 
test doing this:

printf("Pass\n");
/* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
/* { dg-output "Pass.*" } */

.  Thread sanitizer prints its data to stderr, and then printf prints to stdout.  The 
testcase expects stderr to be flushed before stdout, and "Pass" to be at the 
end of the output.  AFAIK, that works fine in native/local environment, but fails in 
remote testing from time to time.  The failure case happens when stdout output is printed 
before stderr output.  This is, likely, because there is no strict ordering of stdout and 
stderr when remote testing.

This patch fixes the affected tests in GCC testsuite, and I'll be also posting 
a similar patch for LLVM testsuite.


FYI, this was posted to LLVM (and approved) here: 
http://reviews.llvm.org/D17757 .


I guess it's OK then.


Bernd



Re: [PATCH,testsuite] Print markers to stderr to avoid races with sanitizer output

2016-03-01 Thread Maxim Kuvyrkov
> On Mar 1, 2016, at 12:31 PM, Maxim Kuvyrkov  wrote:
> 
> This patch improves sanitizer testsuite to avoid sporadic failures, 
> especially when [cross-]testing on a remote machine.
> 
> There are several unstable sanitizer tests in GCC testsuite (e.g., 
> g++.dg/tsan/aligned_vs_unaligned_race.C), and the instability comes from the 
> test doing this:
> 
> printf("Pass\n");
> /* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
> /* { dg-output "Pass.*" } */
> 
> .  Thread sanitizer prints its data to stderr, and then printf prints to 
> stdout.  The testcase expects stderr to be flushed before stdout, and "Pass" 
> to be at the end of the output.  AFAIK, that works fine in native/local 
> environment, but fails in remote testing from time to time.  The failure case 
> happens when stdout output is printed before stderr output.  This is, likely, 
> because there is no strict ordering of stdout and stderr when remote testing.
> 
> This patch fixes the affected tests in GCC testsuite, and I'll be also 
> posting a similar patch for LLVM testsuite.

FYI, this was posted to LLVM (and approved) here: 
http://reviews.llvm.org/D17757 .

> 
> OK for trunk?


--
Maxim Kuvyrkov
www.linaro.org




[PATCH,testsuite] Print markers to stderr to avoid races with sanitizer output

2016-03-01 Thread Maxim Kuvyrkov
This patch improves sanitizer testsuite to avoid sporadic failures, especially 
when [cross-]testing on a remote machine.

There are several unstable sanitizer tests in GCC testsuite (e.g., 
g++.dg/tsan/aligned_vs_unaligned_race.C), and the instability comes from the 
test doing this:

 printf("Pass\n");
 /* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */
 /* { dg-output "Pass.*" } */

.  Thread sanitizer prints its data to stderr, and then printf prints to 
stdout.  The testcase expects stderr to be flushed before stdout, and "Pass" to 
be at the end of the output.  AFAIK, that works fine in native/local 
environment, but fails in remote testing from time to time.  The failure case 
happens when stdout output is printed before stderr output.  This is, likely, 
because there is no strict ordering of stdout and stderr when remote testing.

This patch fixes the affected tests in GCC testsuite, and I'll be also posting 
a similar patch for LLVM testsuite.

OK for trunk?

--
Maxim Kuvyrkov
www.linaro.org




8cffd698.diff
Description: Binary data