Skip to content

Commit

Permalink
Apply a round of code-review comments, still w which
Browse files Browse the repository at this point in the history
  • Loading branch information
portante committed May 24, 2022
1 parent d439921 commit 877698f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 22 deletions.
3 changes: 1 addition & 2 deletions agent/bench-scripts/pbench-fio
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,7 @@ function fio_pre_check() {
fi
if [[ ${do_local_pre_check} -eq 1 ]]; then
debug_log "Running pre-check locally"
local_pre_check "${devs}" "${ver}" "${match}"
rc=${?}
local_pre_check "${devs}" "${ver}" "${match}" || rc=${?}
fi
if [[ ${rc} -ne 0 ]]; then
error_log "pre-check(s) failed, exiting"
Expand Down
10 changes: 5 additions & 5 deletions agent/bench-scripts/pbench-uperf
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ function local_pre_check {
local _ver="${1}"
local _match="${2}"

resolve_benchmark_bin_err="$(resolve_benchmark_bin "${benchmark}" 2>&1)"
if [[ ${?} -ne 0 ]]; then
error_log "${script_name}: ${benchmark} executable not found, '${resolve_benchmark_bin_err}'"
exit 1
fi
resolve_benchmark_bin_err="$(resolve_benchmark_bin "${benchmark}" 2>&1)"
if [[ ${?} -ne 0 ]]; then
error_log "${script_name}: ${benchmark} executable not found, '${resolve_benchmark_bin_err}'"
exit 1
fi

local ver_installed=$(${benchmark} -V | awk 'NR==1 {print $3}')
vercmp "${benchmark}" "${_match}" "${_ver}" "${ver_installed}"
Expand Down
2 changes: 1 addition & 1 deletion agent/bench-scripts/test-bin/fio
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ echo "$0 $*" >> $_testlog
# Mock fio command behaviors.
if [[ "${1%%=*}" == "--client" ]]; then
client_file=${1##*=}
for line in $(cat ${client_file}); do
for line in $(< ${client_file}); do
ip_name="${line%%,*}"
client="${ip_name#*:}"
if [[ "${client%%.*}" == "hist" ]]; then
Expand Down
7 changes: 0 additions & 7 deletions agent/bench-scripts/test-bin/mock-cmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ fi

prog="$(basename "${0}")"
args=( "${@}" )
lastidx=$((${#args[@]} - 1))
# avoid "bad array subscript" error
if [[ "${lastidx}" -lt 0 ]] ;then
exit 0
fi

last=${args[${lastidx}]}
if [[ "${prog}" == "pbench-tool-meister-start" ]]; then
echo [pbench] > ${benchmark_run_dir}/metadata.log
elif [[ "${prog}" == "cat" && "${args[0]}" == "/proc/cmdline" ]]; then
Expand Down
14 changes: 8 additions & 6 deletions agent/bench-scripts/test-bin/which
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/bash

args=( "${@}" )
lastidx=$((${#args[@]} - 1))
# avoid "bad array subscript" error
if [[ "${lastidx}" -lt 0 ]] ;then
exit 0
# Mock the operation of `which` so that the value of `PATH` is never emitted
# during the test runs, thus avoiding it landing in a gold file.

if [[ $# -eq 0 ]] ;then
echo "$0 requires at least one argument" >&2
exit 255
fi
last=${args[${lastidx}]}
args=( "${@}" )
last=${args[-1]}

stdout=$(/usr/bin/which ${last} 2> /dev/null)
res=${?}
Expand Down
2 changes: 1 addition & 1 deletion agent/bench-scripts/unittests
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function _dump_logs {
for f in $(find . -name results.html 2> /dev/null | sort); do
_dump_file ${rundir} ${f:2}
done
for f in $(find . \( -name '*--client_start.sh' -o -name '*--server_start.sh' \) 2> /dev/null | sort); do
for f in $(find . -name '*--client_start.sh' -o -name '*--server_start.sh' 2> /dev/null | sort); do
_dump_file ${rundir} ${f:2}
done
fi
Expand Down

0 comments on commit 877698f

Please sign in to comment.