[compiler-rt] 87d0ff9 - [asan][test] Fix SED issues with macOS (BSD)

Roy Sundahl via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 09:50:08 PST 2022


Author: Roy Sundahl
Date: 2022-11-29T09:47:23-08:00
New Revision: 87d0ff91176221894604aa07fc0e2b8492140f7d

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

LOG: [asan][test] Fix SED issues with macOS (BSD)

SED differs between GNU and BSD in handling semicolon and the use of
'\n' in regex patterns. For macOS we can't use these GNU extensions.

rdar://102686948

Differential Revision: https://reviews.llvm.org/D138824

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/asan/TestCases/Darwin/interface_symbols_darwin.cpp b/compiler-rt/test/asan/TestCases/Darwin/interface_symbols_darwin.cpp
index 9b25b0023a6fa..2cedbc722c463 100644
--- a/compiler-rt/test/asan/TestCases/Darwin/interface_symbols_darwin.cpp
+++ b/compiler-rt/test/asan/TestCases/Darwin/interface_symbols_darwin.cpp
@@ -19,7 +19,15 @@
 // RUN:  | sed -e "s/__asan_version_mismatch_check_v[0-9]+/__asan_version_mismatch_check/" \
 // RUN:  > %t.exports
 //
-// RUN: sed ':a;N;$!ba;s/([\n ]*/(/g'                                             \
+// note: SED 
diff ers between GNU and BSD in handling semicolon and the use of
+//       '\n' in regex patterns. For macOS we must change this GNU syntax:
+//           sed -e ':a' -e 'N' -e '$!ba'
+//       to a form that both GNU and BSD can agree upon (below).
+//
+// RUN:  sed -e ':a' -e 'N' -e '$!ba'                                             \
+// RUN:      -e 's/ //g'                                                          \
+// RUN:      -e ':b' -e 's/\n\n/\n/g' -e 'tb'                                     \
+// RUN:      -e 's/(\n/(/g'                                                       \
 // RUN:  %t.asan_interface.inc                                                    \
 // RUN:  %p/../../../../lib/ubsan/ubsan_interface.inc                             \
 // RUN:  %p/../../../../lib/sanitizer_common/sanitizer_common_interface.inc       \


        


More information about the llvm-commits mailing list