[all-commits] [llvm/llvm-project] d81400: [ASan][test] Fix Posix/coverage-fork.cpp on Solari...
Rainer Orth via All-commits
all-commits at lists.llvm.org
Tue Sep 24 00:38:23 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d814006c0aedf806f2ea09660c26f51099020b2c
https://github.com/llvm/llvm-project/commit/d814006c0aedf806f2ea09660c26f51099020b2c
Author: Rainer Orth <ro at gcc.gnu.org>
Date: 2024-09-24 (Tue, 24 Sep 2024)
Changed paths:
M compiler-rt/test/asan/TestCases/Posix/coverage-fork.cpp
Log Message:
-----------
[ASan][test] Fix Posix/coverage-fork.cpp on Solaris (#109626)
With ASan testing enabled on SPARC as per PR #107405, the
```
AddressSanitizer-sparc-sunos-dynamic :: TestCases/Posix/coverage-fork.cpp
```
test occasionally `FAIL`s on Solaris/sparcv9:
```
compiler-rt/test/asan/TestCases/Posix/coverage-fork.cpp:46:15: error: CHECK-DAG: expected string not found in input
// CHECK-DAG: Parent PID: [[ParentPID:[0-9]+]]
^
```
It turns out that the output for parent and child processes is
interleaved like
```
Parent PID: Child PID: 27426
27425
```
Checking with `truss` shows that the `fprintf`s are implemented as 3
separate `write`s:
```
28489: write(2, " P a r e n t P I D : ", 12) = 12
28489: write(2, " 2 8 4 8 9", 5) = 5
28489: write(2, "\n", 1) = 1
```
To avoid this, this patch switches the test to use `snprintf`/`write` to
guarantee the output is atomic.
Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and
`x86_64-pc-linux-gnu`.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list