summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-04-26 15:51:20 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-01 16:22:48 +0100
commit678a02e112bead7a5ef73c7e74ac2599a544de1f (patch)
treef81302908ac161a370134d0dd2b84a7646823958
parent0c92770ed25196f40ba243f0a286c6fef1350d82 (diff)
downloadpoky-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>
-rwxr-xr-xscripts/contrib/build-perf-test-wrapper.sh102
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
21script=`basename $0`
22usage () {
23 echo "Usage: $script [COMMITISH]"
24}
25
26if [ $# -gt 1 ]; then
27 usage
28 exit 1
29fi
30commitish=$1
31
32echo "Running on `uname -n`"
33
34if ! 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
37fi
38
39cd "$git_topdir"
40
41if [ -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
51fi
52
53# Setup build environment
54timestamp=`date "+%Y%m%d%H%M%S"`
55git_rev=$(git rev-parse --short HEAD) || exit 1
56base_dir="$git_topdir/build-perf-test"
57build_dir="$base_dir/build-$git_rev-$timestamp"
58results_dir="$base_dir/results-$git_rev-$timestamp"
59globalres_log="$base_dir/globalres.log"
60
61mkdir -p "$base_dir"
62source ./oe-init-build-env $build_dir >/dev/null || exit 1
63
64# Additional config
65auto_conf="$build_dir/conf/auto.conf"
66echo 'MACHINE = "qemux86"' > "$auto_conf"
67echo 'BB_NUMBER_THREADS = "8"' >> "$auto_conf"
68echo 'PARALLEL_MAKE = "-j 8"' >> "$auto_conf"
69echo "DL_DIR = \"$base_dir/downloads\"" >> "$auto_conf"
70# Disabling network sanity check slightly reduces the variance of timing results
71echo 'CONNECTIVITY_CHECK_URIS = ""' >> "$auto_conf"
72# Possibility to define extra settings
73if [ -f "$base_dir/auto.conf.extra" ]; then
74 cat "$base_dir/auto.conf.extra" >> "$auto_conf"
75fi
76
77# Run actual test script
78if ! 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
83fi
84
85echo -ne "\n\n-----------------\n"
86echo "Global results file:"
87echo -ne "\n"
88
89cat "$globalres_log"
90
91echo -ne "\n\n-----------------\n"
92echo "Archiving results dir..."
93archive_dir=~/perf-results/archives
94mkdir -p "$archive_dir"
95results_basename=`basename "$results_dir"`
96results_dirname=`dirname "$results_dir"`
97tar -czf "$archive_dir/`uname -n`-${results_basename}.tar.gz" -C "$results_dirname" "$results_basename"
98
99rm -rf "$build_dir"
100rm -rf "$results_dir"
101
102echo "DONE"