2016-06-01 07:25:20 +03: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.
|
|
|
|
|
2019-08-09 16:48:45 +03:00
|
|
|
# This might be set by ENV of a docker container... it is always
|
2021-09-22 18:15:27 +03:00
|
|
|
# overriden by TARGET_LIST if the user sets it. We special case
|
|
|
|
# "none" to allow for other options like --disable-tcg to restrict the
|
|
|
|
# builds we eventually do.
|
|
|
|
if test "$DEF_TARGET_LIST" = "none"; then
|
|
|
|
DEF_TARGET_LIST=""
|
|
|
|
else
|
|
|
|
DEF_TARGET_LIST=${DEF_TARGET_LIST:-"x86_64-softmmu,aarch64-softmmu"}
|
|
|
|
fi
|
2019-08-09 16:48:45 +03:00
|
|
|
|
2021-07-09 17:29:38 +03:00
|
|
|
requires_binary()
|
2016-06-01 07:25:20 +03:00
|
|
|
{
|
2021-07-09 17:29:38 +03:00
|
|
|
found=0
|
2016-06-01 07:25:20 +03:00
|
|
|
for c in $@; do
|
2021-07-09 17:29:38 +03:00
|
|
|
for d in /bin /usr/bin /usr/local/bin
|
|
|
|
do
|
|
|
|
if test -f "$d/$c"
|
|
|
|
then
|
|
|
|
found=1
|
|
|
|
fi
|
|
|
|
done
|
2016-06-01 07:25:20 +03:00
|
|
|
done
|
2021-07-09 17:29:38 +03:00
|
|
|
if test "$found" != "1"
|
|
|
|
then
|
|
|
|
echo "Prerequisite '$c' not present, skip"
|
|
|
|
exit 0
|
|
|
|
fi
|
2016-06-01 07:25:20 +03:00
|
|
|
}
|
|
|
|
|
2018-07-09 12:58:34 +03:00
|
|
|
configure_qemu()
|
2016-06-01 07:25:20 +03:00
|
|
|
{
|
2016-09-21 06:49:25 +03:00
|
|
|
config_opts="--enable-werror \
|
|
|
|
${TARGET_LIST:+--target-list=${TARGET_LIST}} \
|
2017-08-17 06:57:21 +03:00
|
|
|
--prefix=$INSTALL_DIR \
|
2017-02-20 13:51:37 +03:00
|
|
|
$QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
|
2016-09-21 06:49:25 +03:00
|
|
|
$@"
|
|
|
|
echo "Configure options:"
|
|
|
|
echo $config_opts
|
2018-03-15 17:27:13 +03:00
|
|
|
$QEMU_SRC/configure $config_opts || \
|
|
|
|
{ cat config.log && test_fail "Failed to run 'configure'"; }
|
2018-07-09 12:58:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
build_qemu()
|
|
|
|
{
|
|
|
|
configure_qemu $@
|
2018-03-15 17:27:13 +03:00
|
|
|
make $MAKEFLAGS
|
2016-06-01 07:25:20 +03:00
|
|
|
}
|
2017-09-05 05:56:10 +03:00
|
|
|
|
2018-07-09 15:27:54 +03:00
|
|
|
check_qemu()
|
|
|
|
{
|
|
|
|
# default to make check unless the caller specifies
|
2020-07-01 16:56:28 +03:00
|
|
|
if [ $# = 0 ]; then
|
2018-07-09 15:27:54 +03:00
|
|
|
INVOCATION="check"
|
|
|
|
else
|
|
|
|
INVOCATION="$@"
|
|
|
|
fi
|
2018-07-09 16:27:47 +03:00
|
|
|
|
2019-12-18 04:30:11 +03:00
|
|
|
make $MAKEFLAGS $INVOCATION
|
2018-07-09 15:27:54 +03:00
|
|
|
}
|
|
|
|
|
2017-09-05 05:56:10 +03:00
|
|
|
test_fail()
|
|
|
|
{
|
|
|
|
echo "$@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
prep_fail()
|
|
|
|
{
|
|
|
|
echo "$@"
|
|
|
|
exit 2
|
|
|
|
}
|
2017-09-22 18:49:31 +03:00
|
|
|
|
|
|
|
install_qemu()
|
|
|
|
{
|
|
|
|
make install $MAKEFLAGS DESTDIR=$PWD/=destdir
|
|
|
|
ret=$?
|
|
|
|
rm -rf $PWD/=destdir
|
|
|
|
return $ret
|
|
|
|
}
|