summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2015-10-14 13:40:58 +0200
committerAndreas Rumpf <rumpf_a@web.de>2015-10-14 13:40:58 +0200
commit5a02230bf97c96cf4f74ed99024148476f9a2588 (patch)
tree21d6ad158303aabd484caf1ac0d861f047262c35
parented4b0cc92e3a7dfa9cffa742ada615ccd3235691 (diff)
parentf7c979f865143cb7003bc34193cec1a97eff3b1b (diff)
downloadNim-5a02230bf97c96cf4f74ed99024148476f9a2588.tar.gz
Merge pull request #3428 from tmm1/appveyor
[WIP] Add AppVeyor config to run tests on win32
-rw-r--r--.travis.yml3
-rw-r--r--appveyor.yml36
-rw-r--r--koch.nim3
-rw-r--r--tests/ccgbugs/tunsafeaddr.nim4
-rw-r--r--tests/testament/backend.nim3
-rw-r--r--tests/testament/categories.nim2
-rw-r--r--tests/testament/tester.nim24
7 files changed, 68 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml
index c027386f5..256fb0da0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,4 +26,5 @@ script:
   - nimble install zip
   - nimble install opengl
   - nimble install sdl1
-  - ./koch test all --pedantic
+  - nim c --taintMode:on tests/testament/tester
+  - tests/testament/tester --pedantic all
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 000000000..2b1eab5d0
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,36 @@
+clone_depth: 5
+
+artifacts:
+  - path: bin\nim.exe
+
+platform:
+  - x64
+
+before_build:
+  - git log -1
+  - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S zlib-devel"
+  - appveyor DownloadFile http://nim-lang.org/download/dlls.zip
+  - 7z e dlls.zip -odlls
+  - del dlls\libcurl.dll
+  - appveyor DownloadFile http://flatassembler.net/fasmw17139.zip
+  - 7z e fasmw17139.zip -obin fasm.exe
+
+build_script:
+  - SET PATH=C:\msys64\mingw64\bin;dlls;bin;%PATH%
+  - gcc -v
+  - git clone -q --depth 1 https://github.com/nim-lang/csources
+  - cd csources
+  - build64.bat
+  - cd ..
+  - nim c koch
+  - koch boot
+  - koch boot -d:release
+
+before_test:
+  - nim e install_nimble.nims
+  - nimble update
+  - nimble install zip
+
+test_script:
+  - nim c --taintMode:on tests/testament/tester
+  - tests\testament\tester --pedantic all
diff --git a/koch.nim b/koch.nim
index 3d1a22b9c..f7c0ae204 100644
--- a/koch.nim
+++ b/koch.nim
@@ -342,7 +342,8 @@ proc tests(args: string) =
   exec "nim c --lib:lib -d:release --opt:speed compiler/nim.nim"
   let tester = quoteShell(getCurrentDir() / "tests/testament/tester".exe)
   let success = tryExec tester & " " & (args|"all")
-  exec tester & " html"
+  if not existsEnv("TRAVIS") and not existsEnv("APPVEYOR"):
+    exec tester & " html"
   if not success:
     quit("tests failed", QuitFailure)
 
diff --git a/tests/ccgbugs/tunsafeaddr.nim b/tests/ccgbugs/tunsafeaddr.nim
index 4f05c7c21..518e05b25 100644
--- a/tests/ccgbugs/tunsafeaddr.nim
+++ b/tests/ccgbugs/tunsafeaddr.nim
@@ -3,8 +3,8 @@ discard """
 """
 
 {.emit: """
-long sum(long* a, long len) {
-  long i, result = 0;
+NI sum(NI* a, NI len) {
+  NI i, result = 0;
   for (i = 0; i < len; ++i) result += a[i];
   return result;
 }
diff --git a/tests/testament/backend.nim b/tests/testament/backend.nim
index 9ec0c0973..671b5c8b7 100644
--- a/tests/testament/backend.nim
+++ b/tests/testament/backend.nim
@@ -112,7 +112,8 @@ proc writeTestResult*(name, category, target,
                                         thisCommit, thisMachine)
 
 proc open*() =
-  db = open(connection="testament.db", user="testament", password="",
+  let dbFile = if existsEnv("TRAVIS") or existsEnv("APPVEYOR"): ":memory:" else: "testament.db"
+  db = open(connection=dbFile, user="testament", password="",
             database="testament")
   createDb()
   thisMachine = getMachine(db)
diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim
index 3166942ec..3bb18d8a2 100644
--- a/tests/testament/categories.nim
+++ b/tests/testament/categories.nim
@@ -82,6 +82,8 @@ proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
 
   when defined(Windows):
     # windows looks in the dir of the exe (yay!):
+    var serverDll = DynlibFormat % "server"
+    safeCopyFile("lib" / serverDll, "tests/dll" / serverDll)
     var nimrtlDll = DynlibFormat % "nimrtl"
     safeCopyFile("lib" / nimrtlDll, "tests/dll" / nimrtlDll)
   else:
diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim
index ae8735ebe..451bee1d1 100644
--- a/tests/testament/tester.nim
+++ b/tests/testament/tester.nim
@@ -12,7 +12,7 @@
 import
   parseutils, strutils, pegs, os, osproc, streams, parsecfg, json,
   marshal, backend, parseopt, specs, htmlgen, browsers, terminal,
-  algorithm, compiler/nodejs, re
+  algorithm, compiler/nodejs, re, times
 
 const
   resultsFile = "testresults.html"
@@ -47,6 +47,7 @@ type
     options: string
     target: TTarget
     action: TTestAction
+    startTime: float
 
 # ----------------------------------------------------------------------------
 
@@ -104,6 +105,12 @@ proc callCompiler(cmdTemplate, filename, options: string,
   elif suc =~ pegSuccess:
     result.err = reSuccess
 
+  if result.err == reNimcCrash and
+     ("Your platform is not supported" in result.msg or
+      "cannot open 'sdl'" in result.msg or
+      "cannot open 'opengl'" in result.msg):
+    result.err = reIgnored
+
 proc callCCompiler(cmdTemplate, filename, options: string,
                   target: TTarget): TSpec =
   let c = parseCmdLine(cmdTemplate % ["target", targetToCmd[target],
@@ -143,6 +150,7 @@ proc `$`(x: TResults): string =
 proc addResult(r: var TResults, test: TTest,
                expected, given: string, success: TResultEnum) =
   let name = test.name.extractFilename & test.options
+  let duration = epochTime() - test.startTime
   backend.writeTestResult(name = name,
                           category = test.cat.string,
                           target = $test.target,
@@ -164,6 +172,18 @@ proc addResult(r: var TResults, test: TTest,
     styledEcho fgYellow, "Gotten:"
     styledEcho styleBright, given, "\n"
 
+  if existsEnv("APPVEYOR"):
+    let (outcome, msg) =
+      if success == reSuccess:
+        ("Passed", "")
+      elif success == reIgnored:
+        ("Skipped", "")
+      else:
+        ("Failed", "Failure: " & $success & "\nExpected:\n" & expected & "\n\n" & "Gotten:\n" & given)
+    var p = startProcess("appveyor", args=["AddTest", test.name.replace("\\", "/") & test.options, "-Framework", "nim-testament", "-FileName", test.cat.string, "-Outcome", outcome, "-ErrorMessage", msg, "-Duration", $(duration*1000).int], options={poStdErrToStdOut, poUsePath, poParentStreams})
+    discard waitForExit(p)
+    close(p)
+
 proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) =
   if strip(expected.msg) notin strip(given.msg):
     r.addResult(test, expected.msg, given.msg, reMsgsDiffer)
@@ -356,7 +376,7 @@ proc makeTest(test, options: string, cat: Category, action = actionCompile,
               target = targetC, env: string = ""): TTest =
   # start with 'actionCompile', will be overwritten in the spec:
   result = TTest(cat: cat, name: test, options: options,
-                 target: target, action: action)
+                 target: target, action: action, startTime: epochTime())
 
 include categories