[compiler-rt] fc532c1 - Remove some non-determinism from the `Darwin/duplicate_os_log_reports.cpp` test.

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Sat May 30 15:20:13 PDT 2020


Author: Dan Liew
Date: 2020-05-30T15:19:32-07:00
New Revision: fc532c1a0dc66bf23cac60f5363f180c6cbfefbc

URL: https://github.com/llvm/llvm-project/commit/fc532c1a0dc66bf23cac60f5363f180c6cbfefbc
DIFF: https://github.com/llvm/llvm-project/commit/fc532c1a0dc66bf23cac60f5363f180c6cbfefbc.diff

LOG: Remove some non-determinism from the `Darwin/duplicate_os_log_reports.cpp` test.

The test read from an uninitialized buffer which could cause the output
to be unpredictable.

The test is currently disabled so this won't actually change anything
until the test is re-enabled.

Added: 
    

Modified: 
    compiler-rt/test/asan/TestCases/Darwin/duplicate_os_log_reports.cpp

Removed: 
    


################################################################################
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 a8314d804331..dd5a257e3985 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
@@ -16,6 +16,7 @@
 // RUN: FileCheck %s -input-file=%t.process_syslog_output.txt
 #include <cassert>
 #include <cstdio>
+#include <cstring>
 #include <sanitizer/asan_interface.h>
 
 const int kBufferSize = 512;
@@ -37,6 +38,7 @@ void readOne() {
 
 int main() {
   buffer = static_cast<char *>(malloc(kBufferSize));
+  memset(static_cast<void *>(buffer), static_cast<int>('.'), kBufferSize);
   assert(buffer);
   // Deliberately poison `buffer` so that we have a deterministic way
   // triggering two ASan reports in a row in the no halt_on_error mode (e.g. Two


        


More information about the llvm-commits mailing list