[ASan][Darwin] Adapt test for macOS 11+ version scheme
authorJulian Lettner <julian.lettner@apple.com>
Wed, 5 Aug 2020 17:11:50 +0000 (10:11 -0700)
committerJulian Lettner <julian.lettner@apple.com>
Wed, 5 Aug 2020 17:14:57 +0000 (10:14 -0700)
This test depends on the versioning scheme of OSX.

compiler-rt/test/asan/TestCases/Darwin/dyld_insert_libraries_reexec.cpp

index d195258..0fec18b 100644 (file)
 // RUN:       %run %t/a.out 2>&1 \
 // RUN:   | FileCheck %s
 
-// RUN: IS_OSX_10_11_OR_HIGHER=$([ `sw_vers -productVersion | cut -d'.' -f2` -lt 11 ]; echo $?)
+// RUN: MACOS_MAJOR=$(sw_vers -productVersion | cut -d'.' -f1)
+// RUN: MACOS_MINOR=$(sw_vers -productVersion | cut -d'.' -f2)
+
+// RUN: IS_MACOS_10_11_OR_HIGHER=$([ $MACOS_MAJOR -eq 10 ] && [ $MACOS_MINOR -lt 11 ]; echo $?)
 
 // On OS X 10.10 and lower, if the dylib is not DYLD-inserted, ASan will re-exec.
-// RUN: if [ $IS_OSX_10_11_OR_HIGHER == 0 ]; then \
+// RUN: if [ $IS_MACOS_10_11_OR_HIGHER == 0 ]; then \
 // RUN:   %env_asan_opts=verbosity=1 %run %t/a.out 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NOINSERT %s; \
 // RUN:   fi
 
 // On OS X 10.11 and higher, we don't need to DYLD-insert anymore, and the interceptors
 // still installed correctly. Let's just check that things work and we don't try to re-exec.
-// RUN: if [ $IS_OSX_10_11_OR_HIGHER == 1 ]; then \
+// RUN: if [ $IS_MACOS_10_11_OR_HIGHER == 1 ]; then \
 // RUN:   %env_asan_opts=verbosity=1 %run %t/a.out 2>&1 \
 // RUN:   | FileCheck %s; \
 // RUN:   fi