diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2016-04-26 15:51:20 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-01 16:22:48 +0100 |
commit | 678a02e112bead7a5ef73c7e74ac2599a544de1f (patch) | |
tree | f81302908ac161a370134d0dd2b84a7646823958 /scripts/contrib/build-perf-test-wrapper.sh | |
parent | 0c92770ed25196f40ba243f0a286c6fef1350d82 (diff) | |
download | poky-678a02e112bead7a5ef73c7e74ac2599a544de1f.tar.gz |
scripts/contrib: introduce build-perf-test-wrapper.sh
A shell script wrapper around oe-build-perf-test script. The purpose of
this wrapper is to act as a executor script, making it possible to run
the tests with a single command. The wrapper script initializes the
build environment, runs oe-build-perf-test and archives the results.
(From OE-Core rev: 946a076c2ce20dd8f7cfa1acbdab1268d406d3e1)
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 | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/scripts/contrib/build-perf-test-wrapper.sh b/scripts/contrib/build-perf-test-wrapper.sh new file mode 100755 index 0000000000..e8e8021d58 --- /dev/null +++ b/scripts/contrib/build-perf-test-wrapper.sh | |||
@@ -0,0 +1,102 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Build performance test script wrapper | ||
4 | # | ||
5 | # Copyright (c) 2016, Intel Corporation. | ||
6 | # | ||
7 | # This program is free software; you can redistribute it and/or modify it | ||
8 | # under the terms and conditions of the GNU General Public License, | ||
9 | # version 2, as published by the Free Software Foundation. | ||
10 | # | ||
11 | # This program is distributed in the hope it will be useful, but WITHOUT | ||
12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | # more details. | ||
15 | # | ||
16 | # | ||
17 | # This script is a simple wrapper around the actual build performance tester | ||
18 | # script. This script initializes the build environment, runs | ||
19 | # oe-build-perf-test and archives the results. | ||
20 | |||
21 | script=`basename $0` | ||
22 | usage () { | ||
23 | echo "Usage: $script [COMMITISH]" | ||
24 | } | ||
25 | |||
26 | if [ $# -gt 1 ]; then | ||
27 | usage | ||
28 | exit 1 | ||
29 | fi | ||
30 | commitish=$1 | ||
31 | |||
32 | echo "Running on `uname -n`" | ||
33 | |||
34 | if ! git_topdir=$(git rev-parse --show-toplevel); then | ||
35 | echo "The current working dir doesn't seem to be a git clone. Please cd there before running `basename $0`" | ||
36 | exit 1 | ||
37 | fi | ||
38 | |||
39 | cd "$git_topdir" | ||
40 | |||
41 | if [ -n "$commitish" ]; then | ||
42 | # Checkout correct revision | ||
43 | echo "Checking out $commitish" | ||
44 | git fetch &> /dev/null | ||
45 | git checkout HEAD^0 &> /dev/null | ||
46 | git branch -D $commitish &> /dev/null | ||
47 | if ! git checkout -f $commitish &> /dev/null; then | ||
48 | echo "Git checkout failed" | ||
49 | exit 1 | ||
50 | fi | ||
51 | fi | ||
52 | |||
53 | # Setup build environment | ||
54 | timestamp=`date "+%Y%m%d%H%M%S"` | ||
55 | git_rev=$(git rev-parse --short HEAD) || exit 1 | ||
56 | base_dir="$git_topdir/build-perf-test" | ||
57 | build_dir="$base_dir/build-$git_rev-$timestamp" | ||
58 | results_dir="$base_dir/results-$git_rev-$timestamp" | ||
59 | globalres_log="$base_dir/globalres.log" | ||
60 | |||
61 | mkdir -p "$base_dir" | ||
62 | source ./oe-init-build-env $build_dir >/dev/null || exit 1 | ||
63 | |||
64 | # Additional config | ||
65 | auto_conf="$build_dir/conf/auto.conf" | ||
66 | echo 'MACHINE = "qemux86"' > "$auto_conf" | ||
67 | echo 'BB_NUMBER_THREADS = "8"' >> "$auto_conf" | ||
68 | echo 'PARALLEL_MAKE = "-j 8"' >> "$auto_conf" | ||
69 | echo "DL_DIR = \"$base_dir/downloads\"" >> "$auto_conf" | ||
70 | # Disabling network sanity check slightly reduces the variance of timing results | ||
71 | echo 'CONNECTIVITY_CHECK_URIS = ""' >> "$auto_conf" | ||
72 | # Possibility to define extra settings | ||
73 | if [ -f "$base_dir/auto.conf.extra" ]; then | ||
74 | cat "$base_dir/auto.conf.extra" >> "$auto_conf" | ||
75 | fi | ||
76 | |||
77 | # Run actual test script | ||
78 | if ! oe-build-perf-test --out-dir "$results_dir" \ | ||
79 | --globalres-file "$globalres_log" \ | ||
80 | --lock-file "$base_dir/oe-build-perf.lock"; then | ||
81 | echo "oe-build-perf-test script failed!" | ||
82 | exit 1 | ||
83 | fi | ||
84 | |||
85 | echo -ne "\n\n-----------------\n" | ||
86 | echo "Global results file:" | ||
87 | echo -ne "\n" | ||
88 | |||
89 | cat "$globalres_log" | ||
90 | |||
91 | echo -ne "\n\n-----------------\n" | ||
92 | echo "Archiving results dir..." | ||
93 | archive_dir=~/perf-results/archives | ||
94 | mkdir -p "$archive_dir" | ||
95 | results_basename=`basename "$results_dir"` | ||
96 | results_dirname=`dirname "$results_dir"` | ||
97 | tar -czf "$archive_dir/`uname -n`-${results_basename}.tar.gz" -C "$results_dirname" "$results_basename" | ||
98 | |||
99 | rm -rf "$build_dir" | ||
100 | rm -rf "$results_dir" | ||
101 | |||
102 | echo "DONE" | ||