]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virshtest: Test against output files ("echo" tests)
authorPeter Krempa <pkrempa@redhat.com>
Tue, 12 Mar 2024 13:13:19 +0000 (14:13 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 2 Apr 2024 12:24:30 +0000 (14:24 +0200)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
31 files changed:
tests/virshtest.c
tests/virshtestdata/dash-dash-argument-1.out [new file with mode: 0644]
tests/virshtestdata/dash-dash-argument-2.out [new file with mode: 0644]
tests/virshtestdata/dash-dash-argument-3.out [new file with mode: 0644]
tests/virshtestdata/dash-dash-argument-4.out [new file with mode: 0644]
tests/virshtestdata/dash-dash-argument-5.out [new file with mode: 0644]
tests/virshtestdata/dash-dash-argument-6.out [new file with mode: 0644]
tests/virshtestdata/echo-alias-argv.out [new file with mode: 0644]
tests/virshtestdata/echo-escaping-1.out [new file with mode: 0644]
tests/virshtestdata/echo-escaping-2.out [new file with mode: 0644]
tests/virshtestdata/echo-escaping-3.out [new file with mode: 0644]
tests/virshtestdata/echo-quote-removal-1.out [new file with mode: 0644]
tests/virshtestdata/echo-quote-removal-2.out [new file with mode: 0644]
tests/virshtestdata/echo-quote-removal-3.out [new file with mode: 0644]
tests/virshtestdata/echo-quote-removal-4.out [new file with mode: 0644]
tests/virshtestdata/echo-quote-removal-5.out [new file with mode: 0644]
tests/virshtestdata/echo-quote-removal-6.out [new file with mode: 0644]
tests/virshtestdata/echo-quote-removal-7.out [new file with mode: 0644]
tests/virshtestdata/echo-quote-removal-8.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-1.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-10.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-11.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-12.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-2.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-3.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-4.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-5.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-6.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-7.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-8.out [new file with mode: 0644]
tests/virshtestdata/multiple-commands-9.out [new file with mode: 0644]

index fc1246a96d1a79dfbf64c6d300daff133c71d33f..1750cc7abd35053b53d08202617c310c48f00121 100644 (file)
@@ -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 (file)
index 0000000..7898192
--- /dev/null
@@ -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 (file)
index 0000000..7898192
--- /dev/null
@@ -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 (file)
index 0000000..b9f81e9
--- /dev/null
@@ -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 (file)
index 0000000..9367d30
--- /dev/null
@@ -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 (file)
index 0000000..7898192
--- /dev/null
@@ -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 (file)
index 0000000..ab8d1a1
--- /dev/null
@@ -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 (file)
index 0000000..ce01362
--- /dev/null
@@ -0,0 +1 @@
+hello
diff --git a/tests/virshtestdata/echo-escaping-1.out b/tests/virshtestdata/echo-escaping-1.out
new file mode 100644 (file)
index 0000000..ff7ee06
--- /dev/null
@@ -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 (file)
index 0000000..e04d19b
--- /dev/null
@@ -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 (file)
index 0000000..f98b72d
--- /dev/null
@@ -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 (file)
index 0000000..b2901ea
--- /dev/null
@@ -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 (file)
index 0000000..927ce33
--- /dev/null
@@ -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 (file)
index 0000000..927ce33
--- /dev/null
@@ -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 (file)
index 0000000..927ce33
--- /dev/null
@@ -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 (file)
index 0000000..00f7191
--- /dev/null
@@ -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 (file)
index 0000000..6af6f47
--- /dev/null
@@ -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 (file)
index 0000000..e5ec314
--- /dev/null
@@ -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 (file)
index 0000000..1b5a28c
--- /dev/null
@@ -0,0 +1 @@
+' " \\
diff --git a/tests/virshtestdata/multiple-commands-1.out b/tests/virshtestdata/multiple-commands-1.out
new file mode 100644 (file)
index 0000000..422c2b7
--- /dev/null
@@ -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 (file)
index 0000000..a5ce8f1
--- /dev/null
@@ -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 (file)
index 0000000..7898192
--- /dev/null
@@ -0,0 +1 @@
+a
diff --git a/tests/virshtestdata/multiple-commands-12.out b/tests/virshtestdata/multiple-commands-12.out
new file mode 100644 (file)
index 0000000..7898192
--- /dev/null
@@ -0,0 +1 @@
+a
diff --git a/tests/virshtestdata/multiple-commands-2.out b/tests/virshtestdata/multiple-commands-2.out
new file mode 100644 (file)
index 0000000..422c2b7
--- /dev/null
@@ -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 (file)
index 0000000..422c2b7
--- /dev/null
@@ -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 (file)
index 0000000..fa70605
--- /dev/null
@@ -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 (file)
index 0000000..b89bc87
--- /dev/null
@@ -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 (file)
index 0000000..7898192
--- /dev/null
@@ -0,0 +1 @@
+a
diff --git a/tests/virshtestdata/multiple-commands-7.out b/tests/virshtestdata/multiple-commands-7.out
new file mode 100644 (file)
index 0000000..0f7bc76
--- /dev/null
@@ -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 (file)
index 0000000..0f7bc76
--- /dev/null
@@ -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 (file)
index 0000000..a5ce8f1
--- /dev/null
@@ -0,0 +1 @@
+a # b