1f5b95db4SChris Apple // RUN: %clangxx -fsanitize=realtime %s -o %t 2f5b95db4SChris Apple // RUN: env RTSAN_OPTIONS="halt_on_error=false,print_stats_on_exit=true" %run %t 2>&1 | FileCheck %s 3*595e484cSChris Apple // RUN: env RTSAN_OPTIONS="halt_on_error=false,suppress_equal_stacks=false" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-DUPLICATES 4f5b95db4SChris Apple 5f5b95db4SChris Apple // UNSUPPORTED: ios 6f5b95db4SChris Apple 7f5b95db4SChris Apple // Intent: Ensure all errors are deduplicated. 8f5b95db4SChris Apple 9f5b95db4SChris Apple #include <unistd.h> 10f5b95db4SChris Apple 11f5b95db4SChris Apple const int kNumViolations = 10; 12f5b95db4SChris Apple 13f5b95db4SChris Apple void violation() [[clang::nonblocking]] { 14f5b95db4SChris Apple for (int i = 0; i < kNumViolations; i++) 15f5b95db4SChris Apple usleep(1); 16f5b95db4SChris Apple } 17f5b95db4SChris Apple 18f5b95db4SChris Apple void violation2() [[clang::nonblocking]] { 19f5b95db4SChris Apple for (int i = 0; i < kNumViolations; i++) 20f5b95db4SChris Apple violation(); 21f5b95db4SChris Apple } 22f5b95db4SChris Apple 23f5b95db4SChris Apple void double_violation() [[clang::nonblocking]] { 24f5b95db4SChris Apple violation(); 25f5b95db4SChris Apple violation2(); 26f5b95db4SChris Apple } 27f5b95db4SChris Apple 28f5b95db4SChris Apple int main() { 29f5b95db4SChris Apple violation(); // 1 unique errors here, but 10 total 30f5b95db4SChris Apple violation2(); // 1 unique errors here, but 100 total 31f5b95db4SChris Apple double_violation(); // 2 unique errors here, but 110 total 32f5b95db4SChris Apple return 0; 33f5b95db4SChris Apple } 34f5b95db4SChris Apple 35f5b95db4SChris Apple // CHECK-COUNT-4: ==ERROR: 36f5b95db4SChris Apple // CHECK-NOT: ==ERROR: 37f5b95db4SChris Apple 38f5b95db4SChris Apple // CHECK: RealtimeSanitizer exit stats: 39f5b95db4SChris Apple // CHECK-NEXT: Total error count: 220 40f5b95db4SChris Apple // CHECK-NEXT: Unique error count: 4 41*595e484cSChris Apple 42*595e484cSChris Apple // CHECK-DUPLICATES-COUNT-220: ==ERROR: 43*595e484cSChris Apple // CHECK-DUPLICATES-NOT: ==ERROR: 44