virshtest: Adapt 'echo --split' tests to DO_TEST_SCRIPT

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>
This commit is contained in:
Peter Krempa 2024-03-20 14:42:46 +01:00
parent fdaf2ffb04
commit 7fca0d4d52
3 changed files with 30 additions and 10 deletions

View 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);

View File

@ -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,,,,

View File

@ -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,,