This is an archive of the discontinued LLVM Phabricator instance.

[sanitizers][test] Test sanitizer_common and ubsan_minimal on Solaris
ClosedPublic

Authored by ro on Nov 17 2020, 2:58 AM.

Details

Summary

During the initial Solaris sanitizer port, I missed to enable the sanitizer_common and ubsan_minimal testsuites. This patch fixes this, correcting a few unportabilities:

  • Posix/getpass.cpp failed to link since Solaris lacks libutil. Omitting the library lets the test PASS, but I thought adding %libutil along the lines of %librt to be overkill.
  • One subtest of Posix/getpw_getgr.cpp is disabled because Solaris getpwent_r has a different signature than expected.
  • /dev/null is a symlink on Solaris.
  • XPG7 specifies that uname returns a non-negative value on success.

Tested on amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11.

Diff Detail

Event Timeline

ro created this revision.Nov 17 2020, 2:58 AM
ro requested review of this revision.Nov 17 2020, 2:58 AM
vitalybuka accepted this revision.Nov 18 2020, 1:35 AM
vitalybuka added inline comments.
compiler-rt/test/sanitizer_common/CMakeLists.txt
65–70
compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp
6

XFAIL or UNSUPPORTED?
I assume that XFAIL is useful when thing is consistently broken and it should be fixed in future.
If you don't expect -lutil supported it should be probably UNSUPPORTED

This revision is now accepted and ready to land.Nov 18 2020, 1:35 AM
ro added inline comments.Nov 18 2020, 7:15 AM
compiler-rt/test/sanitizer_common/CMakeLists.txt
65–70

Unless I'm mistaken, that would disable the SanitizerCommon-ubsan-x86_64-SunOS tests which do work just fine, just like the code above (l.65-67) only disables the ASan tests on sparc*.

compiler-rt/test/sanitizer_common/TestCases/Posix/getpass.cpp
6

You're right: looking at the contents of libutil on Linux I see that most (all) of those functions live in libc on Solaris. I hadn't even heard about libutil ever before, so I'm pretty certain this won't be introduced.

I'll make it UNSUPPORTED, unless I get around to implementing %libutil.

ro added inline comments.Nov 20 2020, 5:02 AM
compiler-rt/test/sanitizer_common/CMakeLists.txt
65–70

Unless I'm mistaken, that would disable the SanitizerCommon-ubsan-x86_64-SunOS tests which do work just fine, just like the code above (l.65-67) only disables the ASan tests on sparc*.

I've tried this now and indeed with your suggested change the SanitizerCommon-ubsan-x86_64-SunOS tests change from PASS to UNSUPPORTED. So I'm going to leave this as is.

ro updated this revision to Diff 306664.Nov 20 2020, 5:03 AM

getpass.cpp changed to UNSUPPORTED.

This revision was landed with ongoing or failed builds.Nov 20 2020, 5:07 AM
This revision was automatically updated to reflect the committed changes.