Skip to content

Commit

Permalink
Fix pbench-move-results to only push valid results
Browse files Browse the repository at this point in the history
A valid result is defined to be where the name of the result directory
in /var/lib/pbench-agent is the same as the value in the metadata.log
file under the "name" option of the "pbench" section.

Fixes #1039.
  • Loading branch information
portante committed Jan 26, 2019
1 parent c677925 commit b5ceebe
Show file tree
Hide file tree
Showing 10 changed files with 176 additions and 0 deletions.
46 changes: 46 additions & 0 deletions agent/util-scripts/gold/pbench-move-results/test-33.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
+++ setup pbench results dir time stamps
--- setup pbench results dir time stamps
+++ Running test-33 pbench-move-results
tar --create --force-local "pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.42" | xz -T0 > "/var/tmp/pbench-test-utils/pbench/tmp/pbench-move-results.NNNNN/testhost/pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.42.tar.xz"
[warn][1900-01-01T00:00:00.000000] the run in directory /var/tmp/pbench-test-utils/pbench/pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.43 has an unexpected metadata name, "pbench-user-benchmark__2019.01.01T12.00.43" - skipping
--- Finished test-33 pbench-move-results (status=0)
+++ pbench tree state
/var/tmp/pbench-test-utils/pbench
/var/tmp/pbench-test-utils/pbench/pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.43
/var/tmp/pbench-test-utils/pbench/pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.43/metadata.log
/var/tmp/pbench-test-utils/pbench/pbench.log
/var/tmp/pbench-test-utils/pbench/[email protected]:
/var/tmp/pbench-test-utils/pbench/[email protected]:/foo
/var/tmp/pbench-test-utils/pbench/[email protected]:/foo/bar
/var/tmp/pbench-test-utils/pbench/[email protected]:/foo/bar/iostat
/var/tmp/pbench-test-utils/pbench/[email protected]:/foo/bar/mpstat
/var/tmp/pbench-test-utils/pbench/[email protected]:/foo/bar/perf
/var/tmp/pbench-test-utils/pbench/[email protected]:/foo/bar/pidstat
/var/tmp/pbench-test-utils/pbench/[email protected]:/foo/bar/proc-interrupts
/var/tmp/pbench-test-utils/pbench/[email protected]:/foo/bar/proc-vmstat
/var/tmp/pbench-test-utils/pbench/[email protected]:/foo/bar/sar
/var/tmp/pbench-test-utils/pbench/[email protected]:/foo/bar/turbostat
/var/tmp/pbench-test-utils/pbench/tmp
--- pbench tree state
+++ pbench.log file contents
/var/tmp/pbench-test-utils/pbench/pbench.log:Fake log file contents.
/var/tmp/pbench-test-utils/pbench/pbench.log:[debug][1900-01-01T00:00:00.000000] preparing to copy 1 MB of data from /var/tmp/pbench-test-utils/pbench/pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.42
/var/tmp/pbench-test-utils/pbench/pbench.log:[warn][1900-01-01T00:00:00.000000] the run in directory /var/tmp/pbench-test-utils/pbench/pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.43 has an unexpected metadata name, "pbench-user-benchmark__2019.01.01T12.00.43" - skipping
/var/tmp/pbench-test-utils/pbench/pbench.log:[debug][1900-01-01T00:00:00.000000] successfully moved 1 runs, encountered 0 failures
--- pbench.log file contents
+++ test-execution.log file contents
/var/tmp/pbench-test-utils/test-execution.log:/var/tmp/pbench-test-utils/opt/pbench-agent/unittest-scripts/yum info installed pbench-agent
/var/tmp/pbench-test-utils/test-execution.log:/var/tmp/pbench-test-utils/opt/pbench-agent/unittest-scripts/yum info installed pbench-agent
/var/tmp/pbench-test-utils/test-execution.log:/var/tmp/pbench-test-utils/opt/pbench-agent/unittest-scripts/curl -s -A pbench-agent-unknown-:agent.example.com:nobody:/var/tmp/pbench-test-utils/opt/pbench-agent/util-scripts/pbench-move-results -L http://pbench.example.com/pbench-results-host-info.versioned/pbench-results-host-info.URL002
/var/tmp/pbench-test-utils/test-execution.log:/var/tmp/pbench-test-utils/opt/pbench-agent/unittest-scripts/ssh -q -i /var/tmp/pbench-test-utils/opt/pbench-agent/id_rsa -o StrictHostKeyChecking=no [email protected] exit
/var/tmp/pbench-test-utils/test-execution.log:/var/tmp/pbench-test-utils/opt/pbench-agent/unittest-scripts/scp -r -o StrictHostKeyChecking=no -i /var/tmp/pbench-test-utils/opt/pbench-agent/id_rsa -o StrictHostKeyChecking=no /var/tmp/pbench-test-utils/pbench/tmp/pbench-move-results.NNNNN/testhost [email protected]:/foo/bar
/var/tmp/pbench-test-utils/test-execution.log:[email protected]:/foo/bar/iostat:foo
/var/tmp/pbench-test-utils/test-execution.log:[email protected]:/foo/bar/mpstat:bar
/var/tmp/pbench-test-utils/test-execution.log:[email protected]:/foo/bar/perf:baz
/var/tmp/pbench-test-utils/test-execution.log:[email protected]:/foo/bar/pidstat:hunoz
/var/tmp/pbench-test-utils/test-execution.log:[email protected]:/foo/bar/proc-interrupts:hukerz
/var/tmp/pbench-test-utils/test-execution.log:[email protected]:/foo/bar/proc-vmstat:foobar
/var/tmp/pbench-test-utils/test-execution.log:[email protected]:/foo/bar/sar:foo
/var/tmp/pbench-test-utils/test-execution.log:[email protected]:/foo/bar/turbostat:bar
/var/tmp/pbench-test-utils/test-execution.log:/var/tmp/pbench-test-utils/opt/pbench-agent/unittest-scripts/ssh -i /var/tmp/pbench-test-utils/opt/pbench-agent/id_rsa -o StrictHostKeyChecking=no [email protected] cd /foo/bar/testhost; md5sum --check pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.42.tar.xz.md5.check && mv pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.42.tar.xz.md5.check pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.42.tar.xz.md5
--- test-execution.log file contents
14 changes: 14 additions & 0 deletions agent/util-scripts/gold/pbench-move-results/test-34.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
+++ Running test-34 pbench-move-results
usage:
pbench-move-results [--help] [--user=<user>] [--prefix=<path>] [--xz-single-threaded] [--show-server]
--- Finished test-34 pbench-move-results (status=0)
+++ pbench tree state
/var/tmp/pbench-test-utils/pbench
/var/tmp/pbench-test-utils/pbench/tmp
--- pbench tree state
+++ pbench.log file contents
grep: /var/tmp/pbench-test-utils/pbench/pbench.log: No such file or directory
--- pbench.log file contents
+++ test-execution.log file contents
grep: /var/tmp/pbench-test-utils/test-execution.log: No such file or directory
--- test-execution.log file contents
6 changes: 6 additions & 0 deletions agent/util-scripts/pbench-move-results
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ for dir in `/bin/ls -ort -d */ | awk '{print $8}' | grep -v "^tools-" | grep -v
continue
fi

res_name=$(getconf.py --config ${pbench_run_name}/metadata.log name pbench)
if [ "${res_name}" != "${pbench_run_name}" ]; then
warn_log "the run in directory ${pbench_run}/${pbench_run_name} has an unexpected metadata name, \"${res_name}\" - skipping"
continue
fi

# Any result where tools or benchmark results were used get the pbench
# logfile so it can be referenced later if needed.
if [ -e pbench.log ]; then
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[DEFAULT]
pbench_install_dir = /opt/pbench-agent
pbench_results_redirector = pbench.example.com
pbench_web_server = pbench.example.com

[pbench-agent]
install-dir = %(pbench_install_dir)s
pbench_user = pbench
pbench_group = pbench
pbench_run = /var/lib/pbench-agent
pbench_log = %(pbench_run)s/pbench.log

[pbench-agent-internal]
install-dir = /opt/pbench-agent-internal

[results]
user = pbench
host_path = http://%(pbench_results_redirector)s/pbench-archive-host
dir = /pbench/public_html/incoming
ssh_opts = -o StrictHostKeyChecking=no
webserver = %(pbench_web_server)s
host_info_url = http://%(webserver)s/pbench-results-host-info.versioned/pbench-results-host-info.URL002

[pbench/tools]
default-tool-set = sar, iostat, mpstat, pidstat, proc-vmstat, proc-interrupts, turbostat
interval = 3

[tools/pidstat]
interval = 30

[packages]

[config]
path = %(pbench_install_dir)s/config
files = pbench-agent-default.cfg
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,32 @@
[pbench]
name = pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.42
script = pbench-user-benchmark
config = ndk-test-1
date = 2018-05-23T03:21:32
rpm-version = 0.50-1g799ea025
iterations = 1, 1

[tools]
hosts = alphaville
group = default

[tools/alphaville]
hostname-s = alphaville
iostat = --interval=3
mpstat = --interval=3
perf = --record-opts=record -a --freq=100
pidstat = --interval=30
proc-interrupts = --interval=3
proc-vmstat = --interval=3
sar = --interval=3
turbostat = --interval=3

[run]
controller = alphaville.usersys.redhat.com
start_run = 2018-05-23T03:21:32.387628370
end_run = 2018-05-23T03:22:39.538437410

[iterations/1]
iteration_name = 1
user_script = sleep

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[pbench]
name = pbench-user-benchmark__2019.01.01T12.00.43
script = pbench-user-benchmark
config =
date = 2018-05-23T03:21:32
rpm-version = 0.50-1g799ea025
iterations = 1, 1

[tools]
hosts = alphaville
group = default

[tools/alphaville]
hostname-s = alphaville
iostat = --interval=3
mpstat = --interval=3
perf = --record-opts=record -a --freq=100
pidstat = --interval=30
proc-interrupts = --interval=3
proc-vmstat = --interval=3
sar = --interval=3
turbostat = --interval=3

[run]
controller = alphaville.usersys.redhat.com
start_run = 2018-05-23T03:21:32.387628370
end_run = 2018-05-23T03:22:39.538437410

[iterations/1]
iteration_name = 1
user_script = sleep

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fake log file contents.
9 changes: 9 additions & 0 deletions agent/util-scripts/unittests
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ declare -A tools=(
[test-30]="pbench-collect-sysinfo"
[test-31]="pbench-copy-results"
[test-32]="pbench-copy-results"
[test-33]="pbench-move-results"
[test-34]="pbench-move-results"
)
declare -A options=(
[test-00]="--name=mpstat --group=default -- --interval=10"
Expand Down Expand Up @@ -237,6 +239,7 @@ declare -A options=(
[test-30]="--check --sysinfo=libvirt,default,kernel_config,all,topology,none"
[test-31]="--prefix=foo/bar --user=ndk"
[test-32]="--help"
[test-34]="--help"
)

declare -A expected_status=(
Expand All @@ -248,6 +251,10 @@ declare -A expected_status=(
[test-29]=1
)

declare -A pre_hooks=(
[test-33]='(echo "+++ setup pbench results dir time stamps"; touch --date="2019-01-01 12:00:42" $_testdir/pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.42; touch --date="2019-01-01 12:00:43" $_testdir/pbench-user-benchmark_ndk-test-1_2019.01.01T12.00.43; echo "--- setup pbench results dir time stamps") >> $_testout'
)

declare -A post_hooks=(
[test-31]='(echo "+++ metadata.log file contents"; cat $_testdir/pbench-user-benchmark_ndk-test-1_2018.05.23T03.21.32/metadata.log; echo "--- metadata.log file contents") >> $_testout'
)
Expand All @@ -263,9 +270,11 @@ for tst in $tests; do
tool=${tools[$tst]}
opts=${options[$tst]}
status=${expected_status[$tst]}
pre_hook=${pre_hooks[$tst]}
post_hook=${post_hooks[$tst]}

_setup_state $tst $tool
eval "$pre_hook"
USER=nobody _run $tst $tool $opts
res=$?
_save_tree
Expand Down

0 comments on commit b5ceebe

Please sign in to comment.