Skip to content

Commit

Permalink
Server side integration tests work on my machine now
Browse files Browse the repository at this point in the history
  • Loading branch information
ChillerDragon committed Jan 22, 2024
1 parent f0ac6a2 commit 936c4d2
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions integration_test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tmpdir=tmp
kill_marker=kill_me_d5af0410
server_port=8377
srvcfg="sv_rcon_password rcon;sv_port $server_port;$kill_marker"
cl_fifo="$tmpdir/client.fifo"
cl_fifo="$PWD/$tmpdir/client.fifo"
clcfg="cl_input_fifo $cl_fifo;connect 127.0.0.1:$server_port;$kill_marker"
tw_srv_running=0
ruby_logfile=ruby_client.txt
Expand Down Expand Up @@ -191,11 +191,17 @@ then
connect_ddnet7_client "$kill_marker" &>> "$logdir/client.txt" &
_kill_pids+=($!)
sleep 1
echo "connect 127.0.0.1" > "$cl_fifo"
fi
timeout 6 "$kill_marker" &
_timeout_pid=$!

function fifo() {
local cmd="$1"
local fifo_file="$2"
echo "[*] $cmd >> $fifo_file"
echo "$cmd" >> "$fifo_file"
}

if [ "$testname" == "client/chat.rb" ]
then
if ! grep -q 'hello world' "$logdir/server.txt"
Expand Down Expand Up @@ -253,16 +259,28 @@ then
fi
elif [ "$testname" == "server/connect.rb" ]
then
echo "rcon_auth test" >> "$cl_fifo"
fifo "rcon_auth test" "$cl_fifo"
sleep 1
fifo "rcon shutdown" "$cl_fifo"
sleep 1
echo "shutdown" >> "$cl_fifo"
fifo "quit" "$cl_fifo"
else
echo "Error: unkown test '$testname'"
exit 1
fi

echo "[*] waiting for jobs to finish ..."
wait
while true
do
running_jobs="$(jobs | grep -v timeout)"
if [ "$running_jobs" == "" ]
then
break
fi
echo "[*] waiting for:"
echo "$running_jobs"
sleep 1
done

if [ -f "$tmpdir/timeout.txt" ]
then
Expand Down

0 comments on commit 936c4d2

Please sign in to comment.