Re: [PATCH] add error message for the case of "vcpupin" fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"S.Sakamoto" <fj0588di@xxxxxxxxxxxxxxxxx> wrote:
> When I set a number that is bigger than
> virtual CPU's setting of guest_dom to <vcpu>,
> No error-messages are shown.
>
> I try follow,
>
>     # virsh vcpupin guest_dom 100 0,1
>     [no error messages]
>     # echo $?
>     1
>
> I make the patch to solve this problem.

Thank you for the report and patch.
For an easily-reproducible failure like this, it is simple to
include a regression test case addition, so that we're sure
never to reintroduce the offending behavior.  Adding even
trivial tests like this helps increase automated test coverage, too.

So here's a new test to match (I'll commit this on Monday):

	* tests/vcpupin: Add a test for just-fixed bug.

FYI, to run just this one test script, I used this command:

    make -C tests check TESTS=vcpupin

diff --git a/tests/vcpupin b/tests/vcpupin
index b56c7f2..7b5f86c 100755
--- a/tests/vcpupin
+++ b/tests/vcpupin
@@ -24,14 +24,23 @@ fi
 . $srcdir/test-lib.sh

 fail=0
+
+# Invalid syntax.
 virsh --connect test:///default vcpupin test a 0,1 > out 2>&1
 test $? = 1 || fail=1
-
 cat <<\EOF > exp || fail=1
 error: vcpupin: Invalid or missing vCPU number.

 EOF
+compare out exp || fail=1

+# An out-of-range vCPU number deserves a diagnostic, too.
+virsh --connect test:///default vcpupin test 100 0,1 > out 2>&1
+test $? = 1 || fail=1
+cat <<\EOF > exp || fail=1
+error: vcpupin: Invalid vCPU number.
+
+EOF
 compare out exp || fail=1

 (exit $fail); exit $fail
--
1.5.5.rc2.7.g144a

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]