This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer_common][tests] Fix SanitizerCommon-Unit :: ./Sanitizer-*-Test/SanitizerCommon.PthreadDestructorIterations on Solaris
ClosedPublic

Authored by ro on Jul 21 2019, 8:30 AM.

Details

Summary

SanitizerCommon.PthreadDestructorIterations currently FAILs on Solaris:

[ RUN      ] SanitizerCommon.PthreadDestructorIterations
/vol/llvm/src/compiler-rt/local/lib/sanitizer_common/tests/sanitizer_posix_test.cc:58: Failure
Value of: destructor_executed
  Actual: true
Expected: false
[  FAILED  ] SanitizerCommon.PthreadDestructorIterations (1 ms)

It turns out that destructor is called 4 times after the first call to SpawnThread, but
5 times after the second. While PTHREAD_DESTRUCTOR_ITERATIONS is 4 in
<limits.h>, the Solaris pthread_key_create(3C) man page documents

If, after all the destructors have been called for all keys  with  non-
null  values,  there  are  still  some  keys  with non-null values, the
process will be repeated. POSIX requires that this process be  executed
at   least   PTHREAD_DESTRUCTOR_ITERATIONS  times.  Solaris  calls  the
destructors repeatedly until all values with associated destructors are
NULL. Destructors that set new values can cause an infinite loop.

The patch adjusts the test case to allow for this.

Tested on x86_64-pc-solaris2.11. Ok for trunk?

Diff Detail

Repository
rL LLVM

Event Timeline

ro created this revision.Jul 21 2019, 8:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2019, 8:30 AM
Herald added subscribers: Restricted Project, jfb, fedor.sergeev, kubamracek. · View Herald Transcript
ro added a comment.Jul 28 2019, 8:02 AM

Ping? It's been a week and the behaviour of Solaris pthread_key_create is allowed by the spec.

ro added a comment.Jul 28 2019, 8:37 PM
This comment was removed by ro.
ro added a comment.Jul 29 2019, 12:57 AM
This comment was removed by ro.
ro added a comment.Jul 29 2019, 6:20 AM

Ping? It's been a week and the behaviour of Solaris pthread_key_create is allowed by the spec.

ro updated this revision to Diff 212994.Aug 2 2019, 2:00 AM

Rebased after .cc -> .cpp mass renamings.

vitalybuka accepted this revision.Aug 2 2019, 11:21 AM
This revision is now accepted and ready to land.Aug 2 2019, 11:21 AM
This revision was automatically updated to reflect the committed changes.