[clang] 30c4b97 - [test] Fix unit test case errors.

Han Shen via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 17 11:32:26 PDT 2023


Author: Han Shen
Date: 2023-08-17T11:32:06-07:00
New Revision: 30c4b97aec60895a6905816670f493cdd1d7c546

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

LOG: [test] Fix unit test case errors.

This fix includes two changes:
- use proper triple name for arm: arm-unknown-linux-gnueabi
- specify output to be in a temp directory

Test cases fixed:
 - clang/test/Driver/fsplit-machine-functions-with-cuda-nvptx.c
 - clang/test/Driver/fsplit-machine-functions.c
 - clang/test/Driver/fsplit-machine-functions2.c

Reviewed: xur

Added: 
    

Modified: 
    clang/test/Driver/fsplit-machine-functions-with-cuda-nvptx.c
    clang/test/Driver/fsplit-machine-functions.c
    clang/test/Driver/fsplit-machine-functions2.c

Removed: 
    


################################################################################
diff  --git a/clang/test/Driver/fsplit-machine-functions-with-cuda-nvptx.c b/clang/test/Driver/fsplit-machine-functions-with-cuda-nvptx.c
index 226c3787348e8f..f2b09e13d80b68 100644
--- a/clang/test/Driver/fsplit-machine-functions-with-cuda-nvptx.c
+++ b/clang/test/Driver/fsplit-machine-functions-with-cuda-nvptx.c
@@ -5,21 +5,24 @@
 
 // Check that -fsplit-machine-functions is passed to both x86 and cuda
 // compilation and does not cause driver error.
+// RUN:   cd "$(dirname "%t")" ; \
 // RUN:   %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
-// RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions -S %s 2>&1 \
-// RUN:     | FileCheck %s --check-prefix=MFS1
+// RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions -S %s \
+// RUN:     2>&1 | FileCheck %s --check-prefix=MFS1
 // MFS1: "-target-cpu" "x86-64"{{.*}}"-fsplit-machine-functions"
 // MFS1: "-target-cpu" "sm_70"{{.*}}"-fsplit-machine-functions"
 
 // Check that -fsplit-machine-functions is passed to cuda and it
 // causes a warning.
+// RUN:   cd "$(dirname "%t")" ; \
 // RUN:   %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
-// RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions -S %s 2>&1 \
-// RUN:     | FileCheck %s --check-prefix=MFS2
+// RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions -S %s \
+// RUN:     2>&1 | FileCheck %s --check-prefix=MFS2
 // MFS2: warning: -fsplit-machine-functions is not valid for nvptx
 
 // Check that -Xarch_host -fsplit-machine-functions is passed only to
 // native compilation.
+// RUN:   cd "$(dirname "%t")" ; \
 // RUN:   %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
 // RUN:     --cuda-gpu-arch=sm_70 -x cuda -Xarch_host \
 // RUN:     -fsplit-machine-functions -S %s \
@@ -28,6 +31,7 @@
 // MFS3-NOT: "-target-cpu" "sm_70"{{.*}}"-fsplit-machine-functions"
 
 // Check that -Xarch_host -fsplit-machine-functions does not cause any warning.
+// RUN:   cd "$(dirname "%t")" ; \
 // RUN:   %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
 // RUN      --cuda-gpu-arch=sm_70 -x cuda -Xarch_host \
 // RUN      -fsplit-machine-functions -S %s || { echo \
@@ -36,6 +40,7 @@
 // MFS4-NOT: warning: -fsplit-machine-functions is not valid for
 
 // Check that -Xarch_device -fsplit-machine-functions does cause the warning.
+// RUN:   cd "$(dirname "%t")" ; \
 // RUN:   %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
 // RUN:     --cuda-gpu-arch=sm_70 -x cuda -Xarch_device \
 // RUN:     -fsplit-machine-functions -S %s 2>&1 | \
@@ -44,6 +49,7 @@
 
 // Check that -fsplit-machine-functions -Xarch_device
 // -fno-split-machine-functions only passes MFS to x86
+// RUN:   cd "$(dirname "%t")" ; \
 // RUN:   %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
 // RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions \
 // RUN:     -Xarch_device -fno-split-machine-functions -S %s \
@@ -53,6 +59,7 @@
 
 // Check that -fsplit-machine-functions -Xarch_device
 // -fno-split-machine-functions has no warnings
+// RUN:   cd "$(dirname "%t")" ; \
 // RUN:   %clang --target=x86_64-unknown-linux-gnu -nogpulib -nogpuinc \
 // RUN:     --cuda-gpu-arch=sm_70 -x cuda -fsplit-machine-functions \
 // RUN:     -Xarch_device -fno-split-machine-functions -S %s \

diff  --git a/clang/test/Driver/fsplit-machine-functions.c b/clang/test/Driver/fsplit-machine-functions.c
index e5f6a74763af23..4ba4e52fb79484 100644
--- a/clang/test/Driver/fsplit-machine-functions.c
+++ b/clang/test/Driver/fsplit-machine-functions.c
@@ -1,9 +1,9 @@
 // REQUIRES: arm-registered-target
 
-// RUN: %clang -### -target x86_64 -fprofile-use=default.profdata -fsplit-machine-functions %s -c 2>&1 | FileCheck -check-prefix=CHECK-OPT %s
-// RUN: %clang -### -target x86_64 -fsplit-machine-functions %s -c 2>&1 | FileCheck -check-prefix=CHECK-OPT %s
-// RUN: %clang -### -target x86_64 -fprofile-use=default.profdata -fsplit-machine-functions -fno-split-machine-functions %s -c 2>&1 | FileCheck -check-prefix=CHECK-NOOPT %s
-// RUN: %clang -c -target arm-unknown-linux -fsplit-machine-functions %s 2>&1 | FileCheck -check-prefix=CHECK-TRIPLE %s
+// RUN: %clang -### -target x86_64 -fprofile-use=default.profdata -fsplit-machine-functions %s -c -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-OPT %s
+// RUN: %clang -### -target x86_64 -fsplit-machine-functions %s -c -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-OPT %s
+// RUN: %clang -### -target x86_64 -fprofile-use=default.profdata -fsplit-machine-functions -fno-split-machine-functions %s -c -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOOPT %s
+// RUN: %clang -c -target arm-unknown-linux-gnueabi -fsplit-machine-functions %s -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-TRIPLE %s
 
 // CHECK-OPT:       "-fsplit-machine-functions"
 // CHECK-NOOPT-NOT: "-fsplit-machine-functions"

diff  --git a/clang/test/Driver/fsplit-machine-functions2.c b/clang/test/Driver/fsplit-machine-functions2.c
index 70a6ce592094a1..45bf71b6eb9ad9 100644
--- a/clang/test/Driver/fsplit-machine-functions2.c
+++ b/clang/test/Driver/fsplit-machine-functions2.c
@@ -1,14 +1,14 @@
 // Test -fsplit-machine-functions option pass-through with lto
-// RUN: %clang -### -target x86_64-unknown-linux -flto -fsplit-machine-functions %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS
+// RUN: %clang -### -target x86_64-unknown-linux -flto -fsplit-machine-functions %s -o %t.o 2>&1 | FileCheck %s -check-prefix=CHECK-PASS
 
 // Test no pass-through to ld without lto
-// RUN: %clang -### -target x86_64-unknown-linux -fsplit-machine-functions %s 2>&1 | FileCheck %s -check-prefix=CHECK-NOPASS
+// RUN: %clang -### -target x86_64-unknown-linux -fsplit-machine-functions %s -o %t.o 2>&1 | FileCheck %s -check-prefix=CHECK-NOPASS
 
 // Test the mix of -fsplit-machine-functions and -fno-split-machine-functions
-// RUN: %clang -### -target x86_64-unknown-linux -flto -fsplit-machine-functions -fno-split-machine-functions %s 2>&1 | FileCheck %s -check-prefix=CHECK-NOPASS
-// RUN: %clang -### -target x86_64-unknown-linux -flto -fno-split-machine-functions -fsplit-machine-functions %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS
+// RUN: %clang -### -target x86_64-unknown-linux -flto -fsplit-machine-functions -fno-split-machine-functions %s -o %t.o 2>&1 | FileCheck %s -check-prefix=CHECK-NOPASS
+// RUN: %clang -### -target x86_64-unknown-linux -flto -fno-split-machine-functions -fsplit-machine-functions %s -o %t.o 2>&1 | FileCheck %s -check-prefix=CHECK-PASS
 // Check that for non-X86, passing no-split-machine-functions does not cause error.
-// RUN: %clang -### -target aarch64-unknown-linux -flto -fsplit-machine-functions -fno-split-machine-functions %s 2>&1 | FileCheck %s -check-prefix=CHECK-NOPASS2
+// RUN: %clang -### -target aarch64-unknown-linux-gnu -flto -fsplit-machine-functions -fno-split-machine-functions %s -o %t.o 2>&1 | FileCheck %s -check-prefix=CHECK-NOPASS2
 
 // CHECK-PASS:          "-plugin-opt=-split-machine-functions"
 // CHECK-NOPASS-NOT:    "-plugin-opt=-split-machine-functions"


        


More information about the cfe-commits mailing list