[PATCH] D40900: [Sanitizers, test] Fix sanitizer tests on Solaris (PR 33274)

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 08:14:15 PST 2017


ro created this revision.
ro added a project: Sanitizers.
Herald added subscribers: Sanitizers, JDevlieghere, fedor.sergeev, krytarowski, mgorny, kubamracek, srhines.

This patch (on top of the previous two (https://reviews.llvm.org/D40898 and
https://reviews.llvm.org/D40899) complete the compiler-rt side of the the Solaris
sanitizer port.

It contains the following sets of changes:

- For the time being, the port is for 32-bit x86 only, so reject the various tests on x86_64.

- When compiling as C++, <setjmp.h> resp. <iso/setjmp_iso.h> only declares _setjmp and _longjmp inside namespace std.

- MAP_FILE is a Windows feature.  While e.g. Linux <sys/mman.h> provides a no-op compat define, Solaris does not.

- test/asan/TestCases/Posix/coverage.cc was initially failing like this:

/vol/gcc/src/llvm/llvm/local/projects/compiler-rt/lib/sanitizer_common/scripts/sancov.py: 4 files merged; 2 PCs total
rm: cannot remove '/var/gcc/llvm/local/projects/compiler-rt/test/asan/I386SunOSConfig/TestCases/Posix/Output/coverage': Invalid argument

  Further digging revealed that the rm was trying to remove the running test's working
  directory which failed as observed.  cd'ing out of the dir before let the test pass.

- Two tests needed a declaration of alloca. I've now copied the existing code from test/asan/TestCases/alloca_constant_size.cc, but it may be more profitable and maintainable to have a common testsuite header where such code is collected.

- Similarly, Solaris' printf %p format doesn't include the leading 0x.

- In test/asan/TestCases/malloc-no-intercept.c, I had to undef __EXTENSIONS__ (predefined by clang for no apparent reason) to avoid conflicting declarations for memalign.

- test/ubsan/TestCases/Float/cast-overflow.cpp has different platform dependent ways to define BYTE_ORDER and friends.  Why not just use __BYTE_ORDER__ and friends as predefined by clang and gcc?


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D40900

Files:
  lib/asan/tests/CMakeLists.txt
  lib/asan/tests/asan_test.cc
  lib/sanitizer_common/tests/sanitizer_test_utils.h
  test/asan/CMakeLists.txt
  test/asan/TestCases/Posix/asan-sigbus.cpp
  test/asan/TestCases/Posix/coverage.cc
  test/asan/TestCases/Posix/ioctl.cc
  test/asan/TestCases/alloca_loop_unpoisoning.cc
  test/asan/TestCases/alloca_vla_interact.cc
  test/asan/TestCases/debug_double_free.cc
  test/asan/TestCases/debug_report.cc
  test/asan/TestCases/malloc-no-intercept.c
  test/asan/lit.cfg
  test/lit.common.cfg
  test/sanitizer_common/CMakeLists.txt
  test/ubsan/CMakeLists.txt
  test/ubsan/TestCases/Float/cast-overflow.cpp
  test/ubsan/lit.common.cfg
  test/ubsan_minimal/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40900.125732.patch
Type: text/x-patch
Size: 9816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171206/62a28500/attachment.bin>


More information about the llvm-commits mailing list