Skip to content

Commit 6da874c

Browse files
committed
Short-term fix for missing pb-m-r user/prefix args
As of PR #1289, specifically line [177](https://github.com/distributed-system-analysis/pbench/pull/1289/files?file-filters%5B%5D=No+extension#diff-d7362c40121612a2669161b65d94590aR177), any invocation of `pbench-move|copy-results` that did not use both `--user` and `--prefix` always received an unwanted "`user`", and sometimes got the wrong "`--prefix`". * If you did not use either `--user` or `--prefix`, then your "`user`" was being set to "`--prefix`" * If you used only `--user`, then your "`user`" was correct, but your "`prefix`" was being set to "`--xy-singled-threaded`" * If you used only `--prefix`, then your "`user`" was being set to "`--prefix`", and your "`prefix`" was being ignored If you used both `--user` and `--prefix` then your "`user`" and "`prefix`" were being set as expected. This PR corrects the invocation of `pbench-make-result-tb` from `pbench-move-results`, and ensures that empty arguments for `--user` and `--prefix` are properly handled.
1 parent bc187fa commit 6da874c

File tree

734 files changed

+106237
-66
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

734 files changed

+106237
-66
lines changed

agent/util-scripts/gold/pbench-copy-results/test-39.txt

Lines changed: 352 additions & 0 deletions
Large diffs are not rendered by default.

agent/util-scripts/gold/pbench-copy-results/test-40.txt

Lines changed: 352 additions & 0 deletions
Large diffs are not rendered by default.

agent/util-scripts/gold/pbench-copy-results/test-41.txt

Lines changed: 351 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
+++ Running test-37 pbench-move-results --prefix=
2+
3+
pbench-move-results: --prefix is missing its argument
4+
5+
usage:
6+
pbench-move-results [--help] [--user=<user>] [--prefix=<path>] [--xz-single-threaded] [--show-server]
7+
--- Finished test-37 pbench-move-results (status=1)
8+
+++ pbench tree state
9+
/var/tmp/pbench-test-utils/pbench
10+
/var/tmp/pbench-test-utils/pbench/tmp
11+
--- pbench tree state
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
+++ Running test-38 pbench-move-results --user=
2+
3+
pbench-move-results: --user is missing its argument
4+
5+
usage:
6+
pbench-move-results [--help] [--user=<user>] [--prefix=<path>] [--xz-single-threaded] [--show-server]
7+
--- Finished test-38 pbench-move-results (status=1)
8+
+++ pbench tree state
9+
/var/tmp/pbench-test-utils/pbench
10+
/var/tmp/pbench-test-utils/pbench/tmp
11+
--- pbench tree state

agent/util-scripts/pbench-make-result-tb

Lines changed: 53 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ function usage() {
1313
printf "${script_name} --result-dir=<pbench results dir> --target-dir=<where to put tar ball> [--help] [--user=<user>] [--prefix=<path>] [--xz-single-threaded=<0|1>]\n"
1414
}
1515

16+
function missing_arg() {
17+
printf "\n${script_name}: ${1} is missing its argument\n\n" >&2
18+
usage >&2
19+
exit 1
20+
}
21+
1622
# Process options and arguments
1723
opts=$(getopt -q -o h --longoptions "user:,prefix:,result-dir:,target-dir:,xz-single-threaded:,help" -n "getopt.sh" -- "${@}")
1824
sts=${?}
1925
if [[ ${sts} -ne 0 ]]; then
20-
printf "\n${script_name}: you specified an invalid option\n\n" >&2
26+
printf "\n${script_name}: you specified an invalid option or an unexpected argument\n\n" >&2
2127
usage >&2
2228
exit 1
2329
fi
@@ -29,50 +35,61 @@ prefix=""
2935
xz_single_threaded=0
3036
eval set -- "${opts}"
3137
while true; do
32-
case "${1}" in
38+
opt="${1}"
39+
shift
40+
case "${opt}" in
3341
--result-dir)
34-
shift;
35-
if [[ -n "${1}" ]]; then
36-
result_dir="${1}"
37-
shift;
38-
fi
39-
;;
42+
if [[ -n "${1}" ]]; then
43+
result_dir="${1}"
44+
shift
45+
else
46+
missing_arg "${opt}"
47+
fi
48+
;;
4049
--target-dir)
41-
shift;
42-
if [[ -n "${1}" ]]; then
43-
target_dir="${1}"
44-
shift;
45-
fi
46-
;;
50+
if [[ -n "${1}" ]]; then
51+
target_dir="${1}"
52+
shift
53+
else
54+
missing_arg "${opt}"
55+
fi
56+
;;
4757
--user)
48-
shift;
49-
if [[ -n "${1}" ]]; then
50-
user="${1}"
51-
shift;
52-
fi
53-
;;
54-
--prefix)
55-
shift;
56-
if [[ -n "${1}" ]]; then
57-
prefix="${1}"
58-
shift;
59-
fi
60-
;;
58+
if [[ -n "${1}" ]]; then
59+
user="${1}"
60+
shift
61+
else
62+
missing_arg "${opt}"
63+
fi
64+
;;
65+
--prefix)
66+
if [[ -n "${1}" ]]; then
67+
prefix="${1}"
68+
shift
69+
else
70+
missing_arg "${opt}"
71+
fi
72+
;;
6173
--xz-single-threaded)
62-
shift;
63-
if [[ -n "${1}" ]]; then
74+
if [[ -n "${1}" ]]; then
6475
xz_single_threaded="${1}"
65-
shift;
66-
fi
76+
shift
77+
else
78+
missing_arg "${opt}"
79+
fi
6780
;;
6881
-h|--help)
6982
usage
70-
exit 0
83+
exit 0
84+
;;
85+
--)
86+
break;
87+
;;
88+
*)
89+
printf "\n${script_name}: you specified an invalid option or an unexpected argument: \"${opt}\"\n\n" >&2
90+
usage >&2
91+
exit 1
7192
;;
72-
--)
73-
shift;
74-
break;
75-
;;
7693
esac
7794
done
7895

agent/util-scripts/pbench-move-results

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ function usage() {
1313
printf "${script_name} [--help] [--user=<user>] [--prefix=<path>] [--xz-single-threaded] [--show-server]\n"
1414
}
1515

16+
function missing_arg() {
17+
printf "\n${script_name}: ${1} is missing its argument\n\n" >&2
18+
usage >&2
19+
exit 1
20+
}
21+
1622
# Process options and arguments
1723
opts=$(getopt -q -o u:p:xSh --longoptions "user:,prefix:,xz-single-threaded,show-server,help" -n "getopt.sh" -- "${@}")
1824
if [[ ${?} -ne 0 ]]; then
19-
printf "\n${script_name}: you specified an invalid option\n\n" >&2
25+
printf "\n${script_name}: you specified an invalid option or an unexpected argument\n\n" >&2
2026
usage >&2
2127
exit 1
2228
fi
@@ -27,37 +33,42 @@ xz_single_threaded=0
2733
show_server=""
2834
eval set -- "${opts}"
2935
while true; do
30-
case "${1}" in
36+
opt="${1}"
37+
shift
38+
case "${opt}" in
3139
-u|--user)
32-
shift;
33-
if [[ -n "${1}" ]]; then
34-
user="${1}"
35-
shift;
36-
fi
37-
;;
38-
-p|--prefix)
39-
shift;
40-
if [[ -n "${1}" ]]; then
41-
prefix="${1}"
42-
shift;
43-
fi
44-
;;
40+
if [[ -n "${1}" ]]; then
41+
user="${1}"
42+
shift;
43+
else
44+
missing_arg "${opt}"
45+
fi
46+
;;
47+
-p|--prefix)
48+
if [[ -n "${1}" ]]; then
49+
prefix="${1}"
50+
shift;
51+
else
52+
missing_arg "${opt}"
53+
fi
54+
;;
4555
-x|--xz-single-threaded)
46-
shift;
4756
xz_single_threaded=1
4857
;;
4958
-S|--show-server)
50-
shift;
51-
show_server=1
59+
show_server="show"
5260
;;
5361
-h|--help)
5462
usage
5563
exit 0
5664
;;
57-
--)
58-
shift;
59-
break;
60-
;;
65+
--)
66+
break;
67+
;;
68+
*)
69+
printf "\n${script_name}: you specified an invalid option or an unexpected argument\n\n" >&2
70+
usage >&2
71+
exit 1
6172
esac
6273
done
6374

@@ -174,7 +185,17 @@ for dir in `/bin/ls -ort -d */ | awk '{print $8}' | grep -v "^tools-" | grep -v
174185
# contain the tarball and the md5 file (as ${tb}.tar.xz.md5.check); pass
175186
# that information on to pbench-make-result-tb.
176187
result_dir=$(basename ${dir})
177-
result_tb_name=$(pbench-make-result-tb --result-dir ${result_dir} --target-dir ${tmp}/${controller} --user ${user} --prefix ${prefix} --xz-single-threaded ${xz_single_threaded})
188+
if [[ -n "${user}" ]]; then
189+
user_arg="--user ${user}"
190+
else
191+
user_arg=""
192+
fi
193+
if [[ -n "${prefix}" ]]; then
194+
prefix_arg="--prefix ${prefix}"
195+
else
196+
prefix_arg=""
197+
fi
198+
result_tb_name=$(pbench-make-result-tb --result-dir "${result_dir}" --target-dir "${tmp}/${controller}" ${user_arg} ${prefix_arg} --xz-single-threaded "${xz_single_threaded}")
178199
if [[ ${?} -ne 0 ]]; then
179200
# Messaging already handled by pbench-make-result-tb
180201
continue
@@ -191,18 +212,18 @@ for dir in `/bin/ls -ort -d */ | awk '{print $8}' | grep -v "^tools-" | grep -v
191212
exit 1
192213
fi
193214
if [[ ${sts} -ne 0 ]]; then
194-
let failures=failures+1
195-
continue
215+
let failures=failures+1
216+
continue
196217
fi
197218

198219
if [[ "$script_name" == "pbench-move-results" ]]; then
199-
rm -r ${result_dir}
220+
rm -r ${result_dir}
200221
if [[ ${?} -ne 0 ]]; then
201222
error_log "UNEXPECTED ERROR: rm failed to remove the ${result_dir} directory hierarchy"
202223
exit 1
203224
fi
204225
else
205-
touch ${result_dir}.copied
226+
touch ${result_dir}.copied
206227
if [[ ${?} -ne 0 ]]; then
207228
error_log "UNEXPECTED ERROR: touch failed to ${result_dir}.copied"
208229
exit 1
@@ -216,9 +237,9 @@ popd >/dev/null
216237
let anything=runs_copied+failures
217238
if [[ $anything -gt 0 ]]; then
218239
if [[ "$script_name" == "pbench-move-results" ]]; then
219-
op="moved"
240+
op="moved"
220241
else
221-
op="copied"
242+
op="copied"
222243
fi
223244
debug_log "successfully $op $runs_copied runs, encountered $failures failures"
224245
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo

agent/util-scripts/samples/pbench-copy-results/test-39/pbench/pbench-user-benchmark_ndk-test-1_2019.09.27T14.21.31/1/reference-result/result.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
timestamp_ms,fedora-home-read,fedora-home-write,fedora-root-read,fedora-root-write,fedora-swap-read,fedora-swap-write,luks-5f8fb120-e038-4959-bc17-ea3216650f9c-read,luks-5f8fb120-e038-4959-bc17-ea3216650f9c-write,sda-read,sda-write
2+
1527045696000,0.00,0.00,164.33,0.00,0.00,0.00,164.33,0.00,164.33,0.00
3+
1527045699000,0.00,0.00,1.67,0.00,0.00,0.00,1.67,0.00,1.67,0.00
4+
1527045702000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
5+
1527045705000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
6+
1527045708000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
7+
1527045711000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
8+
1527045714000,0.33,49.33,0.33,7.00,0.00,0.00,0.67,56.33,0.67,45.33
9+
1527045717000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
10+
1527045720000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
11+
1527045723000,0.00,5.00,0.00,0.00,0.00,0.00,0.00,5.00,0.00,5.00
12+
1527045726000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
13+
1527045729000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
14+
1527045732000,0.00,1.33,0.00,0.33,0.00,0.00,0.00,1.67,0.00,1.67
15+
1527045735000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
16+
1527045738000,0.00,1.00,0.00,0.00,0.00,0.00,0.00,1.00,0.00,1.00
17+
1527045741000,0.00,7.33,0.00,0.00,0.00,0.00,0.00,7.33,0.00,7.33
18+
1527045744000,0.00,2.00,0.00,0.00,0.00,0.00,0.00,2.00,0.00,2.00
19+
1527045747000,0.00,0.67,0.00,0.00,0.00,0.00,0.00,0.67,0.00,0.67
20+
1527045750000,0.00,0.33,0.00,0.00,0.00,0.00,0.00,0.33,0.00,0.33
21+
1527045753000,0.00,0.00,4.00,0.00,0.00,0.00,4.00,0.00,4.00,0.00

0 commit comments

Comments
 (0)