From 4d9e8e13ae35452f66dfcb89e1692762660deaac Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 31 Dec 2011 15:49:48 +0100 Subject: [PATCH] MAP_ANONYMOUS is not always 0x20 for linux; changed the tests --- lib/system/alloc.nim | 9 ++++----- tests/specials.nim | 15 +++++++++++++-- tests/system/io.nim | 5 +++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim index bc8124aca..e31ef47df 100755 --- a/lib/system/alloc.nim +++ b/lib/system/alloc.nim @@ -20,15 +20,14 @@ when defined(posix): PROT_WRITE = 2 # page can be written MAP_PRIVATE = 2 # Changes are private - when defined(linux) or defined(aix): - const MAP_ANONYMOUS = 0x20 # don't use a file - elif defined(macosx) or defined(bsd): + when defined(macosx) or defined(bsd): const MAP_ANONYMOUS = 0x1000 elif defined(solaris): const MAP_ANONYMOUS = 0x100 else: - {.error: "Port memory manager to your platform".} - + var + MAP_ANONYMOUS {.importc: "MAP_ANONYMOUS", header: "".}: cint + proc mmap(adr: pointer, len: int, prot, flags, fildes: cint, off: int): pointer {.header: "".} diff --git a/tests/specials.nim b/tests/specials.nim index 5152b089f..f5a6545d4 100644 --- a/tests/specials.nim +++ b/tests/specials.nim @@ -92,7 +92,16 @@ proc runDLLTests(r: var TResults, options: string) = runBasicDLLTest c, r, options & " -d:release" runBasicDLLTest c, r, options & " --gc:boehm" runBasicDLLTest c, r, options & " -d:release --gc:boehm" + +proc compileDLLTests(r: var TResults, options: string) = + # dummy run result: + var c = initResults() + runBasicDLLTest r, c, options + runBasicDLLTest r, c, options & " -d:release" + runBasicDLLTest r, c, options & " --gc:boehm" + runBasicDLLTest r, c, options & " -d:release --gc:boehm" + # ------------------------------ GC tests ------------------------------------- proc runGcTests(r: var TResults, options: string) = @@ -118,7 +127,8 @@ proc runThreadTests(r: var TResults, options: string) = test "tactors" test "threadex" - test "trecursive_actor" + # deactivated because output capturing still causes problems sometimes: + #test "trecursive_actor" #test "threadring" #test "tthreadanalysis" #test "tthreadsort" @@ -139,7 +149,7 @@ proc runIOTests(r: var TResults, options: string) = # ------------------------- register special tests here ----------------------- proc runSpecialTests(r: var TResults, options: string) = runRodFiles(r, options) - runDLLTests(r, options) + #runDLLTests(r, options) runGCTests(r, options) runThreadTests(r, options & " --threads:on") runIOTests(r, options) @@ -154,4 +164,5 @@ proc compileSpecialTests(r: var TResults, options: string) = compileSingleTest(r, "compiler/pas2nim/pas2nim.nim", options) compileIOTests(r, options) + compileDLLTests(r, options) diff --git a/tests/system/io.nim b/tests/system/io.nim index 2c68fd249..31978feb7 100644 --- a/tests/system/io.nim +++ b/tests/system/io.nim @@ -1,9 +1,10 @@ discard """output: '''[OK] stdin -[OK] file'''""" +[OK] file''' +""" import - unittest, osproc, streams, os, readall_echo + unittest, osproc, streams, os, "helpers/readall_echo" const STRING_DATA = """Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.""" const TEST_FILE = "tests/testdata/string"