]> git.proxmox.com Git - mirror_qemu.git/blame - tests/docker/run
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-20190206' into staging
[mirror_qemu.git] / tests / docker / run
CommitLineData
4f6afe41 1#!/bin/bash
b344aa91
FZ
2#
3# Docker test runner
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
c8158513
FZ
14if test -n "$V"; then
15 set -x
16fi
17
18BASE="$(dirname $(readlink -e $0))"
19
b344aa91 20# Prepare the environment
6a2e1197 21export PATH=/usr/lib/ccache:/usr/lib64/ccache:$PATH
b344aa91
FZ
22
23if test -n "$J"; then
24 export MAKEFLAGS="$MAKEFLAGS -j$J"
25fi
26
27# We are in the container so the whole file system belong to us
28export TEST_DIR=/tmp/qemu-test
29mkdir -p $TEST_DIR/{src,build,install}
30
31# Extract the source tarballs
18580922 32tar -C $TEST_DIR/src -xf $BASE/qemu.tar || { echo "Failed to untar source"; exit 2; }
299d296e
FZ
33if test -f $TEST_DIR/src/Makefile; then
34 export FEATURES="$FEATURES dtc"
35fi
b344aa91 36
ec960b9a
FZ
37if test -n "$SHOW_ENV"; then
38 if test -f /packages.txt; then
39 echo "Packages installed:"
40 cat /packages.txt
41 echo
42 fi
43 echo "Environment variables:"
44 env
45 echo
46fi
47
b344aa91 48export QEMU_SRC="$TEST_DIR/src"
05790daf
FZ
49export BUILD_DIR="$TEST_DIR/build"
50export INSTALL_DIR="$TEST_DIR/install"
b344aa91
FZ
51
52cd "$QEMU_SRC/tests/docker"
53
05790daf 54CMD="./$@"
b344aa91 55
9b77336d
FZ
56if test -z "$DEBUG"; then
57 exec $CMD
b344aa91
FZ
58fi
59
9b77336d
FZ
60# DEBUG workflow
61echo "* Prepared to run command:"
62echo " $CMD"
63echo "* Hit Ctrl-D to continue, or type 'exit 1' to abort"
64echo
65$SHELL
66
b344aa91
FZ
67if "$CMD"; then
68 exit 0
69elif test -n "$DEBUG"; then
70 echo "* Command failed:"
71 echo " $CMD"
72 echo "* Hit Ctrl-D to exit"
73 echo
74 # Force error after shell exits
75 $SHELL && exit 1
1ad76b8a
FZ
76else
77 exit 1
b344aa91 78fi