xref: /qemu/tests/docker/common.rc (revision 7271a819)
1#!/bin/sh
2#
3# Common routines for docker test scripts.
4#
5# Copyright (c) 2016 Red Hat Inc.
6#
7# Authors:
8#  Fam Zheng <famz@redhat.com>
9#
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.
13
14requires()
15{
16    for c in $@; do
17        if ! echo "$FEATURES" | grep -wq -e "$c"; then
18            echo "Prerequisite '$c' not present, skip"
19            exit 0
20        fi
21    done
22}
23
24build_qemu()
25{
26    config_opts="--enable-werror \
27                 ${TARGET_LIST:+--target-list=${TARGET_LIST}} \
28                 --prefix=$INSTALL_DIR \
29                 $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
30                 $@"
31    echo "Configure options:"
32    echo $config_opts
33    $QEMU_SRC/configure $config_opts && make $MAKEFLAGS
34}
35
36test_fail()
37{
38    echo "$@"
39    exit 1
40}
41
42prep_fail()
43{
44    echo "$@"
45    exit 2
46}
47
48install_qemu()
49{
50    make install $MAKEFLAGS DESTDIR=$PWD/=destdir
51    ret=$?
52    rm -rf $PWD/=destdir
53    return $ret
54}
55