mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 11:54:11 +00:00
Merge pull request #3428 from tmm1/appveyor
[WIP] Add AppVeyor config to run tests on win32
This commit is contained in:
@@ -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
|
||||
|
||||
36
appveyor.yml
Normal file
36
appveyor.yml
Normal file
@@ -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
|
||||
3
koch.nim
3
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)
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user