Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

This test was using $'<content with escapes' to have bash interpret
shell escapes and then passing them to grep. The lexer/parser for lit's
internal shell does not support such sequences. Given this is the only
test in-tree that uses this functionality, it makes much more sense to
use a POSIX compliant utility like od to transform the file into hex and
then grep over that rather than modify the internal shell. This test
should remain portable as od should be widely available and we are only
using options specified in POSIX.

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Sep 14, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 14, 2025

@llvm/pr-subscribers-clang

Author: Aiden Grossman (boomanaiden154)

Changes

This test was using $'<content with escapes' to have bash interpret
shell escapes and then passing them to grep. The lexer/parser for lit's
internal shell does not support such sequences. Given this is the only
test in-tree that uses this functionality, it makes much more sense to
use a POSIX compliant utility like od to transform the file into hex and
then grep over that rather than modify the internal shell. This test
should remain portable as od should be widely available and we are only
using options specified in POSIX.


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

1 Files Affected:

  • (modified) clang/test/Frontend/rewrite-includes-bom.c (+2-3)
diff --git a/clang/test/Frontend/rewrite-includes-bom.c b/clang/test/Frontend/rewrite-includes-bom.c
index caa431ad9aaff..059cfa3be5bc8 100644
--- a/clang/test/Frontend/rewrite-includes-bom.c
+++ b/clang/test/Frontend/rewrite-includes-bom.c
@@ -1,8 +1,7 @@
-// RUN: grep -q $'^\xEF\xBB\xBF' %S/Inputs/rewrite-includes-bom.h
+// RUN: cat %S/Inputs/rewrite-includes-bom.h | od -t x1 | grep -q 'ef bb bf'
 // RUN: %clang_cc1 -E -frewrite-includes -I %S/Inputs %s -o %t.c
-// RUN: ! grep -q $'\xEF\xBB\xBF' %t.c
+// RUN: cat %t.c | od -t x1 | not grep -q 'ef bb bf'
 // RUN: %clang_cc1 -fsyntax-only -verify %t.c
 // expected-no-diagnostics
-// REQUIRES: shell
 
 #include "rewrite-includes-bom.h"

Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Sep 19, 2025
This test was using $'<content with escapes' to have bash interpret
shell escapes and then passing them to grep. The lexer/parser for lit's
internal shell does not support such sequences. Given this is the only
test in-tree that uses this functionality, it makes much more sense to
use a POSIX compliant utility like od to transform the file into hex and
then grep over that rather than modify the internal shell. This test
should remain portable as od should be widely available and we are only
using options specified in POSIX.

Pull Request: llvm#158463
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
@boomanaiden154 boomanaiden154 changed the base branch from users/boomanaiden154/main.clang-make-rewrite-includes-bomc-work-with-internal-shell to main September 20, 2025 04:45
@boomanaiden154 boomanaiden154 merged commit 8d6470f into main Sep 20, 2025
8 of 9 checks passed
@boomanaiden154 boomanaiden154 deleted the users/boomanaiden154/clang-make-rewrite-includes-bomc-work-with-internal-shell branch September 20, 2025 04:45
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Sep 20, 2025
This test was using $'<content with escapes' to have bash interpret
shell escapes and then passing them to grep. The lexer/parser for lit's
internal shell does not support such sequences. Given this is the only
test in-tree that uses this functionality, it makes much more sense to
use a POSIX compliant utility like od to transform the file into hex and
then grep over that rather than modify the internal shell. This test
should remain portable as od should be widely available and we are only
using options specified in POSIX.

Reviewers: cmtice, petrhosek, ilovepi

Reviewed By: petrhosek, ilovepi

Pull Request: llvm/llvm-project#158463
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.

5 participants