Skip to content

Commit 918dad5

Browse files
committed
[test] Avoid unportable echo in Other/lit-quoting.txt
`LLVM :: Other/lit-quoting.txt` currently `FAIL`s on Solaris: llvm/test/Other/lit-quoting.txt:8:9: error: CHECK2: expected string not found in input CHECK2: {{^a\[b\\c$}} ^ <stdin>:1:1: note: scanning from here a[b ^ This happens because echo with backslashes or special characters is unportable, as extensively documented in the Autoconf manual. In the case at hand, `echo 'a[b\c'` yields `a[b\c` on Linux, but `a[b` (no newline) on Solaris. This patch fixes this by using the portable alternative suggested in the Autoconf manual. Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and `x86_64-pc-linux-gnu`. Differential Revision: https://reviews.llvm.org/D108031
1 parent 7aef2e5 commit 918dad5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

llvm/test/Other/lit-quoting.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
RUN: echo "\"" | FileCheck %s --check-prefix=CHECK1
2-
RUN: echo '"' | FileCheck %s --check-prefix=CHECK1
3-
RUN: echo 'a[b\c' | FileCheck %s --check-prefix=CHECK2
4-
RUN: echo "a[b\\c" | FileCheck %s --check-prefix=CHECK2
5-
RUN: echo 'a\b\\c\\\\d' | FileCheck %s --check-prefix=CHECK3
6-
RUN: echo "a\\b\\\\c\\\\\\\\d" | FileCheck %s --check-prefix=CHECK3
1+
RUN: printf "%%s\n" "\"" | FileCheck %s --check-prefix=CHECK1
2+
RUN: printf "%%s\n" '"' | FileCheck %s --check-prefix=CHECK1
3+
RUN: printf "%%s\n" 'a[b\c' | FileCheck %s --check-prefix=CHECK2
4+
RUN: printf "%%s\n" "a[b\\c" | FileCheck %s --check-prefix=CHECK2
5+
RUN: printf "%%s\n" 'a\b\\c\\\\d' | FileCheck %s --check-prefix=CHECK3
6+
RUN: printf "%%s\n" "a\\b\\\\c\\\\\\\\d" | FileCheck %s --check-prefix=CHECK3
77
CHECK1: {{^"$}}
88
CHECK2: {{^a\[b\\c$}}
99
CHECK3: {{^a\\b\\\\c\\\\\\\\d$}}
1010

1111
On Windows, with MSYS based tools, the following commands fail though:
12-
RUNX: echo 'a[b\c\\d' | FileCheck %s --check-prefix=CHECK4
13-
RUNX: echo "a[b\\c\\\\d" | FileCheck %s --check-prefix=CHECK4
12+
RUNX: printf "%%s\n" 'a[b\c\\d' | FileCheck %s --check-prefix=CHECK4
13+
RUNX: printf "%%s\n" "a[b\\c\\\\d" | FileCheck %s --check-prefix=CHECK4
1414
CHECK4: {{^a\[b\\c\\\\d$}}

0 commit comments

Comments
 (0)