From: Cole Robinson Date: Thu, 21 Apr 2016 15:30:55 +0000 (-0400) Subject: tests: consistently name virsh tests with 'virsh-' prefix X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=6cf52a2ffde04c14a024536e4130e35c2c74cff6;p=libvirt.git tests: consistently name virsh tests with 'virsh-' prefix --- diff --git a/tests/Makefile.am b/tests/Makefile.am index b32435d2f3..edf7b22c43 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -368,22 +368,22 @@ test_scripts = \ secretschematest libvirtd_test_scripts = \ - test_conf.sh \ - cpuset \ - define-dev-segfault \ - int-overflow \ libvirtd-fail \ libvirtd-pool \ - read-bufsiz \ - read-non-seekable \ - start \ - virsh-uriprecedence \ - vcpupin \ + test_conf.sh \ virsh-all \ + virsh-cpuset \ + virsh-define-dev-segfault \ + virsh-int-overflow \ virsh-optparse \ + virsh-read-bufsiz \ + virsh-read-non-seekable \ virsh-schedinfo \ + virsh-start \ virsh-synopsis \ virsh-undefine \ + virsh-uriprecedence \ + virsh-vcpupin \ $(NULL) if WITH_LIBVIRTD diff --git a/tests/cpuset b/tests/cpuset deleted file mode 100755 index 35803be02c..0000000000 --- a/tests/cpuset +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -# ensure that defining with an invalid vCPU cpuset elicits a diagnostic - -# Copyright (C) 2008-2009 Red Hat, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see -# . - -test -z "$srcdir" && srcdir=$(pwd) -test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/.. -test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/.. - -if test "$VERBOSE" = yes; then - set -x - $abs_top_builddir/tools/virsh --version -fi - -. "$srcdir/test-lib.sh" - -fail=0 - -# generate input -$abs_top_builddir/tools/virsh --connect test:///default dumpxml 1 > xml || fail=1 - -# require the presence of the string we'll transform -grep ' /dev/null || fail=1 - -sed "s/vcpu placement='static'>/vcpu cpuset='aaa'>/" xml > xml-invalid || fail=1 - -# Require failure and a diagnostic. -$abs_top_builddir/tools/virsh --connect test:///default define xml-invalid > out 2>&1 && fail=1 -cat <<\EOF > exp || fail=1 -error: Failed to define domain from xml-invalid -error: invalid argument: Failed to parse bitmap 'aaa' - -EOF -compare exp out || fail=1 - -(exit $fail); exit $fail diff --git a/tests/define-dev-segfault b/tests/define-dev-segfault deleted file mode 100755 index 81a8773def..0000000000 --- a/tests/define-dev-segfault +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -# 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)/.. - -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. -cat <<\EOF > D.xml || fail=1 - - D - aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82 - 262144 - 262144 - 1 - - hvm - - - - - - - destroy - restart - destroy - - /usr/bin/qemu-kvm - - - - - - - - - - - - - - - - - - - - - - - - - - - -EOF - -url=test:///default -$abs_top_builddir/tools/virsh --connect "$url" 'define D.xml; dumpxml D' > out 2>&1 || fail=1 - -cat > exp < exp || fail=1 -$abs_top_builddir/tools/virsh --quiet \ - --connect test://$abs_top_srcdir/examples/xml/test/testnode.xml \ - 'domname 4294967298; quit' > /dev/null 2> err || fail=1 -diff -u err exp || fail=1 - -exit $fail diff --git a/tests/read-bufsiz b/tests/read-bufsiz deleted file mode 100755 index 23c3b531d9..0000000000 --- a/tests/read-bufsiz +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# ensure that reading a file larger than BUFSIZ works - -# Copyright (C) 2008, 2010 Red Hat, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see -# . - -test -z "$srcdir" && srcdir=`pwd` -test -z "$abs_top_srcdir" && abs_top_srcdir=`pwd`/.. -test -z "$abs_top_builddir" && abs_top_builddir=`pwd`/.. - -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. -$abs_top_builddir/tools/virsh -c test:///default dumpxml 1 > xml.t || fail=1 - -# Change the VM name and UUID -sed -e "s|test|newtest|g" \ - -e "\|.*|d" \ - xml.t > xml - -for i in before after; do - # The largest BUFSIZ I've seen is 128K. This is slightly larger. - printf %132000s ' ' > sp || fail=1 - in=in-$i - # Append or prepend enough spaces to push the size over the limit: - ( test $i = before && cat sp xml || cat xml sp ) > $in || fail=1 - - $abs_top_builddir/tools/virsh --connect test:///default define $in > out || fail=1 - printf "Domain newtest defined from $in\n\n" > exp || fail=1 - compare exp out || fail=1 -done - -(exit $fail); exit $fail diff --git a/tests/read-non-seekable b/tests/read-non-seekable deleted file mode 100755 index 46e2831eb9..0000000000 --- a/tests/read-non-seekable +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# ensure that certain file-reading commands can handle non-seekable files - -# Copyright (C) 2008 Red Hat, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see -# . - -test -z "$srcdir" && srcdir=`pwd` -test -z "$abs_top_srcdir" && abs_top_srcdir=`pwd`/.. -test -z "$abs_top_builddir" && abs_top_builddir=`pwd`/.. - -if test "$VERBOSE" = yes; then - set -x - $abs_top_builddir/tools/virsh --version -fi - -. "$srcdir/test-lib.sh" - -fail=0 - -cat <<\EOF > dom - - t2 - 004b96e1-2d78-c30f-5aa5-000000000000 - 8388608 - 2 - - xen - - restart - destroy - restart - -EOF - -$abs_top_builddir/tools/virsh -c test:///default define dom > /dev/null || fail=1 - -mkfifo_or_skip_ fifo -cat dom > fifo & - -$abs_top_builddir/tools/virsh -c test:///default define fifo > /dev/null || fail=1 - -(exit $fail); exit $fail diff --git a/tests/start b/tests/start deleted file mode 100755 index 5d4c0a73c7..0000000000 --- a/tests/start +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# ensure that virsh start works properly - -# Copyright (C) 2008 Red Hat, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see -# . - -test -z "$srcdir" && srcdir=$(pwd) -test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/.. -test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/.. - -if test "$VERBOSE" = yes; then - set -x - $abs_top_builddir/tools/virsh --version -fi - -. "$srcdir/test-lib.sh" - -fail=0 - -test_url=test:///default - -# expect this to fail -$abs_top_builddir/tools/virsh -c $test_url start test > out 2> err && fail=1 - -# stdout gets a newline -echo > exp || fail=1 -compare exp out || fail=1 - -echo 'error: Domain is already active' > exp || fail=1 -compare exp err || fail=1 - -(exit $fail); exit $fail diff --git a/tests/vcpupin b/tests/vcpupin deleted file mode 100755 index 9e656c0aa1..0000000000 --- a/tests/vcpupin +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -# ensure that an invalid CPU spec elicits a diagnostic - -# Copyright (C) 2008 Red Hat, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see -# . - -test -z "$srcdir" && srcdir=$(pwd) -test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/.. -test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/.. - -if test "$VERBOSE" = yes; then - set -x - $abs_top_builddir/tools/virsh --version -fi - -. "$srcdir/test-lib.sh" - -fail=0 - -# Invalid syntax. -$abs_top_builddir/tools/virsh --connect test:///default vcpupin test a 0,1 > out 2>&1 -test $? = 1 || fail=1 -cat <<\EOF > exp || fail=1 -error: Numeric value 'a' for option is malformed or out of range - -EOF -compare exp out || fail=1 - -# An out-of-range vCPU number deserves a diagnostic, too. -$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 0,1 > out 2>&1 -test $? = 1 || fail=1 -cat <<\EOF > exp || fail=1 -error: invalid argument: requested vcpu '100' is not present in the domain - -EOF -compare exp out || fail=1 - -# Negative number -$abs_top_builddir/tools/virsh --connect test:///default vcpupin test -100 0,1 > out 2>&1 -test $? = 1 || fail=1 -cat <<\EOF > exp || fail=1 -error: Numeric value '-100' for option is malformed or out of range - -EOF -compare exp out || fail=1 - -# missing argument -$abs_top_builddir/tools/virsh --connect test:///default vcpupin test --cpulist 0,1 > out 2>&1 -test $? = 1 || fail=1 -cat <<\EOF > exp || fail=1 -error: vcpupin: Missing vCPU number in pin mode. - -EOF -compare exp out || fail=1 - -# An out-of-range vCPU number when get information with live flag -$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --live > out 2>&1 -test $? = 1 || fail=1 -cat <<\EOF > exp || fail=1 -error: vcpu 100 is out of range of live cpu count 2 - -EOF -compare exp out || fail=1 - -# An out-of-range vCPU number when get information without flag -$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 > out 2>&1 -test $? = 1 || fail=1 -cat <<\EOF > exp || fail=1 -error: vcpu 100 is out of range of live cpu count 2 - -EOF -compare exp out || fail=1 - -# An out-of-range vCPU number when get information with config flag -$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --config > out 2>&1 -test $? = 1 || fail=1 -cat <<\EOF > exp || fail=1 -error: vcpu 100 is out of range of persistent cpu count 2 - -EOF -compare exp out || fail=1 - -# An out-of-range vCPU number when get information with current flag -$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --current > out 2>&1 -test $? = 1 || fail=1 -cat <<\EOF > exp || fail=1 -error: vcpu 100 is out of range of live cpu count 2 - -EOF -compare exp out || fail=1 -(exit $fail); exit $fail diff --git a/tests/virsh-cpuset b/tests/virsh-cpuset new file mode 100755 index 0000000000..35803be02c --- /dev/null +++ b/tests/virsh-cpuset @@ -0,0 +1,50 @@ +#!/bin/sh +# ensure that defining with an invalid vCPU cpuset elicits a diagnostic + +# Copyright (C) 2008-2009 Red Hat, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# . + +test -z "$srcdir" && srcdir=$(pwd) +test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/.. +test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/.. + +if test "$VERBOSE" = yes; then + set -x + $abs_top_builddir/tools/virsh --version +fi + +. "$srcdir/test-lib.sh" + +fail=0 + +# generate input +$abs_top_builddir/tools/virsh --connect test:///default dumpxml 1 > xml || fail=1 + +# require the presence of the string we'll transform +grep ' /dev/null || fail=1 + +sed "s/vcpu placement='static'>/vcpu cpuset='aaa'>/" xml > xml-invalid || fail=1 + +# Require failure and a diagnostic. +$abs_top_builddir/tools/virsh --connect test:///default define xml-invalid > out 2>&1 && fail=1 +cat <<\EOF > exp || fail=1 +error: Failed to define domain from xml-invalid +error: invalid argument: Failed to parse bitmap 'aaa' + +EOF +compare exp out || fail=1 + +(exit $fail); exit $fail diff --git a/tests/virsh-define-dev-segfault b/tests/virsh-define-dev-segfault new file mode 100755 index 0000000000..81a8773def --- /dev/null +++ b/tests/virsh-define-dev-segfault @@ -0,0 +1,80 @@ +#!/bin/sh +# 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)/.. + +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. +cat <<\EOF > D.xml || fail=1 + + D + aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82 + 262144 + 262144 + 1 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-kvm + + + + + + + + + + + + + + + + + + + + + + + + + + + +EOF + +url=test:///default +$abs_top_builddir/tools/virsh --connect "$url" 'define D.xml; dumpxml D' > out 2>&1 || fail=1 + +cat > exp < exp || fail=1 +$abs_top_builddir/tools/virsh --quiet \ + --connect test://$abs_top_srcdir/examples/xml/test/testnode.xml \ + 'domname 4294967298; quit' > /dev/null 2> err || fail=1 +diff -u err exp || fail=1 + +exit $fail diff --git a/tests/virsh-read-bufsiz b/tests/virsh-read-bufsiz new file mode 100755 index 0000000000..23c3b531d9 --- /dev/null +++ b/tests/virsh-read-bufsiz @@ -0,0 +1,53 @@ +#!/bin/sh +# ensure that reading a file larger than BUFSIZ works + +# Copyright (C) 2008, 2010 Red Hat, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# . + +test -z "$srcdir" && srcdir=`pwd` +test -z "$abs_top_srcdir" && abs_top_srcdir=`pwd`/.. +test -z "$abs_top_builddir" && abs_top_builddir=`pwd`/.. + +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. +$abs_top_builddir/tools/virsh -c test:///default dumpxml 1 > xml.t || fail=1 + +# Change the VM name and UUID +sed -e "s|test|newtest|g" \ + -e "\|.*|d" \ + xml.t > xml + +for i in before after; do + # The largest BUFSIZ I've seen is 128K. This is slightly larger. + printf %132000s ' ' > sp || fail=1 + in=in-$i + # Append or prepend enough spaces to push the size over the limit: + ( test $i = before && cat sp xml || cat xml sp ) > $in || fail=1 + + $abs_top_builddir/tools/virsh --connect test:///default define $in > out || fail=1 + printf "Domain newtest defined from $in\n\n" > exp || fail=1 + compare exp out || fail=1 +done + +(exit $fail); exit $fail diff --git a/tests/virsh-read-non-seekable b/tests/virsh-read-non-seekable new file mode 100755 index 0000000000..46e2831eb9 --- /dev/null +++ b/tests/virsh-read-non-seekable @@ -0,0 +1,55 @@ +#!/bin/sh +# ensure that certain file-reading commands can handle non-seekable files + +# Copyright (C) 2008 Red Hat, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# . + +test -z "$srcdir" && srcdir=`pwd` +test -z "$abs_top_srcdir" && abs_top_srcdir=`pwd`/.. +test -z "$abs_top_builddir" && abs_top_builddir=`pwd`/.. + +if test "$VERBOSE" = yes; then + set -x + $abs_top_builddir/tools/virsh --version +fi + +. "$srcdir/test-lib.sh" + +fail=0 + +cat <<\EOF > dom + + t2 + 004b96e1-2d78-c30f-5aa5-000000000000 + 8388608 + 2 + + xen + + restart + destroy + restart + +EOF + +$abs_top_builddir/tools/virsh -c test:///default define dom > /dev/null || fail=1 + +mkfifo_or_skip_ fifo +cat dom > fifo & + +$abs_top_builddir/tools/virsh -c test:///default define fifo > /dev/null || fail=1 + +(exit $fail); exit $fail diff --git a/tests/virsh-start b/tests/virsh-start new file mode 100755 index 0000000000..5d4c0a73c7 --- /dev/null +++ b/tests/virsh-start @@ -0,0 +1,45 @@ +#!/bin/sh +# ensure that virsh start works properly + +# Copyright (C) 2008 Red Hat, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# . + +test -z "$srcdir" && srcdir=$(pwd) +test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/.. +test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/.. + +if test "$VERBOSE" = yes; then + set -x + $abs_top_builddir/tools/virsh --version +fi + +. "$srcdir/test-lib.sh" + +fail=0 + +test_url=test:///default + +# expect this to fail +$abs_top_builddir/tools/virsh -c $test_url start test > out 2> err && fail=1 + +# stdout gets a newline +echo > exp || fail=1 +compare exp out || fail=1 + +echo 'error: Domain is already active' > exp || fail=1 +compare exp err || fail=1 + +(exit $fail); exit $fail diff --git a/tests/virsh-vcpupin b/tests/virsh-vcpupin new file mode 100755 index 0000000000..9e656c0aa1 --- /dev/null +++ b/tests/virsh-vcpupin @@ -0,0 +1,104 @@ +#!/bin/sh +# ensure that an invalid CPU spec elicits a diagnostic + +# Copyright (C) 2008 Red Hat, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# . + +test -z "$srcdir" && srcdir=$(pwd) +test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/.. +test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/.. + +if test "$VERBOSE" = yes; then + set -x + $abs_top_builddir/tools/virsh --version +fi + +. "$srcdir/test-lib.sh" + +fail=0 + +# Invalid syntax. +$abs_top_builddir/tools/virsh --connect test:///default vcpupin test a 0,1 > out 2>&1 +test $? = 1 || fail=1 +cat <<\EOF > exp || fail=1 +error: Numeric value 'a' for option is malformed or out of range + +EOF +compare exp out || fail=1 + +# An out-of-range vCPU number deserves a diagnostic, too. +$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 0,1 > out 2>&1 +test $? = 1 || fail=1 +cat <<\EOF > exp || fail=1 +error: invalid argument: requested vcpu '100' is not present in the domain + +EOF +compare exp out || fail=1 + +# Negative number +$abs_top_builddir/tools/virsh --connect test:///default vcpupin test -100 0,1 > out 2>&1 +test $? = 1 || fail=1 +cat <<\EOF > exp || fail=1 +error: Numeric value '-100' for option is malformed or out of range + +EOF +compare exp out || fail=1 + +# missing argument +$abs_top_builddir/tools/virsh --connect test:///default vcpupin test --cpulist 0,1 > out 2>&1 +test $? = 1 || fail=1 +cat <<\EOF > exp || fail=1 +error: vcpupin: Missing vCPU number in pin mode. + +EOF +compare exp out || fail=1 + +# An out-of-range vCPU number when get information with live flag +$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --live > out 2>&1 +test $? = 1 || fail=1 +cat <<\EOF > exp || fail=1 +error: vcpu 100 is out of range of live cpu count 2 + +EOF +compare exp out || fail=1 + +# An out-of-range vCPU number when get information without flag +$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 > out 2>&1 +test $? = 1 || fail=1 +cat <<\EOF > exp || fail=1 +error: vcpu 100 is out of range of live cpu count 2 + +EOF +compare exp out || fail=1 + +# An out-of-range vCPU number when get information with config flag +$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --config > out 2>&1 +test $? = 1 || fail=1 +cat <<\EOF > exp || fail=1 +error: vcpu 100 is out of range of persistent cpu count 2 + +EOF +compare exp out || fail=1 + +# An out-of-range vCPU number when get information with current flag +$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --current > out 2>&1 +test $? = 1 || fail=1 +cat <<\EOF > exp || fail=1 +error: vcpu 100 is out of range of live cpu count 2 + +EOF +compare exp out || fail=1 +(exit $fail); exit $fail