]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virshtest: Adapt 'echo --split' tests to DO_TEST_SCRIPT
authorPeter Krempa <pkrempa@redhat.com>
Wed, 20 Mar 2024 13:42:46 +0000 (14:42 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 2 Apr 2024 12:24:30 +0000 (14:24 +0200)
Optimize invocation of the tests to share one 'virsh' binary as they
don't influence each other.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/virshtest.c
tests/virshtestdata/echo-split.in [new file with mode: 0644]
tests/virshtestdata/echo-split.out [new file with mode: 0644]

index 376fb861ed8572e2a63100bde37c8ce3a4cc144e..51314859b91f217cc06d90a0fd9c1c385d8b6650 100644 (file)
@@ -682,16 +682,7 @@ mymain(void)
     DO_TEST(47, "a\n", "\\# ignored;echo a\n'#also' ignored");
 
     /* test of splitting in vshStringToArray */
-    DO_TEST(48, "a\nb,c,\nd,,e,,\nf,,,e\n",
-            "-q", "echo", "--split", "a,b,,c,,,d,,,,e,,,,,f,,,,,,e");
-    DO_TEST(49, "\na\nb,c,\nd,,e,,\nf,,,e\n\n",
-            "-q", "echo", "--split", ",a,b,,c,,,d,,,,e,,,,,f,,,,,,e,");
-    DO_TEST(50, ",a\nb,c,\nd,,e,,\nf,,,e,\n",
-            "-q", "echo", "--split", ",,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,");
-    DO_TEST(51, ",\na\nb,c,\nd,,e,,\nf,,,e,\n\n",
-            "-q", "echo", "--split", ",,,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,,");
-    DO_TEST(52, ",,a\nb,c,\nd,,e,,\nf,,,e,,\n",
-            "-q", "echo", "--split", ",,,,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,,,");
+    DO_TEST_SCRIPT("echo-split", NULL, VIRSH_DEFAULT, "-q");
 # undef DO_TEST
 
     VIR_FREE(custom_uri);
diff --git a/tests/virshtestdata/echo-split.in b/tests/virshtestdata/echo-split.in
new file mode 100644 (file)
index 0000000..2df9f4d
--- /dev/null
@@ -0,0 +1,5 @@
+echo --split a,b,,c,,,d,,,,e,,,,,f,,,,,,e
+echo --split ,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,
+echo --split ,,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,
+echo --split ,,,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,,
+echo --split ,,,,a,b,,c,,,d,,,,e,,,,,f,,,,,,e,,,,
diff --git a/tests/virshtestdata/echo-split.out b/tests/virshtestdata/echo-split.out
new file mode 100644 (file)
index 0000000..88bf09c
--- /dev/null
@@ -0,0 +1,24 @@
+a
+b,c,
+d,,e,,
+f,,,e
+
+a
+b,c,
+d,,e,,
+f,,,e
+
+,a
+b,c,
+d,,e,,
+f,,,e,
+,
+a
+b,c,
+d,,e,,
+f,,,e,
+
+,,a
+b,c,
+d,,e,,
+f,,,e,,