From 0f11a95950add8ca1f34031d19fd5a724aa4d16b Mon Sep 17 00:00:00 2001 From: Nagesh Date: Sun, 11 Apr 2021 22:02:28 +0530 Subject: [PATCH] made changes to run tests in custom paths --- run.sh | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/run.sh b/run.sh index d029ca8..ddee118 100755 --- a/run.sh +++ b/run.sh @@ -2,7 +2,7 @@ dir=`dirname $0`; usage () { - echo "Usage: $0 -r [-t -o ]" + echo "Usage: $0 -r [-t -c -o ]" echo "Example: $0 -r \"kbench-run-on-XYZ-cluster\" -t \"cp_heavy16,dp_netperf_internode,dp_fio\" -o \"./\"" echo ""; echo "Valid test names:" @@ -10,21 +10,17 @@ usage () { 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 @@ -36,23 +32,35 @@ 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 @@ -60,13 +68,13 @@ 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