Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 1 | // RUN: %clang_tsan -O1 %s -o %t && %env_tsan_opts=flush_memory_ms=1:memory_limit_mb=1 %run %t 2>&1 | FileCheck %s |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 2 | #include "test.h" |
| 3 | #include <sys/types.h> |
| 4 | #include <unistd.h> |
| 5 | #include <time.h> |
| 6 | |
| 7 | // Test that setuid call works in presence of stoptheworld. |
| 8 | |
| 9 | int main() { |
Pirama Arumuga Nainar | 799172d | 2016-03-03 15:50:30 -0800 | [diff] [blame^] | 10 | unsigned long long tp0, tp1; |
| 11 | tp0 = monotonic_clock_ns(); |
| 12 | tp1 = monotonic_clock_ns(); |
| 13 | while (tp1 - tp0 < 3 * 1000000000ull) { |
| 14 | tp1 = monotonic_clock_ns(); |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 15 | setuid(0); |
| 16 | } |
| 17 | fprintf(stderr, "DONE\n"); |
| 18 | return 0; |
| 19 | } |
| 20 | |
| 21 | // CHECK: DONE |