Skip to content

Commit 77fd836

Browse files
committed
test(e2e): make 202 CDB path greps separator-agnostic
Windows CDBs store file paths with backslashes, so `grep 'src/main.cpp'` never matched and the test failed on the Windows e2e shard once the CDB was actually being generated. Match either separator with `[\/]`.
1 parent e1fe32d commit 77fd836

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tests/e2e/202_configure_only_cdb.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ out=$($MCPP build --configure-only 2>&1) || {
5555
exit 1
5656
}
5757

58-
grep -q 'src/main.cpp' compile_commands.json || {
58+
grep -q 'src[\/]main.cpp' compile_commands.json || {
5959
echo "CDB is missing the ordinary source TU"
6060
cat compile_commands.json
6161
exit 1
6262
}
63-
grep -q 'tests/test_smoke.cpp' compile_commands.json || {
63+
grep -q 'tests[\/]test_smoke.cpp' compile_commands.json || {
6464
echo "CDB is missing the test TU"
6565
cat compile_commands.json
6666
exit 1
@@ -118,16 +118,16 @@ cd "$TMP/ws"
118118
for member in a b; do
119119
cdb="$member/compile_commands.json"
120120
[[ -s "$cdb" ]] || { echo "missing $cdb"; exit 1; }
121-
grep -q "src/main.cpp" "$cdb" || { cat "$cdb"; exit 1; }
122-
grep -q "tests/main.cpp" "$cdb" || { cat "$cdb"; exit 1; }
121+
grep -q "src[\\/]main.cpp" "$cdb" || { cat "$cdb"; exit 1; }
122+
grep -q "tests[\\/]main.cpp" "$cdb" || { cat "$cdb"; exit 1; }
123123
done
124124
rm -f a/compile_commands.json
125125
"$MCPP" build --configure-only -p a > configure-member.log 2>&1 || {
126126
cat configure-member.log
127127
exit 1
128128
}
129-
grep -q 'src/main.cpp' a/compile_commands.json || { cat a/compile_commands.json; exit 1; }
130-
if grep -q 'b/src/main.cpp' a/compile_commands.json; then
129+
grep -q 'src[\/]main.cpp' a/compile_commands.json || { cat a/compile_commands.json; exit 1; }
130+
if grep -q 'b[\/]src[\/]main.cpp' a/compile_commands.json; then
131131
echo "-p a leaked member b into the CDB"
132132
cat a/compile_commands.json
133133
exit 1

0 commit comments

Comments
 (0)