2022-12-21 11:48:58 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
prog_NAME=$(basename "${0}")
|
|
|
|
|
|
|
|
warn()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: WARN: $*"
|
|
|
|
}
|
|
|
|
|
|
|
|
info()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: INFO: $*"
|
|
|
|
}
|
|
|
|
|
|
|
|
err()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: ERROR: $*" 1>&2
|
|
|
|
}
|
|
|
|
|
|
|
|
die()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: ERROR: $*" 1>&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
PERFSCRIPT_DIR="$1"
|
|
|
|
PERFDATA_DIR="$2"
|
|
|
|
BIN="$3"
|
|
|
|
SERVER="$4"
|
|
|
|
SERVER_DIR="$5"
|
|
|
|
|
|
|
|
SERVER_W_DIR="$SERVER:$SERVER_DIR"
|
|
|
|
SSH="ssh $SERVER"
|
|
|
|
|
|
|
|
scp "$BIN" "$SERVER_W_DIR"
|
2023-01-10 15:49:44 +00:00
|
|
|
scp -r "$PERFSCRIPT_DIR"/* "$SERVER_W_DIR"
|
2022-12-21 11:48:58 +00:00
|
|
|
|
2023-01-11 17:48:34 +00:00
|
|
|
#> goto problem: backgrounding a task make it not fail this script :/
|
2022-12-21 11:48:58 +00:00
|
|
|
info initializing context for unikernel
|
2023-01-11 17:48:34 +00:00
|
|
|
$SSH "cd $SERVER_DIR; ./init.sh" &
|
2023-01-10 15:49:44 +00:00
|
|
|
INIT_PID=$!
|
2022-12-21 11:48:58 +00:00
|
|
|
|
|
|
|
info running unikernel in background
|
2023-01-11 17:48:34 +00:00
|
|
|
$SSH "cd $SERVER_DIR; ./run-unikernel.sh" &
|
2022-12-21 11:48:58 +00:00
|
|
|
UNIKERNEL_PID=$!
|
|
|
|
|
|
|
|
info sleeping a bit before test
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
info running test
|
2023-01-11 17:48:34 +00:00
|
|
|
$SSH "cd $SERVER_DIR; ./run-test.sh"
|
2022-12-21 11:48:58 +00:00
|
|
|
|
|
|
|
info killing unikernel
|
2023-01-11 17:48:34 +00:00
|
|
|
$SSH "cd $SERVER_DIR; kill "'$(cat run-unikernel.sh.PID)' || echo "couldn't kill: unikernel not running"
|
|
|
|
#kill "$UNIKERNEL_PID"
|
2022-12-21 11:48:58 +00:00
|
|
|
|
2023-01-10 15:49:44 +00:00
|
|
|
info killing init-daemon
|
2023-01-11 17:48:34 +00:00
|
|
|
$SSH "cd $SERVER_DIR; kill "'$(cat init.sh.PID)' || echo "couldn't kill: git daemon not running"
|
|
|
|
#kill "$INIT_PID"
|
2023-01-10 15:49:44 +00:00
|
|
|
|
2022-12-21 11:48:58 +00:00
|
|
|
info copying results to "$PERFDATA_DIR"
|
2023-01-11 17:48:34 +00:00
|
|
|
if [ ! -e "$PERFDATA_DIR" ]; then
|
|
|
|
mkdir -p "$PERFDATA_DIR"
|
|
|
|
fi
|
|
|
|
scp "${SERVER_W_DIR}/output/*" "$PERFDATA_DIR"/
|
2022-12-21 11:48:58 +00:00
|
|
|
|
|
|
|
info running cleanup
|
2023-01-11 17:48:34 +00:00
|
|
|
$SSH "cd $SERVER_DIR; ./cleanup.sh"
|
2022-12-21 11:48:58 +00:00
|
|
|
|
|
|
|
info done
|
|
|
|
|
|
|
|
|