Speed up ctrlc test by using shorter sleep (1s instead of 5s)

This commit is contained in:
2026-08-06 21:20:46 +00:00
parent 64d8e5bb49
commit 3bc2b61b5a
+7 -7
View File
@@ -2,10 +2,10 @@
# test_ctrlc_after_tool.sh - Test ctrlc (SIGINT) handling between tool calls
# Create mock responses: two tool calls followed by a final response
# First tool sleeps 5 seconds, second tool is instant
# We send SIGINT during the first tool's execution (at 3s)
# The new ctrlc check after tool execution should catch it at 5s
tool_call run_dangerous_shell '{"command":"sleep 5","timeout_seconds":10}' >> mock_ctrlc_between_tools.txt
# First tool sleeps 1 second, second tool is instant
# We send SIGINT during the first tool's execution (at 0.5s)
# The new ctrlc check after tool execution should catch it at 1s
tool_call run_dangerous_shell '{"command":"sleep 1","timeout_seconds":5}' >> mock_ctrlc_between_tools.txt
tool_call run_dangerous_shell '{"command":"echo second_tool","timeout_seconds":5}' >> mock_ctrlc_between_tools.txt
be_done 'Final response' >> mock_ctrlc_between_tools.txt
@@ -13,11 +13,11 @@ be_done 'Final response' >> mock_ctrlc_between_tools.txt
"${DRHARNESS}" -F chat_ctrlc.json -n -m "Test ctrlc between tools" -t run_dangerous_shell -d < "mock_ctrlc_between_tools.txt" > /dev/null 2>&1 &
DRHARNESS_PID=$!
# Send SIGINT at 3s - during first tool's sleep
sleep 3
# Send SIGINT at 0.5s - during first tool's sleep
sleep 0.5
kill -SIGINT $DRHARNESS_PID 2>/dev/null || true
# Wait for drharness to complete (first tool finishes at 5s, then ctrlc check catches it)
# Wait for drharness to complete (first tool finishes at 1s, then ctrlc check catches it)
wait $DRHARNESS_PID 2>/dev/null || true
# Verify the chat file exists and has the conversation state preserved