From 7fca0d4d52c5ef242db0007a89c7d2372aea7343 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 20 Mar 2024 14:42:46 +0100 Subject: [PATCH] virshtest: Adapt 'echo --split' tests to DO_TEST_SCRIPT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Optimize invocation of the tests to share one 'virsh' binary as they don't influence each other. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- tests/virshtest.c | 11 +---------- tests/virshtestdata/echo-split.in | 5 +++++ tests/virshtestdata/echo-split.out | 24 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 tests/virshtestdata/echo-split.in create mode 100644 tests/virshtestdata/echo-split.out diff --git a/tests/virshtest.c b/tests/virshtest.c index 376fb861ed..51314859b9 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -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 index 0000000000..2df9f4da97 --- /dev/null +++ b/tests/virshtestdata/echo-split.in @@ -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 index 0000000000..88bf09c225 --- /dev/null +++ b/tests/virshtestdata/echo-split.out @@ -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,,