1#!/bin/bash -e 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 14# Prepare the environment 15. /etc/profile || true 16export PATH=/usr/lib/ccache:$PATH 17 18if test -n "$J"; then 19 export MAKEFLAGS="$MAKEFLAGS -j$J" 20fi 21 22# We are in the container so the whole file system belong to us 23export TEST_DIR=/tmp/qemu-test 24mkdir -p $TEST_DIR/{src,build,install} 25 26# Extract the source tarballs 27tar -C $TEST_DIR/src -xzf qemu.tgz 28for p in dtc pixman; do 29 if test -f $p.tgz; then 30 tar -C $TEST_DIR/src/$p -xzf $p.tgz 31 export FEATURES="$FEATURES $p" 32 fi 33done 34 35export QEMU_SRC="$TEST_DIR/src" 36 37cd "$QEMU_SRC/tests/docker" 38 39CMD="$QEMU_SRC/tests/docker/$@" 40 41if test -n "$DEBUG"; then 42 echo "* Prepared to run command:" 43 echo " $CMD" 44 echo "* Hit Ctrl-D to continue, or type 'exit 1' to abort" 45 echo 46 $SHELL 47fi 48 49if "$CMD"; then 50 exit 0 51elif test -n "$DEBUG"; then 52 echo "* Command failed:" 53 echo " $CMD" 54 echo "* Hit Ctrl-D to exit" 55 echo 56 # Force error after shell exits 57 $SHELL && exit 1 58fi 59