Move the argument parsing tests excercising 'virsh setvcpus' from 'virsh-optparse' to 'virshtest'. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- tests/virsh-optparse | 29 ------- tests/virshtest.c | 3 + tests/virshtestdata/argument-assignment.in | 15 ++++ tests/virshtestdata/argument-assignment.out | 91 +++++++++++++++++++++ 4 files changed, 109 insertions(+), 29 deletions(-) create mode 100644 tests/virshtestdata/argument-assignment.in create mode 100644 tests/virshtestdata/argument-assignment.out diff --git a/tests/virsh-optparse b/tests/virsh-optparse index 3fe38b2931..77e754d73a 100755 --- a/tests/virsh-optparse +++ b/tests/virsh-optparse @@ -28,39 +28,10 @@ if test "$VERBOSE" = yes; then $VIRSH --version 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 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 cat <<\EOF > exp-out || framework_failure <domainsnapshot> diff --git a/tests/virshtest.c b/tests/virshtest.c index 926f919d8d..1baa402648 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -198,6 +198,9 @@ mymain(void) DO_TEST_SCRIPT("echo-split", NULL, VIRSH_DEFAULT, "-q"); # undef DO_TEST + /* comprehensive coverage of argument assignment */ + DO_TEST_SCRIPT("argument-assignment", NULL, VIRSH_DEFAULT, "-k0", "-d0"); + VIR_FREE(custom_uri); return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/tests/virshtestdata/argument-assignment.in b/tests/virshtestdata/argument-assignment.in new file mode 100644 index 0000000000..283f521b1c --- /dev/null +++ b/tests/virshtestdata/argument-assignment.in @@ -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 diff --git a/tests/virshtestdata/argument-assignment.out b/tests/virshtestdata/argument-assignment.out new file mode 100644 index 0000000000..501f0add33 --- /dev/null +++ b/tests/virshtestdata/argument-assignment.out @@ -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 + -- 2.44.0 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx