Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust/tools/qltest.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set "RUST_BACKTRACE=full"
set "QLTEST_LOG=%CODEQL_EXTRACTOR_RUST_LOG_DIR%/qltest.log"

type NUL && "%CODEQL_EXTRACTOR_RUST_ROOT%/tools/%CODEQL_PLATFORM%/extractor" --qltest >"%QLTEST_LOG%" 2>&1
type NUL && "%CODEQL_EXTRACTOR_RUST_ROOT%/tools/%CODEQL_PLATFORM%/extractor" --qltest --logging-verbosity=progress+ >"%QLTEST_LOG%" 2>&1

if %ERRORLEVEL% neq 0 (
type "%QLTEST_LOG%"
Expand Down
16 changes: 14 additions & 2 deletions rust/tools/qltest.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
#!/bin/bash

set -eu
set -o pipefail

export RUST_BACKTRACE=full
QLTEST_LOG="$CODEQL_EXTRACTOR_RUST_LOG_DIR"/qltest.log
if ! "$CODEQL_EXTRACTOR_RUST_ROOT/tools/$CODEQL_PLATFORM/extractor" --qltest >> "$QLTEST_LOG" 2>&1; then
cat "$QLTEST_LOG"
mkdir -p "$CODEQL_EXTRACTOR_RUST_SCRATCH_DIR"
TMP_OUT="$(mktemp --tmpdir="$CODEQL_EXTRACTOR_RUST_SCRATCH_DIR" qltest-XXXXXX.log))"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't bother with the mktemp and trap commands. The scratch dir is cleaned up already when a database is finalized.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right!

trap 'rm -f "$TMP_OUT"' EXIT
# put full-color output on the side, but remove the color codes from the log file
# also, print (colored) output only in case of failure
if ! "$CODEQL_EXTRACTOR_RUST_ROOT/tools/$CODEQL_PLATFORM/extractor" \
--qltest \
--logging-verbosity=progress+ \
2>&1 \
| tee "$TMP_OUT" \
| sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' \
> "$QLTEST_LOG"; then
cat "$TMP_OUT"
exit 1
fi