blob: 9dbb6577e1c60532e47078eb78c00286e76b3174 [file] [log] [blame]
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -08001// 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 Nainarcdce50b2015-07-01 12:26:56 -07002#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
9int main() {
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -080010 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 Nainarcdce50b2015-07-01 12:26:56 -070015 setuid(0);
16 }
17 fprintf(stderr, "DONE\n");
18 return 0;
19}
20
21// CHECK: DONE