diff options
| author | Rainer Orth <ro@gcc.gnu.org> | 2024-09-24 09:38:01 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-24 09:38:01 +0200 |
| commit | d814006c0aedf806f2ea09660c26f51099020b2c (patch) | |
| tree | c5db8cdec977b3189d1cb0e5b564235c6f71043b /llvm/lib/Object/ModuleSymbolTable.cpp | |
| parent | 4a264c559922a8754a0e28fbf316ba667ec19798 (diff) | |
| download | llvm-d814006c0aedf806f2ea09660c26f51099020b2c.zip llvm-d814006c0aedf806f2ea09660c26f51099020b2c.tar.gz llvm-d814006c0aedf806f2ea09660c26f51099020b2c.tar.bz2 | |
[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`.
Diffstat (limited to 'llvm/lib/Object/ModuleSymbolTable.cpp')
0 files changed, 0 insertions, 0 deletions
