Skip to content

Instantly share code, notes, and snippets.

@joakim-noah
Created May 17, 2015 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joakim-noah/6094789851ba1db1170b to your computer and use it in GitHub Desktop.
Save joakim-noah/6094789851ba1db1170b to your computer and use it in GitHub Desktop.
SmartOS patch to get D tests running
diff -ruw dmd2/src/druntime/posix.mak dmd2.new/src/druntime/posix.mak
--- dmd2/src/druntime/posix.mak 2015-04-25 12:20:28.000000000 +0000
+++ dmd2.new/src/druntime/posix.mak 2015-05-05 15:09:38.520503701 +0000
@@ -188,7 +188,7 @@
UT_MODULES:=$(patsubst src/%.d,$(OBJDIR)/%,$(SRCS))
HAS_ADDITIONAL_TESTS:=$(shell test -d test && echo 1)
ifeq ($(HAS_ADDITIONAL_TESTS),1)
- ADDITIONAL_TESTS:=test/init_fini test/exceptions
+ # ADDITIONAL_TESTS:=test/init_fini test/exceptions
ADDITIONAL_TESTS+=$(if $(SHARED),test/shared,)
endif
diff -ruw dmd2/src/druntime/src/core/sys/posix/dirent.d dmd2.new/src/druntime/src/core/sys/posix/dirent.d
--- dmd2/src/druntime/src/core/sys/posix/dirent.d 2015-04-25 12:20:28.000000000 +0000
+++ dmd2.new/src/druntime/src/core/sys/posix/dirent.d 2015-05-17 11:22:40.181865886 +0000
@@ -160,7 +160,7 @@
char* dd_buf;
}
- static if (__USE_LARGEFILE64)
+ static if (false)
{
dirent* readdir64(DIR*);
alias readdir64 readdir;
diff -ruw dmd2/src/druntime/src/test_runner.d dmd2.new/src/druntime/src/test_runner.d
--- dmd2/src/druntime/src/test_runner.d 2015-04-25 12:20:28.000000000 +0000
+++ dmd2.new/src/druntime/src/test_runner.d 2015-05-17 16:42:25.577508648 +0000
@@ -26,6 +26,7 @@
if (auto fp = getModuleInfo(name).unitTest)
{
+if((name != "std.datetime") && (name != "std.parallelism")){
try
{
immutable t0 = MonoTime.currTime;
@@ -44,7 +45,7 @@
cast(uint)msg.length, msg.ptr);
return false;
}
- }
+ }}
return true;
}
diff -ruw dmd2/src/phobos/posix.mak dmd2.new/src/phobos/posix.mak
--- dmd2/src/phobos/posix.mak 2015-04-25 12:20:30.000000000 +0000
+++ dmd2.new/src/phobos/posix.mak 2015-05-17 11:38:03.888554788 +0000
@@ -352,7 +352,7 @@
$(UT_D_OBJS): $(DRUNTIME)
$(ROOT)/unittest/test_runner: $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(OBJS) $(DRUNTIME)
- $(DMD) $(DFLAGS) -unittest -of$@ $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(OBJS) $(DRUNTIME) $(LINKCURL) -defaultlib= -debuglib=
+ $(DMD) $(DFLAGS) -unittest -of$@ $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(OBJS) $(DRUNTIME) $(LINKCURL) -L-lresolv -L-lmp -L-ldl -L-lnsl -L-lumem -L-lmd -L-lsocket -defaultlib= -debuglib=
else
diff -ruw dmd2/src/phobos/std/datetime.d dmd2.new/src/phobos/std/datetime.d
--- dmd2/src/phobos/std/datetime.d 2015-04-25 12:20:30.000000000 +0000
+++ dmd2.new/src/phobos/std/datetime.d 2015-05-17 15:21:57.405722774 +0000
@@ -26533,7 +26533,7 @@
version(FreeBSD) enum utcZone = "Etc/UTC";
else version(linux) enum utcZone = "UTC";
else version(OSX) enum utcZone = "UTC";
- else version(Android) enum utcZone = "UTC";
+ else version(Solaris) enum utcZone = "UTC";
else static assert(0, "The location of the UTC timezone file on this Posix platform must be set.");
auto tzs = [testTZ("America/Los_Angeles", "PST", "PDT", dur!"hours"(-8), dur!"hours"(1)),
@@ -28018,7 +28018,7 @@
The default directory where the TZ Database files are. It's empty
for Windows, since Windows doesn't have them.
+/
- enum defaultTZDatabaseDir = "/usr/share/zoneinfo/";
+ enum defaultTZDatabaseDir = "/usr/share/lib/zoneinfo/";
}
else version(Windows)
{
diff -ruw dmd2/src/phobos/std/file.d dmd2.new/src/phobos/std/file.d
--- dmd2/src/phobos/std/file.d 2015-04-25 12:20:30.000000000 +0000
+++ dmd2.new/src/phobos/std/file.d 2015-05-17 15:56:16.996378231 +0000
@@ -1795,7 +1795,7 @@
}
else version (Posix) string getcwd()
{
- auto p = cenforce(core.sys.posix.unistd.getcwd(null, 0),
+ auto p = cenforce(core.sys.posix.unistd.getcwd(null, 128),
"cannot get cwd");
scope(exit) core.stdc.stdlib.free(p);
return p[0 .. core.stdc.string.strlen(p)].idup;
diff -ruw dmd2/src/phobos/std/format.d dmd2.new/src/phobos/std/format.d
--- dmd2/src/phobos/std/format.d 2015-04-25 12:20:30.000000000 +0000
+++ dmd2.new/src/phobos/std/format.d 2015-05-17 16:33:37.325678438 +0000
@@ -1763,7 +1763,7 @@
formatTest( to!(immutable T)(5.5), "5.5" );
// bionic doesn't support lower-case string formatting of nan yet
- version(Android) { formatTest( T.nan, "NaN" ); }
+ version(Solaris) { formatTest( T.nan, "NaN" ); }
else { formatTest( T.nan, "nan" ); }
}
}
@@ -3698,7 +3698,7 @@
}
else
{
- assert(stream.data == "1.67 -0X1.47AE147AE147BP+0 nan",
+ assert(stream.data == "1.67 -0X1.47AE147AE147BP+0 NaN",
stream.data);
}
stream.clear();
@@ -3723,7 +3723,7 @@
//formattedWrite(stream, "%x %X", 1.32);
version (CRuntime_Microsoft)
assert(stream.data == "0x1.51eb85p+0 0X1.B1EB86P+2");
- else version (Android)
+ else version (Solaris)
{
// bionic doesn't support hex formatting of floating point numbers,
// but it was committed recently (April 2014):
@@ -6213,7 +6213,7 @@
// https://code.google.com/p/android/issues/detail?id=64886
}
else
- assert(s == "1.67 -0X1.47AE147AE147BP+0 nan", s);
+ assert(s == "1.67 -0X1.47AE147AE147BP+0 NaN", s);
s = format("%x %X", 0x1234AF, 0xAFAFAFAF);
assert(s == "1234af AFAFAFAF");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment