From 3aea44f661ad4f17590cadb44452a1e8ccdd69ae Mon Sep 17 00:00:00 2001 From: rand00 Date: Wed, 21 Dec 2022 12:48:58 +0100 Subject: [PATCH] packaging/perftest/unipi/run-test-on-vm.sh: A script to manage and run the test on VM --- packaging/perftest/unipi/run-test-on-vm.sh | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 packaging/perftest/unipi/run-test-on-vm.sh diff --git a/packaging/perftest/unipi/run-test-on-vm.sh b/packaging/perftest/unipi/run-test-on-vm.sh new file mode 100755 index 0000000..e01d019 --- /dev/null +++ b/packaging/perftest/unipi/run-test-on-vm.sh @@ -0,0 +1,67 @@ +#! /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" +scp "$PERFSCRIPT_DIR"/init.sh "$SERVER_W_DIR" +scp "$PERFSCRIPT_DIR"/run-unikernel.sh "$SERVER_W_DIR" +scp "$PERFSCRIPT_DIR"/run-test.sh "$SERVER_W_DIR" +scp "$PERFSCRIPT_DIR"/cleanup.sh "$SERVER_W_DIR" + +info initializing context for unikernel +"$SSH" ./init.sh + +info running unikernel in background +"$SSH" ./run-unikernel.sh & +UNIKERNEL_PID=$! + +info sleeping a bit before test +sleep 5 + +info running test +"$SSH" ./run-test.sh + +info killing unikernel +kill "$UNIKERNEL_PID" + +info copying results to "$PERFDATA_DIR" +scp "${SERVER_W_DIR}/results/*" "$PERFDATA_DIR" + +info running cleanup +"$SSH" ./cleanup.sh + +info done + +