Skip to content

Commit 6e65e6a

Browse files
[lld] Update cgdata-* tests to not use subshells
Subshells are not supported in the lit internal shell. We can remove them by constructing sed commands directly inside of a separate file. Towards #102700. Reviewers: ilovepi, MaskRay, petrhosek, mysterymath, cmtice, kyulee-com Reviewed By: MaskRay, cmtice, petrhosek Pull Request: #156533
1 parent 688d12c commit 6e65e6a

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

lld/test/MachO/cgdata-generate-merge.s

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55

66
# Synthesize raw cgdata without the header (32 byte) from the indexed cgdata.
77
# RUN: llvm-cgdata --convert --format binary %t/raw-1.cgtext -o %t/raw-1.cgdata
8-
# RUN: od -t x1 -j 32 -An %t/raw-1.cgdata | tr -d '\n\r\t' | sed 's/[ ][ ]*/ /g; s/^[ ]*//; s/[ ]*$//; s/[ ]/,0x/g; s/^/0x/' > %t/raw-1-bytes.txt
9-
# RUN: sed "s/<RAW_BYTES>/$(cat %t/raw-1-bytes.txt)/g" %t/merge-template.s > %t/merge-1.s
8+
# RUN: echo -n "s/<RAW_BYTES>/" > %t/raw-1-sed.txt
9+
# RUN: od -t x1 -j 32 -An %t/raw-1.cgdata | tr -d '\n\r\t' | sed 's/[ ][ ]*/ /g; s/^[ ]*//; s/[ ]*$//; s/[ ]/,0x/g; s/^/0x/' >> %t/raw-1-sed.txt
10+
# RUN: echo "/g" >> %t/raw-1-sed.txt
11+
# RUN: sed -f %t/raw-1-sed.txt %t/merge-template.s > %t/merge-1.s
1012
# RUN: llvm-cgdata --convert --format binary %t/raw-2.cgtext -o %t/raw-2.cgdata
11-
# RUN: od -t x1 -j 32 -An %t/raw-2.cgdata | tr -d '\n\r\t' | sed 's/[ ][ ]*/ /g; s/^[ ]*//; s/[ ]*$//; s/[ ]/,0x/g; s/^/0x/' > %t/raw-2-bytes.txt
12-
# RUN: sed "s/<RAW_BYTES>/$(cat %t/raw-2-bytes.txt)/g" %t/merge-template.s > %t/merge-2.s
13+
# RUN: echo -n "s/<RAW_BYTES>/" > %t/raw-2-sed.txt
14+
# RUN: od -t x1 -j 32 -An %t/raw-2.cgdata | tr -d '\n\r\t' | sed 's/[ ][ ]*/ /g; s/^[ ]*//; s/[ ]*$//; s/[ ]/,0x/g; s/^/0x/' >> %t/raw-2-sed.txt
15+
# RUN: echo "/g" >> %t/raw-2-sed.txt
16+
# RUN: sed -f %t/raw-2-sed.txt %t/merge-template.s > %t/merge-2.s
1317

1418
# RUN: llvm-mc -filetype obj -triple arm64-apple-darwin %t/merge-1.s -o %t/merge-1.o
1519
# RUN: llvm-mc -filetype obj -triple arm64-apple-darwin %t/merge-2.s -o %t/merge-2.o

lld/test/MachO/cgdata-generate.s

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55

66
# Synthesize raw cgdata without the header (32 byte) from the indexed cgdata.
77
# RUN: llvm-cgdata --convert --format binary %t/raw-1.cgtext -o %t/raw-1.cgdata
8-
# RUN: od -t x1 -j 32 -An %t/raw-1.cgdata | tr -d '\n\r\t' | sed 's/[ ][ ]*/ /g; s/^[ ]*//; s/[ ]*$//; s/[ ]/,0x/g; s/^/0x/' > %t/raw-1-bytes.txt
9-
# RUN: sed "s/<RAW_BYTES>/$(cat %t/raw-1-bytes.txt)/g" %t/merge-template.s > %t/merge-1.s
8+
# RUN: echo -n "s/<RAW_BYTES>/" > %t/raw-1-sed.txt
9+
# RUN: od -t x1 -j 32 -An %t/raw-1.cgdata | tr -d '\n\r\t' | sed 's/[ ][ ]*/ /g; s/^[ ]*//; s/[ ]*$//; s/[ ]/,0x/g; s/^/0x/' >> %t/raw-1-sed.txt
10+
# RUN: echo "/g" >> %t/raw-1-sed.txt
11+
# RUN: sed -f %t/raw-1-sed.txt %t/merge-template.s > %t/merge-1.s
1012
# RUN: llvm-cgdata --convert --format binary %t/raw-2.cgtext -o %t/raw-2.cgdata
11-
# RUN: od -t x1 -j 32 -An %t/raw-2.cgdata | tr -d '\n\r\t' | sed 's/[ ][ ]*/ /g; s/^[ ]*//; s/[ ]*$//; s/[ ]/,0x/g; s/^/0x/' > %t/raw-2-bytes.txt
12-
# RUN: sed "s/<RAW_BYTES>/$(cat %t/raw-2-bytes.txt)/g" %t/merge-template.s > %t/merge-2.s
13+
# RUN: echo -n "s/<RAW_BYTES>/" > %t/raw-2-sed.txt
14+
# RUN: od -t x1 -j 32 -An %t/raw-2.cgdata | tr -d '\n\r\t' | sed 's/[ ][ ]*/ /g; s/^[ ]*//; s/[ ]*$//; s/[ ]/,0x/g; s/^/0x/' >> %t/raw-2-sed.txt
15+
# RUN: echo "/g" >> %t/raw-2-sed.txt
16+
# RUN: sed -f %t/raw-2-sed.txt %t/merge-template.s > %t/merge-2.s
1317

1418
# RUN: llvm-mc -filetype obj -triple arm64-apple-darwin %t/merge-1.s -o %t/merge-1.o
1519
# RUN: llvm-mc -filetype obj -triple arm64-apple-darwin %t/merge-2.s -o %t/merge-2.o

0 commit comments

Comments
 (0)