2016-06-01 06:25:20 +02:00
|
|
|
#!/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
|
|
|
|
}
|
|
|
|
|
2018-07-09 11:58:34 +02:00
|
|
|
configure_qemu()
|
2016-06-01 06:25:20 +02:00
|
|
|
{
|
2016-09-21 05:49:25 +02:00
|
|
|
config_opts="--enable-werror \
|
|
|
|
${TARGET_LIST:+--target-list=${TARGET_LIST}} \
|
2017-08-17 05:57:21 +02:00
|
|
|
--prefix=$INSTALL_DIR \
|
2017-02-20 11:51:37 +01:00
|
|
|
$QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
|
2016-09-21 05:49:25 +02:00
|
|
|
$@"
|
|
|
|
echo "Configure options:"
|
|
|
|
echo $config_opts
|
2018-03-15 15:27:13 +01:00
|
|
|
$QEMU_SRC/configure $config_opts || \
|
|
|
|
{ cat config.log && test_fail "Failed to run 'configure'"; }
|
2018-07-09 11:58:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
build_qemu()
|
|
|
|
{
|
|
|
|
configure_qemu $@
|
2018-03-15 15:27:13 +01:00
|
|
|
make $MAKEFLAGS
|
2016-06-01 06:25:20 +02:00
|
|
|
}
|
2017-09-05 04:56:10 +02:00
|
|
|
|
2018-07-09 14:27:54 +02:00
|
|
|
check_qemu()
|
|
|
|
{
|
|
|
|
# default to make check unless the caller specifies
|
|
|
|
if test -z "$@"; then
|
|
|
|
INVOCATION="check"
|
|
|
|
else
|
|
|
|
INVOCATION="$@"
|
|
|
|
fi
|
2018-07-09 15:27:47 +02:00
|
|
|
|
|
|
|
if command -v gtester > /dev/null 2>&1 && \
|
|
|
|
gtester --version > /dev/null 2>&1; then
|
|
|
|
make $MAKEFLAGS $INVOCATION
|
|
|
|
else
|
|
|
|
echo "No working gtester, skipping make $INVOCATION"
|
|
|
|
fi
|
2018-07-09 14:27:54 +02:00
|
|
|
}
|
|
|
|
|
2017-09-05 04:56:10 +02:00
|
|
|
test_fail()
|
|
|
|
{
|
|
|
|
echo "$@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
prep_fail()
|
|
|
|
{
|
|
|
|
echo "$@"
|
|
|
|
exit 2
|
|
|
|
}
|
2017-09-22 17:49:31 +02:00
|
|
|
|
|
|
|
install_qemu()
|
|
|
|
{
|
|
|
|
make install $MAKEFLAGS DESTDIR=$PWD/=destdir
|
|
|
|
ret=$?
|
|
|
|
rm -rf $PWD/=destdir
|
|
|
|
return $ret
|
|
|
|
}
|