summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authoralaviss <alaviss@users.noreply.github.com>2018-08-14 14:35:07 +0700
committerAndreas Rumpf <rumpf_a@web.de>2018-08-14 09:35:07 +0200
commit7ef268274f387530b85f5a9f704e0eda5a7aa022 (patch)
treeda50f8c26a1e1f94b5d152a8cdaab87a3dddeb34 /tests
parentfeda366d86e723ff1877a1751cb3eadde8b00cb0 (diff)
downloadNim-7ef268274f387530b85f5a9f704e0eda5a7aa022.tar.gz
Haiku support for Nim (#8542)
* posix_other: Haiku now has spawn.h

This is added per https://dev.haiku-os.org/ticket/13446

* posix_other: Add Haiku specific Dirent members

* cpuinfo: Add an implementation for Haiku

* distros: Add basic Haiku support

* encodings: update Haiku support

* fenv, math: Haiku now provides libm

* times: Add Haiku struct members

* ansi_c, osalloc: Add Haiku constants

* threads: Add Haiku support

* testament: Haiku uses LIBRARY_PATH

* nim.cfg: Update Haiku support

libnetwork should only be linked if network functions are used

* threads: Haiku does not support -pthread switch

* tworkingdir: Haiku's env is in /bin

* posix_other: add SIGKILLTHR for Haiku

* sockets: link with libnetwork on Haiku

* coro: correct ucontext.h location

http://pubs.opengroup.org/onlinepubs/009696699/basedefs/ucontext.h.html

* coro: ucontext backend is not available on Haiku

Haiku doesn't provide the <ucontext.h> header, as it was removed from POSIX

* coro: fix setjmp backend

The compiler does not allow statements after a noreturn function

* nativesockets: Haiku doesn't support AI_V4MAPPED

* system: hostOS can contains "haiku"

* os: add support for Haiku's packagefs

packagefs is read-only, but there are writable holes to the underlying
file system as well

* os: update constant for Haiku
Diffstat (limited to 'tests')
-rw-r--r--tests/osproc/texitsignal.nim5
-rw-r--r--tests/osproc/tworkingdir.nim2
-rw-r--r--tests/testament/categories.nim10
3 files changed, 13 insertions, 4 deletions
diff --git a/tests/osproc/texitsignal.nim b/tests/osproc/texitsignal.nim
index c0bed70ee..fbf5068ea 100644
--- a/tests/osproc/texitsignal.nim
+++ b/tests/osproc/texitsignal.nim
@@ -28,9 +28,12 @@ if paramCount() == 0:
     # windows kill happens using TerminateProcess(h, 0), so we should get a
     # 0 here
     echo p.waitForExit() == 0
+  elif defined(haiku):
+    # on Haiku, the program main thread receive SIGKILLTHR
+    echo p.waitForExit() == 128 + SIGKILLTHR
   else:
     # on posix (non-windows), kill sends SIGKILL
     echo p.waitForExit() == 128 + SIGKILL
 
 else:
-  sleep(5000)  # should get killed before this
\ No newline at end of file
+  sleep(5000)  # should get killed before this
diff --git a/tests/osproc/tworkingdir.nim b/tests/osproc/tworkingdir.nim
index eeed9240d..7d58d5ae6 100644
--- a/tests/osproc/tworkingdir.nim
+++ b/tests/osproc/tworkingdir.nim
@@ -12,6 +12,8 @@ else:
   var process: Process
   when defined(android):
     process = startProcess("/system/bin/env", "/system/bin", ["true"])
+  elif defined(haiku):
+    process = startProcess("/bin/env", "/bin", ["true"])
   else:
     process = startProcess("/usr/bin/env", "/usr/bin", ["true"])
   let dir2 = getCurrentDir()
diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim
index 95521449a..fca6927d4 100644
--- a/tests/testament/categories.nim
+++ b/tests/testament/categories.nim
@@ -109,10 +109,14 @@ proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
     safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll)
   else:
     # posix relies on crappy LD_LIBRARY_PATH (ugh!):
-    var libpath = getEnv"LD_LIBRARY_PATH".string
+    const libpathenv = when defined(haiku):
+                         "LIBRARY_PATH"
+                       else:
+                         "LD_LIBRARY_PATH"
+    var libpath = getEnv(libpathenv).string
     # Temporarily add the lib directory to LD_LIBRARY_PATH:
-    putEnv("LD_LIBRARY_PATH", "tests/dll" & (if libpath.len > 0: ":" & libpath else: ""))
-    defer: putEnv("LD_LIBRARY_PATH", libpath)
+    putEnv(libpathenv, "tests/dll" & (if libpath.len > 0: ":" & libpath else: ""))
+    defer: putEnv(libpathenv, libpath)
     var nimrtlDll = DynlibFormat % "nimrtl"
     safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll)