Skip to content

Commit

Permalink
Short-term fix for missing pb-m-r user/prefix args
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
portante committed Sep 27, 2019
1 parent bc187fa commit 6da874c
Show file tree
Hide file tree
Showing 734 changed files with 106,237 additions and 66 deletions.
352 changes: 352 additions & 0 deletions agent/util-scripts/gold/pbench-copy-results/test-39.txt

Large diffs are not rendered by default.

352 changes: 352 additions & 0 deletions agent/util-scripts/gold/pbench-copy-results/test-40.txt

Large diffs are not rendered by default.

351 changes: 351 additions & 0 deletions agent/util-scripts/gold/pbench-copy-results/test-41.txt

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions agent/util-scripts/gold/pbench-move-results/test-37.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+++ Running test-37 pbench-move-results --prefix=

pbench-move-results: --prefix is missing its argument

usage:
pbench-move-results [--help] [--user=<user>] [--prefix=<path>] [--xz-single-threaded] [--show-server]
--- Finished test-37 pbench-move-results (status=1)
+++ pbench tree state
/var/tmp/pbench-test-utils/pbench
/var/tmp/pbench-test-utils/pbench/tmp
--- pbench tree state
11 changes: 11 additions & 0 deletions agent/util-scripts/gold/pbench-move-results/test-38.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
+++ Running test-38 pbench-move-results --user=

pbench-move-results: --user is missing its argument

usage:
pbench-move-results [--help] [--user=<user>] [--prefix=<path>] [--xz-single-threaded] [--show-server]
--- Finished test-38 pbench-move-results (status=1)
+++ pbench tree state
/var/tmp/pbench-test-utils/pbench
/var/tmp/pbench-test-utils/pbench/tmp
--- pbench tree state
89 changes: 53 additions & 36 deletions agent/util-scripts/pbench-make-result-tb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@ function usage() {
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"
}

function missing_arg() {
printf "\n${script_name}: ${1} is missing its argument\n\n" >&2
usage >&2
exit 1
}

# Process options and arguments
opts=$(getopt -q -o h --longoptions "user:,prefix:,result-dir:,target-dir:,xz-single-threaded:,help" -n "getopt.sh" -- "${@}")
sts=${?}
if [[ ${sts} -ne 0 ]]; then
printf "\n${script_name}: you specified an invalid option\n\n" >&2
printf "\n${script_name}: you specified an invalid option or an unexpected argument\n\n" >&2
usage >&2
exit 1
fi
Expand All @@ -29,50 +35,61 @@ prefix=""
xz_single_threaded=0
eval set -- "${opts}"
while true; do
case "${1}" in
opt="${1}"
shift
case "${opt}" in
--result-dir)
shift;
if [[ -n "${1}" ]]; then
result_dir="${1}"
shift;
fi
;;
if [[ -n "${1}" ]]; then
result_dir="${1}"
shift
else
missing_arg "${opt}"
fi
;;
--target-dir)
shift;
if [[ -n "${1}" ]]; then
target_dir="${1}"
shift;
fi
;;
if [[ -n "${1}" ]]; then
target_dir="${1}"
shift
else
missing_arg "${opt}"
fi
;;
--user)
shift;
if [[ -n "${1}" ]]; then
user="${1}"
shift;
fi
;;
--prefix)
shift;
if [[ -n "${1}" ]]; then
prefix="${1}"
shift;
fi
;;
if [[ -n "${1}" ]]; then
user="${1}"
shift
else
missing_arg "${opt}"
fi
;;
--prefix)
if [[ -n "${1}" ]]; then
prefix="${1}"
shift
else
missing_arg "${opt}"
fi
;;
--xz-single-threaded)
shift;
if [[ -n "${1}" ]]; then
if [[ -n "${1}" ]]; then
xz_single_threaded="${1}"
shift;
fi
shift
else
missing_arg "${opt}"
fi
;;
-h|--help)
usage
exit 0
exit 0
;;
--)
break;
;;
*)
printf "\n${script_name}: you specified an invalid option or an unexpected argument: \"${opt}\"\n\n" >&2
usage >&2
exit 1
;;
--)
shift;
break;
;;
esac
done

Expand Down
79 changes: 50 additions & 29 deletions agent/util-scripts/pbench-move-results
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ function usage() {
printf "${script_name} [--help] [--user=<user>] [--prefix=<path>] [--xz-single-threaded] [--show-server]\n"
}

function missing_arg() {
printf "\n${script_name}: ${1} is missing its argument\n\n" >&2
usage >&2
exit 1
}

# Process options and arguments
opts=$(getopt -q -o u:p:xSh --longoptions "user:,prefix:,xz-single-threaded,show-server,help" -n "getopt.sh" -- "${@}")
if [[ ${?} -ne 0 ]]; then
printf "\n${script_name}: you specified an invalid option\n\n" >&2
printf "\n${script_name}: you specified an invalid option or an unexpected argument\n\n" >&2
usage >&2
exit 1
fi
Expand All @@ -27,37 +33,42 @@ xz_single_threaded=0
show_server=""
eval set -- "${opts}"
while true; do
case "${1}" in
opt="${1}"
shift
case "${opt}" in
-u|--user)
shift;
if [[ -n "${1}" ]]; then
user="${1}"
shift;
fi
;;
-p|--prefix)
shift;
if [[ -n "${1}" ]]; then
prefix="${1}"
shift;
fi
;;
if [[ -n "${1}" ]]; then
user="${1}"
shift;
else
missing_arg "${opt}"
fi
;;
-p|--prefix)
if [[ -n "${1}" ]]; then
prefix="${1}"
shift;
else
missing_arg "${opt}"
fi
;;
-x|--xz-single-threaded)
shift;
xz_single_threaded=1
;;
-S|--show-server)
shift;
show_server=1
show_server="show"
;;
-h|--help)
usage
exit 0
;;
--)
shift;
break;
;;
--)
break;
;;
*)
printf "\n${script_name}: you specified an invalid option or an unexpected argument\n\n" >&2
usage >&2
exit 1
esac
done

Expand Down Expand Up @@ -174,7 +185,17 @@ for dir in `/bin/ls -ort -d */ | awk '{print $8}' | grep -v "^tools-" | grep -v
# contain the tarball and the md5 file (as ${tb}.tar.xz.md5.check); pass
# that information on to pbench-make-result-tb.
result_dir=$(basename ${dir})
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})
if [[ -n "${user}" ]]; then
user_arg="--user ${user}"
else
user_arg=""
fi
if [[ -n "${prefix}" ]]; then
prefix_arg="--prefix ${prefix}"
else
prefix_arg=""
fi
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}")
if [[ ${?} -ne 0 ]]; then
# Messaging already handled by pbench-make-result-tb
continue
Expand All @@ -191,18 +212,18 @@ for dir in `/bin/ls -ort -d */ | awk '{print $8}' | grep -v "^tools-" | grep -v
exit 1
fi
if [[ ${sts} -ne 0 ]]; then
let failures=failures+1
continue
let failures=failures+1
continue
fi

if [[ "$script_name" == "pbench-move-results" ]]; then
rm -r ${result_dir}
rm -r ${result_dir}
if [[ ${?} -ne 0 ]]; then
error_log "UNEXPECTED ERROR: rm failed to remove the ${result_dir} directory hierarchy"
exit 1
fi
else
touch ${result_dir}.copied
touch ${result_dir}.copied
if [[ ${?} -ne 0 ]]; then
error_log "UNEXPECTED ERROR: touch failed to ${result_dir}.copied"
exit 1
Expand All @@ -216,9 +237,9 @@ popd >/dev/null
let anything=runs_copied+failures
if [[ $anything -gt 0 ]]; then
if [[ "$script_name" == "pbench-move-results" ]]; then
op="moved"
op="moved"
else
op="copied"
op="copied"
fi
debug_log "successfully $op $runs_copied runs, encountered $failures failures"
fi
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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
1527045696000,0.00,0.00,164.33,0.00,0.00,0.00,164.33,0.00,164.33,0.00
1527045699000,0.00,0.00,1.67,0.00,0.00,0.00,1.67,0.00,1.67,0.00
1527045702000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045705000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045708000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045711000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045714000,0.33,49.33,0.33,7.00,0.00,0.00,0.67,56.33,0.67,45.33
1527045717000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045720000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045723000,0.00,5.00,0.00,0.00,0.00,0.00,0.00,5.00,0.00,5.00
1527045726000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045729000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045732000,0.00,1.33,0.00,0.33,0.00,0.00,0.00,1.67,0.00,1.67
1527045735000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045738000,0.00,1.00,0.00,0.00,0.00,0.00,0.00,1.00,0.00,1.00
1527045741000,0.00,7.33,0.00,0.00,0.00,0.00,0.00,7.33,0.00,7.33
1527045744000,0.00,2.00,0.00,0.00,0.00,0.00,0.00,2.00,0.00,2.00
1527045747000,0.00,0.67,0.00,0.00,0.00,0.00,0.00,0.67,0.00,0.67
1527045750000,0.00,0.33,0.00,0.00,0.00,0.00,0.00,0.33,0.00,0.33
1527045753000,0.00,0.00,4.00,0.00,0.00,0.00,4.00,0.00,4.00,0.00
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
timestamp_ms,fedora-home,fedora-root,fedora-swap,luks-5f8fb120-e038-4959-bc17-ea3216650f9c,sda
1527045696000,0.00,0.04,0.00,0.04,0.03
1527045699000,0.00,0.01,0.00,0.01,0.01
1527045702000,0.00,0.00,0.00,0.00,0.00
1527045705000,0.00,0.00,0.00,0.00,0.00
1527045708000,0.00,0.00,0.00,0.00,0.00
1527045711000,0.00,0.00,0.00,0.00,0.00
1527045714000,0.85,0.08,0.00,0.93,0.70
1527045717000,0.00,0.00,0.00,0.00,0.00
1527045720000,0.00,0.00,0.00,0.00,0.00
1527045723000,0.02,0.00,0.00,0.02,0.02
1527045726000,0.00,0.00,0.00,0.00,0.00
1527045729000,0.00,0.00,0.00,0.00,0.00
1527045732000,0.00,0.00,0.00,0.00,0.00
1527045735000,0.00,0.00,0.00,0.00,0.00
1527045738000,0.01,0.00,0.00,0.01,0.01
1527045741000,0.02,0.00,0.00,0.02,0.02
1527045744000,0.01,0.00,0.00,0.01,0.01
1527045747000,0.00,0.00,0.00,0.00,0.00
1527045750000,0.00,0.00,0.00,0.00,0.00
1527045753000,0.00,0.00,0.00,0.00,0.00
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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
1527045696000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045699000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045702000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045705000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045708000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045711000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045714000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,11.00
1527045717000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045720000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045723000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045726000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045729000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045732000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045735000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045738000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045741000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045744000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045747000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045750000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045753000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
timestamp_ms,fedora-home,fedora-root,fedora-swap,luks-5f8fb120-e038-4959-bc17-ea3216650f9c,sda
1527045696000,0.00,57.48,0.00,57.48,57.48
1527045699000,0.00,27.20,0.00,27.20,27.20
1527045702000,0.00,0.00,0.00,0.00,0.00
1527045705000,0.00,0.00,0.00,0.00,0.00
1527045708000,0.00,0.00,0.00,0.00,0.00
1527045711000,0.00,0.00,0.00,0.00,0.00
1527045714000,39.33,55.55,0.00,37.91,46.98
1527045717000,0.00,0.00,0.00,0.00,0.00
1527045720000,0.00,0.00,0.00,0.00,0.00
1527045723000,17.87,0.00,0.00,14.00,14.00
1527045726000,0.00,0.00,0.00,0.00,0.00
1527045729000,0.00,0.00,0.00,0.00,0.00
1527045732000,12.00,8.00,0.00,11.20,11.20
1527045735000,0.00,0.00,0.00,0.00,0.00
1527045738000,90.67,0.00,0.00,78.67,78.67
1527045741000,48.64,0.00,0.00,48.14,48.14
1527045744000,69.00,0.00,0.00,67.83,67.83
1527045747000,24.00,0.00,0.00,24.00,24.00
1527045750000,8.00,0.00,0.00,8.00,8.00
1527045753000,0.00,26.00,0.00,26.00,26.00
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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
1527045696000,0.00,0.00,4.61,0.00,0.00,0.00,4.61,0.00,4.61,0.00
1527045699000,0.00,0.00,0.02,0.00,0.00,0.00,0.02,0.00,0.02,0.00
1527045702000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045705000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045708000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045711000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045714000,0.01,0.95,0.01,0.19,0.00,0.00,0.01,1.04,0.01,1.04
1527045717000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045720000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045723000,0.00,0.04,0.00,0.00,0.00,0.00,0.00,0.03,0.00,0.03
1527045726000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045729000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045732000,0.00,0.01,0.00,0.00,0.00,0.00,0.00,0.01,0.00,0.01
1527045735000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045738000,0.00,0.04,0.00,0.00,0.00,0.00,0.00,0.04,0.00,0.04
1527045741000,0.00,0.17,0.00,0.00,0.00,0.00,0.00,0.17,0.00,0.17
1527045744000,0.00,0.07,0.00,0.00,0.00,0.00,0.00,0.07,0.00,0.07
1527045747000,0.00,0.01,0.00,0.00,0.00,0.00,0.00,0.01,0.00,0.01
1527045750000,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00
1527045753000,0.00,0.00,0.05,0.00,0.00,0.00,0.05,0.00,0.05,0.00
Loading

0 comments on commit 6da874c

Please sign in to comment.