Skip to content
Snippets Groups Projects
Commit bfef9ead authored by Sydney Anne Erickson's avatar Sydney Anne Erickson :chipmunk:
Browse files

Separate the running of basice2e network into its own script

parent 67d5ad6f
No related branches found
No related tags found
2 merge requests!68Master merge,!30Client Session Testing
# Client Session Tests: this script will run the "old" `client` binary to init session files and setup the environment
# for the "new" `client-release` binary to run tests on the old session files.
set -e
#set -o xtrace
# --- Define variables to use for the test & local network ---
DEBUGLEVEL=${DEBUGLEVEL-1}
CLIENTOPTS="--password hello --ndf results/ndf.json --sendDelay 100 --waitTimeout 360 --unsafe-channel-creation -v $DEBUGLEVEL"
SERVERLOGS=results/servers
GATEWAYLOGS=results/gateways
UDBOUT=results/udb-console.txt
# --- Setup a local network ---
rm -rf client*.log blob* rick*.bin ben*.bin
rm -rf results.bak results
mkdir results
mkdir -p $SERVERLOGS
mkdir -p $GATEWAYLOGS
# Start the network
source network.sh
CLIENTOPTS="--password hello --ndf results/ndf.json --sendDelay 100 --waitTimeout 360 --unsafe-channel-creation -v 1"
echo "DOWNLOADING TLS Cert..."
CMD="openssl s_client -showcerts -connect $(tr -d '[:space:]' < results/startgwserver.txt)"
echo $CMD
eval $CMD < /dev/null 2>&1 > "results/startgwcert.bin"
CMD="cat results/startgwcert.bin | openssl x509 -outform PEM"
echo $CMD
eval $CMD > "results/startgwcert.pem"
head "results/startgwcert.pem"
echo "DOWNLOADING NDF..."
CLIENTCMD="../bin/client getndf --gwhost $(tr -d '[:space:]' < results/startgwserver.txt) --cert results/startgwcert.pem"
eval $CLIENTCMD >> results/ndf.json 2>&1 &
PIDVAL=$!
echo "$CLIENTCMD -- $PIDVAL"
wait $PIDVAL
# ------------------------------------------------------------------------------
# TESTS BEGIN BELOW
# ------------------------------------------------------------------------------
# --- Pre-canned messaging to self ---
timeout 240s ../bin/client --password hello --ndf results/ndf.json --sendDelay 100 --waitTimeout 360 --unsafe-channel-creation -v 1 -l client9-master.log --sendCount 2 --receiveCount 2 -s blob9/blob9 --sendid 9 --destid 9 -m "Hi 9->9, with E2E Encryption"
......@@ -66,4 +105,4 @@ eval $CLIENTCMD || true &
PIDVAL2=$!
echo "$CLIENTCMD -- $PIDVAL"
wait $PIDVAL
wait $PIDVAL2
\ No newline at end of file
wait $PIDVAL2
echo "STARTING SERVERS..."
# Copy udbContact into place when running locally.
cp udbContact.bin results/udbContact.bin
PERMCMD="../bin/permissioning --logLevel $DEBUGLEVEL -c permissioning.yaml "
$PERMCMD > results/permissioning-console.txt 2>&1 &
PIDVAL=$!
echo "$PERMCMD -- $PIDVAL"
# Run Client Registrar
CLIENT_REG_CMD="../bin/client-registrar \
-l 2 -c client-registrar.yaml"
$CLIENT_REG_CMD > results/client-registrat-console.txt 2>&1 &
PIDVAL=$!
echo "$CLIENT_REG_CMD -- $PIDVAL"
for SERVERID in $(seq 5 -1 1)
do
IDX=$(($SERVERID - 1))
SERVERCMD="../bin/server --logLevel $DEBUGLEVEL --config server-$SERVERID.yaml"
if [ $SERVERID -eq 5 ] && [ -n "$NSYSENABLED" ]
then
SERVERCMD="nsys profile --session-new=gputest --trace=cuda -o server-$SERVERID $SERVERCMD"
fi
$SERVERCMD > $SERVERLOGS/server-$SERVERID-console.txt 2>&1 &
PIDVAL=$!
echo "$SERVERCMD -- $PIDVAL"
done
# Start gateways
for GWID in $(seq 5 -1 1)
do
IDX=$(($GWID - 1))
GATEWAYCMD="../bin/gateway --logLevel $DEBUGLEVEL --config gateway-$GWID.yaml"
$GATEWAYCMD > $GATEWAYLOGS/gateway-$GWID-console.txt 2>&1 &
PIDVAL=$!
echo "$GATEWAYCMD -- $PIDVAL"
done
jobs -p > results/serverpids
finish() {
echo "STOPPING SERVERS AND GATEWAYS..."
if [ -n "$NSYSENABLED" ]
then
nsys stop --session=gputest
fi
# NOTE: jobs -p doesn't work in a signal handler
for job in $(cat results/serverpids)
do
echo "KILLING $job"
kill $job || true
done
sleep 5
for job in $(cat results/serverpids)
do
echo "KILL -9 $job"
kill -9 $job || true
done
#tail $SERVERLOGS/*
#tail $CLIENTCLEAN/*
#diff -aruN clients.goldoutput $CLIENTCLEAN
}
trap finish EXIT
trap finish INT
# Sleeps can die in a fire on the sun, we wait for the servers to start running
# rounds
rm rid.txt || true
touch rid.txt
cnt=0
echo -n "Waiting for a round to run"
while [ ! -s rid.txt ] && [ $cnt -lt 120 ]; do
sleep 1
grep -a "RID 1 ReceiveFinishRealtime END" results/servers/server-* > rid.txt || true
cnt=$(($cnt + 1))
echo -n "."
done
# Start a user discovery bot server
echo "STARTING UDB..."
UDBCMD="../bin/udb --logLevel $DEBUGLEVEL --skipVerification --protoUserPath udbProto.json --config udb.yaml -l 1"
$UDBCMD >> $UDBOUT 2>&1 &
PIDVAL=$!
echo $PIDVAL >> results/serverpids
echo "$UDBCMD -- $PIDVAL"
rm rid.txt || true
while [ ! -s rid.txt ] && [ $cnt -lt 30 ]; do
sleep 1
grep -a "Sending Poll message" results/udb-console.txt > rid.txt || true
cnt=$(($cnt + 1))
echo -n "."
done
echo "localhost:8440" > results/startgwserver.txt
echo "DONE LETS DO STUFF"
\ No newline at end of file
......@@ -64,108 +64,7 @@ echo "NETWORK: $NETWORKENTRYPOINT"
if [ "$NETWORKENTRYPOINT" == "localhost:8440" ]
then
echo "STARTING SERVERS..."
# Copy udbContact into place when running locally.
cp udbContact.bin results/udbContact.bin
PERMCMD="../bin/permissioning --logLevel $DEBUGLEVEL -c permissioning.yaml "
$PERMCMD > results/permissioning-console.txt 2>&1 &
PIDVAL=$!
echo "$PERMCMD -- $PIDVAL"
# Run Client Registrar
CLIENT_REG_CMD="../bin/client-registrar \
-l 2 -c client-registrar.yaml"
$CLIENT_REG_CMD > results/client-registrat-console.txt 2>&1 &
PIDVAL=$!
echo "$CLIENT_REG_CMD -- $PIDVAL"
for SERVERID in $(seq 5 -1 1)
do
IDX=$(($SERVERID - 1))
SERVERCMD="../bin/server --logLevel $DEBUGLEVEL --config server-$SERVERID.yaml"
if [ $SERVERID -eq 5 ] && [ -n "$NSYSENABLED" ]
then
SERVERCMD="nsys profile --session-new=gputest --trace=cuda -o server-$SERVERID $SERVERCMD"
fi
$SERVERCMD > $SERVERLOGS/server-$SERVERID-console.txt 2>&1 &
PIDVAL=$!
echo "$SERVERCMD -- $PIDVAL"
done
# Start gateways
for GWID in $(seq 5 -1 1)
do
IDX=$(($GWID - 1))
GATEWAYCMD="../bin/gateway --logLevel $DEBUGLEVEL --config gateway-$GWID.yaml"
$GATEWAYCMD > $GATEWAYLOGS/gateway-$GWID-console.txt 2>&1 &
PIDVAL=$!
echo "$GATEWAYCMD -- $PIDVAL"
done
jobs -p > results/serverpids
finish() {
echo "STOPPING SERVERS AND GATEWAYS..."
if [ -n "$NSYSENABLED" ]
then
nsys stop --session=gputest
fi
# NOTE: jobs -p doesn't work in a signal handler
for job in $(cat results/serverpids)
do
echo "KILLING $job"
kill $job || true
done
sleep 5
for job in $(cat results/serverpids)
do
echo "KILL -9 $job"
kill -9 $job || true
done
#tail $SERVERLOGS/*
#tail $CLIENTCLEAN/*
#diff -aruN clients.goldoutput $CLIENTCLEAN
}
trap finish EXIT
trap finish INT
# Sleeps can die in a fire on the sun, we wait for the servers to start running
# rounds
rm rid.txt || true
touch rid.txt
cnt=0
echo -n "Waiting for a round to run"
while [ ! -s rid.txt ] && [ $cnt -lt 120 ]; do
sleep 1
grep -a "RID 1 ReceiveFinishRealtime END" results/servers/server-* > rid.txt || true
cnt=$(($cnt + 1))
echo -n "."
done
# Start a user discovery bot server
echo "STARTING UDB..."
UDBCMD="../bin/udb --logLevel $DEBUGLEVEL --skipVerification --protoUserPath udbProto.json --config udb.yaml -l 1"
$UDBCMD >> $UDBOUT 2>&1 &
PIDVAL=$!
echo $PIDVAL >> results/serverpids
echo "$UDBCMD -- $PIDVAL"
rm rid.txt || true
while [ ! -s rid.txt ] && [ $cnt -lt 30 ]; do
sleep 1
grep -a "Sending Poll message" results/udb-console.txt > rid.txt || true
cnt=$(($cnt + 1))
echo -n "."
done
echo "localhost:8440" > results/startgwserver.txt
echo "DONE LETS DO STUFF"
source network.sh
else
echo "Connecting to network defined at $NETWORKENTRYPOINT"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment