Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made changes to run tests in custom paths #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,25 @@
dir=`dirname $0`;

usage () {
echo "Usage: $0 -r <run-tag> [-t <comma-separated-tests> -o <output-dir>]"
echo "Usage: $0 -r <run-tag> [-t <comma-separated-tests> -c <config-dir> -o <output-dir>]"
echo "Example: $0 -r \"kbench-run-on-XYZ-cluster\" -t \"cp_heavy16,dp_netperf_internode,dp_fio\" -o \"./\""
echo "";
echo "Valid test names:"
echo "";
echo "all|all_control_plane|all_data_plane|$tests" | sed 's/|/ || /g'
}

tests=`ls -b $dir/config/ | tr '\n' '|'`
configdir="${dir}/config/";
tag="run";
outdir="$dir";

if [ $# -eq 0 ]
then
usage
echo "Since no tests specified, I am running the default workload: config/default";
tests="default"
fi

while getopts "r:t:o:h" ARGOPTS ; do
while getopts "r:t:c:o:h" ARGOPTS ; do
case ${ARGOPTS} in
t) tests=$OPTARG
;;
c) configdir=$OPTARG
;;
r) tag=$OPTARG
;;
o) outdir=$OPTARG
Expand All @@ -36,37 +32,49 @@ while getopts "r:t:o:h" ARGOPTS ; do
esac
done


if [ $# -eq 0 ]
then
usage
echo "Since no tests specified, I am running the default workload: config/default";
tests="default"
fi

if [ -z "${tests}" ]; then
tests=`ls -b $configdir | tr '\n' ','`
fi

folder=`date '+%d-%b-%Y-%I-%M-%S-%P'`
folder="$outdir/results_${tag}_$folder"
mkdir $folder

if grep -q "all_data_plane" <<< $tests; then
dptests=`ls -b $dir/config/ | grep "dp_" | tr '\n' ','`
dptests=`ls -b $configdir | grep "dp_" | tr '\n' ','`
tests=`echo $tests | sed "s/all_data_plane/$dptests/g"`
fi

if grep -q "all_control_plane" <<< $tests; then
cptests=`ls -b $dir/config/ | grep "cp_" | tr '\n' ','`
cptests=`ls -b $configdir | grep "cp_" | tr '\n' ','`
cptests="default,$cptests"
tests=`echo $tests | sed "s/all_control_plane/$cptests/g"`
fi

if grep -q "all" <<< $tests; then
alltests=`ls -b $dir/config/ | tr '\n' ','`
alltests=`ls -b $configdir | tr '\n' ','`
tests=`echo $tests | sed "s/all/$alltests/g"`
fi

tests=`echo $tests | sed "s/,/ /g"`

for test in $tests; do
mkdir $folder/$test;
cp $dir/config/$test/config.json $folder/$test/;
cp $dir/config/$test/*.yaml $folder/$test/ > /dev/null 2>&1;
cp $dir/config/$test/*.sh $folder/$test/ > /dev/null 2>&1;
echo "Running test $test and results redirected to \"$folder/$test\"";
cp $configdir/$test/config.json $folder/$test/;
cp $configdir/$test/*.yaml $folder/$test/ > /dev/null 2>&1;
cp $configdir/$test/*.sh $folder/$test/ > /dev/null 2>&1;
echo "Running test $test found in $configdir and results redirected to \"$folder/$test\"";
if [ "$test" == "dp_fio" ]; then
kubectl apply -f ./config/dp_fio/fio_pvc.yaml
kubectl apply -f ${configdir}/dp_fio/fio_pvc.yaml
fi
kbench -benchconfig="$dir/config/$test/config.json" -outdir="$folder/$test";
kbench -benchconfig="$configdir/$test/config.json" -outdir="$folder/$test";
$dir/cleanup.sh > /dev/null 2>&1;
done