[clang] 80765ed - [Driver][test] Ignore %clang exit code for -mcpu=native tests

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 28 21:31:49 PDT 2023


Author: Fangrui Song
Date: 2023-07-28T21:31:44-07:00
New Revision: 80765ede5bbcca1364c2d4ae06127011eaba6389

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

LOG: [Driver][test] Ignore %clang exit code for -mcpu=native tests

They may be either 0 or 1, depending whether `--target=` specifies a
native target.

Added: 
    

Modified: 
    clang/test/Driver/aarch64-mcpu.c
    clang/test/Driver/ppc-cpus.c
    clang/test/Driver/riscv-cpus.c

Removed: 
    


################################################################################
diff  --git a/clang/test/Driver/aarch64-mcpu.c b/clang/test/Driver/aarch64-mcpu.c
index abcdf98e1f9652..321d3a739b3535 100644
--- a/clang/test/Driver/aarch64-mcpu.c
+++ b/clang/test/Driver/aarch64-mcpu.c
@@ -19,7 +19,8 @@
 
 // We cannot check much for -mcpu=native, but it should be replaced by either generic or a valid
 // Arm cpu string, depending on the host.
-// RUN: not %clang --target=arm64 -mcpu=native -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-NATIVE %s
+// RUN: %clang --target=arm64 -mcpu=native -### -c %s 2> %t.err || true
+// RUN: FileCheck --input-file=%t.err -check-prefix=ARM64-NATIVE %s
 // ARM64-NATIVE-NOT: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "native"
 
 // RUN: %clang --target=arm64-apple-ios -arch arm64 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-IOS %s

diff  --git a/clang/test/Driver/ppc-cpus.c b/clang/test/Driver/ppc-cpus.c
index 51ff2492eb8fab..b0fd539b198a2c 100644
--- a/clang/test/Driver/ppc-cpus.c
+++ b/clang/test/Driver/ppc-cpus.c
@@ -2,7 +2,8 @@
 // MCPU_PPC64: "-target-cpu" "ppc64"
 
 /// We cannot check much for -mcpu=native, but it should be replaced by a CPU name.
-// RUN: %clang -### -c --target=powerpc64 %s -mcpu=native 2>&1 | FileCheck --check-prefix=MCPU_NATIVE %s
+// RUN: %clang -### -c --target=powerpc64 %s -mcpu=native 2> %t.err || true
+// RUN: FileCheck --input-file=%t.err -check-prefix=MCPU_NATIVE %s
 // MCPU_NATIVE-NOT: "-target-cpu" "native"
 
 /// Check that we are passing unknown mcpu options to the backend so an error

diff  --git a/clang/test/Driver/riscv-cpus.c b/clang/test/Driver/riscv-cpus.c
index a7d4c3635410f3..bd8488d81c0b15 100644
--- a/clang/test/Driver/riscv-cpus.c
+++ b/clang/test/Driver/riscv-cpus.c
@@ -21,7 +21,8 @@
 // MCPU-SYNTACORE-SCR1-MAX: "-target-abi" "ilp32"
 
 // We cannot check much for -mcpu=native, but it should be replaced by a valid CPU string.
-// RUN: not %clang --target=riscv64 -### -c %s 2>&1 -mcpu=native | FileCheck -check-prefix=MCPU-NATIVE %s
+// RUN: %clang --target=riscv64 -### -c %s -mcpu=native 2> %t.err || true
+// RUN: FileCheck --input-file=%t.err -check-prefix=MCPU-NATIVE %s
 // MCPU-NATIVE-NOT: "-target-cpu" "native"
 
 // RUN: %clang --target=riscv32 -### -c %s 2>&1 -mtune=rocket-rv32 | FileCheck -check-prefix=MTUNE-ROCKET32 %s


        


More information about the cfe-commits mailing list