mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-21 21:25:25 +00:00
virshtest: Adapt some 'escaping' tests via DO_TEST_SCRIPT
Express what's possible via a "virsh script" rather than invoking separate virsh for each one. We need to keep a few for parity as the argument parser behaves differently when processing argv-like input compared to a string. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f3d205ad44
commit
5fd0653a39
@ -610,6 +610,7 @@ mymain(void)
|
||||
"echo \"'\" '\"' '\\'\"\\\\\"");
|
||||
|
||||
/* Tests of echo flags. */
|
||||
DO_TEST_SCRIPT("echo-escaping", NULL, VIRSH_DEFAULT);
|
||||
DO_TEST(13, "a A 0 + * ; . ' \" / ? = \n < > &\n",
|
||||
"echo", "a", "A", "0", "+", "*", ";", ".", "'", "\"", "/", "?",
|
||||
"=", " ", "\n", "<", ">", "&");
|
||||
@ -619,25 +620,6 @@ mymain(void)
|
||||
DO_TEST(15, "a A 0 + * ; . ' " / ? = \n < > &\n",
|
||||
"echo", "--xml", "a", "A", "0", "+", "*", ";", ".", "'", "\"",
|
||||
"/", "?", "=", " ", "\n", "<", ">", "&");
|
||||
DO_TEST(16, "a A 0 + '*' ';' . ''\\''' '\"' / '?' = ' ' '\n' '<' '>' '&'\n",
|
||||
"echo", "--shell", "a", "A", "0", "+", "*", ";", ".", "\'",
|
||||
"\"", "/", "?", "=", " ", "\n", "<", ">", "&");
|
||||
DO_TEST(17, "\n",
|
||||
"echo", "");
|
||||
DO_TEST(18, "''\n",
|
||||
"echo", "--shell", "");
|
||||
DO_TEST(19, "\n",
|
||||
"echo", "--xml", "");
|
||||
DO_TEST(20, "''\n",
|
||||
"echo", "--shell", "");
|
||||
DO_TEST(21, "\n",
|
||||
"echo ''");
|
||||
DO_TEST(22, "''\n",
|
||||
"echo --shell \"\"");
|
||||
DO_TEST(23, "\n",
|
||||
"echo --xml ''");
|
||||
DO_TEST(24, "''\n",
|
||||
"echo --shell \"\"''");
|
||||
|
||||
/* Tests of -- handling. */
|
||||
DO_TEST(25, "a\n",
|
||||
|
11
tests/virshtestdata/echo-escaping.in
Normal file
11
tests/virshtestdata/echo-escaping.in
Normal file
@ -0,0 +1,11 @@
|
||||
echo a A 0 + * . \' / ? = < > &
|
||||
echo --xml a A 0 + * . \' / ? = < > &
|
||||
echo --shell a A 0 + * . \' / ? = < > &
|
||||
echo ""
|
||||
echo --shell
|
||||
echo --xml
|
||||
echo --shell
|
||||
echo ''
|
||||
echo --shell ""
|
||||
echo --xml ''
|
||||
echo --shell ""''
|
11
tests/virshtestdata/echo-escaping.out
Normal file
11
tests/virshtestdata/echo-escaping.out
Normal file
@ -0,0 +1,11 @@
|
||||
a A 0 + * . ' / ? = < > &
|
||||
a A 0 + * . ' / ? = < > &
|
||||
a A 0 + '*' . ''\''' / '?' = '<' '>' '&'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
''
|
||||
|
||||
''
|
Loading…
Reference in New Issue
Block a user