summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorxzfc <xzfc@users.noreply.github.com>2018-10-11 03:47:08 +0700
committerAndreas Rumpf <rumpf_a@web.de>2018-10-10 22:47:08 +0200
commit8ed3dac1dcffd5598be88520a76d7430324b6007 (patch)
tree157cb3dee13e156c7a5e929f69a05e6b69b5a28f /tests
parent0ead36dae6ab0d4525d2318d19335147ffa0bd3d (diff)
downloadNim-8ed3dac1dcffd5598be88520a76d7430324b6007.tar.gz
Fix tests on NixOS (#9209) (#9285)
* Replace `/bin/sleep` with just `sleep`, i.e. use environment variable
  `$PATH` to locate binary.
* Replace `/usr/share/zoneinfo` with `$TZDIR` when it is defined,
  fallback to hardcoded path otherwise. This is the same behavior that
  Glibc2 normally have, see man 3 tzset.
Diffstat (limited to 'tests')
-rw-r--r--tests/async/tioselectors.nim4
-rw-r--r--tests/async/tupcoming_async.nim2
-rw-r--r--tests/stdlib/ttimes.nim2
3 files changed, 4 insertions, 4 deletions
diff --git a/tests/async/tioselectors.nim b/tests/async/tioselectors.nim
index a556b6dd2..7a8986644 100644
--- a/tests/async/tioselectors.nim
+++ b/tests/async/tioselectors.nim
@@ -163,9 +163,9 @@ elif not defined(windows):
 
     proc process_notification_test(): bool =
       var selector = newSelector[int]()
-      var process2 = startProcess("/bin/sleep", "", ["2"], nil,
+      var process2 = startProcess("sleep", "", ["2"], nil,
                            {poStdErrToStdOut, poUsePath})
-      discard startProcess("/bin/sleep", "", ["1"], nil,
+      discard startProcess("sleep", "", ["1"], nil,
                            {poStdErrToStdOut, poUsePath})
 
       selector.registerProcess(process2.processID, 0)
diff --git a/tests/async/tupcoming_async.nim b/tests/async/tupcoming_async.nim
index e3170620e..0a334709d 100644
--- a/tests/async/tupcoming_async.nim
+++ b/tests/async/tupcoming_async.nim
@@ -100,7 +100,7 @@ when defined(upcoming):
                                    {poStdErrToStdOut, poUsePath, poInteractive,
                                    poDemon})
       else:
-        var process = startProcess("/bin/sleep", "", ["1"], nil,
+        var process = startProcess("sleep", "", ["1"], nil,
                                    {poStdErrToStdOut, poUsePath})
       var fut = waitProcess(process)
       waitFor(fut or waitTimer(2000))
diff --git a/tests/stdlib/ttimes.nim b/tests/stdlib/ttimes.nim
index fcafe933a..660c9325f 100644
--- a/tests/stdlib/ttimes.nim
+++ b/tests/stdlib/ttimes.nim
@@ -114,7 +114,7 @@ suite "ttimes":
   # Generate tests for multiple timezone files where available
   # Set the TZ env var for each test
   when defined(linux) or defined(macosx):
-    const tz_dir = "/usr/share/zoneinfo"
+    let tz_dir = getEnv("TZDIR", "/usr/share/zoneinfo")
     const f = "yyyy-MM-dd HH:mm zzz"
     
     let orig_tz = getEnv("TZ")