hw/mips/malta: Fix the malta machine on big endian hosts
[qemu/ar7.git] / tests / docker / common.rc
blob9a33df2832e539dc480975f036073b656b5a9bf0
1 #!/bin/sh
3 # Common routines for docker test scripts.
5 # Copyright (c) 2016 Red Hat Inc.
7 # Authors:
8 # Fam Zheng <famz@redhat.com>
10 # This work is licensed under the terms of the GNU GPL, version 2
11 # or (at your option) any later version. See the COPYING file in
12 # the top-level directory.
14 # This might be set by ENV of a docker container... it is always
15 # overriden by TARGET_LIST if the user sets it. We special case
16 # "none" to allow for other options like --disable-tcg to restrict the
17 # builds we eventually do.
18 if test "$DEF_TARGET_LIST" = "none"; then
19 DEF_TARGET_LIST=""
20 else
21 DEF_TARGET_LIST=${DEF_TARGET_LIST:-"x86_64-softmmu,aarch64-softmmu"}
24 requires_binary()
26 found=0
27 for c in $@; do
28 for d in /bin /usr/bin /usr/local/bin
30 if test -f "$d/$c"
31 then
32 found=1
34 done
35 done
36 if test "$found" != "1"
37 then
38 echo "Prerequisite '$c' not present, skip"
39 exit 0
43 configure_qemu()
45 config_opts="--enable-werror \
46 ${TARGET_LIST:+--target-list=${TARGET_LIST}} \
47 --prefix=$INSTALL_DIR \
48 $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
49 $@"
50 echo "Configure options:"
51 echo $config_opts
52 $QEMU_SRC/configure $config_opts || \
53 { cat config.log && test_fail "Failed to run 'configure'"; }
56 build_qemu()
58 configure_qemu $@
59 make $MAKEFLAGS
62 check_qemu()
64 # default to make check unless the caller specifies
65 if [ $# = 0 ]; then
66 INVOCATION="${TEST_COMMAND:-make $MAKEFLAGS check}"
67 else
68 INVOCATION="make $MAKEFLAGS $@"
71 $INVOCATION
74 test_fail()
76 echo "$@"
77 exit 1
80 prep_fail()
82 echo "$@"
83 exit 2
86 install_qemu()
88 make install $MAKEFLAGS DESTDIR=$PWD/=destdir
89 ret=$?
90 rm -rf $PWD/=destdir
91 return $ret