]> Git Repo - qemu.git/blob - tests/docker/run
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
[qemu.git] / tests / docker / run
1 #!/bin/bash
2 #
3 # Docker test runner
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
14 if test -n "$V"; then
15     set -x
16 fi
17
18 BASE="$(dirname $(readlink -e $0))"
19
20 # Prepare the environment
21 export PATH=/usr/lib/ccache:/usr/lib64/ccache:$PATH
22
23 if test -n "$J"; then
24     export MAKEFLAGS="$MAKEFLAGS -j$J"
25 fi
26
27 # We are in the container so the whole file system belong to us
28 export TEST_DIR=/tmp/qemu-test
29 mkdir -p $TEST_DIR/{src,build,install}
30
31 # Extract the source tarballs
32 tar -C $TEST_DIR/src -xf $BASE/qemu.tar || { echo "Failed to untar source"; exit 2; }
33 if test -f $TEST_DIR/src/Makefile; then
34     export FEATURES="$FEATURES dtc"
35 fi
36
37 if 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
46 fi
47
48 export QEMU_SRC="$TEST_DIR/src"
49 export BUILD_DIR="$TEST_DIR/build"
50 export INSTALL_DIR="$TEST_DIR/install"
51
52 cd "$QEMU_SRC/tests/docker"
53
54 CMD="./$@"
55
56 if test -z "$DEBUG"; then
57     exec $CMD
58 fi
59
60 # DEBUG workflow
61 echo "* Prepared to run command:"
62 echo "  $CMD"
63 echo "* Hit Ctrl-D to continue, or type 'exit 1' to abort"
64 echo
65 $SHELL
66
67 if "$CMD"; then
68     exit 0
69 elif 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
76 else
77     exit 1
78 fi
This page took 0.028905 seconds and 4 git commands to generate.