Fixed tests for TravisCI

This commit is contained in:
Yuriy Glukhov 2015-10-22 17:39:39 +03:00
commit e5aefbd1d4
3 changed files with 13 additions and 9 deletions

View file

@ -7,6 +7,7 @@ addons:
packages: packages:
- libcurl4-openssl-dev - libcurl4-openssl-dev
- libsdl1.2-dev - libsdl1.2-dev
- libgc-dev
before_script: before_script:
- set -e - set -e
- wget http://flatassembler.net/fasm-1.71.39.tgz - wget http://flatassembler.net/fasm-1.71.39.tgz
@ -26,5 +27,6 @@ script:
- nimble install zip - nimble install zip
- nimble install opengl - nimble install opengl
- nimble install sdl1 - nimble install sdl1
- nimble install jester
- nim c --taintMode:on tests/testament/tester - nim c --taintMode:on tests/testament/tester
- tests/testament/tester --pedantic all - tests/testament/tester --pedantic all

View file

@ -1,5 +1,5 @@
import nake import nake
import httpclient, zip/zipfiles, times, math import httpclient, zip/zipfiles, times, math, sequtils
nakeImports nakeImports
randomize() randomize()

View file

@ -75,29 +75,31 @@ proc safeCopyFile(src, dest: string) =
echo "[Warning] could not copy: ", src, " to ", dest echo "[Warning] could not copy: ", src, " to ", dest
proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) = proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
const rpath = when defined(macosx):
" --passL:-rpath --passL:@loader_path"
else:
""
testSpec c, makeTest("lib/nimrtl.nim", testSpec c, makeTest("lib/nimrtl.nim",
options & " --app:lib -d:createNimRtl", cat) options & " --app:lib -d:createNimRtl", cat)
testSpec c, makeTest("tests/dll/server.nim", testSpec c, makeTest("tests/dll/server.nim",
options & " --app:lib -d:useNimRtl", cat) options & " --app:lib -d:useNimRtl" & rpath, cat)
when defined(Windows): when defined(Windows):
# windows looks in the dir of the exe (yay!): # windows looks in the dir of the exe (yay!):
var serverDll = DynlibFormat % "server"
safeCopyFile("lib" / serverDll, "tests/dll" / serverDll)
var nimrtlDll = DynlibFormat % "nimrtl" var nimrtlDll = DynlibFormat % "nimrtl"
safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll) safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll)
else: else:
# posix relies on crappy LD_LIBRARY_PATH (ugh!): # posix relies on crappy LD_LIBRARY_PATH (ugh!):
var libpath = getEnv"LD_LIBRARY_PATH".string var libpath = getEnv"LD_LIBRARY_PATH".string
# Temporarily add the lib directory to LD_LIBRARY_PATH: # Temporarily add the lib directory to LD_LIBRARY_PATH:
putEnv("LD_LIBRARY_PATH", "lib:" & libpath) putEnv("LD_LIBRARY_PATH", "tests/dll:" & libpath)
defer: putEnv("LD_LIBRARY_PATH", libpath) defer: putEnv("LD_LIBRARY_PATH", libpath)
var serverDll = DynlibFormat % "server"
safeCopyFile("tests/dll" / serverDll, "lib" / serverDll)
var nimrtlDll = DynlibFormat % "nimrtl" var nimrtlDll = DynlibFormat % "nimrtl"
safeCopyFile("tests/dll" / nimrtlDll, "lib" / nimrtlDll) safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll)
testSpec r, makeTest("tests/dll/client.nim", options & " -d:useNimRtl", testSpec r, makeTest("tests/dll/client.nim", options & " -d:useNimRtl" & rpath,
cat, actionRun) cat, actionRun)
proc dllTests(r: var TResults, cat: Category, options: string) = proc dllTests(r: var TResults, cat: Category, options: string) =