mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 10:24:07 +00:00
The tests need to run with certain environment variables set that only cmake really knows and that differ between stages. Cmake could just set the variables directly when running the tests and benchmarks, but that would leave no good way to manually run a single benchmark. So cmake generates some stage-specific scripts instead that set the required environment variables. Previously, those scripts were sourced directly by the individual `run_*` scripts, so the env scripts of different stages would overwrite each other. This PR changes the setup so they can instead be generated next to each other. This also simplifies the `run_*` scripts themselves a bit, and makes `tests/bench/build` less of a hack.
34 lines
1.1 KiB
Bash
34 lines
1.1 KiB
Bash
# We need a package test because we need multiple files with imports.
|
|
# Currently the other package tests all succeed,
|
|
# but here we need to check for a particular error message.
|
|
# This is just an ad-hoc text mangling script to extract the error message
|
|
# and account for some OS differences.
|
|
# Ideally there would be a more principled testing framework
|
|
# that took care of all this!
|
|
|
|
rm -rf .lake/build
|
|
|
|
# TODO Use and/or emulate the helper functions from util.sh?
|
|
|
|
# Function to process the output
|
|
verify_output() {
|
|
awk '/error: .*lean:/, /error: Lean exited/' |
|
|
# Remove system-specific path information from error
|
|
sed 's/error: .*TestExtern.lean:/error: TestExtern.lean:/g' |
|
|
sed '/error: Lean exited/d'
|
|
}
|
|
|
|
${LAKE:-lake} build 2>&1 | verify_output > produced.txt
|
|
|
|
# Compare the actual output with the expected output
|
|
if diff --strip-trailing-cr -q produced.txt expected.txt > /dev/null; then
|
|
echo "Output matches expected output."
|
|
rm produced.txt
|
|
exit 0
|
|
else
|
|
echo "Output differs from expected output:"
|
|
diff --strip-trailing-cr produced.txt expected.txt
|
|
rm produced.txt
|
|
exit 1
|
|
fi
|