diff options
Diffstat (limited to 'tests/testament')
-rw-r--r-- | tests/testament/categories.nim | 26 | ||||
-rw-r--r-- | tests/testament/specs.nim | 4 | ||||
-rw-r--r-- | tests/testament/tester.nim | 6 |
3 files changed, 26 insertions, 10 deletions
diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim index cde8880b3..2c55bd0bd 100644 --- a/tests/testament/categories.nim +++ b/tests/testament/categories.nim @@ -76,7 +76,7 @@ proc flagTests(r: var TResults, cat: Category, options: string) = testExec r, makeTest(filename, " cmd /c cd " & nimcache & " && compile_tgenscript.bat", cat) - when defined(linux): + elif defined(posix): testExec r, makeTest(filename, " sh -c \"cd " & nimcache & " && sh compile_tgenscript.sh\"", cat) @@ -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) @@ -256,6 +260,8 @@ proc jsTests(r: var TResults, cat: Category, options: string) = # ------------------------- nim in action ----------- proc testNimInAction(r: var TResults, cat: Category, options: string) = + let options = options & " --nilseqs:on" + template test(filename: untyped, action: untyped) = testSpec r, makeTest(filename, options, cat, action) @@ -482,8 +488,12 @@ proc processCategory(r: var TResults, cat: Category, options: string) = compileRodFiles(r, cat, options) runRodFiles(r, cat, options) of "js": - # XXX JS doesn't need to be special anymore - jsTests(r, cat, options) + # only run the JS tests on Windows or Linux because Travis is bad + # and other OSes like Haiku might lack nodejs: + if not defined(linux) and isTravis: + discard + else: + jsTests(r, cat, options) of "dll": dllTests(r, cat, options) of "flags": @@ -521,5 +531,9 @@ proc processCategory(r: var TResults, cat: Category, options: string) = # We can't test it because it depends on a third party. discard # TODO: Move untestable tests to someplace else, i.e. nimble repo. else: + var testsRun = 0 for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"): testSpec r, makeTest(name, options, cat) + inc testsRun + if testsRun == 0: + echo "[Warning] - Invalid category specified \"", cat.string, "\", no tests were run" diff --git a/tests/testament/specs.nim b/tests/testament/specs.nim index ac79e3942..fbe930a4f 100644 --- a/tests/testament/specs.nim +++ b/tests/testament/specs.nim @@ -12,8 +12,8 @@ import parseutils, strutils, os, osproc, streams, parsecfg var compilerPrefix* = "compiler" / "nim " -let isTravis = existsEnv("TRAVIS") -let isAppVeyor = existsEnv("APPVEYOR") +let isTravis* = existsEnv("TRAVIS") +let isAppVeyor* = existsEnv("APPVEYOR") proc cmdTemplate*(): string = compilerPrefix & "$target --lib:lib --hints:on -d:testing $options $file" diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim index 136a509e4..566338559 100644 --- a/tests/testament/tester.nim +++ b/tests/testament/tester.nim @@ -22,7 +22,7 @@ const Command: all run all tests - c|category <category> run all the tests of a certain category + c|cat|category <category> run all the tests of a certain category r|run <test> run single test file html generate $1 from the database Arguments: @@ -262,6 +262,7 @@ proc codegenCheck(test: TTest, target: TTarget, spec: TSpec, expectedMsg: var st echo getCurrentExceptionMsg() except IOError: given.err = reCodeNotFound + echo getCurrentExceptionMsg() proc nimoutCheck(test: TTest; expectedNimout: string; given: var TSpec) = let exp = expectedNimout.strip.replace("\C\L", "\L") @@ -509,7 +510,8 @@ proc main() = backend.close() var failed = r.total - r.passed - r.skipped if failed != 0: - echo "FAILURE! total: ", r.total, " passed: ", r.passed, " skipped: ", r.skipped + echo "FAILURE! total: ", r.total, " passed: ", r.passed, " skipped: ", + r.skipped, " failed: ", failed quit(QuitFailure) if paramCount() == 0: |