[PATCH 07/35] virshtest: Adapt some 'escaping' tests via DO_TEST_SCRIPT

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

 



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@xxxxxxxxxx>
---
 tests/virshtest.c                     | 20 +-------------------
 tests/virshtestdata/echo-escaping.in  | 11 +++++++++++
 tests/virshtestdata/echo-escaping.out | 11 +++++++++++
 3 files changed, 23 insertions(+), 19 deletions(-)
 create mode 100644 tests/virshtestdata/echo-escaping.in
 create mode 100644 tests/virshtestdata/echo-escaping.out

diff --git a/tests/virshtest.c b/tests/virshtest.c
index a60cfdf7a0..4b02ef3a49 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -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 + * ; . &apos; &quot; / ? =   \n &lt; &gt; &amp;\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",
diff --git a/tests/virshtestdata/echo-escaping.in b/tests/virshtestdata/echo-escaping.in
new file mode 100644
index 0000000000..26d4e4cc18
--- /dev/null
+++ b/tests/virshtestdata/echo-escaping.in
@@ -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 ""''
diff --git a/tests/virshtestdata/echo-escaping.out b/tests/virshtestdata/echo-escaping.out
new file mode 100644
index 0000000000..ff3e0a98b3
--- /dev/null
+++ b/tests/virshtestdata/echo-escaping.out
@@ -0,0 +1,11 @@
+a A 0 + * . ' / ? = < > &
+a A 0 + * . &apos; / ? = &lt; &gt; &amp;
+a A 0 + '*' . ''\''' / '?' = '<' '>' '&'
+
+
+
+
+
+''
+
+''
-- 
2.44.0
_______________________________________________
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