backup: Wire up qemu full pull backup commands over QMP
[libvirt/ericb.git] / tests / virsh-vcpupin
blob306552a8f4d158c90bb26b4ad1e2c67a5fec1f5e
1 #!/bin/sh
2 # ensure that an invalid CPU spec elicits a diagnostic
4 # Copyright (C) 2008 Red Hat, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see
18 # <http://www.gnu.org/licenses/>.
20 . "$(dirname $0)/test-lib.sh"
22 if test "$VERBOSE" = yes; then
23 set -x
24 $abs_top_builddir/tools/virsh --version
27 fail=0
29 # Invalid syntax.
30 $abs_top_builddir/tools/virsh --connect test:///default vcpupin test a 0,1 > out 2>&1
31 test $? = 1 || fail=1
32 cat <<\EOF > exp || fail=1
33 error: Numeric value 'a' for <vcpu> option is malformed or out of range
35 EOF
36 compare exp out || fail=1
38 # An out-of-range vCPU number deserves a diagnostic, too.
39 $abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 0,1 > out 2>&1
40 test $? = 1 || fail=1
41 cat <<\EOF > exp || fail=1
42 error: invalid argument: requested vcpu '100' is not present in the domain
44 EOF
45 compare exp out || fail=1
47 # Negative number
48 $abs_top_builddir/tools/virsh --connect test:///default vcpupin test -100 0,1 > out 2>&1
49 test $? = 1 || fail=1
50 cat <<\EOF > exp || fail=1
51 error: Numeric value '-100' for <vcpu> option is malformed or out of range
53 EOF
54 compare exp out || fail=1
56 # missing argument
57 $abs_top_builddir/tools/virsh --connect test:///default vcpupin test --cpulist 0,1 > out 2>&1
58 test $? = 1 || fail=1
59 cat <<\EOF > exp || fail=1
60 error: vcpupin: Missing vCPU number in pin mode.
62 EOF
63 compare exp out || fail=1
65 # An out-of-range vCPU number when get information with live flag
66 $abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --live > out 2>&1
67 test $? = 1 || fail=1
68 cat <<\EOF > exp || fail=1
69 error: vcpu 100 is out of range of live cpu count 2
71 EOF
72 compare exp out || fail=1
74 # An out-of-range vCPU number when get information without flag
75 $abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 > out 2>&1
76 test $? = 1 || fail=1
77 cat <<\EOF > exp || fail=1
78 error: vcpu 100 is out of range of live cpu count 2
80 EOF
81 compare exp out || fail=1
83 # An out-of-range vCPU number when get information with config flag
84 $abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --config > out 2>&1
85 test $? = 1 || fail=1
86 cat <<\EOF > exp || fail=1
87 error: vcpu 100 is out of range of persistent cpu count 2
89 EOF
90 compare exp out || fail=1
92 # An out-of-range vCPU number when get information with current flag
93 $abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 --current > out 2>&1
94 test $? = 1 || fail=1
95 cat <<\EOF > exp || fail=1
96 error: vcpu 100 is out of range of live cpu count 2
98 EOF
99 compare exp out || fail=1
100 (exit $fail); exit $fail