Files
lean4/tests/pkg/signal/run_test.sh
Garmelon 49715fe63c chore: improve how test suite interacts with stages (#12913)
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.
2026-03-16 15:20:03 +00:00

44 lines
1.0 KiB
Bash

rm -rf .lake/build
lake build release
# Create a named pipe for communication
PIPE="$TMP_DIR/pipe"
mkfifo "$PIPE"
# Run release in the background, redirect stdout to the pipe
.lake/build/bin/release > "$PIPE" &
PID=$!
echo "Started process with PID: $PID"
# Read the first line from the pipe
{
if read -r first_line < "$PIPE"; then
echo "Received first line: $first_line"
sleep 1
echo "Sending USR1 signal..."
kill -USR1 "$PID" 2>/dev/null || echo "Failed to send USR1"
echo "Sending HUP signal..."
kill -HUP "$PID" 2>/dev/null || echo "Failed to send HUP"
echo "Sending QUIT signal..."
kill -QUIT "$PID" 2>/dev/null || echo "Failed to send QUIT"
echo "Sending INT signal..."
kill -INT "$PID" 2>/dev/null || echo "Failed to send INT"
else
echo "Failed to read first line"
fi
}
# Wait for process to finish
echo "Waiting for process $PID to finish..."
if wait "$PID"; then
echo "Process completed successfully"
else
echo "Process exited with code $?"
fi