mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 06:30:28 +03:00
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:
commit
8d14c379c2
2 changed files with 25 additions and 14 deletions
12
posix.mak
12
posix.mak
|
@ -344,7 +344,17 @@ endif
|
||||||
# Unittests
|
# 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
|
@echo Testing $@ - disabled
|
||||||
|
|
||||||
include dip1000.mak
|
include dip1000.mak
|
||||||
|
|
|
@ -164,19 +164,9 @@ import std.encoding : EncodingScheme;
|
||||||
import std.traits : isSomeChar;
|
import std.traits : isSomeChar;
|
||||||
import std.typecons : Flag, Yes, No, Tuple;
|
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)
|
version (unittest)
|
||||||
{
|
{
|
||||||
import std.socket : Socket;
|
import std.socket : Socket, SocketShutdown;
|
||||||
|
|
||||||
private struct TestServer
|
private struct TestServer
|
||||||
{
|
{
|
||||||
|
@ -248,8 +238,11 @@ version (unittest)
|
||||||
// terminate server from a thread local dtor of the thread that started it,
|
// terminate server from a thread local dtor of the thread that started it,
|
||||||
// because thread_joinall is called before shared module dtors
|
// because thread_joinall is called before shared module dtors
|
||||||
if (tlsInit && server.sock)
|
if (tlsInit && server.sock)
|
||||||
|
{
|
||||||
|
server.sock.shutdown(SocketShutdown.RECEIVE);
|
||||||
server.sock.close();
|
server.sock.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private struct Request(T)
|
private struct Request(T)
|
||||||
{
|
{
|
||||||
|
@ -451,7 +444,11 @@ if (isCurlConn!Conn)
|
||||||
s.send(httpOK("Hello world"));
|
s.send(httpOK("Hello world"));
|
||||||
});
|
});
|
||||||
auto fn = std.file.deleteme;
|
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);
|
download(host, fn);
|
||||||
assert(std.file.readText(fn) == "Hello world");
|
assert(std.file.readText(fn) == "Hello world");
|
||||||
}
|
}
|
||||||
|
@ -513,7 +510,11 @@ if (isCurlConn!Conn)
|
||||||
foreach (host; [testServer.addr, "http://"~testServer.addr])
|
foreach (host; [testServer.addr, "http://"~testServer.addr])
|
||||||
{
|
{
|
||||||
auto fn = std.file.deleteme;
|
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");
|
std.file.write(fn, "upload data\n");
|
||||||
testServer.handle((s) {
|
testServer.handle((s) {
|
||||||
auto req = s.recvReq;
|
auto req = s.recvReq;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue