mirror of https://gitee.com/openkylin/libvirt.git
tests: consistently source test-lib.sh in scripts
This unifies the test scripts to all use the similar pattern added for
schematests in ace4aecd
. This gives the following
- Enables running all tests from outside of tests/ dir
- Drops redundant abs_* definitions, which are set by test-lib.sh
- Drops unnecessary srcdir variable which was only used for sourcing
test-lib.sh
Behavior changes:
- srcdir can no longer be overwritten, but I don't know why anyone would
really need to...
- Script VERBOSE setting no longer prints commands executed by test-lib.sh.
if anyone cares I suggest handling this in test-lib.sh which already
has other verbose style handling
This commit is contained in:
parent
18644491de
commit
856e84a516
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=$(dirname $0)}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
. $abs_srcdir/schematestutils.sh
|
||||
|
||||
DIRS="capabilityschemadata xencapsdata"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=$(dirname $0)}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
. $abs_srcdir/schematestutils.sh
|
||||
|
||||
DIRS=""
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=$(dirname $0)}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
. $abs_srcdir/schematestutils.sh
|
||||
|
||||
DIRS=""
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=$(dirname $0)}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
. $abs_srcdir/schematestutils.sh
|
||||
|
||||
DIRS="domainsnapshotxml2xmlin domainsnapshotxml2xmlout"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=$(dirname $0)}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
. $abs_srcdir/schematestutils.sh
|
||||
|
||||
DIRS="interfaceschemadata"
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
#!/bin/sh
|
||||
# Ensure that libvirt fails when given nonexistent --config=FILE
|
||||
|
||||
test -z "$srcdir" && srcdir=$(pwd)
|
||||
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
|
||||
test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$abs_top_builddir/daemon/libvirtd --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
fail=0
|
||||
|
||||
$abs_top_builddir/daemon/libvirtd --config=no-such-conf --timeout=5 2> log
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
#!/bin/sh
|
||||
# Get coverage of virsh pool-define-as XML formatting
|
||||
|
||||
test -z "$srcdir" && srcdir=$(pwd)
|
||||
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
|
||||
test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$abs_top_builddir/tools/virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
fail=0
|
||||
|
||||
pwd=$(pwd) || fail=1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=$(dirname $0)}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
. $abs_srcdir/schematestutils.sh
|
||||
|
||||
DIRS="../src/network networkxml2xmlin networkxml2xmlout"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=$(dirname $0)}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
. $abs_srcdir/schematestutils.sh
|
||||
|
||||
DIRS="nodedevschemadata"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=$(dirname $0)}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
. $abs_srcdir/schematestutils.sh
|
||||
|
||||
DIRS="nwfilterxml2xmlout"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=$(dirname $0)}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
. $abs_srcdir/schematestutils.sh
|
||||
|
||||
DIRS="secretxml2xmlin"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=$(dirname $0)}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
. $abs_srcdir/schematestutils.sh
|
||||
|
||||
DIRS="storagepoolxml2xmlin storagepoolxml2xmlout storagepoolschemadata"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=$(dirname $0)}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
. $abs_srcdir/schematestutils.sh
|
||||
|
||||
DIRS="storagevolxml2xmlin storagevolxml2xmlout storagevolschemadata"
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
test -z "$srcdir" && srcdir=$(pwd)
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
test_intro $this_test
|
||||
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
# along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
test -z "$srcdir" && srcdir=$(pwd)
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
test_expensive
|
||||
|
||||
|
|
|
@ -17,17 +17,13 @@
|
|||
# along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
test -z "$srcdir" && srcdir=$(pwd)
|
||||
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
|
||||
test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$abs_top_builddir/tools/virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
fail=0
|
||||
|
||||
# generate input
|
||||
|
|
|
@ -2,17 +2,13 @@
|
|||
# Exercise a bug whereby defining a valid domain could kill libvirtd.
|
||||
# The bug can also be exercised with a simple define/dumpxml pair to virsh.
|
||||
|
||||
test -z "$srcdir" && srcdir=$(pwd)
|
||||
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
|
||||
test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$abs_top_builddir/tools/virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
fail=0
|
||||
|
||||
# Domain definition from Cole Robinson.
|
||||
|
|
|
@ -2,17 +2,13 @@
|
|||
# Ensure that an invalid domain ID isn't interpreted as a valid one.
|
||||
# Before, an ID of 2^32+2 would be treated just like an ID of 2.
|
||||
|
||||
test -z "$srcdir" && srcdir=$(pwd)
|
||||
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
|
||||
test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$abs_top_builddir/tools/virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
echo "error: failed to get domain '4294967298'" > exp || fail=1
|
||||
$abs_top_builddir/tools/virsh --quiet \
|
||||
--connect test://$abs_top_srcdir/examples/xml/test/testnode.xml \
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
# along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
: ${srcdir=$(pwd)}
|
||||
: ${abs_top_srcdir=$(pwd)/..}
|
||||
: ${abs_top_builddir=$(pwd)/..}
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
# If $abs_top_builddir/tools is not early in $PATH, put it there,
|
||||
# so that we can safely invoke "virsh" simply with its name.
|
||||
|
@ -34,8 +32,6 @@ if test "$VERBOSE" = yes; then
|
|||
virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
cat <<\EOF > exp-out || framework_failure
|
||||
|
||||
setvcpus: <domain> trying as domain NAME
|
||||
|
|
|
@ -17,17 +17,13 @@
|
|||
# along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
test -z "$srcdir" && srcdir=`pwd`
|
||||
test -z "$abs_top_srcdir" && abs_top_srcdir=`pwd`/..
|
||||
test -z "$abs_top_builddir" && abs_top_builddir=`pwd`/..
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$abs_top_builddir/tools/virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
fail=0
|
||||
|
||||
# Output a valid definition, to be used as input.
|
||||
|
|
|
@ -17,17 +17,13 @@
|
|||
# along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
test -z "$srcdir" && srcdir=`pwd`
|
||||
test -z "$abs_top_srcdir" && abs_top_srcdir=`pwd`/..
|
||||
test -z "$abs_top_builddir" && abs_top_builddir=`pwd`/..
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$abs_top_builddir/tools/virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
fail=0
|
||||
|
||||
cat <<\EOF > dom
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
# along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
: ${srcdir=$(pwd)}
|
||||
: ${abs_top_srcdir=$(pwd)/..}
|
||||
: ${abs_top_builddir=$(pwd)/..}
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
# If $abs_top_builddir/tools is not early in $PATH, put it there,
|
||||
# so that we can safely invoke "virsh" simply with its name.
|
||||
|
@ -34,8 +32,6 @@ if test "$VERBOSE" = yes; then
|
|||
virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
printf 'Scheduler : fair\n\n' > exp-out || framework_failure
|
||||
printf 'error: invalid scheduler option: j\n' > exp-err || framework_failure
|
||||
|
||||
|
|
|
@ -17,17 +17,13 @@
|
|||
# along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
test -z "$srcdir" && srcdir=$(pwd)
|
||||
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
|
||||
test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$abs_top_builddir/tools/virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
fail=0
|
||||
|
||||
test_url=test:///default
|
||||
|
|
|
@ -17,17 +17,13 @@
|
|||
# along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
test -z "$srcdir" && srcdir=$(pwd)
|
||||
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
|
||||
test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$abs_top_builddir/tools/virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
fail=0
|
||||
|
||||
test_url=test:///default
|
||||
|
|
|
@ -17,17 +17,13 @@
|
|||
# along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
test -z "$srcdir" && srcdir=$(pwd)
|
||||
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
|
||||
test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$abs_top_builddir/tools/virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
fail=0
|
||||
|
||||
# Attempt to undefine a running domain, by domain name. Every time a new
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
: ${srcdir=.}
|
||||
. $srcdir/test-lib.sh
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
# This test checks if virsh obeys the proper precedence of different
|
||||
# URI settings
|
||||
|
|
|
@ -17,17 +17,13 @@
|
|||
# along with this program. If not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
test -z "$srcdir" && srcdir=$(pwd)
|
||||
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
|
||||
test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
|
||||
. "$(dirname $0)/test-lib.sh"
|
||||
|
||||
if test "$VERBOSE" = yes; then
|
||||
set -x
|
||||
$abs_top_builddir/tools/virsh --version
|
||||
fi
|
||||
|
||||
. "$srcdir/test-lib.sh"
|
||||
|
||||
fail=0
|
||||
|
||||
# Invalid syntax.
|
||||
|
|
Loading…
Reference in New Issue