]> Git Repo - qemu.git/blame - tests/qemu-iotests/common.config
qemu-iotests: test qemu-img rebase
[qemu.git] / tests / qemu-iotests / common.config
CommitLineData
6bf19c94
CH
1#!/bin/sh
2#
3# Copyright (C) 2009 Red Hat, Inc.
4# Copyright (c) 2000-2003,2006 Silicon Graphics, Inc. All Rights Reserved.
5#
6# This program is free software; you can redistribute it and/or
7# modify it under the terms of the GNU General Public License as
8# published by the Free Software Foundation.
9#
10# This program is distributed in the hope that it would be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
e8c212d6 16# along with this program. If not, see <http://www.gnu.org/licenses/>.
6bf19c94
CH
17#
18#
19# setup and check for config parameters, and in particular
20#
21# EMAIL - email of the script runner.
22# TEST_DIR - scratch test directory
23#
24# - These can be added to $HOST_CONFIG_DIR (witch default to ./config)
25# below or a separate local configuration file can be used (using
26# the HOST_OPTIONS variable).
27# - This script is shared by the stress test system and the auto-qa
28# system (includes both regression test and benchmark components).
29# - this script shouldn't make any assertions about filesystem
30# validity or mountedness.
31#
32
33# all tests should use a common language setting to prevent golden
34# output mismatches.
35export LANG=C
36
37PATH=".:$PATH"
38
39HOST=`hostname -s`
40HOSTOS=`uname -s`
41
42EMAIL=root@localhost # where auto-qa will send its status messages
43export HOST_OPTIONS=${HOST_OPTIONS:=local.config}
44export CHECK_OPTIONS=${CHECK_OPTIONS:="-g auto"}
45export PWD=`pwd`
46
47# $1 = prog to look for, $2* = default pathnames if not found in $PATH
48set_prog_path()
49{
50 p=`which $1 2> /dev/null`
51 if [ -n "$p" -a -x "$p" ]; then
52 echo $p
53 return 0
54 fi
55 p=$1
56
57 shift
58 for f; do
59 if [ -x $f ]; then
60 echo $f
61 return 0
62 fi
63 done
64
65 echo ""
66 return 1
67}
68
69_fatal()
70{
71 echo "$*"
72 status=1
73 exit 1
74}
75
76export PERL_PROG="`set_prog_path perl`"
77[ "$PERL_PROG" = "" ] && _fatal "perl not found"
78
79export AWK_PROG="`set_prog_path awk`"
80[ "$AWK_PROG" = "" ] && _fatal "awk not found"
81
82export SED_PROG="`set_prog_path sed`"
83[ "$SED_PROG" = "" ] && _fatal "sed not found"
84
85export BC_PROG="`set_prog_path bc`"
86[ "$BC_PROG" = "" ] && _fatal "bc not found"
87
88export PS_ALL_FLAGS="-ef"
89
90export QEMU_PROG="`set_prog_path qemu`"
91[ "$QEMU_PROG" = "" ] && _fatal "qemu not found"
92
93export QEMU_IMG_PROG="`set_prog_path qemu-img`"
94[ "$QEMU_IMG_PROG" = "" ] && _fatal "qemu-img not found"
95
96export QEMU_IO_PROG="`set_prog_path qemu-io`"
97[ "$QEMU_IO_PROG" = "" ] && _fatal "qemu-io not found"
98
99export QEMU=$QEMU_PROG
100export QEMU_IMG=$QEMU_IMG_PROG
101export QEMU_IO="$QEMU_IO_PROG $QEMU_IO_OPTIONS"
102
103[ -f /etc/qemu-iotest.config ] && . /etc/qemu-iotest.config
104
105if [ ! -e "$TEST_DIR" ]; then
106 TEST_DIR=`pwd`/scratch
107fi
108
109if [ ! -d "$TEST_DIR" ]; then
110 echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
111 exit 1
112fi
113
114_readlink()
115{
116 if [ $# -ne 1 ]; then
117 echo "Usage: _readlink filename" 1>&2
118 exit 1
119 fi
120
121 perl -e "\$in=\"$1\";" -e '
122 $lnk = readlink($in);
123 if ($lnk =~ m!^/.*!) {
124 print "$lnk\n";
125 }
126 else {
127 chomp($dir = `dirname $in`);
128 print "$dir/$lnk\n";
129 }'
130}
131
132# make sure this script returns success
133/bin/true
This page took 0.035072 seconds and 4 git commands to generate.