forked from OSchip/llvm-project
[compiler-rt] Reset global variables in ThreadRegistryThreadedTest
Summary: The unittest 'ThreadRegistryThreadedTest' is failing when running in loop. There are global variables that need to be cleared. To repro: ``` projects\compiler-rt\lib\sanitizer_common\tests\Release\Sanitizer-x86_64-Test.exe --gtest_filter=SanitizerCommon.ThreadRegistryThreadedTest --gtest_repeat=2 ``` Output: ``` Repeating all tests (iteration 1) . . . Note: Google Test filter = SanitizerCommon.ThreadRegistryThreadedTest [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from SanitizerCommon [ RUN ] SanitizerCommon.ThreadRegistryThreadedTest [ OK ] SanitizerCommon.ThreadRegistryThreadedTest (1 ms) [----------] 1 test from SanitizerCommon (1 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (2 ms total) [ PASSED ] 1 test. Repeating all tests (iteration 2) . . . Note: Google Test filter = SanitizerCommon.ThreadRegistryThreadedTest [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from SanitizerCommon [ RUN ] SanitizerCommon.ThreadRegistryThreadedTest C:/src/llvm/llvm/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cc(216): error: Value of: num_created[0] Actual: 2 Expected: 1 C:/src/llvm/llvm/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cc(217): error: Value of: num_started[0] Actual: 2 Expected: 1 C:/src/llvm/llvm/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cc(220): error: Value of: num_created[i] [...] [ FAILED ] SanitizerCommon.ThreadRegistryThreadedTest (294 ms) [----------] 1 test from SanitizerCommon (294 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (299 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] SanitizerCommon.ThreadRegistryThreadedTest 1 FAILED TEST ``` Reviewers: rnk Subscribers: llvm-commits, wang0109, kubabrecka, chrisha Differential Revision: http://reviews.llvm.org/D21886 llvm-svn: 274231
This commit is contained in:
parent
e6f424460a
commit
c8ee9d9614
|
@ -224,6 +224,10 @@ static void ThreadedTestRegistry(ThreadRegistry *registry) {
|
|||
}
|
||||
|
||||
TEST(SanitizerCommon, ThreadRegistryThreadedTest) {
|
||||
memset(&num_created, 0, sizeof(num_created));
|
||||
memset(&num_started, 0, sizeof(num_created));
|
||||
memset(&num_joined, 0, sizeof(num_created));
|
||||
|
||||
ThreadRegistry registry(GetThreadContext<TestThreadContext>,
|
||||
kThreadsPerShard * kNumShards + 1, 10);
|
||||
ThreadedTestRegistry(®istry);
|
||||
|
|
Loading…
Reference in New Issue