]> Git Repo - qemu.git/blame - tests/docker/common.rc
works with less than base ISA qemu-system-riscv32 -M virt -bios none -kernel output...
[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 <[email protected]>
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 14# This might be set by ENV of a docker container... it is always
17888749
AB
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.
18if test "$DEF_TARGET_LIST" = "none"; then
19 DEF_TARGET_LIST=""
20else
21 DEF_TARGET_LIST=${DEF_TARGET_LIST:-"x86_64-softmmu,aarch64-softmmu"}
22fi
6945018a 23
888673bb 24requires_binary()
3568f98c 25{
888673bb 26 found=0
3568f98c 27 for c in $@; do
888673bb
DB
28 for d in /bin /usr/bin /usr/local/bin
29 do
30 if test -f "$d/$c"
31 then
32 found=1
33 fi
34 done
3568f98c 35 done
888673bb
DB
36 if test "$found" != "1"
37 then
38 echo "Prerequisite '$c' not present, skip"
39 exit 0
40 fi
3568f98c
FZ
41}
42
e4ce964d 43configure_qemu()
3568f98c 44{
9445c28e
FZ
45 config_opts="--enable-werror \
46 ${TARGET_LIST:+--target-list=${TARGET_LIST}} \
05790daf 47 --prefix=$INSTALL_DIR \
24e0131f 48 $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
9445c28e
FZ
49 $@"
50 echo "Configure options:"
51 echo $config_opts
0c153b4c
PMD
52 $QEMU_SRC/configure $config_opts || \
53 { cat config.log && test_fail "Failed to run 'configure'"; }
e4ce964d
AB
54}
55
56build_qemu()
57{
58 configure_qemu $@
0c153b4c 59 make $MAKEFLAGS
3568f98c 60}
82659e84 61
3f9747a7
AB
62check_qemu()
63{
64 # default to make check unless the caller specifies
10c927dc 65 if [ $# = 0 ]; then
e558220d 66 INVOCATION="${TEST_COMMAND:-make $MAKEFLAGS check}"
3f9747a7 67 else
e558220d 68 INVOCATION="make $MAKEFLAGS $@"
3f9747a7 69 fi
56c115a9 70
e558220d 71 $INVOCATION
3f9747a7
AB
72}
73
82659e84
FZ
74test_fail()
75{
76 echo "$@"
77 exit 1
78}
79
80prep_fail()
81{
82 echo "$@"
83 exit 2
84}
62838478
PB
85
86install_qemu()
87{
88 make install $MAKEFLAGS DESTDIR=$PWD/=destdir
89 ret=$?
90 rm -rf $PWD/=destdir
91 return $ret
92}
This page took 0.322728 seconds and 5 git commands to generate.