-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexecute_via_pbench
executable file
·201 lines (188 loc) · 4.95 KB
/
execute_via_pbench
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#!/bin/bash
#
#
# Copyright (C) 2022 David Valin [email protected]
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
source ~/.bashrc
chars=`echo $0 | awk -v RS='/' 'END{print NR-1}'`
TOOLS_BIN=`echo $0 | cut -d'/' -f 1-${chars}`
top_dir=`echo $TOOLS_BIN | rev | cut -d'/' -f2- | rev`
cmd_executing=""
configuration=""
puser=""
run_label=""
spacing=0
sys_type=""
test_name=""
times_to_run=1
pbench_stats="default"
#
# Usage information.
#
usage()
{
echo "$1 usage:"
echo " --sysname: name of the system running, used in determing config files"
echo "tools_git: Pointer to the test_tools git. Default is ${tools_git}. Top directory is always test_tools"
echo " --tuned_setting: used in naming the tar file"
echo " --usage: this usage message"
echo " --pbench: use pbench-user-benchmark and place information into pbench"
echo " --pbench_user: user who started everything."
echo " --pbench_stats: stats to execute with, default is all"
echo "Unused options, present as Zathras passes them in."
echo " --host_config"
echo " --home_parent"
echo " --iterations"
echo " --run_label: the label to associate with the pbench run"
echo " --run_user"
echo " --sys_type"
exit 0
}
#
# Now handle the command options
#
i=1
j=$#
separ=""
cmd_options=""
while [ $i -le $j ]
do
case "$1" in
--cmd_executing)
cmd_executing=${2}
i=$((i + 2))
shift 2
;;
--host_config)
configuration=${2}
cmd_options="${cmd_options}${separ}${1} ${2}"
separ=" "
i=$((i + 2))
shift 2
;;
--iterations)
cmd_options="${cmd_options}${separ}--iterations 1"
separ=" "
times_to_run=${2}
i=$((i + 2))
shift 2
;;
--pbench)
i=$((i + 1))
shift 1
;;
--pbench_stats)
pbench_stats=$2
i=$((i + 2))
shift 2
;;
--pbench_user)
puser=$2
i=$((i + 2))
shift 2
;;
--run_label)
i=$((i + 2))
run_label=$2
shift 2
;;
--spacing)
spacing=${2}
shift 2
;;
--sys_type)
cmd_options="${cmd_options}${separ}${1} ${2}"
separ=" "
sys_type=${2}
shift 2
;;
--test)
test_name=${2}
shift 2
;;
--tuned_setting)
# cmd_options="${cmd_options}${separ}${1} ${2}"
tuned_setting=${2}
shift 2
;;
--)
break;
;;
*)
cmd_options="${cmd_options}${separ}${1}"
separ=" "
shift 1
i=$((i + 1))
if [[ $1 != *"--"* ]]; then
i=$((i + 1))
cmd_options="${cmd_options}${separ}${1}"
shift 1
fi
;;
esac
done
if [[ $pbench_stats != "default" ]]; then
pushd /var/lib/pbench-agent > /dev/null
rm -rf tools-v1-zathras
cp -R tools-v1-default tools-v1-zathras
cd tools-v1-zathras
dir=`ls -d *ip*`
cd $dir
mkdir ../back
mv * ../back
tools=`echo $pbench_stats | sed "s/,/ /g"`
for i in $tools; do
cp ../back/$i .
done
rm -rf ../back
popd > /dev/null
pbench_stats="zathras"
fi
echo $times_to_run > ./iteration.lis
#
# Assign the pbench args to a varaible, no duplication that way.
#
pbench_args="-C ${puser}_${test_name}_test__${configuration} --iteration-list=./iteration.lis --tool-group=${pbench_stats} -- ${cmd_executing} ${cmd_options}"
pbench-user-benchmark $pbench_args
if [ $? -ne 0 ]; then
echo pbench-user-benchmark $pbench_args
exit 1
fi
if [[ -d $top_dir/export_results ]]; then
copy_from=$top_dir/export_results
else
copy_from=/tmp
fi
dir=`ls -rtd /var/lib/pbench-agent/pben*${test_name}* | tail -1`
pushd $dir > /dev/null
tar_file=`ls -rt $copy_from/results*${test_name}*tar | tail -1`
csv_file=`tar xvf $tar_file | grep csv`
pbench_dir=`ls -rdt /var/lib/pbench-agent/pbench-user-benchmark_* | tail -1`
for csv in $csv_file; do
new_file=`echo $csv | sed "s/csv//g"`
echo ${TOOLS_BIN}/convert_csv_to_txt --field_seper : --field_size ${spacing} --results_in $csv --results_out ${new_file}txt
${TOOLS_BIN}/convert_csv_to_txt --field_seper : --field_size ${spacing} --results_in $csv --results_out ${new_file}txt
cp $csv_file ${new_file}txt $pbench_dir
done
pushd $pbench_dir 2> /dev/null
tar xf $tar_file --strip=1
popd 2> /dev/null
value=`$TOOLS_BIN/set_pbench_variables --host_config $configuration --sys_type $sys_type --test ${test_name} --pbench_user $puser --run_label $run_label`
results_prefix=`echo $value | cut -d: -f 2`
hostname=`echo $value | cut -d: -f 1`
$TOOLS_BIN/pbench_copy_data --hostname "${hostname}" --user "${puser}" --prefix ${results_prefix} --copy 0
exit 0