Skip to content

Commit e0d0dc9

Browse files
author
Paolo Tranquilli
committed
Rust: tweak qltest logs
* verbosity is raised to DEBUG to have more information in the logs * color codes are now skipped in the `qltest.log` file * they are still printed out on the console when running with `--show-extractor-output`.
1 parent 0d1865d commit e0d0dc9

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

rust/tools/qltest.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
#!/bin/bash
22

33
set -eu
4+
set -o pipefail
45

56
export RUST_BACKTRACE=full
67
QLTEST_LOG="$CODEQL_EXTRACTOR_RUST_LOG_DIR"/qltest.log
7-
if ! "$CODEQL_EXTRACTOR_RUST_ROOT/tools/$CODEQL_PLATFORM/extractor" --qltest >> "$QLTEST_LOG" 2>&1; then
8-
cat "$QLTEST_LOG"
8+
TMP_OUT="$(mktemp)"
9+
trap 'rm -f "$TMP_OUT"' EXIT
10+
# put full-color output on the side, but remove the color codes from the log file
11+
# also, print (colored) output only in case of failure
12+
if ! "$CODEQL_EXTRACTOR_RUST_ROOT/tools/$CODEQL_PLATFORM/extractor" \
13+
--qltest \
14+
--logging-verbosity=progress+ \
15+
2>&1 \
16+
| tee "$TMP_OUT" \
17+
| sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' \
18+
> "$QLTEST_LOG"; then
19+
cat "$TMP_OUT"
920
exit 1
1021
fi

0 commit comments

Comments
 (0)