Skip to content

Commit dbdf6ea

Browse files
committed
Swift: fix qltest failure reporting
`qltest.sh` was not exiting with a failure when the extractor was failing.
1 parent cf7a5f8 commit dbdf6ea

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

swift/tools/qltest.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,19 @@ QLTEST_LOG="$CODEQL_EXTRACTOR_SWIFT_LOG_DIR"/qltest.log
66

77
export LD_LIBRARY_PATH="$CODEQL_EXTRACTOR_SWIFT_ROOT/tools/$CODEQL_PLATFORM"
88

9+
EXTRACTOR="$CODEQL_EXTRACTOR_SWIFT_ROOT/tools/$CODEQL_PLATFORM/extractor"
10+
SDK="$CODEQL_EXTRACTOR_SWIFT_ROOT/qltest/$CODEQL_PLATFORM/sdk"
11+
912
for src in *.swift; do
10-
opts=(-sdk "$CODEQL_EXTRACTOR_SWIFT_ROOT/qltest/$CODEQL_PLATFORM/sdk" -c -primary-file $src)
13+
opts=(-sdk "$SDK" -c -primary-file "$src")
1114
opts+=($(sed -n '1 s=//codeql-extractor-options:==p' $src))
1215
echo -e "calling extractor with flags: ${opts[@]}\n" >> $QLTEST_LOG
13-
"$CODEQL_EXTRACTOR_SWIFT_ROOT/tools/$CODEQL_PLATFORM/extractor" "${opts[@]}" >> $QLTEST_LOG 2>&1 || FAILED=1
16+
if ! "$EXTRACTOR" "${opts[@]}" >> $QLTEST_LOG 2>&1; then
17+
FAILED=1
18+
fi
1419
done
1520

16-
[ -z "$FAILED" ] || cat "$QLTEST_LOG" # Show compiler errors on extraction failure
21+
if [ -n "$FAILED" ]; then
22+
cat "$QLTEST_LOG" # Show compiler errors on extraction failure
23+
exit 1
24+
fi

0 commit comments

Comments
 (0)