Files
codeql/rust/tools/qltest.sh
Paolo Tranquilli aeae922ef3 Rust: make ql tests extract files together
For the moment this removes the possibility to set custom flags or env
variables for the extractor via comments, but that can be added back
easily if needed with a different mechanism (like an `env` file).
2024-09-12 09:13:35 +02:00

27 lines
525 B
Bash
Executable File

#!/bin/bash
mkdir -p "$CODEQL_EXTRACTOR_RUST_TRAP_DIR"
export RUST_BACKTRACE=full
QLTEST_LOG="$CODEQL_EXTRACTOR_RUST_LOG_DIR"/qltest.log
EXTRACTOR="$CODEQL_EXTRACTOR_RUST_ROOT/tools/$CODEQL_PLATFORM/extractor"
echo > lib.rs
for src in *.rs; do
echo "mod ${src%.rs};" >> lib.rs
done
cat > Cargo.toml << EOF
[workspace]
[package]
name = "test"
version="0.0.1"
[lib]
path="lib.rs"
EOF
"$EXTRACTOR" *.rs >> "$QLTEST_LOG"
if [[ "$?" != 0 ]]; then
cat "$QLTEST_LOG" # Show compiler errors on extraction failure
exit 1
fi