summary refs log tree commit diff stats
path: root/tests/dll
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dll')
-rw-r--r--tests/dll/client.nim9
-rw-r--r--tests/dll/nimhcr_0_3.nim1
-rw-r--r--tests/dll/nimhcr_2_1.nim2
-rw-r--r--tests/dll/nimhcr_basic.nim8
-rw-r--r--tests/dll/nimhcr_integration.nim20
-rw-r--r--tests/dll/nimhcr_unit.nim8
-rw-r--r--tests/dll/server.nim1
7 files changed, 40 insertions, 9 deletions
diff --git a/tests/dll/client.nim b/tests/dll/client.nim
index 90ca05149..62697569f 100644
--- a/tests/dll/client.nim
+++ b/tests/dll/client.nim
@@ -1,6 +1,4 @@
 discard """
-  output: "Done"
-  disabled: "freebsd"
   cmd: "nim $target --debuginfo --hints:on --define:useNimRtl $options $file"
 """
 
@@ -38,5 +36,8 @@ proc eval(n: PNode): int =
 for i in 0..100_000:
   discard eval(buildTree(2))
 
-echo "Done"
-
+# bug https://forum.nim-lang.org/t/8176; Error: ambiguous identifier: 'nimrtl'
+import std/strutils
+doAssert join(@[1, 2]) == "12"
+doAssert join(@[1.5, 2.5]) == "1.52.5"
+doAssert join(@["a", "bc"]) == "abc"
diff --git a/tests/dll/nimhcr_0_3.nim b/tests/dll/nimhcr_0_3.nim
index 56f66e08c..183424e11 100644
--- a/tests/dll/nimhcr_0_3.nim
+++ b/tests/dll/nimhcr_0_3.nim
@@ -14,5 +14,6 @@ let c = makeCounter()
 afterCodeReload:
   echo "   0: after - closure iterator: ", c()
   echo "   0: after - closure iterator: ", c()
+  echo "   0: after - c_2 = ", c_2
 
 proc getInt*(): int = return g_1 + g_2.len
diff --git a/tests/dll/nimhcr_2_1.nim b/tests/dll/nimhcr_2_1.nim
index faafb1f76..705ed6d5a 100644
--- a/tests/dll/nimhcr_2_1.nim
+++ b/tests/dll/nimhcr_2_1.nim
@@ -7,6 +7,8 @@ type
 
 let g_2* = @[Type2(data: 2), Type2(data: 3)][1..^1] # should have a length of 1
 
+const c_2* = [1, 2, 3] # testing that a complext const object is properly exported
+
 var a: tuple[str: string, i: int]
 a.str = "   2: random string"
 echo a.str
diff --git a/tests/dll/nimhcr_basic.nim b/tests/dll/nimhcr_basic.nim
new file mode 100644
index 000000000..2e1f39ae0
--- /dev/null
+++ b/tests/dll/nimhcr_basic.nim
@@ -0,0 +1,8 @@
+discard """
+  output: '''
+Hello world
+'''
+"""
+# for now orc only tests successful compilation
+
+echo "Hello world"
diff --git a/tests/dll/nimhcr_integration.nim b/tests/dll/nimhcr_integration.nim
index 64f6bb708..ac34f1f85 100644
--- a/tests/dll/nimhcr_integration.nim
+++ b/tests/dll/nimhcr_integration.nim
@@ -1,5 +1,5 @@
 discard """
-  disabled: "macosx"
+  disabled: "true"
   output: '''
 main: HELLO!
 main: hasAnyModuleChanged? true
@@ -35,6 +35,7 @@ max mutual recursion reached!
 bar
    0: after - closure iterator: 0
    0: after - closure iterator: 1
+   0: after - c_2 = [1, 2, 3]
 main: after
               The answer is: 9
 main: hasAnyModuleChanged? true
@@ -53,6 +54,20 @@ done
 '''
 """
 
+#[
+xxx disabled: "openbsd" because it would otherwise give:
+/home/build/Nim/lib/nimhcr.nim(532) hcrInit
+/home/build/Nim/lib/nimhcr.nim(503) initModules
+/home/build/Nim/lib/nimhcr.nim(463) initPointerData
+/home/build/Nim/lib/nimhcr.nim(346) hcrRegisterProc
+/home/build/Nim/lib/pure/reservedmem.nim(223) setLen
+/home/build/Nim/lib/pure/reservedmem.nim(97) setLen
+/home/build/Nim/lib/pure/includes/oserr.nim(94) raiseOSError
+Error: unhandled exception: Not supported [OSError]
+
+After instrumenting code, the stacktrace actually points to the call to `check mprotect`
+]#
+
 ## This is perhaps the most complex test in the nim test suite - calling the
 ## compiler on the file itself with the same set or arguments and reloading
 ## parts of the program at runtime! In the same folder there are a few modules
@@ -97,6 +112,7 @@ proc compileReloadExecute() =
   #   binary triggers rebuilding itself here it shouldn't rebuild the main module -
   #   that would lead to replacing the main binary executable which is running!
   let cmd = commandLineParams()[0..^1].join(" ").replace(" --forceBuild")
+  doAssert cmd.len > 0
   let (stdout, exitcode) = execCmdEx(cmd)
   if exitcode != 0:
     echo "COMPILATION ERROR!"
@@ -151,4 +167,4 @@ update 0
 update 1
 update 2
 
-echo "done"
+echo "done"
\ No newline at end of file
diff --git a/tests/dll/nimhcr_unit.nim b/tests/dll/nimhcr_unit.nim
index f539a53c8..249f3f9f1 100644
--- a/tests/dll/nimhcr_unit.nim
+++ b/tests/dll/nimhcr_unit.nim
@@ -1,4 +1,6 @@
 discard """
+disabled: "openbsd"
+disabled: "netbsd"
 output: '''
 fastcall_proc implementation #1 10
 11
@@ -104,14 +106,14 @@ macro carryOutTests(callingConv: untyped): untyped =
       echo `procName`, " implementation #1 ", x
       return x + 1
 
-    let fp1 = cast[F](hcrRegisterProc("dummy_module", `procName`, `p1`))
+    let fp1 = cast[F](hcrRegisterProc("dummy_module", `procName`, cast[pointer](`p1`)))
     echo fp1(10)
 
     proc `p2`(x: int): int {.placeholder.} =
       echo `procName`, " implementation #2 ", x
       return x + 2
 
-    let fp2 = cast[F](hcrRegisterProc("dummy_module", `procName`, `p2`))
+    let fp2 = cast[F](hcrRegisterProc("dummy_module", `procName`, cast[pointer](`p2`)))
     echo fp1(20)
     echo fp2(20)
 
@@ -119,7 +121,7 @@ macro carryOutTests(callingConv: untyped): untyped =
       echo `procName`, " implementation #3 ", x
       return x + 3
 
-    let fp3 = cast[F](hcrRegisterProc("dummy_module", `procName`, `p3`))
+    let fp3 = cast[F](hcrRegisterProc("dummy_module", `procName`, cast[pointer](`p3`)))
     echo fp1(30)
     echo fp2(30)
     echo fp3(30)
diff --git a/tests/dll/server.nim b/tests/dll/server.nim
index 2b7791d4b..dd4606298 100644
--- a/tests/dll/server.nim
+++ b/tests/dll/server.nim
@@ -1,6 +1,7 @@
 discard """
 action: compile
   cmd: "nim $target --debuginfo --hints:on --define:useNimRtl --app:lib $options $file"
+batchable: false
 """
 
 type