Files
foxhunt/scripts/test_crash_logging.sh
jgrusewski 8d89fe80ff chore: Second cleanup wave - organize root directory
- Archive: 85 agent .txt files → docs/archive/agents/legacy_txt/
- Scripts: Move 110 shell scripts → scripts/ (keep deploy.sh in root)
- Models: Move 18 .safetensors → ml/models/checkpoints/training_artifacts/
- Delete: 34 directories (~33GB freed) - target/, coverage_*, test artifacts
- Build: Clean 14 build artifacts (.rlib, .o, .pid, binaries)
- Tests: Move 14 .rs files → tests/standalone/
- SQL: Move 5 files → sql/ (keep init-db*.sql for Docker)
- Wave 153: Archive to docs/archive/historical/wave153/
- Docs: Archive 9 markdown files to wave_d/reports/ and historical/

Total impact: ~34GB freed (both waves), root directory cleaned from 583 to ~40 essential files
Directory count reduced from 65 to 31 (52% reduction)
All historical data preserved in organized archive structure
2025-10-30 01:26:02 +01:00

101 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# Test script to verify crash logging in entrypoint.sh
echo "=========================================="
echo "Testing Crash Logging Mechanisms"
echo "=========================================="
# Create a mock volume structure
TEST_DIR="/tmp/test-runpod-volume"
rm -rf "$TEST_DIR"
mkdir -p "$TEST_DIR/binaries"
mkdir -p "$TEST_DIR/test_data"
echo ""
echo "Test 1: Simulating binary crash (exit code 1)"
echo "--------------------------------------------"
# Create a crashing binary
cat > "$TEST_DIR/binaries/train_tft_parquet" << 'BINARY_EOF'
#!/bin/bash
echo "Starting training..."
echo "Loading model..."
echo "Error: CUDA out of memory!" >&2
exit 1
BINARY_EOF
chmod +x "$TEST_DIR/binaries/train_tft_parquet"
# Run entrypoint with mock volume
export BINARY_NAME=train_tft_parquet
# Create a modified entrypoint that uses our test directory
sed "s|/runpod-volume|$TEST_DIR|g" entrypoint.sh > /tmp/test_entrypoint.sh
chmod +x /tmp/test_entrypoint.sh
echo "Running entrypoint with crashing binary..."
/tmp/test_entrypoint.sh --test-arg 2>&1 | head -100
EXIT_CODE=$?
echo ""
echo "Exit code: $EXIT_CODE (expected: 1)"
if [ $EXIT_CODE -eq 1 ]; then
echo "✓ Test 1 PASSED: Crash was captured and logged"
else
echo "✗ Test 1 FAILED: Exit code mismatch"
fi
echo ""
echo "Test 2: Verifying crash log file contents"
echo "--------------------------------------------"
if [ -f "/tmp/foxhunt-crash.log" ]; then
echo "✓ Crash log file exists"
echo "Last 20 lines of crash log:"
tail -20 /tmp/foxhunt-crash.log
else
echo "✗ Crash log file not found"
fi
echo ""
echo "Test 3: Simulating successful execution"
echo "--------------------------------------------"
# Create a successful binary
cat > "$TEST_DIR/binaries/train_tft_parquet" << 'BINARY_EOF'
#!/bin/bash
echo "Starting training..."
echo "Epoch 1/10..."
echo "Training complete!"
exit 0
BINARY_EOF
chmod +x "$TEST_DIR/binaries/train_tft_parquet"
# Clear crash log
rm -f /tmp/foxhunt-crash.log
echo "Running entrypoint with successful binary..."
/tmp/test_entrypoint.sh --test-arg 2>&1 | tail -20
EXIT_CODE=$?
echo ""
echo "Exit code: $EXIT_CODE (expected: 0)"
if [ $EXIT_CODE -eq 0 ]; then
echo "✓ Test 3 PASSED: Success was logged correctly"
else
echo "✗ Test 3 FAILED: Exit code mismatch"
fi
# Cleanup
rm -rf "$TEST_DIR"
rm -f /tmp/test_entrypoint.sh
rm -f /tmp/foxhunt-crash.log
echo ""
echo "=========================================="
echo "Testing Complete"
echo "=========================================="