diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2017-05-04 12:01:30 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-05-18 14:01:47 +0100 |
commit | 4fdb6aa28d5d442dfd87f748d33f2c45784b4730 (patch) | |
tree | 1b97e95d95eb529d075bab01a8cb278ddeadc0c6 /scripts/contrib/build-perf-test-wrapper.sh | |
parent | 5403db7f4077b61b1a66908731e37f3fd50103eb (diff) | |
download | poky-4fdb6aa28d5d442dfd87f748d33f2c45784b4730.tar.gz |
build-perf-test-wrapper.sh: support uploading test reports
Implement new '-R' command line option for specifying an rsync
destination where to upload test reports.
[YOCTO #5049]
(From OE-Core rev: ebc37ede5b247347483128f091b505fe33356591)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib/build-perf-test-wrapper.sh')
-rwxr-xr-x | scripts/contrib/build-perf-test-wrapper.sh | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/scripts/contrib/build-perf-test-wrapper.sh b/scripts/contrib/build-perf-test-wrapper.sh index 3da32532be..19bee1dd03 100755 --- a/scripts/contrib/build-perf-test-wrapper.sh +++ b/scripts/contrib/build-perf-test-wrapper.sh | |||
@@ -35,6 +35,7 @@ Optional arguments: | |||
35 | -C GIT_REPO commit results into Git | 35 | -C GIT_REPO commit results into Git |
36 | -E EMAIL_ADDR send email report | 36 | -E EMAIL_ADDR send email report |
37 | -P GIT_REMOTE push results to a remote Git repository | 37 | -P GIT_REMOTE push results to a remote Git repository |
38 | -R DEST rsync reports to a remote destination | ||
38 | -w WORK_DIR work dir for this script | 39 | -w WORK_DIR work dir for this script |
39 | (default: GIT_TOP_DIR/build-perf-test) | 40 | (default: GIT_TOP_DIR/build-perf-test) |
40 | -x create xml report (instead of json) | 41 | -x create xml report (instead of json) |
@@ -50,7 +51,7 @@ get_os_release_var () { | |||
50 | commitish="" | 51 | commitish="" |
51 | oe_build_perf_test_extra_opts=() | 52 | oe_build_perf_test_extra_opts=() |
52 | oe_git_archive_extra_opts=() | 53 | oe_git_archive_extra_opts=() |
53 | while getopts "ha:c:C:E:P:w:x" opt; do | 54 | while getopts "ha:c:C:E:P:R:w:x" opt; do |
54 | case $opt in | 55 | case $opt in |
55 | h) usage | 56 | h) usage |
56 | exit 0 | 57 | exit 0 |
@@ -65,6 +66,8 @@ while getopts "ha:c:C:E:P:w:x" opt; do | |||
65 | ;; | 66 | ;; |
66 | P) oe_git_archive_extra_opts+=("--push" "$OPTARG") | 67 | P) oe_git_archive_extra_opts+=("--push" "$OPTARG") |
67 | ;; | 68 | ;; |
69 | R) rsync_dst="$OPTARG" | ||
70 | ;; | ||
68 | w) base_dir=`realpath -s "$OPTARG"` | 71 | w) base_dir=`realpath -s "$OPTARG"` |
69 | ;; | 72 | ;; |
70 | x) oe_build_perf_test_extra_opts+=("--xml") | 73 | x) oe_build_perf_test_extra_opts+=("--xml") |
@@ -132,6 +135,11 @@ if [ -n "$commitish" ]; then | |||
132 | git reset --hard $commit > /dev/null | 135 | git reset --hard $commit > /dev/null |
133 | fi | 136 | fi |
134 | 137 | ||
138 | # Determine name of the current branch | ||
139 | branch=`git symbolic-ref HEAD 2> /dev/null` | ||
140 | # Strip refs/heads/ | ||
141 | branch=${branch:11} | ||
142 | |||
135 | # Setup build environment | 143 | # Setup build environment |
136 | if [ -z "$base_dir" ]; then | 144 | if [ -z "$base_dir" ]; then |
137 | base_dir="$git_topdir/build-perf-test" | 145 | base_dir="$git_topdir/build-perf-test" |
@@ -187,13 +195,25 @@ if [ -n "$results_repo" ]; then | |||
187 | "${oe_git_archive_extra_opts[@]}" \ | 195 | "${oe_git_archive_extra_opts[@]}" \ |
188 | "$results_dir" | 196 | "$results_dir" |
189 | 197 | ||
198 | # Generate test reports | ||
199 | sanitized_branch=`echo $branch | tr / _` | ||
200 | report_txt=`hostname`_${sanitized_branch}_${machine}.txt | ||
201 | report_html=`hostname`_${sanitized_branch}_${machine}.html | ||
202 | echo -e "\nGenerating test report" | ||
203 | oe-build-perf-report -r "$results_repo" > $report_txt | ||
204 | oe-build-perf-report -r "$results_repo" --html > $report_html | ||
205 | |||
190 | # Send email report | 206 | # Send email report |
191 | if [ -n "$email_to" ]; then | 207 | if [ -n "$email_to" ]; then |
192 | echo -e "\nEmailing test report" | 208 | echo "Emailing test report" |
193 | os_name=`get_os_release_var PRETTY_NAME` | 209 | os_name=`get_os_release_var PRETTY_NAME` |
194 | oe-build-perf-report -r "$results_repo" > report.txt | 210 | "$script_dir"/oe-build-perf-report-email.py --to "$email_to" --subject "Build Perf Test Report for $os_name" --text $report_txt --html $report_html "${OE_BUILD_PERF_REPORT_EMAIL_EXTRA_ARGS[@]}" |
195 | oe-build-perf-report -r "$results_repo" --html > report.html | 211 | fi |
196 | "$script_dir"/oe-build-perf-report-email.py --to "$email_to" --subject "Build Perf Test Report for $os_name" --text report.txt --html report.html "${OE_BUILD_PERF_REPORT_EMAIL_EXTRA_ARGS[@]}" | 212 | |
213 | # Upload report files, unless we're on detached head | ||
214 | if [ -n "$rsync_dst" -a -n "$branch" ]; then | ||
215 | echo "Uploading test report" | ||
216 | rsync $report_txt $report_html $rsync_dst | ||
197 | fi | 217 | fi |
198 | fi | 218 | fi |
199 | 219 | ||