travis: run 'koch testinstall' on OSX
This commit is contained in:
parent
23c323ea1d
commit
7ee6774fb7
4 changed files with 53 additions and 40 deletions
10
.travis.yml
10
.travis.yml
|
|
@ -6,9 +6,9 @@ os:
|
||||||
dist: trusty
|
dist: trusty
|
||||||
|
|
||||||
|
|
||||||
#matrix:
|
matrix:
|
||||||
# allow_failures:
|
allow_failures:
|
||||||
# - os: osx
|
- os: osx
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
|
|
@ -44,7 +44,9 @@ script:
|
||||||
#- nimble install jester@#head -y
|
#- nimble install jester@#head -y
|
||||||
#- nimble install niminst
|
#- nimble install niminst
|
||||||
- nim c --taintMode:on -d:nimCoroutines tests/testament/tester
|
- nim c --taintMode:on -d:nimCoroutines tests/testament/tester
|
||||||
- tests/testament/tester --pedantic all -d:nimCoroutines
|
# Do not run the tests on OSX as OSX does 'testinstall' which *also* runs all the tests!
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" != "osx" ]]; tests/testament/tester --pedantic all -d:nimCoroutines
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; ./koch testinstall
|
||||||
- nim c -o:bin/nimpretty nimpretty/nimpretty.nim
|
- nim c -o:bin/nimpretty nimpretty/nimpretty.nim
|
||||||
- nim c -r nimpretty/tester.nim
|
- nim c -r nimpretty/tester.nim
|
||||||
- ./koch docs
|
- ./koch docs
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ Files: "compiler"
|
||||||
Files: "doc"
|
Files: "doc"
|
||||||
Files: "doc/html"
|
Files: "doc/html"
|
||||||
Files: "tools"
|
Files: "tools"
|
||||||
|
Files: "nimpretty"
|
||||||
Files: "nimsuggest"
|
Files: "nimsuggest"
|
||||||
Files: "nimsuggest/tests/*.nim"
|
Files: "nimsuggest/tests/*.nim"
|
||||||
Files: "web/website.ini"
|
Files: "web/website.ini"
|
||||||
|
|
|
||||||
60
koch.nim
60
koch.nim
|
|
@ -75,33 +75,6 @@ template withDir(dir, body) =
|
||||||
finally:
|
finally:
|
||||||
setCurrentdir(old)
|
setCurrentdir(old)
|
||||||
|
|
||||||
proc testUnixInstall() =
|
|
||||||
let oldCurrentDir = getCurrentDir()
|
|
||||||
try:
|
|
||||||
let destDir = getTempDir()
|
|
||||||
copyFile("build/nim-$1.tar.xz" % VersionAsString,
|
|
||||||
destDir / "nim-$1.tar.xz" % VersionAsString)
|
|
||||||
setCurrentDir(destDir)
|
|
||||||
execCleanPath("tar -xJf nim-$1.tar.xz" % VersionAsString)
|
|
||||||
setCurrentDir("nim-$1" % VersionAsString)
|
|
||||||
execCleanPath("sh build.sh")
|
|
||||||
# first test: try if './bin/nim --version' outputs something sane:
|
|
||||||
let output = execProcess("./bin/nim --version").splitLines
|
|
||||||
if output.len > 0 and output[0].contains(VersionAsString):
|
|
||||||
echo "Version check: success"
|
|
||||||
execCleanPath("./bin/nim c koch.nim")
|
|
||||||
execCleanPath("./koch boot -d:release", destDir / "bin")
|
|
||||||
# check the docs build:
|
|
||||||
execCleanPath("./koch docs", destDir / "bin")
|
|
||||||
# check nimble builds:
|
|
||||||
execCleanPath("./koch tools")
|
|
||||||
# check the tests work:
|
|
||||||
execCleanPath("./koch tests", destDir / "bin")
|
|
||||||
else:
|
|
||||||
echo "Version check: failure"
|
|
||||||
finally:
|
|
||||||
setCurrentDir oldCurrentDir
|
|
||||||
|
|
||||||
proc tryExec(cmd: string): bool =
|
proc tryExec(cmd: string): bool =
|
||||||
echo(cmd)
|
echo(cmd)
|
||||||
result = execShellCmd(cmd) == 0
|
result = execShellCmd(cmd) == 0
|
||||||
|
|
@ -475,6 +448,36 @@ proc pushCsources() =
|
||||||
finally:
|
finally:
|
||||||
setCurrentDir(cwd)
|
setCurrentDir(cwd)
|
||||||
|
|
||||||
|
proc testUnixInstall(cmdLineRest: string) =
|
||||||
|
csource("-d:release " & cmdLineRest)
|
||||||
|
xz(cmdLineRest)
|
||||||
|
let oldCurrentDir = getCurrentDir()
|
||||||
|
try:
|
||||||
|
let destDir = getTempDir()
|
||||||
|
copyFile("build/nim-$1.tar.xz" % VersionAsString,
|
||||||
|
destDir / "nim-$1.tar.xz" % VersionAsString)
|
||||||
|
setCurrentDir(destDir)
|
||||||
|
execCleanPath("tar -xJf nim-$1.tar.xz" % VersionAsString)
|
||||||
|
setCurrentDir("nim-$1" % VersionAsString)
|
||||||
|
execCleanPath("sh build.sh")
|
||||||
|
# first test: try if './bin/nim --version' outputs something sane:
|
||||||
|
let output = execProcess("./bin/nim --version").splitLines
|
||||||
|
if output.len > 0 and output[0].contains(VersionAsString):
|
||||||
|
echo "Version check: success"
|
||||||
|
execCleanPath("./bin/nim c koch.nim")
|
||||||
|
execCleanPath("./koch boot -d:release", destDir / "bin")
|
||||||
|
# check the docs build:
|
||||||
|
execCleanPath("./koch docs", destDir / "bin")
|
||||||
|
# check nimble builds:
|
||||||
|
execCleanPath("./koch testtools")
|
||||||
|
# check the tests work:
|
||||||
|
execCleanPath("./koch tests", destDir / "bin")
|
||||||
|
#execCleanPath("./koch tests cat newconfig", destDir / "bin")
|
||||||
|
else:
|
||||||
|
echo "Version check: failure"
|
||||||
|
finally:
|
||||||
|
setCurrentDir oldCurrentDir
|
||||||
|
|
||||||
proc valgrind(cmd: string) =
|
proc valgrind(cmd: string) =
|
||||||
# somewhat hacky: '=' sign means "pass to valgrind" else "pass to Nim"
|
# somewhat hacky: '=' sign means "pass to valgrind" else "pass to Nim"
|
||||||
let args = parseCmdLine(cmd)
|
let args = parseCmdLine(cmd)
|
||||||
|
|
@ -522,7 +525,7 @@ when isMainModule:
|
||||||
of "geninstall": geninstall(op.cmdLineRest)
|
of "geninstall": geninstall(op.cmdLineRest)
|
||||||
of "distrohelper": geninstall()
|
of "distrohelper": geninstall()
|
||||||
of "install": install(op.cmdLineRest)
|
of "install": install(op.cmdLineRest)
|
||||||
of "testinstall": testUnixInstall()
|
of "testinstall": testUnixInstall(op.cmdLineRest)
|
||||||
of "test", "tests": tests(op.cmdLineRest)
|
of "test", "tests": tests(op.cmdLineRest)
|
||||||
of "temp": temp(op.cmdLineRest)
|
of "temp": temp(op.cmdLineRest)
|
||||||
of "xtemp": xtemp(op.cmdLineRest)
|
of "xtemp": xtemp(op.cmdLineRest)
|
||||||
|
|
@ -531,6 +534,7 @@ when isMainModule:
|
||||||
of "nimble": buildNimble(existsDir(".git"))
|
of "nimble": buildNimble(existsDir(".git"))
|
||||||
of "nimsuggest": bundleNimsuggest(buildExe=true)
|
of "nimsuggest": bundleNimsuggest(buildExe=true)
|
||||||
of "tools": buildTools(existsDir(".git"))
|
of "tools": buildTools(existsDir(".git"))
|
||||||
|
of "testtools": buildTools(true)
|
||||||
of "pushcsource", "pushcsources": pushCsources()
|
of "pushcsource", "pushcsources": pushCsources()
|
||||||
of "valgrind": valgrind(op.cmdLineRest)
|
of "valgrind": valgrind(op.cmdLineRest)
|
||||||
else: showHelp()
|
else: showHelp()
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,9 @@ assert wd != getCurrentDir()
|
||||||
cd(wd)
|
cd(wd)
|
||||||
assert wd == getCurrentDir()
|
assert wd == getCurrentDir()
|
||||||
|
|
||||||
assert findExe("nim") != ""
|
when false:
|
||||||
|
# this doesn't work in a 'koch testintall' environment
|
||||||
|
assert findExe("nim") != ""
|
||||||
|
|
||||||
# general tests
|
# general tests
|
||||||
mode = ScriptMode.Verbose
|
mode = ScriptMode.Verbose
|
||||||
|
|
@ -69,12 +71,16 @@ assert dirExists("tempXYZ") == false
|
||||||
mkDir("tempXYZ")
|
mkDir("tempXYZ")
|
||||||
assert dirExists("tempXYZ") == true
|
assert dirExists("tempXYZ") == true
|
||||||
assert fileExists("tempXYZ/koch.nim") == false
|
assert fileExists("tempXYZ/koch.nim") == false
|
||||||
cpFile("koch.nim", "tempXYZ/koch.nim")
|
|
||||||
assert fileExists("tempXYZ/koch.nim") == true
|
when false:
|
||||||
cpDir("nimsuggest", "tempXYZ/.")
|
# this doesn't work in a 'koch testintall' environment
|
||||||
assert dirExists("tempXYZ/tests") == true
|
cpFile("koch.nim", "tempXYZ/koch.nim")
|
||||||
assert fileExists("tempXYZ/nimsuggest.nim") == true
|
assert fileExists("tempXYZ/koch.nim") == true
|
||||||
rmFile("tempXYZ/koch.nim")
|
cpDir("nimsuggest", "tempXYZ/.")
|
||||||
assert fileExists("tempXYZ/koch.nim") == false
|
assert dirExists("tempXYZ/tests") == true
|
||||||
|
assert fileExists("tempXYZ/nimsuggest.nim") == true
|
||||||
|
rmFile("tempXYZ/koch.nim")
|
||||||
|
assert fileExists("tempXYZ/koch.nim") == false
|
||||||
|
|
||||||
rmDir("tempXYZ")
|
rmDir("tempXYZ")
|
||||||
assert dirExists("tempXYZ") == false
|
assert dirExists("tempXYZ") == false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue