Files
lean4/tests/pkg/signal/run_test
Garmelon 6a2a884372 chore: migrate pkg tests (#12889)
Also refactor util.sh in the process, so test scripts become easier to
write (inspired in part by lake's test suite).
2026-03-11 18:55:46 +00:00

47 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
source ../../env_test.sh
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