dank@kegel.com: wininet: let automated testers force all DNS lookups to returnlocalhost

5 views
Skip to first unread message

Patchwatcher

unread,
Oct 31, 2008, 8:12:15 AM10/31/08
to wine-patch...@googlegroups.com
From: "Dan Kegel" <da...@kegel.com>
Subject: wininet: let automated testers force all DNS lookups to returnlocalhost
Date: Fri, 31 Oct 2008 04:45:58 -0700

The public internet can (and does) go pear-shaped
in the middle of test runs, which means any test
that tries to access the public internet is de facto
flaky, even if it tries to protect itself by skipping
if the internet is down.

So let's provide a way for automated testers to
force all hostname resolution requests to
return the same result (say, 'localhost' or 'mytestserver').
Only include this in debugging builds.

Later we should provide a script to set up
a local test server that can handle all of
our conformance tests' requests, but for
now, just letting patchwatcher or winetest
redirect everything to localhost will let tests
fail reliably instead of randomly.
See http://bugs.winehq.org/show_bug.cgi?id=15716

diff --git a/dlls/wininet/utility.c b/dlls/wininet/utility.c
index ff914f4..021aea0 100644
--- a/dlls/wininet/utility.c
+++ b/dlls/wininet/utility.c
@@ -153,6 +153,24 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,
struct hostent *phe;
#endif

+#ifndef NDEBUG
+ /* Provide a way to redirect all internet access to
+ * a private server, usually localhost.
+ * Don't enable this in any builds that go out to users,
+ * this is just for automated conformance testing, where
+ * we can't afford letting the flaky internet make
+ * tests fail randomly.
+ */
+ static char *dns_override = 0;
+ static int first_run = 1;
+ if (first_run) {
+ dns_override = getenv("WINETEST_DNSOVERRIDE");
+ first_run = 0;
+ }
+ if (dns_override)
+ lpszServerName = dns_override;
+#endif
+
TRACE("%s\n", debugstr_w(lpszServerName));

/* Validate server name first


Reply all
Reply to author
Forward
0 new messages