qemu-patch-raspberry4/tests/docker/common.rc
Alex Bennée 3f9747a738 docker: move make check into check_qemu helper
Not all docker images can run the check step. Let's move everything
into a common helper so we don't need to replicate checks in the
future.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2018-07-24 11:45:25 +01:00

73 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
#
# Common routines for docker test scripts.
#
# Copyright (c) 2016 Red Hat Inc.
#
# Authors:
# Fam Zheng <famz@redhat.com>
#
# This work is licensed under the terms of the GNU GPL, version 2
# or (at your option) any later version. See the COPYING file in
# the top-level directory.
requires()
{
for c in $@; do
if ! echo "$FEATURES" | grep -wq -e "$c"; then
echo "Prerequisite '$c' not present, skip"
exit 0
fi
done
}
configure_qemu()
{
config_opts="--enable-werror \
${TARGET_LIST:+--target-list=${TARGET_LIST}} \
--prefix=$INSTALL_DIR \
$QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
$@"
echo "Configure options:"
echo $config_opts
$QEMU_SRC/configure $config_opts || \
{ cat config.log && test_fail "Failed to run 'configure'"; }
}
build_qemu()
{
configure_qemu $@
make $MAKEFLAGS
}
check_qemu()
{
# default to make check unless the caller specifies
if test -z "$@"; then
INVOCATION="check"
else
INVOCATION="$@"
fi
make $MAKEFLAGS $INVOCATION
}
test_fail()
{
echo "$@"
exit 1
}
prep_fail()
{
echo "$@"
exit 2
}
install_qemu()
{
make install $MAKEFLAGS DESTDIR=$PWD/=destdir
ret=$?
rm -rf $PWD/=destdir
return $ret
}