]> git.proxmox.com Git - mirror_qemu.git/blame - tests/docker/common.rc
docker: remove unused debian8 partial image
[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
6945018a
AB
14# This might be set by ENV of a docker container... it is always
15# overriden by TARGET_LIST if the user sets it.
16DEF_TARGET_LIST=${DEF_TARGET_LIST:-"x86_64-softmmu,aarch64-softmmu"}
17
3568f98c
FZ
18requires()
19{
20 for c in $@; do
21 if ! echo "$FEATURES" | grep -wq -e "$c"; then
22 echo "Prerequisite '$c' not present, skip"
23 exit 0
24 fi
25 done
26}
27
e4ce964d 28configure_qemu()
3568f98c 29{
9445c28e
FZ
30 config_opts="--enable-werror \
31 ${TARGET_LIST:+--target-list=${TARGET_LIST}} \
05790daf 32 --prefix=$INSTALL_DIR \
24e0131f 33 $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
9445c28e
FZ
34 $@"
35 echo "Configure options:"
36 echo $config_opts
0c153b4c
PMD
37 $QEMU_SRC/configure $config_opts || \
38 { cat config.log && test_fail "Failed to run 'configure'"; }
e4ce964d
AB
39}
40
41build_qemu()
42{
43 configure_qemu $@
0c153b4c 44 make $MAKEFLAGS
3568f98c 45}
82659e84 46
3f9747a7
AB
47check_qemu()
48{
49 # default to make check unless the caller specifies
50 if test -z "$@"; then
51 INVOCATION="check"
52 else
53 INVOCATION="$@"
54 fi
56c115a9
AB
55
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"
61 fi
3f9747a7
AB
62}
63
82659e84
FZ
64test_fail()
65{
66 echo "$@"
67 exit 1
68}
69
70prep_fail()
71{
72 echo "$@"
73 exit 2
74}
62838478
PB
75
76install_qemu()
77{
78 make install $MAKEFLAGS DESTDIR=$PWD/=destdir
79 ret=$?
80 rm -rf $PWD/=destdir
81 return $ret
82}