[PATCH 09/35] virshtest: Test against output files ("echo" tests)

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

 



Managing output files is much simpler especially with
VIR_TEST_REGENERATE_OUTPUT compared to putting the expected string blobs
into the C source file.

For now the output is tested both against the hardcoded strings as well
as the output files.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/virshtest.c                            | 2 +-
 tests/virshtestdata/dash-dash-argument-1.out | 1 +
 tests/virshtestdata/dash-dash-argument-2.out | 1 +
 tests/virshtestdata/dash-dash-argument-3.out | 1 +
 tests/virshtestdata/dash-dash-argument-4.out | 1 +
 tests/virshtestdata/dash-dash-argument-5.out | 1 +
 tests/virshtestdata/dash-dash-argument-6.out | 1 +
 tests/virshtestdata/echo-alias-argv.out      | 1 +
 tests/virshtestdata/echo-escaping-1.out      | 2 ++
 tests/virshtestdata/echo-escaping-2.out      | 2 ++
 tests/virshtestdata/echo-escaping-3.out      | 2 ++
 tests/virshtestdata/echo-quote-removal-1.out | 1 +
 tests/virshtestdata/echo-quote-removal-2.out | 1 +
 tests/virshtestdata/echo-quote-removal-3.out | 1 +
 tests/virshtestdata/echo-quote-removal-4.out | 1 +
 tests/virshtestdata/echo-quote-removal-5.out | 1 +
 tests/virshtestdata/echo-quote-removal-6.out | 1 +
 tests/virshtestdata/echo-quote-removal-7.out | 2 ++
 tests/virshtestdata/echo-quote-removal-8.out | 1 +
 tests/virshtestdata/multiple-commands-1.out  | 2 ++
 tests/virshtestdata/multiple-commands-10.out | 1 +
 tests/virshtestdata/multiple-commands-11.out | 1 +
 tests/virshtestdata/multiple-commands-12.out | 1 +
 tests/virshtestdata/multiple-commands-2.out  | 2 ++
 tests/virshtestdata/multiple-commands-3.out  | 2 ++
 tests/virshtestdata/multiple-commands-4.out  | 2 ++
 tests/virshtestdata/multiple-commands-5.out  | 3 +++
 tests/virshtestdata/multiple-commands-6.out  | 1 +
 tests/virshtestdata/multiple-commands-7.out  | 2 ++
 tests/virshtestdata/multiple-commands-8.out  | 2 ++
 tests/virshtestdata/multiple-commands-9.out  | 1 +
 31 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 tests/virshtestdata/dash-dash-argument-1.out
 create mode 100644 tests/virshtestdata/dash-dash-argument-2.out
 create mode 100644 tests/virshtestdata/dash-dash-argument-3.out
 create mode 100644 tests/virshtestdata/dash-dash-argument-4.out
 create mode 100644 tests/virshtestdata/dash-dash-argument-5.out
 create mode 100644 tests/virshtestdata/dash-dash-argument-6.out
 create mode 100644 tests/virshtestdata/echo-alias-argv.out
 create mode 100644 tests/virshtestdata/echo-escaping-1.out
 create mode 100644 tests/virshtestdata/echo-escaping-2.out
 create mode 100644 tests/virshtestdata/echo-escaping-3.out
 create mode 100644 tests/virshtestdata/echo-quote-removal-1.out
 create mode 100644 tests/virshtestdata/echo-quote-removal-2.out
 create mode 100644 tests/virshtestdata/echo-quote-removal-3.out
 create mode 100644 tests/virshtestdata/echo-quote-removal-4.out
 create mode 100644 tests/virshtestdata/echo-quote-removal-5.out
 create mode 100644 tests/virshtestdata/echo-quote-removal-6.out
 create mode 100644 tests/virshtestdata/echo-quote-removal-7.out
 create mode 100644 tests/virshtestdata/echo-quote-removal-8.out
 create mode 100644 tests/virshtestdata/multiple-commands-1.out
 create mode 100644 tests/virshtestdata/multiple-commands-10.out
 create mode 100644 tests/virshtestdata/multiple-commands-11.out
 create mode 100644 tests/virshtestdata/multiple-commands-12.out
 create mode 100644 tests/virshtestdata/multiple-commands-2.out
 create mode 100644 tests/virshtestdata/multiple-commands-3.out
 create mode 100644 tests/virshtestdata/multiple-commands-4.out
 create mode 100644 tests/virshtestdata/multiple-commands-5.out
 create mode 100644 tests/virshtestdata/multiple-commands-6.out
 create mode 100644 tests/virshtestdata/multiple-commands-7.out
 create mode 100644 tests/virshtestdata/multiple-commands-8.out
 create mode 100644 tests/virshtestdata/multiple-commands-9.out

diff --git a/tests/virshtest.c b/tests/virshtest.c
index fc1246a96d..1750cc7abd 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -585,7 +585,7 @@ mymain(void)
     do { \
         const char *testname = testname_; \
         const char *myargv[] = { __VA_ARGS__, NULL }; \
-        const struct testInfo info = { NULL, NULL, myargv, result }; \
+        const struct testInfo info = { testname, NULL, myargv, result }; \
         if (virTestRun(testname, testCompare, &info) < 0) \
             ret = -1; \
     } while (0)
diff --git a/tests/virshtestdata/dash-dash-argument-1.out b/tests/virshtestdata/dash-dash-argument-1.out
new file mode 100644
index 0000000000..7898192261
--- /dev/null
+++ b/tests/virshtestdata/dash-dash-argument-1.out
@@ -0,0 +1 @@
+a
diff --git a/tests/virshtestdata/dash-dash-argument-2.out b/tests/virshtestdata/dash-dash-argument-2.out
new file mode 100644
index 0000000000..7898192261
--- /dev/null
+++ b/tests/virshtestdata/dash-dash-argument-2.out
@@ -0,0 +1 @@
+a
diff --git a/tests/virshtestdata/dash-dash-argument-3.out b/tests/virshtestdata/dash-dash-argument-3.out
new file mode 100644
index 0000000000..b9f81e916d
--- /dev/null
+++ b/tests/virshtestdata/dash-dash-argument-3.out
@@ -0,0 +1 @@
+a --shell
diff --git a/tests/virshtestdata/dash-dash-argument-4.out b/tests/virshtestdata/dash-dash-argument-4.out
new file mode 100644
index 0000000000..9367d302cc
--- /dev/null
+++ b/tests/virshtestdata/dash-dash-argument-4.out
@@ -0,0 +1 @@
+-- --shell a
diff --git a/tests/virshtestdata/dash-dash-argument-5.out b/tests/virshtestdata/dash-dash-argument-5.out
new file mode 100644
index 0000000000..7898192261
--- /dev/null
+++ b/tests/virshtestdata/dash-dash-argument-5.out
@@ -0,0 +1 @@
+a
diff --git a/tests/virshtestdata/dash-dash-argument-6.out b/tests/virshtestdata/dash-dash-argument-6.out
new file mode 100644
index 0000000000..ab8d1a1b1f
--- /dev/null
+++ b/tests/virshtestdata/dash-dash-argument-6.out
@@ -0,0 +1 @@
+--shell a
diff --git a/tests/virshtestdata/echo-alias-argv.out b/tests/virshtestdata/echo-alias-argv.out
new file mode 100644
index 0000000000..ce01362503
--- /dev/null
+++ b/tests/virshtestdata/echo-alias-argv.out
@@ -0,0 +1 @@
+hello
diff --git a/tests/virshtestdata/echo-escaping-1.out b/tests/virshtestdata/echo-escaping-1.out
new file mode 100644
index 0000000000..ff7ee063bf
--- /dev/null
+++ b/tests/virshtestdata/echo-escaping-1.out
@@ -0,0 +1,2 @@
+a A 0 + * ; . ' " / ? =   
+ < > &
diff --git a/tests/virshtestdata/echo-escaping-2.out b/tests/virshtestdata/echo-escaping-2.out
new file mode 100644
index 0000000000..e04d19b8e0
--- /dev/null
+++ b/tests/virshtestdata/echo-escaping-2.out
@@ -0,0 +1,2 @@
+a A 0 + '*' ';' . ''\''' '"' / '?' = ' ' '
+' '<' '>' '&'
diff --git a/tests/virshtestdata/echo-escaping-3.out b/tests/virshtestdata/echo-escaping-3.out
new file mode 100644
index 0000000000..f98b72d213
--- /dev/null
+++ b/tests/virshtestdata/echo-escaping-3.out
@@ -0,0 +1,2 @@
+a A 0 + * ; . &apos; &quot; / ? =   
+ &lt; &gt; &amp;
diff --git a/tests/virshtestdata/echo-quote-removal-1.out b/tests/virshtestdata/echo-quote-removal-1.out
new file mode 100644
index 0000000000..b2901ea97c
--- /dev/null
+++ b/tests/virshtestdata/echo-quote-removal-1.out
@@ -0,0 +1 @@
+a b
diff --git a/tests/virshtestdata/echo-quote-removal-2.out b/tests/virshtestdata/echo-quote-removal-2.out
new file mode 100644
index 0000000000..927ce33b9b
--- /dev/null
+++ b/tests/virshtestdata/echo-quote-removal-2.out
@@ -0,0 +1 @@
+a 	 b
diff --git a/tests/virshtestdata/echo-quote-removal-3.out b/tests/virshtestdata/echo-quote-removal-3.out
new file mode 100644
index 0000000000..927ce33b9b
--- /dev/null
+++ b/tests/virshtestdata/echo-quote-removal-3.out
@@ -0,0 +1 @@
+a 	 b
diff --git a/tests/virshtestdata/echo-quote-removal-4.out b/tests/virshtestdata/echo-quote-removal-4.out
new file mode 100644
index 0000000000..927ce33b9b
--- /dev/null
+++ b/tests/virshtestdata/echo-quote-removal-4.out
@@ -0,0 +1 @@
+a 	 b
diff --git a/tests/virshtestdata/echo-quote-removal-5.out b/tests/virshtestdata/echo-quote-removal-5.out
new file mode 100644
index 0000000000..00f7191294
--- /dev/null
+++ b/tests/virshtestdata/echo-quote-removal-5.out
@@ -0,0 +1 @@
+' " \;echo	a
diff --git a/tests/virshtestdata/echo-quote-removal-6.out b/tests/virshtestdata/echo-quote-removal-6.out
new file mode 100644
index 0000000000..6af6f47e48
--- /dev/null
+++ b/tests/virshtestdata/echo-quote-removal-6.out
@@ -0,0 +1 @@
+' " ;echo a
diff --git a/tests/virshtestdata/echo-quote-removal-7.out b/tests/virshtestdata/echo-quote-removal-7.out
new file mode 100644
index 0000000000..e5ec314ba9
--- /dev/null
+++ b/tests/virshtestdata/echo-quote-removal-7.out
@@ -0,0 +1,2 @@
+' " \
+a
diff --git a/tests/virshtestdata/echo-quote-removal-8.out b/tests/virshtestdata/echo-quote-removal-8.out
new file mode 100644
index 0000000000..1b5a28c5b3
--- /dev/null
+++ b/tests/virshtestdata/echo-quote-removal-8.out
@@ -0,0 +1 @@
+' " \\
diff --git a/tests/virshtestdata/multiple-commands-1.out b/tests/virshtestdata/multiple-commands-1.out
new file mode 100644
index 0000000000..422c2b7ab3
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-1.out
@@ -0,0 +1,2 @@
+a
+b
diff --git a/tests/virshtestdata/multiple-commands-10.out b/tests/virshtestdata/multiple-commands-10.out
new file mode 100644
index 0000000000..a5ce8f1469
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-10.out
@@ -0,0 +1 @@
+a # b
diff --git a/tests/virshtestdata/multiple-commands-11.out b/tests/virshtestdata/multiple-commands-11.out
new file mode 100644
index 0000000000..7898192261
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-11.out
@@ -0,0 +1 @@
+a
diff --git a/tests/virshtestdata/multiple-commands-12.out b/tests/virshtestdata/multiple-commands-12.out
new file mode 100644
index 0000000000..7898192261
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-12.out
@@ -0,0 +1 @@
+a
diff --git a/tests/virshtestdata/multiple-commands-2.out b/tests/virshtestdata/multiple-commands-2.out
new file mode 100644
index 0000000000..422c2b7ab3
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-2.out
@@ -0,0 +1,2 @@
+a
+b
diff --git a/tests/virshtestdata/multiple-commands-3.out b/tests/virshtestdata/multiple-commands-3.out
new file mode 100644
index 0000000000..422c2b7ab3
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-3.out
@@ -0,0 +1,2 @@
+a
+b
diff --git a/tests/virshtestdata/multiple-commands-4.out b/tests/virshtestdata/multiple-commands-4.out
new file mode 100644
index 0000000000..fa70605cd2
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-4.out
@@ -0,0 +1,2 @@
+a
+ b
diff --git a/tests/virshtestdata/multiple-commands-5.out b/tests/virshtestdata/multiple-commands-5.out
new file mode 100644
index 0000000000..b89bc872d4
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-5.out
@@ -0,0 +1,3 @@
+a
+\
+ b
diff --git a/tests/virshtestdata/multiple-commands-6.out b/tests/virshtestdata/multiple-commands-6.out
new file mode 100644
index 0000000000..7898192261
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-6.out
@@ -0,0 +1 @@
+a
diff --git a/tests/virshtestdata/multiple-commands-7.out b/tests/virshtestdata/multiple-commands-7.out
new file mode 100644
index 0000000000..0f7bc76605
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-7.out
@@ -0,0 +1,2 @@
+a
+c
diff --git a/tests/virshtestdata/multiple-commands-8.out b/tests/virshtestdata/multiple-commands-8.out
new file mode 100644
index 0000000000..0f7bc76605
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-8.out
@@ -0,0 +1,2 @@
+a
+c
diff --git a/tests/virshtestdata/multiple-commands-9.out b/tests/virshtestdata/multiple-commands-9.out
new file mode 100644
index 0000000000..a5ce8f1469
--- /dev/null
+++ b/tests/virshtestdata/multiple-commands-9.out
@@ -0,0 +1 @@
+a # b
-- 
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