diff --git a/compiler-rt/test/asan/TestCases/Darwin/Inputs/check-syslog.sh b/compiler-rt/test/asan/TestCases/Darwin/Inputs/check-syslog.sh new file mode 100755 index 0000000000000..8939ca7ca1564 --- /dev/null +++ b/compiler-rt/test/asan/TestCases/Darwin/Inputs/check-syslog.sh @@ -0,0 +1,6 @@ +#!/bin/sh +for I in {1..3}; do \ + log show --debug --last $((SECONDS + 30))s --predicate "processID == $1" --style syslog > $2; \ + if grep -q "use-after-poison" $2; then break; fi; \ + sleep 5; \ +done diff --git a/compiler-rt/test/asan/TestCases/Darwin/duplicate_os_log_reports.cpp b/compiler-rt/test/asan/TestCases/Darwin/duplicate_os_log_reports.cpp index 5a0353bfb1b31..40a168bc15290 100644 --- a/compiler-rt/test/asan/TestCases/Darwin/duplicate_os_log_reports.cpp +++ b/compiler-rt/test/asan/TestCases/Darwin/duplicate_os_log_reports.cpp @@ -1,8 +1,8 @@ // UNSUPPORTED: ios // REQUIRES: darwin_log_cmd // RUN: %clangxx_asan -fsanitize-recover=address %s -o %t -// RUN: { %env_asan_opts=halt_on_error=0,log_to_syslog=1 %run %t > %t.process_output.txt 2>&1 & } \ -// RUN: ; export TEST_PID=$! ; wait ${TEST_PID} +// RUN: bash -c '{ %env_asan_opts=halt_on_error=0,log_to_syslog=1 %run %t > %t.process_output.txt 2>&1 & } \ +// RUN: ; export TEST_PID=$! ; wait ${TEST_PID}; echo -n ${TEST_PID} > %t.test_pid' // Check process output. // RUN: FileCheck %s --check-prefixes CHECK,CHECK-PROC -input-file=%t.process_output.txt @@ -10,11 +10,7 @@ // Check syslog output. We filter recent system logs based on PID to avoid // getting the logs of previous test runs. Make some reattempts in case there // is a delay. -// RUN: for I in {1..3}; do \ -// RUN: log show --debug --last $((SECONDS + 30))s --predicate "processID == ${TEST_PID}" --style syslog > %t.process_syslog_output.txt; \ -// RUN: if grep -q "use-after-poison" %t.process_syslog_output.txt; then break; fi; \ -// RUN: sleep 5; \ -// RUN: done +// RUN: %S/Inputs/check-syslog.sh %{readfile:%t.test_pid} %t.process_syslog_output.txt // RUN: FileCheck %s -input-file=%t.process_syslog_output.txt #include #include