1
1
#! /bin/bash
2
2
3
+ python_pkg=" python36"
3
4
#
4
5
# To make sure.
5
6
#
6
- alternatives --set python /usr/bin/python3
7
+ exit_out ()
8
+ {
9
+ echo $1
10
+ exit $2
11
+ }
12
+
7
13
usage ()
8
14
{
9
15
echo " $1 Usage:"
10
16
source test_tools/general_setup --usage
11
- exit 0
17
+ exit 1
12
18
}
13
19
14
20
install_tools ()
@@ -45,8 +51,7 @@ install_tools()
45
51
if [ ! -d " test_tools" ]; then
46
52
git clone $tools_git test_tools
47
53
if [ $? -ne 0 ]; then
48
- echo pulling git $tools_git failed.
49
- exit
54
+ exit_out " pulling git $tools_git failed." 1
50
55
fi
51
56
fi
52
57
@@ -97,6 +102,22 @@ generate_csv_file()
97
102
printf " %s:%12.2f:%s\n" $test_name $results $unit >> ${1} .csv
98
103
}
99
104
105
+ dnf_install ()
106
+ {
107
+ dnf install -y $1
108
+ if [ $? -ne 0 ]; then
109
+ exit_out " dnf install of $1 failed" 1
110
+ fi
111
+ }
112
+
113
+ pip3_install ()
114
+ {
115
+ pip3 install $1
116
+ if [ $? -ne 0 ]; then
117
+ exit_out " pip3 install of $1 failed." 1
118
+ fi
119
+ }
120
+
100
121
#
101
122
# Variables set by general setup.
102
123
#
@@ -137,9 +158,15 @@ if [ ! -f "/tmp/pyperf.out" ]; then
137
158
command=" ${0} $@ "
138
159
echo $command
139
160
$command & > /tmp/pyperf.out
140
- cat /tmp/pyperf.out
141
- rm /tmp/pyperf.out
142
- exit
161
+ rtc=$?
162
+ if [ -f /tmp/pyperf.out ]; then
163
+ echo =================================
164
+ echo Output from the test.
165
+ echo =================================
166
+ cat /tmp/pyperf.out
167
+ rm /tmp/pyperf.out
168
+ fi
169
+ exit $rtc
143
170
fi
144
171
145
172
@@ -151,18 +178,26 @@ if [ -d "workloads" ]; then
151
178
#
152
179
start_dir=` pwd`
153
180
cd workloads
154
- ln -s $start_dir /* .
181
+ for file in ` ls ${start_dir} ` ; do
182
+ if [[ ! -f $file ]] && [[ ! -d $file ]]; then
183
+ ln -s $start_dir /* .
184
+ fi
185
+ done
155
186
fi
156
187
157
188
source test_tools/general_setup " $@ "
158
189
190
+ ARGUMENT_LIST=(
191
+ " python_pkg"
192
+ )
193
+
159
194
NO_ARGUMENTS=(
160
- " powers_2"
161
195
" usage"
162
196
)
163
197
164
198
# read arguments
165
199
opts=$( getopt \
200
+ --longoptions " $( printf " %s:," " ${ARGUMENT_LIST[@]} " ) " \
166
201
--longoptions " $( printf " %s," " ${NO_ARGUMENTS[@]} " ) " \
167
202
--name " $( basename " $0 " ) " \
168
203
--options " h" \
@@ -173,6 +208,10 @@ eval set --$opts
173
208
174
209
while [[ $# -gt 0 ]]; do
175
210
case " $1 " in
211
+ --python_pkg)
212
+ python_pkg=$2
213
+ shift 2
214
+ ;;
176
215
--usage)
177
216
usage $0
178
217
;;
@@ -189,19 +228,29 @@ while [[ $# -gt 0 ]]; do
189
228
esac
190
229
done
191
230
192
-
193
231
if [ $to_pbench -eq 0 ]; then
194
232
rm -rf pyperformance
195
233
git clone https://github.com/python/pyperformance
234
+ if [ $? -ne 0 ]; then
235
+ exit_out " Cloning of https://github.com/python/pyperformance failed." 1
236
+ fi
196
237
cd pyperformance
197
238
git checkout tags/1.0.4
198
- dnf install -y python36 python36-devel
199
- dnf install -y python38 python38-devel
200
- pip3 install psutil
201
- pip3 install packaging
202
- pip3 install pyparsing
203
- pip3 install pyperf
204
- pip3 install toml
239
+ if [ $? -ne 0 ]; then
240
+ exit_out " Checkout of 1.0.4 failed." 1
241
+ fi
242
+ dnf_install " ${python_pkg} "
243
+ dnf_install " ${python_pkg} -devel"
244
+ #
245
+ # Install pip/pip3
246
+ #
247
+ wget https://bootstrap.pypa.io/get-pip.py
248
+ python3 ./get-pip.py
249
+ pip3_install psutil
250
+ pip3_install packaging
251
+ pip3_install pyparsing
252
+ pip3_install pyperf
253
+ pip3_install toml
205
254
206
255
cpus=` cat /proc/cpuinfo | grep processor | wc -l`
207
256
cous=1
@@ -211,16 +260,24 @@ if [ $to_pbench -eq 0 ]; then
211
260
pwd > /tmp/dave_debug
212
261
echo python3 -m pyperformance run --output ${pyresults} .json >> /tmp/dave_debug
213
262
python3 -m pyperformance run --output ${pyresults} .json
263
+ if [ $? -ne 0 ]; then
264
+ exit_out " Failed: python3 -m pyperformance run --output ${pyresults} .json" 1
265
+ fi
214
266
echo python3 -m pyperf dump ${pyresults} .json >> /tmp/dave_debug
215
267
python3 -m pyperf dump ${pyresults} .json > ${pyresults} .results
216
-
268
+ if [ $? -ne 0 ]; then
269
+ echo " Failed: python3 -m pyperf dump ${pyresults} .json > ${pyresults} .results" 1
270
+ fi
217
271
generate_csv_file ${pyresults}
218
272
else
219
273
source ~ /.bashrc
220
274
arguments=" ${arguments} --test_iterations ${to_times_to_run} "
221
275
cd $curdir
222
276
echo $TOOLS_BIN /execute_via_pbench --cmd_executing " $0 " $arguments --test ${test_name_run} --spacing 11 --pbench_stats $to_pstats
223
277
$TOOLS_BIN /execute_via_pbench --cmd_executing " $0 " $arguments --test ${test_name_run} --spacing 11 --pbench_stats $to_pstats
278
+ if [ $? -ne 0 ]; then
279
+ exit_out " Failed: $TOOLS_BIN /execute_via_pbench --cmd_executing " $0 " $arguments --test ${test_name_run} --spacing 11 --pbench_stats $to_pstats "
280
+ fi
224
281
fi
225
282
226
283
0 commit comments