]> git.proxmox.com Git - mirror_qemu.git/blame - tests/docker/common.rc
minikconf: do not include variables from MINIKCONF_ARGS in config-all-devices.mak
[mirror_qemu.git] / tests / docker / common.rc
CommitLineData
3568f98c
FZ
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
e4ce964d 24configure_qemu()
3568f98c 25{
9445c28e
FZ
26 config_opts="--enable-werror \
27 ${TARGET_LIST:+--target-list=${TARGET_LIST}} \
05790daf 28 --prefix=$INSTALL_DIR \
24e0131f 29 $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
9445c28e
FZ
30 $@"
31 echo "Configure options:"
32 echo $config_opts
0c153b4c
PMD
33 $QEMU_SRC/configure $config_opts || \
34 { cat config.log && test_fail "Failed to run 'configure'"; }
e4ce964d
AB
35}
36
37build_qemu()
38{
39 configure_qemu $@
0c153b4c 40 make $MAKEFLAGS
3568f98c 41}
82659e84 42
3f9747a7
AB
43check_qemu()
44{
45 # default to make check unless the caller specifies
46 if test -z "$@"; then
47 INVOCATION="check"
48 else
49 INVOCATION="$@"
50 fi
56c115a9
AB
51
52 if command -v gtester > /dev/null 2>&1 && \
53 gtester --version > /dev/null 2>&1; then
54 make $MAKEFLAGS $INVOCATION
55 else
56 echo "No working gtester, skipping make $INVOCATION"
57 fi
3f9747a7
AB
58}
59
82659e84
FZ
60test_fail()
61{
62 echo "$@"
63 exit 1
64}
65
66prep_fail()
67{
68 echo "$@"
69 exit 2
70}
62838478
PB
71
72install_qemu()
73{
74 make install $MAKEFLAGS DESTDIR=$PWD/=destdir
75 ret=$?
76 rm -rf $PWD/=destdir
77 return $ret
78}