This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Attachment: 8cffd698.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]