diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-20 11:51:34 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-20 11:54:36 +0000 |
commit | 997615921e6b8dde92fb0cfc023b65412b98793e (patch) | |
tree | 2033919fb1585fe95a9418fcbd73ba7de28ad7f1 /scripts/contrib | |
parent | 2b4c4f9fdf4a86ec22dfeac8c6e730ec2fd4e062 (diff) | |
download | poky-997615921e6b8dde92fb0cfc023b65412b98793e.tar.gz |
scripts/contrib/build-perf-test-wrapper.sh: Improve interaction with autobuilder automation
This tweaks the script to:
* Ensure directories exist and can be written to
* Allow the downloads directory to be specified
* Error early if the phantomjs or optipng dependencies are not installed
* Allow the location of the globalres.log file to be specified
This means that the main build directory can be destroyed and any state
from the script is stored elsewhere allowing it to be triggered
automatically from the autobuilder infrastructure.
(From OE-Core rev: 1de5fbd484e6a747ae6419ccc89d8c2911b9706b)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib')
-rwxr-xr-x | scripts/contrib/build-perf-test-wrapper.sh | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/scripts/contrib/build-perf-test-wrapper.sh b/scripts/contrib/build-perf-test-wrapper.sh index 19bee1dd03..7cbb5d794f 100755 --- a/scripts/contrib/build-perf-test-wrapper.sh +++ b/scripts/contrib/build-perf-test-wrapper.sh | |||
@@ -33,7 +33,9 @@ Optional arguments: | |||
33 | -c COMMITISH test (checkout) this commit, <branch>:<commit> can be | 33 | -c COMMITISH test (checkout) this commit, <branch>:<commit> can be |
34 | specified to test specific commit of certain branch | 34 | specified to test specific commit of certain branch |
35 | -C GIT_REPO commit results into Git | 35 | -C GIT_REPO commit results into Git |
36 | -d DOWNLOAD_DIR directory to store downloaded sources in | ||
36 | -E EMAIL_ADDR send email report | 37 | -E EMAIL_ADDR send email report |
38 | -g GLOBALRES_DIR where to place the globalres file | ||
37 | -P GIT_REMOTE push results to a remote Git repository | 39 | -P GIT_REMOTE push results to a remote Git repository |
38 | -R DEST rsync reports to a remote destination | 40 | -R DEST rsync reports to a remote destination |
39 | -w WORK_DIR work dir for this script | 41 | -w WORK_DIR work dir for this script |
@@ -51,19 +53,26 @@ get_os_release_var () { | |||
51 | commitish="" | 53 | commitish="" |
52 | oe_build_perf_test_extra_opts=() | 54 | oe_build_perf_test_extra_opts=() |
53 | oe_git_archive_extra_opts=() | 55 | oe_git_archive_extra_opts=() |
54 | while getopts "ha:c:C:E:P:R:w:x" opt; do | 56 | while getopts "ha:c:C:d:E:g:P:R:w:x" opt; do |
55 | case $opt in | 57 | case $opt in |
56 | h) usage | 58 | h) usage |
57 | exit 0 | 59 | exit 0 |
58 | ;; | 60 | ;; |
59 | a) archive_dir=`realpath -s "$OPTARG"` | 61 | a) mkdir -p "$OPTARG" |
62 | archive_dir=`realpath -s "$OPTARG"` | ||
60 | ;; | 63 | ;; |
61 | c) commitish=$OPTARG | 64 | c) commitish=$OPTARG |
62 | ;; | 65 | ;; |
63 | C) results_repo=`realpath -s "$OPTARG"` | 66 | C) mkdir -p "$OPTARG" |
67 | results_repo=`realpath -s "$OPTARG"` | ||
68 | ;; | ||
69 | d) download_dir=`realpath -s "$OPTARG"` | ||
64 | ;; | 70 | ;; |
65 | E) email_to="$OPTARG" | 71 | E) email_to="$OPTARG" |
66 | ;; | 72 | ;; |
73 | g) mkdir -p "$OPTARG" | ||
74 | globalres_dir=`realpath -s "$OPTARG"` | ||
75 | ;; | ||
67 | P) oe_git_archive_extra_opts+=("--push" "$OPTARG") | 76 | P) oe_git_archive_extra_opts+=("--push" "$OPTARG") |
68 | ;; | 77 | ;; |
69 | R) rsync_dst="$OPTARG" | 78 | R) rsync_dst="$OPTARG" |
@@ -86,6 +95,17 @@ if [ $# -ne 0 ]; then | |||
86 | exit 1 | 95 | exit 1 |
87 | fi | 96 | fi |
88 | 97 | ||
98 | if [ -n "$email_to" ]; then | ||
99 | if ! [ -x "$(command -v phantomjs)" ]; then | ||
100 | echo "ERROR: Sending email needs phantomjs." | ||
101 | exit 1 | ||
102 | fi | ||
103 | if ! [ -x "$(command -v optipng)" ]; then | ||
104 | echo "ERROR: Sending email needs optipng." | ||
105 | exit 1 | ||
106 | fi | ||
107 | fi | ||
108 | |||
89 | # Open a file descriptor for flock and acquire lock | 109 | # Open a file descriptor for flock and acquire lock |
90 | LOCK_FILE="/tmp/oe-build-perf-test-wrapper.lock" | 110 | LOCK_FILE="/tmp/oe-build-perf-test-wrapper.lock" |
91 | if ! exec 3> "$LOCK_FILE"; then | 111 | if ! exec 3> "$LOCK_FILE"; then |
@@ -146,11 +166,18 @@ if [ -z "$base_dir" ]; then | |||
146 | fi | 166 | fi |
147 | echo "Using working dir $base_dir" | 167 | echo "Using working dir $base_dir" |
148 | 168 | ||
169 | if [ -z "$download_dir" ]; then | ||
170 | download_dir="$base_dir/downloads" | ||
171 | fi | ||
172 | if [ -z "$globalres_dir" ]; then | ||
173 | globalres_dir="$base_dir" | ||
174 | fi | ||
175 | |||
149 | timestamp=`date "+%Y%m%d%H%M%S"` | 176 | timestamp=`date "+%Y%m%d%H%M%S"` |
150 | git_rev=$(git rev-parse --short HEAD) || exit 1 | 177 | git_rev=$(git rev-parse --short HEAD) || exit 1 |
151 | build_dir="$base_dir/build-$git_rev-$timestamp" | 178 | build_dir="$base_dir/build-$git_rev-$timestamp" |
152 | results_dir="$base_dir/results-$git_rev-$timestamp" | 179 | results_dir="$base_dir/results-$git_rev-$timestamp" |
153 | globalres_log="$base_dir/globalres.log" | 180 | globalres_log="$globalres_dir/globalres.log" |
154 | machine="qemux86" | 181 | machine="qemux86" |
155 | 182 | ||
156 | mkdir -p "$base_dir" | 183 | mkdir -p "$base_dir" |
@@ -161,7 +188,7 @@ auto_conf="$build_dir/conf/auto.conf" | |||
161 | echo "MACHINE = \"$machine\"" > "$auto_conf" | 188 | echo "MACHINE = \"$machine\"" > "$auto_conf" |
162 | echo 'BB_NUMBER_THREADS = "8"' >> "$auto_conf" | 189 | echo 'BB_NUMBER_THREADS = "8"' >> "$auto_conf" |
163 | echo 'PARALLEL_MAKE = "-j 8"' >> "$auto_conf" | 190 | echo 'PARALLEL_MAKE = "-j 8"' >> "$auto_conf" |
164 | echo "DL_DIR = \"$base_dir/downloads\"" >> "$auto_conf" | 191 | echo "DL_DIR = \"$download_dir\"" >> "$auto_conf" |
165 | # Disabling network sanity check slightly reduces the variance of timing results | 192 | # Disabling network sanity check slightly reduces the variance of timing results |
166 | echo 'CONNECTIVITY_CHECK_URIS = ""' >> "$auto_conf" | 193 | echo 'CONNECTIVITY_CHECK_URIS = ""' >> "$auto_conf" |
167 | # Possibility to define extra settings | 194 | # Possibility to define extra settings |