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
24 $abs_top_builddir/tools
/virsh
--version
30 $abs_top_builddir/tools
/virsh
--connect test:///default vcpupin
test a
0,1 > out
2>&1
32 cat <<\EOF
> exp || fail
=1
33 error
: Numeric value
'a' for <vcpu
> option is malformed or out of range
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
41 cat <<\EOF
> exp || fail
=1
42 error
: invalid argument
: requested vcpu
'100' is not present
in the domain
45 compare exp out || fail
=1
48 $abs_top_builddir/tools
/virsh
--connect test:///default vcpupin
test -100 0,1 > out
2>&1
50 cat <<\EOF
> exp || fail
=1
51 error
: Numeric value
'-100' for <vcpu
> option is malformed or out of range
54 compare exp out || fail
=1
57 $abs_top_builddir/tools
/virsh
--connect test:///default vcpupin
test --cpulist 0,1 > out
2>&1
59 cat <<\EOF
> exp || fail
=1
60 error
: vcpupin
: Missing vCPU number
in pin mode.
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
68 cat <<\EOF
> exp || fail
=1
69 error
: vcpu
100 is out of range of live cpu count
2
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
77 cat <<\EOF
> exp || fail
=1
78 error
: vcpu
100 is out of range of live cpu count
2
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
86 cat <<\EOF
> exp || fail
=1
87 error
: vcpu
100 is out of range of persistent cpu count
2
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
95 cat <<\EOF
> exp || fail
=1
96 error
: vcpu
100 is out of range of live cpu count
2
99 compare exp out || fail
=1
100 (exit $fail); exit $fail