[libvirt PATCH v2 5/6] virnetsockettest: Test more socket paths

Andrea Bolognani abologna at redhat.com
Mon Feb 14 16:03:34 UTC 2022


While unlikely, the socket path might also contain unusual
characters that need special handling. Adjust test cases so that
these scenarios are covered.

Note that none of these inputs will actually work outside of the
test suite at the moment, but we're going to address that in the
next commit.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 tests/virnetsockettest.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index 09c3ba13ad..ef7b5c6f59 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -668,14 +668,14 @@ mymain(void)
     struct testSSHData sshData7 = {
         .nodename = "somehost",
         .netcat = "n c",
-        .path = "/tmp/socket",
+        .path = "/tmp/sock et",
         .expectOut = "-T -e none -- somehost sh -c '"
                          "if '''\\''n c'\\'''' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
                              "ARG=-q0; "
                          "else "
                              "ARG=; "
                          "fi; "
-                         "'''\\''n c'\\'''' $ARG -U /tmp/socket"
+                         "'''\\''n c'\\'''' $ARG -U /tmp/sock et"
                      "'\n",
     };
     if (virTestRun("SSH test 7", testSocketSSH, &sshData7) < 0)
@@ -684,14 +684,14 @@ mymain(void)
     struct testSSHData sshData8 = {
         .nodename = "somehost",
         .netcat = "n'c",
-        .path = "/tmp/socket",
+        .path = "/tmp/sock'et",
         .expectOut = "-T -e none -- somehost sh -c '"
                          "if '''\\''n'\\''\\'\\'''\\''c'\\'''' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
                              "ARG=-q0; "
                          "else "
                              "ARG=; "
                          "fi; "
-                         "'''\\''n'\\''\\'\\'''\\''c'\\'''' $ARG -U /tmp/socket"
+                         "'''\\''n'\\''\\'\\'''\\''c'\\'''' $ARG -U /tmp/sock'et"
                      "'\n",
     };
     if (virTestRun("SSH test 8", testSocketSSH, &sshData8) < 0)
@@ -700,14 +700,14 @@ mymain(void)
     struct testSSHData sshData9 = {
         .nodename = "somehost",
         .netcat = "n\"c",
-        .path = "/tmp/socket",
+        .path = "/tmp/sock\"et",
         .expectOut = "-T -e none -- somehost sh -c '"
                          "if '''\\''n\"c'\\'''' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
                              "ARG=-q0; "
                          "else "
                              "ARG=; "
                          "fi; "
-                         "'''\\''n\"c'\\'''' $ARG -U /tmp/socket"
+                         "'''\\''n\"c'\\'''' $ARG -U /tmp/sock\"et"
                      "'\n",
     };
     if (virTestRun("SSH test 9", testSocketSSH, &sshData9) < 0)
-- 
2.35.1




More information about the libvir-list mailing list