xref: /kvm-unit-tests/run_tests.sh (revision e9ae9613dfae8872a0162566d53d3906948fd739)
1#!/bin/bash
2
3verbose="no"
4
5if [ ! -f config.mak ]; then
6    echo "run ./configure && make first. See ./configure -h"
7    exit 1
8fi
9source config.mak
10source scripts/functions.bash
11
12function usage()
13{
14cat <<EOF
15
16Usage: $0 [-g group] [-h] [-v]
17
18    -g: Only execute tests in the given group
19    -h: Output this help text
20    -v: Enables verbose mode
21
22Set the environment variable QEMU=/path/to/qemu-system-ARCH to
23specify the appropriate qemu binary for ARCH-run.
24
25EOF
26}
27
28RUNTIME_arch_run="./$TEST_DIR/run"
29source scripts/runtime.bash
30
31while getopts "g:hv" opt; do
32    case $opt in
33        g)
34            only_group=$OPTARG
35            ;;
36        h)
37            usage
38            exit
39            ;;
40        v)
41            verbose="yes"
42            ;;
43        *)
44            exit 1
45            ;;
46    esac
47done
48
49RUNTIME_log_stdout () {
50    if [ "$PRETTY_PRINT_STACKS" = "yes" ]; then
51        ./scripts/pretty_print_stacks.py $1 >> test.log
52    else
53        cat >> test.log
54    fi
55}
56
57
58config=$TEST_DIR/unittests.cfg
59rm -f test.log
60printf "BUILD_HEAD=$(cat build-head)\n\n" > test.log
61for_each_unittest $config run
62