[llvm-branch-commits] [Clang] Make rewrite-includes-bom.c work with internal shell (PR #158463)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Sep 14 00:13:53 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Aiden Grossman (boomanaiden154)
<details>
<summary>Changes</summary>
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
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"
``````````
</details>
https://github.com/llvm/llvm-project/pull/158463
More information about the llvm-branch-commits
mailing list