Skip to content

[Driver][test] Make the FileCheck less strict for some tests. #94349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

hokein
Copy link
Collaborator

@hokein hokein commented Jun 4, 2024

We see some tests are failing internally after 12949c9.

In CAS systems, we might not see the exact binary name (clang), this patch removes the binary name in the FileCheck content to make these tests work on CAS.

@hokein hokein requested review from MaskRay and rupprecht June 4, 2024 12:54
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Jun 4, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 4, 2024

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: Haojian Wu (hokein)

Changes

We see some tests are failing internally after 12949c9.

In CAS systems, we might not see the exact binary name (clang), this patch removes the binary name in the FileCheck content to make these tests work on CAS.


Full diff: https://github.com/llvm/llvm-project/pull/94349.diff

3 Files Affected:

  • (modified) clang/test/Driver/mips-mti-linux.c (+2-2)
  • (modified) clang/test/Driver/openmp-offload-gpu.c (+3-3)
  • (modified) clang/test/Driver/openmp-offload.c (+5-5)
diff --git a/clang/test/Driver/mips-mti-linux.c b/clang/test/Driver/mips-mti-linux.c
index d10eb837b8a6e..0be25a284b777 100644
--- a/clang/test/Driver/mips-mti-linux.c
+++ b/clang/test/Driver/mips-mti-linux.c
@@ -12,7 +12,7 @@
 // RUN:     --sysroot=%S/Inputs/mips_mti_linux/sysroot \
 // RUN:   | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s
 //
-// CHECK-BE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" "mips-mti-linux"
+// CHECK-BE-HF-32R2: "-triple" "mips-mti-linux"
 // CHECK-BE-HF-32R2-SAME: "-target-cpu" "mips32r2"
 // CHECK-BE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
 // CHECK-BE-HF-32R2: "{{[^"]*}}ld.lld{{[^"]*}}"
@@ -31,7 +31,7 @@
 // RUN:     --sysroot=%S/Inputs/mips_mti_linux/sysroot \
 // RUN:   | FileCheck --check-prefix=CHECK-LE-HF-32R2 %s
 //
-// CHECK-LE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" "mipsel-mti-linux"
+// CHECK-LE-HF-32R2: "-triple" "mipsel-mti-linux"
 // CHECK-LE-HF-32R2-SAME: "-target-cpu" "mips32r2"
 // CHECK-LE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
 // CHECK-LE-HF-32R2: "{{[^"]*}}ld.lld{{[^"]*}}"
diff --git a/clang/test/Driver/openmp-offload-gpu.c b/clang/test/Driver/openmp-offload-gpu.c
index 0b98aaf6ba53c..a9ddf65177ee5 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -89,9 +89,9 @@
 // RUN:   -fopenmp-relocatable-target -save-temps \
 // RUN:   %s 2>&1 | FileCheck -check-prefix=CHK-ENV-BCLIB %s
 
-// CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
-// CHK-BCLIB-DIR: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget{{/|\\\\}}libomptarget-nvptx-sm_52.bc
-// CHK-ENV-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}subdir{{/|\\\\}}libomptarget-nvptx-sm_52.bc
+// CHK-BCLIB: triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-test.bc
+// CHK-BCLIB-DIR: triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget{{/|\\\\}}libomptarget-nvptx-sm_52.bc
+// CHK-ENV-BCLIB: triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}subdir{{/|\\\\}}libomptarget-nvptx-sm_52.bc
 // CHK-BCLIB-NOT: {{error:|warning:}}
 
 /// ###########################################################################
diff --git a/clang/test/Driver/openmp-offload.c b/clang/test/Driver/openmp-offload.c
index 38065d9398f45..9e7f523895ba3 100644
--- a/clang/test/Driver/openmp-offload.c
+++ b/clang/test/Driver/openmp-offload.c
@@ -38,7 +38,7 @@
 // RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu -Xopenmp-target=powerpc64le-ibm-linux-gnu -mcpu=pwr7 %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FOPENMP-EQ-TARGET %s
 
-// CHK-FOPENMP-EQ-TARGET: clang{{.*}} "-target-cpu" "pwr7" {{.*}}"-fopenmp-is-target-device"
+// CHK-FOPENMP-EQ-TARGET: "-target-cpu" "pwr7" {{.*}}"-fopenmp-is-target-device"
 
 /// ###########################################################################
 
@@ -46,7 +46,7 @@
 // RUN:   %clang -### -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu -Xopenmp-target -mcpu=pwr7 %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-FOPENMP-TARGET %s
 
-// CHK-FOPENMP-TARGET: clang{{.*}} "-target-cpu" "pwr7" {{.*}}"-fopenmp-is-target-device"
+// CHK-FOPENMP-TARGET: "-target-cpu" "pwr7" {{.*}}"-fopenmp-is-target-device"
 
 /// ##########################################################################
 
@@ -54,7 +54,7 @@
 // RUN:    %clang -### -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu --target=powerpc64le-ibm-linux-gnu -mcpu=pwr7 %s 2>&1 \
 // RUN:    | FileCheck -check-prefix=CHK-FOPENMP-MCPU-TO-SAME-TRIPLE %s
 
-// CHK-FOPENMP-MCPU-TO-SAME-TRIPLE: clang{{.*}} "-target-cpu" "pwr7" {{.*}}"-fopenmp-is-target-device"
+// CHK-FOPENMP-MCPU-TO-SAME-TRIPLE: "-target-cpu" "pwr7" {{.*}}"-fopenmp-is-target-device"
 
 /// ##########################################################################
 
@@ -62,7 +62,7 @@
 // RUN:    not %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda --target=powerpc64le-ibm-linux-gnu -march=pwr7 %s 2>&1 \
 // RUN:    | FileCheck -check-prefix=CHK-FOPENMP-MARCH-TO-GPU %s
 
-// CHK-FOPENMP-MARCH-TO-GPU-NOT: clang{{.*}} "-target-cpu" "pwr7" {{.*}}"-fopenmp-is-target-device"
+// CHK-FOPENMP-MARCH-TO-GPU-NOT: "-target-cpu" "pwr7" {{.*}}"-fopenmp-is-target-device"
 
 /// ###########################################################################
 
@@ -70,7 +70,7 @@
 // RUN:    not %clang -### -fopenmp=libomp -fopenmp-targets=x86_64-unknown-linux-gnu --target=powerpc64le-ibm-linux-gnu -march=pwr7 %s 2>&1 \
 // RUN:    | FileCheck -check-prefix=CHK-FOPENMP-MARCH-TO-X86 %s
 
-// CHK-FOPENMP-MARCH-TO-X86-NOT: clang{{.*}} "-target-cpu" "pwr7" {{.*}}"-fopenmp-is-target-device"
+// CHK-FOPENMP-MARCH-TO-X86-NOT: "-target-cpu" "pwr7" {{.*}}"-fopenmp-is-target-device"
 
 /// ###########################################################################
 

@hokein hokein force-pushed the fix-driver-tests branch from a5e8cfd to fa0880d Compare June 4, 2024 13:10
@@ -12,7 +12,7 @@
// RUN: --sysroot=%S/Inputs/mips_mti_linux/sysroot \
// RUN: | FileCheck --check-prefix=CHECK-BE-HF-32R2 %s
//
// CHECK-BE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" "mips-mti-linux"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of changing the check, can you change the RUN lines to use %clang -no-canonical-prefixes? I would expect that to not realpath-ify the binary name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I wasn't aware of the -no-canonical-prefixes option, it fixes the failures.

…tests

We see some tests are failing internally after 12949c9.

In some CAS systems, we might not see the exact binary name (clang),
this patch adds the `-no-canonical-prefixes` option to the command line to not
realpath-ify the binary name.
@hokein hokein force-pushed the fix-driver-tests branch from fa0880d to b9bd6c3 Compare June 4, 2024 15:24
@rupprecht rupprecht changed the title [Driver] Make the FileCheck less strict for some tests. [Driver][test] Make the FileCheck less strict for some tests. Jun 4, 2024
@hokein hokein merged commit 335fb94 into llvm:main Jun 4, 2024
5 of 6 checks passed
@hokein hokein deleted the fix-driver-tests branch June 4, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants