Merge pull request #6824 from ibuclaw/issue18519

fix Issue 18519: missing curl + phobos = std.net.curl unittest timing out
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2019-01-04 07:39:51 +01:00 committed by GitHub
commit 8d14c379c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 14 deletions

View file

@ -344,7 +344,17 @@ endif
# Unittests
################################################################################
$(addprefix $(ROOT)/unittest/,$(DISABLED_TESTS)) :
DISABLED_TESTS =
ifeq ($(OS),freebsd)
ifeq ($(MODEL),32)
# Curl tests for FreeBSD 32-bit are temporarily disabled.
# https://github.com/braddr/d-tester/issues/70
# https://issues.dlang.org/show_bug.cgi?id=18519
DISABLED_TESTS += std/net/curl
endif
endif
$(addsuffix .run,$(addprefix unittest/,$(DISABLED_TESTS))) :
@echo Testing $@ - disabled
include dip1000.mak

View file

@ -164,19 +164,9 @@ import std.encoding : EncodingScheme;
import std.traits : isSomeChar;
import std.typecons : Flag, Yes, No, Tuple;
// Curl tests for FreeBSD 32-bit are temporarily disabled.
// https://github.com/braddr/d-tester/issues/70
// https://issues.dlang.org/show_bug.cgi?id=18519
version (unittest)
version (FreeBSD)
version (X86)
version = DisableCurlTests;
version (DisableCurlTests) {} else:
version (unittest)
{
import std.socket : Socket;
import std.socket : Socket, SocketShutdown;
private struct TestServer
{
@ -248,7 +238,10 @@ version (unittest)
// terminate server from a thread local dtor of the thread that started it,
// because thread_joinall is called before shared module dtors
if (tlsInit && server.sock)
{
server.sock.shutdown(SocketShutdown.RECEIVE);
server.sock.close();
}
}
private struct Request(T)
@ -451,7 +444,11 @@ if (isCurlConn!Conn)
s.send(httpOK("Hello world"));
});
auto fn = std.file.deleteme;
scope (exit) std.file.remove(fn);
scope (exit)
{
if (std.file.exists(fn))
std.file.remove(fn);
}
download(host, fn);
assert(std.file.readText(fn) == "Hello world");
}
@ -513,7 +510,11 @@ if (isCurlConn!Conn)
foreach (host; [testServer.addr, "http://"~testServer.addr])
{
auto fn = std.file.deleteme;
scope (exit) std.file.remove(fn);
scope (exit)
{
if (std.file.exists(fn))
std.file.remove(fn);
}
std.file.write(fn, "upload data\n");
testServer.handle((s) {
auto req = s.recvReq;