diff options
| author | Etienne Bergeron <etienneb@google.com> | 2016-06-30 14:37:26 +0000 |
|---|---|---|
| committer | Etienne Bergeron <etienneb@google.com> | 2016-06-30 14:37:26 +0000 |
| commit | c8ee9d9614d2facc48924d91557b7668c5a75dc3 (patch) | |
| tree | a1fdcb3df61a41ea3aac40e7b889ef11c66cd9ab /compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cc | |
| parent | e6f424460aff8dedf89440cc364911821c52b1da (diff) | |
| download | bcm5719-llvm-c8ee9d9614d2facc48924d91557b7668c5a75dc3.tar.gz bcm5719-llvm-c8ee9d9614d2facc48924d91557b7668c5a75dc3.zip | |
[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
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cc')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cc index 58c627a704f..1132bfdf62e 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cc +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_thread_registry_test.cc @@ -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); |

