Re: [PATCH 19/35] virshtest: Adapt 'event' option arg handling tests from 'virsh-optparse'

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

 



On a Friday in 2024, Peter Krempa wrote:
Move the argument parsing tests excercising 'virsh event' options
from 'virsh-optparse' to 'virshtest'.

As the test invokes 'virsh event' with a timeout and thus waits for one
second pointlessly the patch also adds infrastructure to mark individual
cases as expensive and is skipped normally.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
tests/meson.build                             |  1 -
tests/virsh-optparse                          | 98 -------------------
tests/virshtest.c                             | 16 ++-
tests/virshtestdata/numeric-parsing-event.in  | 26 +++++
tests/virshtestdata/numeric-parsing-event.out | 10 ++
5 files changed, 49 insertions(+), 102 deletions(-)
delete mode 100755 tests/virsh-optparse
create mode 100644 tests/virshtestdata/numeric-parsing-event.in
create mode 100644 tests/virshtestdata/numeric-parsing-event.out

@@ -202,6 +209,9 @@ mymain(void)
    DO_TEST_SCRIPT("argument-assignment", NULL, VIRSH_DEFAULT, "-k0", "-d0");
    DO_TEST_SCRIPT("snapshot-create-args", NULL, VIRSH_DEFAULT, "-q");
    DO_TEST_SCRIPT("numeric-parsing", NULL, VIRSH_DEFAULT, "-q");
+    /* The 'numeric-parsing-event' invokes virsh event with a 1 second timeout,
+     * thus is marked expensive */
+    DO_TEST_SCRIPT_FULL("numeric-parsing-event", true, NULL, VIRSH_DEFAULT, "-q");


Same here.

Jano

    VIR_FREE(custom_uri);
    return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/virshtestdata/numeric-parsing-event.out b/tests/virshtestdata/numeric-parsing-event.out
new file mode 100644
index 0000000000..3d3fcbe5fc
--- /dev/null
+++ b/tests/virshtestdata/numeric-parsing-event.out
@@ -0,0 +1,10 @@
+Test the <timeout> option (numeric option converted to ms)Non-numeric valueerror: Numeric value 'abc' for <timeout> option is malformed or out of range
+Numeric value that is too big to be converted to ms and stillfit inside an interror: Numeric value '2147484' for <timeout> option is malformed or out of range
+Numeric value with invalid suffixerror: Numeric value '42WB' for <timeout> option is malformed or out of range
+Numeric value with valid suffix. Suffixes are not supported forthe <timeout> option, so this value is rejectederror: Numeric value '42MB' for <timeout> option is malformed or out of range
+Negative valueerror: Numeric value '-1' for <timeout> option is malformed or out of range
+Zero. This is not a valid timeout, but the value is parsedcorrectlyerror: Numeric value '0' for <timeout> option is malformed or out of range
+Numeric value. No events will be received and the command willfail after a second, but the value has been parsed correctlyevent loop timed out
+events received: 0
+
+## Exit code: 1
--
2.44.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx

[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]

  Powered by Linux