Finally fixed travis build

* Insulting comment on Travis and the universe in general here.
This commit is contained in:
Felix Krause 2017-02-06 21:41:43 +01:00
parent 0ef9cbf535
commit acf9e32fab
1 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,13 @@
import unittest, os, osproc, macros, strutils, streams import unittest, os, osproc, macros, strutils, streams
proc inputTest(basePath, path, nimPath: string): bool = const baseDir = parentDir(staticExec("pwd"))
let (nimPathRaw, nimPathRet) =
execCmdEx("which nim", {poStdErrToStdOut, poUsePath})
if nimPathRet != 0: quit "could not locate nim executable:\n" & nimPathRaw
let nimPath =
if nimPathRaw[0] == '/': nimPathRaw.strip else: baseDir / nimPathRaw.strip
proc inputTest(basePath, path: string): bool =
let let
absolutePath = basePath / path absolutePath = basePath / path
inFileOrig = absolutePath / "01-in.yaml" inFileOrig = absolutePath / "01-in.yaml"
@ -35,7 +42,7 @@ proc inputTest(basePath, path, nimPath: string): bool =
result = false result = false
else: result = true else: result = true
proc outputTest(basePath, path, nimPath: string): bool = proc outputTest(basePath, path: string): bool =
let let
absolutePath = basePath / path absolutePath = basePath / path
codeFileOrig = absolutePath / "00-code.nim" codeFileOrig = absolutePath / "00-code.nim"
@ -103,18 +110,15 @@ proc testsFor(path: string, root: bool = true, titlePrefix: string = ""):
NimNode {.compileTime.} = NimNode {.compileTime.} =
result = newStmtList() result = newStmtList()
let let
baseDir = parentDir(staticExec("pwd"))
nimPathRaw = staticExec("which nim")
nimPath = if nimPathRaw[0] == '/': nimPathRaw else: baseDir / nimPathRaw
title = titlePrefix & slurp(baseDir / path / "title").splitLines()[0] title = titlePrefix & slurp(baseDir / path / "title").splitLines()[0]
if fileExists(path / "00-code.nim"): if fileExists(path / "00-code.nim"):
var test = newCall("test", newLit(title)) var test = newCall("test", newLit(title))
if fileExists(path / "01-in.yaml"): if fileExists(path / "01-in.yaml"):
test.add(newCall("doAssert", newCall("inputTest", newLit(baseDir), test.add(newCall("doAssert", newCall("inputTest", newLit(baseDir),
newLit(path), newLit(nimPath)))) newLit(path))))
elif fileExists(path / "01-out.yaml"): elif fileExists(path / "01-out.yaml"):
test.add(newCall("doAssert", newCall("outputTest", newLit(baseDir), test.add(newCall("doAssert", newCall("outputTest", newLit(baseDir),
newLit(path), newLit(nimPath)))) newLit(path))))
else: else:
echo "Error: neither 01-in.yaml nor 01-out.yaml exists in " & path & '!' echo "Error: neither 01-in.yaml nor 01-out.yaml exists in " & path & '!'
quit 1 quit 1