xemu/tests/docker/common.rc
Alex Bennée 17888749ba tests/docker: add a debian-native image and make available
This image is intended for building whatever the native versions of
QEMU are for the host architecture. This will hopefully be an aid for
3rd parties who want to be able to build QEMU themselves without
redoing all the dependencies themselves.

We disable the registry because we currently don't have multi-arch
support there.

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>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Acked-by: Willian Rampazzo <willianr@redhat.com>
Message-Id: <20210922151528.2192966-1-alex.bennee@linaro.org>
2021-10-12 08:38:10 +01:00

93 lines
1.8 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.
# This might be set by ENV of a docker container... it is always
# 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
requires_binary()
{
found=0
for c in $@; do
for d in /bin /usr/bin /usr/local/bin
do
if test -f "$d/$c"
then
found=1
fi
done
done
if test "$found" != "1"
then
echo "Prerequisite '$c' not present, skip"
exit 0
fi
}
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 [ $# = 0 ]; 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
}