mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virshtest: Adapt argument parsing tests from 'virsh-optparse'
Move the argument parsing tests excercising 'virsh setvcpus' from 'virsh-optparse' to 'virshtest'. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
52fc03ef21
commit
1b3f148866
@ -28,39 +28,10 @@ if test "$VERBOSE" = yes; then
|
|||||||
$VIRSH --version
|
$VIRSH --version
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<\EOF > exp-out || framework_failure
|
|
||||||
|
|
||||||
setvcpus: <domain> trying as domain NAME
|
|
||||||
setvcpus: count(optdata): 2
|
|
||||||
setvcpus: domain(optdata): test
|
|
||||||
setvcpus: found option <domain>: test
|
|
||||||
EOF
|
|
||||||
|
|
||||||
fail=0
|
fail=0
|
||||||
|
|
||||||
test_url=test:///default
|
test_url=test:///default
|
||||||
|
|
||||||
for args in \
|
|
||||||
'test 2' \
|
|
||||||
'--domain test 2' \
|
|
||||||
'--domain=test 2' \
|
|
||||||
'test --count 2' \
|
|
||||||
'test --count=2' \
|
|
||||||
'--domain test --count 2' \
|
|
||||||
'--domain=test --count 2' \
|
|
||||||
'--domain test --count=2' \
|
|
||||||
'--domain=test --count=2' \
|
|
||||||
'--count 2 --domain test' \
|
|
||||||
'--count 2 --domain=test' \
|
|
||||||
'--count=2 --domain test' \
|
|
||||||
'--count=2 --domain=test' \
|
|
||||||
'--count 2 test' \
|
|
||||||
'--count=2 test' \
|
|
||||||
; do
|
|
||||||
$VIRSH -k0 -d0 -c $test_url setvcpus $args >out 2>>err || fail=1
|
|
||||||
LC_ALL=C sort out | compare exp-out - || fail=1
|
|
||||||
done
|
|
||||||
|
|
||||||
# Another complex parsing example
|
# Another complex parsing example
|
||||||
cat <<\EOF > exp-out || framework_failure
|
cat <<\EOF > exp-out || framework_failure
|
||||||
<domainsnapshot>
|
<domainsnapshot>
|
||||||
|
@ -198,6 +198,9 @@ mymain(void)
|
|||||||
DO_TEST_SCRIPT("echo-split", NULL, VIRSH_DEFAULT, "-q");
|
DO_TEST_SCRIPT("echo-split", NULL, VIRSH_DEFAULT, "-q");
|
||||||
# undef DO_TEST
|
# undef DO_TEST
|
||||||
|
|
||||||
|
/* comprehensive coverage of argument assignment */
|
||||||
|
DO_TEST_SCRIPT("argument-assignment", NULL, VIRSH_DEFAULT, "-k0", "-d0");
|
||||||
|
|
||||||
VIR_FREE(custom_uri);
|
VIR_FREE(custom_uri);
|
||||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
15
tests/virshtestdata/argument-assignment.in
Normal file
15
tests/virshtestdata/argument-assignment.in
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
setvcpus test 2
|
||||||
|
setvcpus --domain test 2
|
||||||
|
setvcpus --domain=test 2
|
||||||
|
setvcpus test --count 2
|
||||||
|
setvcpus test --count=2
|
||||||
|
setvcpus --domain test --count 2
|
||||||
|
setvcpus --domain=test --count 2
|
||||||
|
setvcpus --domain test --count=2
|
||||||
|
setvcpus --domain=test --count=2
|
||||||
|
setvcpus --count 2 --domain test
|
||||||
|
setvcpus --count 2 --domain=test
|
||||||
|
setvcpus --count=2 --domain test
|
||||||
|
setvcpus --count=2 --domain=test
|
||||||
|
setvcpus --count 2 test
|
||||||
|
setvcpus --count=2 test
|
91
tests/virshtestdata/argument-assignment.out
Normal file
91
tests/virshtestdata/argument-assignment.out
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
commands: "setvcpus test 2
|
||||||
|
setvcpus --domain test 2
|
||||||
|
setvcpus --domain=test 2
|
||||||
|
setvcpus test --count 2
|
||||||
|
setvcpus test --count=2
|
||||||
|
setvcpus --domain test --count 2
|
||||||
|
setvcpus --domain=test --count 2
|
||||||
|
setvcpus --domain test --count=2
|
||||||
|
setvcpus --domain=test --count=2
|
||||||
|
setvcpus --count 2 --domain test
|
||||||
|
setvcpus --count 2 --domain=test
|
||||||
|
setvcpus --count=2 --domain test
|
||||||
|
setvcpus --count=2 --domain=test
|
||||||
|
setvcpus --count 2 test
|
||||||
|
setvcpus --count=2 test
|
||||||
|
"
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: count(optdata): 2
|
||||||
|
setvcpus: domain(optdata): test
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
||||||
|
setvcpus: found option <domain>: test
|
||||||
|
setvcpus: <domain> trying as domain NAME
|
||||||
|
|
Loading…
Reference in New Issue
Block a user