forked from vmware-tanzu/k-bench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·72 lines (62 loc) · 1.91 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
dir=`dirname $0`;
usage () {
echo "Usage: $0 -r <run-tag> [-t <comma-separated-tests> -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' '|'`
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
case ${ARGOPTS} in
t) tests=$OPTARG
;;
r) tag=$OPTARG
;;
o) outdir=$OPTARG
;;
h) usage; exit;
;;
?) usage; exit;
;;
esac
done
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' ','`
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="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' ','`
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\"";
if [ "$test" == "dp_fio" ]; then
kubectl apply -f ./config/dp_fio/fio_pvc.yaml
fi
kbench -benchconfig="$dir/config/$test/config.json" -outdir="$folder/$test";
$dir/cleanup.sh > /dev/null 2>&1;
done