lean4-htt/tests/pkg/test_extern/test.sh
Mac Malone 34385b8ee8
feat: lake: use absolute paths (#7822)
This PR changes Lake to use normalized absolute paths for its various
files and directories.

This is done by storing absolute paths for the workspace directory,
package directories, and configuration files. These are then joined to
relative paths (e.g., for source directories) using a custom join
function that eliminates `.` paths.

Closes #7498. Closes #4042.
2025-04-05 13:38:35 +00:00

33 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env 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
# 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