[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-mailutils] SMTP test failure
From: |
Sergey Poznyakoff |
Subject: |
Re: [bug-mailutils] SMTP test failure |
Date: |
Fri, 13 Apr 2012 18:29:23 +0300 |
Jordi Mallach <address@hidden> ha escrit:
> Apparently no. I'd swear it did work once in multiple tries, but after
> incrementing it to 15 seconds, it's probably safe to assume it never did.
Sure, 15 sec. is an overkill:) Anyways, I took a false track: it has
nothing to do with timing. I'm (almost) certain that it's IPv6 loopback
that spoils things. So, I have installed the attached patch. Please try
it and let me know if it works for you.
Regards,
Sergey
>From 4066c947d378bba39bdc36d8f1c7b0c4c4070ebd Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <address@hidden>
Date: Fri, 13 Apr 2012 18:17:06 +0300
Subject: [PATCH] Fix SMTP test on machines with IPv6 enabled.
* testsuite/smtpsend.c: New assignment option `family=' to
force using a specified interface family.
* testsuite/smtp-msg.at: Force IPv4.
* testsuite/smtp-str.at: Likewise.
---
testsuite/smtp-msg.at | 2 +-
testsuite/smtp-str.at | 2 +-
testsuite/smtpsend.c | 29 +++++++++++++++++++++++------
3 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/testsuite/smtp-msg.at b/testsuite/smtp-msg.at
index 6ffae20..4214071 100644
--- a/testsuite/smtp-msg.at
+++ b/testsuite/smtp-msg.at
@@ -34,7 +34,7 @@ p=`$abs_top_builddir/examples/mta -bd`
test $? -eq 0 || AT_SKIP_TEST
set -- $p
# $1 - pid, $2 - port
-smtpsend localhost port=$2 \
+smtpsend localhost port=$2 family=4\
address@hidden
address@hidden
domain=mailutils.org\
diff --git a/testsuite/smtp-str.at b/testsuite/smtp-str.at
index bee5cc3..b56f93e 100644
--- a/testsuite/smtp-str.at
+++ b/testsuite/smtp-str.at
@@ -34,7 +34,7 @@ p=`$abs_top_builddir/examples/mta -bd`
test $? -eq 0 || AT_SKIP_TEST
set -- $p
# $1 - pid, $2 - port
-smtpsend localhost port=$2 \
+smtpsend localhost port=$2 family=4\
address@hidden
address@hidden
domain=mailutils.org\
diff --git a/testsuite/smtpsend.c b/testsuite/smtpsend.c
index 40361e2..993c52b 100644
--- a/testsuite/smtpsend.c
+++ b/testsuite/smtpsend.c
@@ -28,7 +28,7 @@
static char usage_text[] =
"usage: %s hostname [port=N] [trace=N] [tls=N] [from=STRING] [rcpt=STRING]\n"
-" [domain=STRING] [user=STRING] [pass=STRING]\n"
+" [family=4|6] [domain=STRING] [user=STRING] [pass=STRING]\n"
" [service=STRING] [realm=STRING] [host=STRING]\n"
" [auth=method[,...]] [url=STRING] [input=FILE] [raw=N]\n"
" [skiphdr=name[,...]]\n";
@@ -107,12 +107,34 @@ main (int argc, char **argv)
if (argc < 2)
usage ();
+ memset (&hints, 0, sizeof (hints));
+ hints.flags = MU_AH_DETECT_FAMILY;
+ hints.port = 25;
+ hints.protocol = IPPROTO_TCP;
+ hints.socktype = SOCK_STREAM;
+
MU_ASSERT (mu_smtp_create (&smtp));
for (i = 1; i < argc; i++)
{
if (strncmp (argv[i], "port=", 5) == 0)
port = argv[i] + 5;
+ else if (strncmp (argv[i], "family=", 7) == 0)
+ {
+ hints.flags &= ~MU_AH_DETECT_FAMILY;
+ switch (argv[i][7])
+ {
+ case '4':
+ hints.family = AF_INET;
+ break;
+ case '6':
+ hints.family = AF_INET6;
+ break;
+ default:
+ mu_error ("invalid family name: %s", argv[i]+7);
+ exit (1);
+ }
+ }
else if (strncmp (argv[i], "trace=", 6) == 0)
{
char *arg = argv[i] + 6;
@@ -195,11 +217,6 @@ main (int argc, char **argv)
host = argv[1];
- memset (&hints, 0, sizeof (hints));
- hints.flags = MU_AH_DETECT_FAMILY;
- hints.port = 25;
- hints.protocol = IPPROTO_TCP;
- hints.socktype = SOCK_STREAM;
MU_ASSERT (mu_sockaddr_from_node (&sa, host, port, &hints));
MU_ASSERT (mu_tcp_stream_create_from_sa (&stream, sa, NULL, MU_STREAM_RDWR));
--
1.7.3.2