Skip to content

Commit beeff24

Browse files
committed
Fix tool argument handling
Fixes issue #1751, where tools with multiple arguments only have the first argument passed to the tool command.
1 parent f822773 commit beeff24

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

agent/util-scripts/gold/pbench-start-tools/test-51.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
[debug][1900-01-01T00:00:00.000000] [pbench-kill-tools] /var/tmp/pbench-test-utils/opt/pbench-agent/tool-scripts/tcpdump --kill --dir=/var/tmp/pbench-test-utils/pbench/mock-run/mock-iteration/mock-sample/tools-default --interface=br1 --packets=1000
2525
[debug][1900-01-01T00:00:00.000000] [pbench-kill-tools]completed:
2626
[debug][1900-01-01T00:00:00.000000] [pbench-start-tools] /var/tmp/pbench-test-utils/opt/pbench-agent/tool-scripts/tcpdump --start --dir=/var/tmp/pbench-test-utils/pbench/mock-run/mock-iteration/mock-sample/tools-default --interface=br1 --packets=1000
27-
[debug][1900-01-01T00:00:00.000000] [pbench-start-tools] "#!/bin/bash screen -dm -L -S "pbench-tool-default-tcpdump" /var/tmp/pbench-test-utils/opt/pbench-agent/tool-scripts/tcpdump --start --dir=/var/tmp/pbench-test-utils/pbench/mock-run/mock-iteration/mock-sample/tools-default --interface=br1"
27+
[debug][1900-01-01T00:00:00.000000] [pbench-start-tools] "#!/bin/bash screen -dm -L -S "pbench-tool-default-tcpdump" /var/tmp/pbench-test-utils/opt/pbench-agent/tool-scripts/tcpdump --start --dir=/var/tmp/pbench-test-utils/pbench/mock-run/mock-iteration/mock-sample/tools-default --interface=br1 --packets=1000 "
2828
[debug][1900-01-01T00:00:00.000000] [pbench-start-tools]completed:
2929
--- pbench.log file contents
3030
+++ test-execution.log file contents
3131
/var/tmp/pbench-test-utils/opt/pbench-agent/unittest-scripts/screen -ls
32-
/var/tmp/pbench-test-utils/opt/pbench-agent/unittest-scripts/screen -dm -L -S pbench-tool-default-tcpdump /var/tmp/pbench-test-utils/opt/pbench-agent/tool-scripts/tcpdump --start --dir=/var/tmp/pbench-test-utils/pbench/mock-run/mock-iteration/mock-sample/tools-default --interface=br1
32+
/var/tmp/pbench-test-utils/opt/pbench-agent/unittest-scripts/screen -dm -L -S pbench-tool-default-tcpdump /var/tmp/pbench-test-utils/opt/pbench-agent/tool-scripts/tcpdump --start --dir=/var/tmp/pbench-test-utils/pbench/mock-run/mock-iteration/mock-sample/tools-default --interface=br1 --packets=1000
3333
--- test-execution.log file contents

agent/util-scripts/pbench-postprocess-tools

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ debug_log "[$script_name]started: $@"
2828

2929
opts=$(getopt -q -o d:g: --longoptions "dir:,group:" -n "getopt.sh" -- "$@");
3030
if [ $? -ne 0 ]; then
31-
printf "\n"
32-
printf "$script_name: you specified an invalid option\n\n"
33-
printf "The following are required:\n\n"
31+
printf -- "\n"
32+
printf -- "%s: you specified an invalid option\n\n" "${script_name}"
33+
printf -- "The following are required:\n\n"
3434
printf -- "\t-g str --group=str, str = a tool group used in a benchmark\n"
3535
printf -- "\t (the default group is 'default')\n"
36-
printf "\n"
37-
printf -- "\t-d str --dir=str, str = a directory where the $script_name\n"
36+
printf -- "\n"
37+
printf -- "\t-d str --dir=str, str = a directory where the %s\n" "${script_name}"
3838
printf -- "\t will store and process data\n"
3939
exit 1
4040
fi
@@ -163,7 +163,7 @@ for this_tool_file in `/bin/ls $tool_group_dir`; do
163163
exit ${rc}
164164
fi
165165
screen_cmd="${screen_dir}/command"
166-
printf -- "#!/bin/bash\n\nscreen -dm -L -S \"${screen_name}\" ${pbench_bin}/tool-scripts/${name} --${action} --dir=${tool_output_dir} ${tool_opts[@]}\n" > ${screen_cmd}
166+
printf -- "#!/bin/bash\n\nscreen -dm -L -S \"%s\" %s/tool-scripts/%s --%s --dir=%s %s\n" "${screen_name}" "${pbench_bin}" "${name}" "${action}" "${tool_output_dir}" "$(echo ${tool_opts[@]})" > ${screen_cmd}
167167
chmod +x ${screen_cmd}
168168
debug_log "[${script_name}] \"$(cat ${screen_cmd} | tr '\n' ' ')\""
169169
(cd ${screen_dir}; ${screen_cmd})

0 commit comments

Comments
 (0)