Skip to content

[Clang] Fix the clang/test/PCH/ignored-pch.c test. #144737

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

Conversation

MaggieYingYi
Copy link
Contributor

Change the test to check the exit status of the 'ls' command line (instead of error message) since the error message is different when running 'ls' command on the different Host machine.

Change the test to check the exit status of the 'ls' command line (instead of error message) since the error message is different when running 'ls' command on the
different Host machine.
@MaggieYingYi MaggieYingYi self-assigned this Jun 18, 2025
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jun 18, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 18, 2025

@llvm/pr-subscribers-clang

Author: Ying Yi (MaggieYingYi)

Changes

Change the test to check the exit status of the 'ls' command line (instead of error message) since the error message is different when running 'ls' command on the different Host machine.


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

1 Files Affected:

  • (modified) clang/test/PCH/ignored-pch.c (+27-31)
diff --git a/clang/test/PCH/ignored-pch.c b/clang/test/PCH/ignored-pch.c
index 5b64582cba618..c6ef3fe74cee9 100644
--- a/clang/test/PCH/ignored-pch.c
+++ b/clang/test/PCH/ignored-pch.c
@@ -1,96 +1,96 @@
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -o %t.pch
 // RUN: %clang -S -emit-llvm %s -include-pch %t.pch -o %t.ll
-// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: ls %t.pch
+// RUN: ls %t.ll
 
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -o %t.pch
 // RUN: %clang %s -emit-ast -include-pch %t.pch -o %t.ll
-// RUN: ls %t.pch | FileCheck --check-prefix=CHECK-PCH %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: ls %t.pch
+// RUN: ls %t.ll
 
 // Check that -ignore-pch causes -emit-pch and -include-pch options to be ignored.
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -ignore-pch -o %t.pch
 // RUN: %clang -S -emit-llvm %s -include-pch %t.pch -ignore-pch -o %t.ll
-// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-PCH-ERROR %s
-// RUN: ls %t.ll 2>&1 | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: not ls %t.pch
+// RUN: ls %t.ll
 
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -emit-ast %s -include-pch %t.pch -ignore-pch -o %t.ll
-// RUN: not ls %t.ll 2>&1 | FileCheck --check-prefix=CHECK-OBJ-ERROR %s
+// RUN: not ls %t.ll
 
 // Check that -ignore-pch works for multiple PCH related options.
 // Test with -building-pch-with-obj.
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -ignore-pch -Xclang -building-pch-with-obj -o %t.pch
 // RUN: %clang -S -emit-llvm %s -include-pch %t.pch -ignore-pch -Xclang -building-pch-with-obj -o %t.ll
-// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-PCH-ERROR %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: not ls %t.pch
+// RUN: ls %t.ll
 
 // Test with -fallow-pch-with-compiler-errors.
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -ignore-pch -Xclang -fallow-pch-with-compiler-errors -o %t.pch
 // RUN: %clang -S -emit-llvm %s -include-pch %t.pch -ignore-pch -Xclang -fallow-pch-with-compiler-errors -o %t.ll
-// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-PCH-ERROR %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: not ls %t.pch
+// RUN: ls %t.ll
 
 // Test with -fallow-pch-with-different-modules-cache-path.
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -ignore-pch -Xclang -fallow-pch-with-different-modules-cache-path -o %t.pch
 // RUN: %clang -S -emit-llvm %s -ignore-pch -include-pch %t.pch -Xclang -fallow-pch-with-different-modules-cache-path -o %t.ll
-// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-PCH-ERROR %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: not ls %t.pch
+// RUN: ls %t.ll
 
 // Test with -fpch-codegen.
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -ignore-pch -fpch-codegen -o %t.pch
 // RUN: %clang -S -emit-llvm %s -include-pch %t.pch -ignore-pch -fpch-codegen -o %t.ll
-// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-PCH-ERROR %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: not ls %t.pch
+// RUN: ls %t.ll
 
 // Test with -fpch-debuginfo.
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -ignore-pch -fpch-debuginfo -o %t.pch
 // RUN: %clang -S -emit-llvm %s -include-pch %t.pch -ignore-pch -fpch-debuginfo -o %t.ll
-// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-PCH %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: not ls %t.pch
+// RUN: ls %t.ll
 
 // Test with -fpch-instantiate-templates.
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -ignore-pch -fpch-instantiate-templates -o %t.pch
 // RUN: %clang -S -emit-llvm %s -include-pch %t.pch -ignore-pch -fpch-instantiate-templates -o %t.ll
-// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-PCH %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: not ls %t.pch
+// RUN: ls %t.ll
 
 // Test with -fno-pch-timestamp.
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -ignore-pch -Xclang -fno-pch-timestamp -o %t.pch
 // RUN: %clang -S -emit-llvm %s -include-pch %t.pch -ignore-pch -Xclang -fno-pch-timestamp -o %t.ll
-// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-PCH %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: not ls %t.pch
+// RUN: ls %t.ll
 
 // Test with -fno-validate-pch.
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -ignore-pch -Xclang -fno-validate-pch -o %t.pch
 // RUN: %clang -S -emit-llvm %s -include-pch %t.pch -ignore-pch -Xclang -fno-validate-pch -o %t.ll
-// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-PCH %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: not ls %t.pch
+// RUN: ls %t.ll
 
 // Test with -relocatable-pch.
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -ignore-pch -relocatable-pch -o %t.pch
 // RUN: %clang -S -emit-llvm %s -include-pch %t.pch -ignore-pch -relocatable-pch -o %t.ll
-// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-PCH %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: not ls %t.pch
+// RUN: ls %t.ll
 
 // Test with -pch-through-hdrstop-create/-pch-through-hdrstop-use
 // RUN: rm -rf %t.pch %t.ll
 // RUN: %clang -x c-header %S/Inputs/ignored-pch.h -ignore-pch -Xclang -pch-through-hdrstop-create -o %t.pch
 // RUN: %clang -S -emit-llvm %s -include-pch %t.pch -ignore-pch -Xclang -pch-through-hdrstop-use -o %t.ll
-// RUN: not ls %t.pch 2>&1 | FileCheck --check-prefix=CHECK-PCH %s
-// RUN: ls %t.ll | FileCheck --check-prefix=CHECK-OBJ %s
+// RUN: not ls %t.pch
+// RUN: ls %t.ll
 
 
 // Test with AST dump output:
@@ -99,10 +99,6 @@
 // RUN: %clang %s -include-pch %t.pch -Xclang -ast-dump-all -c | FileCheck --check-prefix=CHECK-AST-PCH %s
 // RUN: %clang %s -include-pch %t.pch -ignore-pch -Xclang -ast-dump-all -c | FileCheck --check-prefix=CHECK-AST %s
 
-// CHECK-PCH: ignored-pch.c.{{.*}}.pch
-// CHECK-OBJ: ignored-pch.c.{{.*}}.ll
-// CHECK-PCH-ERROR: ignored-pch.c.{{.*}}.pch{{'?}}: No such file or directory
-// CHECK-OBJ-ERROR: ignored-pch.c.{{.*}}.ll{{'?}}: No such file or directory
 // CHECK-AST-PCH: <undeserialized declarations>
 // CHECK-AST-NOT: <undeserialized declarations>
 

Copy link
Collaborator

@goussepi goussepi left a comment

Choose a reason for hiding this comment

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

LGTM!

@MaggieYingYi MaggieYingYi merged commit 6d785ca into llvm:main Jun 18, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants