From a74bbaf97caa57b2669149d7f3b7b3a9bf9bb9f9 Mon Sep 17 00:00:00 2001 From: Steven Wu Date: Wed, 4 Feb 2015 18:10:38 +0000 Subject: [PATCH] Update darwin-version tests Summary: Now that the darwin-version tests in Driver and Frontend are testing different parts of the version encoding instead of doing duplicated work Reviewers: rnk Reviewed By: rnk Subscribers: rnk, cfe-commits Differential Revision: http://reviews.llvm.org/D7134 llvm-svn: 228159 --- clang/test/Driver/darwin-version.c | 72 ++++++++++++++++++++++-------------- clang/test/Frontend/darwin-version.c | 34 ++++++++--------- 2 files changed, 62 insertions(+), 44 deletions(-) diff --git a/clang/test/Driver/darwin-version.c b/clang/test/Driver/darwin-version.c index 2478a99..494c911 100644 --- a/clang/test/Driver/darwin-version.c +++ b/clang/test/Driver/darwin-version.c @@ -1,31 +1,49 @@ -// RUN: env MACOSX_DEPLOYMENT_TARGET=10.1 \ -// RUN: %clang -target i386-apple-darwin9 -DTEST0 -E %s -#ifdef TEST0 -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010 -#error Invalid version -#endif -#endif +// RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX %s +// CHECK-VERSION-OSX: "armv6-apple-macosx10.5.0" +// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=2.0 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS2 %s +// CHECK-VERSION-IOS2: "armv6-apple-ios2.0.0" +// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=2.2 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS22 %s +// CHECK-VERSION-IOS22: "armv6-apple-ios2.2.0" +// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=3.0 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS3 %s +// CHECK-VERSION-IOS3: "armv6-apple-ios3.0.0" +// RUN: %clang -target i686-apple-darwin8 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX4 %s +// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.4 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX4 %s +// CHECK-VERSION-OSX4: "i386-apple-macosx10.4.0" +// RUN: %clang -target i686-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX5 %s +// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.5 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX5 %s +// CHECK-VERSION-OSX5: "i386-apple-macosx10.5.0" +// RUN: %clang -target i686-apple-darwin10 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX6 %s +// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.6 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX6 %s +// CHECK-VERSION-OSX6: "i386-apple-macosx10.6.0" +// RUN: %clang -target x86_64-apple-darwin14 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX10 %s +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.10 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX10 %s +// CHECK-VERSION-OSX10: "x86_64-apple-macosx10.10.0" +// Check environment variable gets interpreted correctly +// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 \ +// RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX5 %s // RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.0 \ -// RUN: %clang -target i386-apple-darwin9 -DTEST1 -E %s -#ifdef TEST1 -#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ != 20000 -#error Invalid version -#endif -#endif - -// RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.3.1 \ -// RUN: %clang -target i386-apple-darwin9 -DTEST2 -E %s -#ifdef TEST2 -#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ != 20301 -#error Invalid version -#endif -#endif +// RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS2 %s // RUN: env MACOSX_DEPLOYMENT_TARGET=10.4.10 \ -// RUN: %clang -target i386-apple-darwin9 -DTEST3 -E %s -#ifdef TEST3 -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1049 -#error Invalid version -#endif -#endif +// RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX49 %s +// CHECK-VERSION-OSX49: "i386-apple-macosx10.4.10" +// RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.3.1 \ +// RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS231 %s +// CHECK-VERSION-IOS231: "armv6-apple-ios2.3.1" diff --git a/clang/test/Frontend/darwin-version.c b/clang/test/Frontend/darwin-version.c index 2e0804b..2da0c4c 100644 --- a/clang/test/Frontend/darwin-version.c +++ b/clang/test/Frontend/darwin-version.c @@ -1,27 +1,27 @@ -// RUN: %clang -target armv6-apple-darwin9 -dM -E -o %t %s -// RUN: not grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t -// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1050' | count 1 -// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=3.0 -dM -E -o %t %s +// RUN: %clang_cc1 -triple armv6-apple-ios3.0.0 -dM -E -o %t %s // RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '30000' | count 1 // RUN: not grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t -// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=2.0 -dM -E -o %t %s +// RUN: %clang_cc1 -triple armv6-apple-ios2.0.0 -dM -E -o %t %s // RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20000' | count 1 // RUN: not grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t -// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=2.2 -dM -E -o %t %s +// RUN: %clang_cc1 -triple armv6-apple-ios2.2.0 -dM -E -o %t %s // RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20200' | count 1 -// RUN: %clang -target i686-apple-darwin8 -dM -E -o %t %s -// RUN: not grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t +// RUN: not grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t +// RUN: %clang_cc1 -triple armv6-apple-ios2.3.1 -dM -E -o %t %s +// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20301' | count 1 +// RUN: not grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t +// RUN: %clang_cc1 -triple i386-apple-macosx10.4.0 -dM -E -o %t %s // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1040' | count 1 -// RUN: %clang -target i686-apple-darwin9 -dM -E -o %t %s -// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1050' | count 1 -// RUN: %clang -target i686-apple-darwin10 -dM -E -o %t %s -// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1060' | count 1 -// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.4 -dM -E -o %t %s // RUN: not grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t -// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1040' | count 1 -// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.5 -dM -E -o %t %s +// RUN: %clang_cc1 -triple i386-apple-macosx10.4.10 -dM -E -o %t %s +// RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1049' | count 1 +// RUN: not grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t +// RUN: %clang_cc1 -triple i386-apple-macosx10.5.0 -dM -E -o %t %s // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1050' | count 1 -// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.6 -dM -E -o %t %s +// RUN: not grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t +// RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -dM -E -o %t %s // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1060' | count 1 -// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.10 -dM -E -o %t %s +// RUN: not grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -dM -E -o %t %s // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '101000' | count 1 +// RUN: not grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t -- 2.7.4