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)

(From OE-Core rev: d6f00d9d89f62e60eaa87abf89477ed7865e2859)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2019-01-20 11:51:34 +00:00
parent 7322e64f9b
commit faab57c597

View File

@ -33,7 +33,9 @@ Optional arguments:
-c COMMITISH test (checkout) this commit, <branch>:<commit> can be
specified to test specific commit of certain branch
-C GIT_REPO commit results into Git
-d DOWNLOAD_DIR directory to store downloaded sources in
-E EMAIL_ADDR send email report
-g GLOBALRES_DIR where to place the globalres file
-P GIT_REMOTE push results to a remote Git repository
-R DEST rsync reports to a remote destination
-w WORK_DIR work dir for this script
@ -51,19 +53,26 @@ get_os_release_var () {
commitish=""
oe_build_perf_test_extra_opts=()
oe_git_archive_extra_opts=()
while getopts "ha:c:C:E:P:R:w:x" opt; do
while getopts "ha:c:C:d:E:g:P:R:w:x" opt; do
case $opt in
h) usage
exit 0
;;
a) archive_dir=`realpath -s "$OPTARG"`
a) mkdir -p "$OPTARG"
archive_dir=`realpath -s "$OPTARG"`
;;
c) commitish=$OPTARG
;;
C) results_repo=`realpath -s "$OPTARG"`
C) mkdir -p "$OPTARG"
results_repo=`realpath -s "$OPTARG"`
;;
d) download_dir=`realpath -s "$OPTARG"`
;;
E) email_to="$OPTARG"
;;
g) mkdir -p "$OPTARG"
globalres_dir=`realpath -s "$OPTARG"`
;;
P) oe_git_archive_extra_opts+=("--push" "$OPTARG")
;;
R) rsync_dst="$OPTARG"
@ -86,6 +95,17 @@ if [ $# -ne 0 ]; then
exit 1
fi
if [ -n "$email_to" ]; then
if ! [ -x "$(command -v phantomjs)" ]; then
echo "ERROR: Sending email needs phantomjs."
exit 1
fi
if ! [ -x "$(command -v optipng)" ]; then
echo "ERROR: Sending email needs optipng."
exit 1
fi
fi
# Open a file descriptor for flock and acquire lock
LOCK_FILE="/tmp/oe-build-perf-test-wrapper.lock"
if ! exec 3> "$LOCK_FILE"; then
@ -146,11 +166,18 @@ if [ -z "$base_dir" ]; then
fi
echo "Using working dir $base_dir"
if [ -z "$download_dir" ]; then
download_dir="$base_dir/downloads"
fi
if [ -z "$globalres_dir" ]; then
globalres_dir="$base_dir"
fi
timestamp=`date "+%Y%m%d%H%M%S"`
git_rev=$(git rev-parse --short HEAD) || exit 1
build_dir="$base_dir/build-$git_rev-$timestamp"
results_dir="$base_dir/results-$git_rev-$timestamp"
globalres_log="$base_dir/globalres.log"
globalres_log="$globalres_dir/globalres.log"
machine="qemux86"
mkdir -p "$base_dir"
@ -161,7 +188,7 @@ auto_conf="$build_dir/conf/auto.conf"
echo "MACHINE = \"$machine\"" > "$auto_conf"
echo 'BB_NUMBER_THREADS = "8"' >> "$auto_conf"
echo 'PARALLEL_MAKE = "-j 8"' >> "$auto_conf"
echo "DL_DIR = \"$base_dir/downloads\"" >> "$auto_conf"
echo "DL_DIR = \"$download_dir\"" >> "$auto_conf"
# Disabling network sanity check slightly reduces the variance of timing results
echo 'CONNECTIVITY_CHECK_URIS = ""' >> "$auto_conf"
# Possibility to define extra settings