Re: [PATCH] test: let the OS choose a port for smtp-dummy

2019-05-10 Thread David Bremner
David Bremner  writes:

> This should avoid potential collisions if we start running multiple
> smtp-dummy processes in parallel.

merged to master
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: let the OS choose a port for smtp-dummy

2019-05-08 Thread Tomi Ollila
On Tue, May 07 2019, Daniel Kahn Gillmor wrote:

> On Tue 2019-05-07 07:20:49 -0300, David Bremner wrote:
>> This should avoid potential collisions if we start running multiple
>> smtp-dummy processes in parallel.
>
> This is excellent, simple, and clearly the right thing to do.  I've
> reviewed it, and am running it on my own development branch with no
> problems.  Thanks, Bremner!
>
> please merge.

i second that, please do!

Tomi


>
>--dkg
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: let the OS choose a port for smtp-dummy

2019-05-07 Thread Daniel Kahn Gillmor
On Tue 2019-05-07 07:20:49 -0300, David Bremner wrote:
> This should avoid potential collisions if we start running multiple
> smtp-dummy processes in parallel.

This is excellent, simple, and clearly the right thing to do.  I've
reviewed it, and am running it on my own development branch with no
problems.  Thanks, Bremner!

please merge.

   --dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test: let the OS choose a port for smtp-dummy

2019-05-07 Thread David Bremner
This should avoid potential collisions if we start running multiple
smtp-dummy processes in parallel.
---
 test/smtp-dummy.c | 15 ++-
 test/test-lib.sh  |  2 +-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/test/smtp-dummy.c b/test/smtp-dummy.c
index 71992edd..a7c1fe4f 100644
--- a/test/smtp-dummy.c
+++ b/test/smtp-dummy.c
@@ -129,6 +129,7 @@ main (int argc, char *argv[])
 int reuse;
 int background;
 int ret = 0;
+socklen_t addrlen;
 
 progname = argv[0];
 
@@ -191,7 +192,7 @@ main (int argc, char *argv[])
 
 memset (, 0, sizeof (addr));
 addr.sin_family = AF_INET;
-addr.sin_port = htons (25025);
+addr.sin_port = 0;
 addr.sin_addr = *(struct in_addr *) hostinfo->h_addr;
 err = bind (sock, (struct sockaddr *) , sizeof (addr));
 if (err) {
@@ -202,6 +203,18 @@ main (int argc, char *argv[])
goto DONE;
 }
 
+addrlen = sizeof (addr);
+err = getsockname (sock, (struct sockaddr *) , );
+if (err) {
+   fprintf (stderr, "Error: getsockname() failed: %s\n",
+strerror (errno));
+   close (sock);
+   ret = 1;
+   goto DONE;
+}
+
+printf ("smtp_dummy_port='%d'\n", ntohs (addr.sin_port));
+
 err = listen (sock, 1);
 if (err) {
fprintf (stderr, "Error: listen() failed: %s\n",
diff --git a/test/test-lib.sh b/test/test-lib.sh
index f5d367aa..507886ba 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -326,7 +326,7 @@ emacs_deliver_message ()
"(let ((message-send-mail-function 'message-smtpmail-send-it)
(mail-host-address \"example.com\")
   (smtpmail-smtp-server \"localhost\")
-  (smtpmail-smtp-service \"25025\"))
+  (smtpmail-smtp-service \"${smtp_dummy_port}\"))
   (notmuch-mua-mail)
   (message-goto-to)
   (insert \"test_su...@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 
-\")
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch