ppc/pnv: Introduce PnvMachineClass::dt_power_mgt()
[qemu/ar7.git] / tests / docker / common.rc
blob512202b0a19e93a8468c2614d8deee15ada7939e
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.
16 DEF_TARGET_LIST=${DEF_TARGET_LIST:-"x86_64-softmmu,aarch64-softmmu"}
18 requires()
20 for c in $@; do
21 if ! echo "$FEATURES" | grep -wq -e "$c"; then
22 echo "Prerequisite '$c' not present, skip"
23 exit 0
25 done
28 configure_qemu()
30 config_opts="--enable-werror \
31 ${TARGET_LIST:+--target-list=${TARGET_LIST}} \
32 --prefix=$INSTALL_DIR \
33 $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
34 $@"
35 echo "Configure options:"
36 echo $config_opts
37 $QEMU_SRC/configure $config_opts || \
38 { cat config.log && test_fail "Failed to run 'configure'"; }
41 build_qemu()
43 configure_qemu $@
44 make $MAKEFLAGS
47 check_qemu()
49 # default to make check unless the caller specifies
50 if test -z "$@"; then
51 INVOCATION="check"
52 else
53 INVOCATION="$@"
56 if command -v gtester > /dev/null 2>&1 && \
57 gtester --version > /dev/null 2>&1; then
58 make $MAKEFLAGS $INVOCATION
59 else
60 echo "No working gtester, skipping make $INVOCATION"
64 test_fail()
66 echo "$@"
67 exit 1
70 prep_fail()
72 echo "$@"
73 exit 2
76 install_qemu()
78 make install $MAKEFLAGS DESTDIR=$PWD/=destdir
79 ret=$?
80 rm -rf $PWD/=destdir
81 return $ret