]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: support non-localhost HOSTIP for dict/smb servers
authorStephan Szabo <stephan.szabo@sony.com>
Wed, 19 Jun 2019 22:54:18 +0000 (15:54 -0700)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 20 Jun 2019 06:33:13 +0000 (08:33 +0200)
smbserver.py/dictserver.py were explicitly using localhost/127.0.0.1 for
binding the server which when we were running the tests with a separate
HOSTIP and CLIENTIP had failures verifying the server from the device we
were testing.

This changes them to take the address from runtests.py and default to
localhost/127.0.0.1 if none is given.

Closes #4048

tests/dictserver.py
tests/runtests.pl
tests/smbserver.py

index a41a8a0d67d1cf8375971ad61fb49ba5bf3f86cb..2d1b5a3b63aa8a0b8fa41b5731d2deadb71d5d2c 100755 (executable)
@@ -33,7 +33,7 @@ def dictserver(options):
         with open(options.pidfile, "w") as f:
             f.write("{0}".format(pid))
 
-    local_bind = (HOST, options.port)
+    local_bind = (options.host, options.port)
     log.info("[DICT] Listening on %s", local_bind)
 
     # Need to set the allow_reuse on the class, not on the instance.
@@ -83,6 +83,8 @@ def get_options():
 
     parser.add_argument("--port", action="store", default=9016,
                         type=int, help="port to listen on")
+    parser.add_argument("--host", action="store", default=HOST,
+                        help="host to listen on")
     parser.add_argument("--verbose", action="store", type=int, default=0,
                         help="verbose output")
     parser.add_argument("--pidfile", action="store",
index e7ea11c460f76c4f6a57325d0dfedde5e9871235..9413f0d4136e68f548f9ca4cbd8f9e4528b37730 100755 (executable)
@@ -2203,7 +2203,8 @@ sub rundictserver {
     $flags .= "--verbose 1 " if($debugprotocol);
     $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
     $flags .= "--id $idnum " if($idnum > 1);
-    $flags .= "--port $port --srcdir \"$srcdir\"";
+    $flags .= "--port $port --srcdir \"$srcdir\" ";
+    $flags .= "--host $HOSTIP";
 
     my $cmd = "$srcdir/dictserver.py $flags";
     my ($dictpid, $pid2) = startnew($cmd, $pidfile, 15, 0);
@@ -2279,7 +2280,8 @@ sub runsmbserver {
     $flags .= "--verbose 1 " if($debugprotocol);
     $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
     $flags .= "--id $idnum " if($idnum > 1);
-    $flags .= "--port $port --srcdir \"$srcdir\"";
+    $flags .= "--port $port --srcdir \"$srcdir\" ";
+    $flags .= "--host $HOSTIP";
 
     my $cmd = "$srcdir/smbserver.py $flags";
     my ($smbpid, $pid2) = startnew($cmd, $pidfile, 15, 0);
index 195ae395ba8b9bc9e021eb9361fa2de29e3df6fb..474e0612bf6e2c22dd9f3d049da3dd07a428eb2f 100755 (executable)
@@ -86,7 +86,7 @@ def smbserver(options):
 
     test_data_dir = os.path.join(options.srcdir, "data")
 
-    smb_server = TestSmbServer(("127.0.0.1", options.port),
+    smb_server = TestSmbServer((options.host, options.port),
                                config_parser=smb_config,
                                test_data_directory=test_data_dir)
     log.info("[SMB] setting up SMB server on port %s", options.port)
@@ -312,6 +312,8 @@ def get_options():
 
     parser.add_argument("--port", action="store", default=9017,
                       type=int, help="port to listen on")
+    parser.add_argument("--host", action="store", default="127.0.0.1",
+                      help="host to listen on")
     parser.add_argument("--verbose", action="store", type=int, default=0,
                         help="verbose output")
     parser.add_argument("--pidfile", action="store",