mirror of
https://github.com/m1ngsama/TNT.git
synced 2025-12-24 10:51:41 +00:00
Added build targets: - make asan - AddressSanitizer for memory bugs - make debug - Debug symbols - make valgrind - Valgrind helper - make check - Static analysis (cppcheck, clang-tidy) Added test scripts: - test_basic.sh - Basic functionality tests * Server startup * SSH connection * Message logging - test_stress.sh - Load testing * Configurable client count * Configurable duration * Automatic cleanup Updated .gitignore: - test.log - *.dSYM/ Philosophy: Simple, minimal, Unix-style tools. No dependencies on complex test frameworks.
38 lines
826 B
Bash
Executable file
38 lines
826 B
Bash
Executable file
#!/bin/sh
|
|
# Stress test for TNT server
|
|
# Usage: ./test_stress.sh [num_clients]
|
|
|
|
PORT=${PORT:-2222}
|
|
CLIENTS=${1:-10}
|
|
DURATION=${2:-30}
|
|
|
|
echo "Starting TNT server on port $PORT..."
|
|
./tnt -p $PORT &
|
|
SERVER_PID=$!
|
|
sleep 2
|
|
|
|
if ! kill -0 $SERVER_PID 2>/dev/null; then
|
|
echo "Server failed to start"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Spawning $CLIENTS clients for ${DURATION}s..."
|
|
|
|
for i in $(seq 1 $CLIENTS); do
|
|
(
|
|
sleep $((i % 5))
|
|
echo "test user $i" | timeout $DURATION ssh -o StrictHostKeyChecking=no \
|
|
-o UserKnownHostsFile=/dev/null -p $PORT localhost \
|
|
>/dev/null 2>&1
|
|
) &
|
|
done
|
|
|
|
echo "Running stress test..."
|
|
sleep $DURATION
|
|
|
|
echo "Cleaning up..."
|
|
kill $SERVER_PID 2>/dev/null
|
|
wait
|
|
|
|
echo "Stress test complete"
|
|
ps aux | grep tnt | grep -v grep && echo "WARNING: tnt process still running"
|