mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-08 14:03:23 +00:00
Testament pre parallel (#9137)
* testament: move to root dir (it's not a test)
* osproc: fix process index passed to afterRunEvent for parallel runs
it was passing the index of the process, not index of all commands
* testament: complete file move
(cherry picked from commit 97738a4f28)
This commit is contained in:
@@ -53,8 +53,8 @@ test-windows:
|
||||
<<: *win_set_path_def
|
||||
script:
|
||||
- call ci\deps.bat
|
||||
- nim c --taintMode:on tests\testament\tester
|
||||
- tests\testament\tester.exe --pedantic all
|
||||
- nim c --taintMode:on testament\tester
|
||||
- testament\tester.exe --pedantic all
|
||||
tags:
|
||||
- windows
|
||||
- fast
|
||||
|
||||
@@ -42,8 +42,8 @@ script:
|
||||
#- nimble install sdl1
|
||||
#- nimble install jester@#head -y
|
||||
#- nimble install niminst
|
||||
- nim c --taintMode:on -d:nimCoroutines tests/testament/tester
|
||||
- tests/testament/tester --pedantic all -d:nimCoroutines
|
||||
- nim c --taintMode:on -d:nimCoroutines testament/tester
|
||||
- testament/tester --pedantic all -d:nimCoroutines
|
||||
- nim c -o:bin/nimpretty nimpretty/nimpretty.nim
|
||||
- nim c -r nimpretty/tester.nim
|
||||
- ./koch docs --git.commit:devel
|
||||
|
||||
@@ -53,11 +53,11 @@ build_script:
|
||||
# - nimble install opengl -y
|
||||
# - nimble install sdl1 -y
|
||||
# - nimble install jester@#head -y
|
||||
- nim c --taintMode:on -d:nimCoroutines --os:genode -d:posix --compileOnly tests/testament/tester
|
||||
- nim c --taintMode:on -d:nimCoroutines tests/testament/tester
|
||||
- nim c --taintMode:on -d:nimCoroutines --os:genode -d:posix --compileOnly testament/tester
|
||||
- nim c --taintMode:on -d:nimCoroutines testament/tester
|
||||
|
||||
test_script:
|
||||
- tests\testament\tester --pedantic all -d:nimCoroutines
|
||||
- testament\tester --pedantic all -d:nimCoroutines
|
||||
- nim c -r nimdoc\tester
|
||||
# - koch csource
|
||||
# - koch zip
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
REM - Run the full testsuite; tests\testament\tester all
|
||||
REM - Run the full testsuite; testament\tester all
|
||||
|
||||
REM - Uncomment the list of changes in news.txt
|
||||
REM - write a news ticker entry
|
||||
|
||||
@@ -78,7 +78,7 @@ only want to see the output of failing tests, go for
|
||||
|
||||
You can also run only a single category of tests. A category is a subdirectory
|
||||
in the ``tests`` directory. There are a couple of special categories; for a
|
||||
list of these, see ``tests/testament/categories.nim``, at the bottom.
|
||||
list of these, see ``testament/categories.nim``, at the bottom.
|
||||
|
||||
::
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ test command
|
||||
------------
|
||||
|
||||
The `test`:idx: command can also be invoked with the alias ``tests``. This
|
||||
command will compile and run ``tests/testament/tester.nim``, which is the main
|
||||
command will compile and run ``testament/tester.nim``, which is the main
|
||||
driver of Nim's test suite. You can pass options to the ``test`` command,
|
||||
they will be forwarded to the tester. See its source code for available
|
||||
options.
|
||||
|
||||
4
koch.nim
4
koch.nim
@@ -380,11 +380,11 @@ template `|`(a, b): string = (if a.len > 0: a else: b)
|
||||
proc tests(args: string) =
|
||||
# we compile the tester with taintMode:on to have a basic
|
||||
# taint mode test :-)
|
||||
nimexec "cc --taintMode:on --opt:speed tests/testament/tester"
|
||||
nimexec "cc --taintMode:on --opt:speed testament/tester"
|
||||
# Since tests take a long time (on my machine), and we want to defy Murhpys
|
||||
# law - lets make sure the compiler really is freshly compiled!
|
||||
nimexec "c --lib:lib -d:release --opt:speed compiler/nim.nim"
|
||||
let tester = quoteShell(getCurrentDir() / "tests/testament/tester".exe)
|
||||
let tester = quoteShell(getCurrentDir() / "testament/tester".exe)
|
||||
let success = tryExec tester & " " & (args|"all")
|
||||
if not existsEnv("TRAVIS") and not existsEnv("APPVEYOR"):
|
||||
exec tester & " html"
|
||||
|
||||
@@ -236,6 +236,7 @@ proc execProcesses*(cmds: openArray[string],
|
||||
if n > 1:
|
||||
var i = 0
|
||||
var q = newSeq[Process](n)
|
||||
var idxs = newSeq[int](n) # map process index to cmds index
|
||||
|
||||
when defined(windows):
|
||||
var w: WOHandleArray
|
||||
@@ -248,6 +249,7 @@ proc execProcesses*(cmds: openArray[string],
|
||||
if beforeRunEvent != nil:
|
||||
beforeRunEvent(i)
|
||||
q[i] = startProcess(cmds[i], options = options + {poEvalCommand})
|
||||
idxs[i] = i
|
||||
when defined(windows):
|
||||
w[i] = q[i].fProcessHandle
|
||||
inc(i)
|
||||
@@ -304,12 +306,13 @@ proc execProcesses*(cmds: openArray[string],
|
||||
|
||||
if rexit >= 0:
|
||||
result = max(result, abs(q[rexit].peekExitCode()))
|
||||
if afterRunEvent != nil: afterRunEvent(rexit, q[rexit])
|
||||
if afterRunEvent != nil: afterRunEvent(idxs[rexit], q[rexit])
|
||||
close(q[rexit])
|
||||
if i < len(cmds):
|
||||
if beforeRunEvent != nil: beforeRunEvent(i)
|
||||
q[rexit] = startProcess(cmds[i],
|
||||
options = options + {poEvalCommand})
|
||||
idxs[rexit] = i
|
||||
when defined(windows):
|
||||
w[rexit] = q[rexit].fProcessHandle
|
||||
inc(i)
|
||||
|
||||
@@ -474,7 +474,7 @@ proc main() =
|
||||
case action
|
||||
of "all":
|
||||
let testsDir = "tests" & DirSep
|
||||
var myself = quoteShell(findExe("tests" / "testament" / "tester"))
|
||||
var myself = quoteShell(findExe("testament" / "tester"))
|
||||
if targetsStr.len > 0:
|
||||
myself &= " " & quoteShell("--targets:" & targetsStr)
|
||||
|
||||
@@ -485,7 +485,7 @@ proc main() =
|
||||
for kind, dir in walkDir(testsDir):
|
||||
assert testsDir.startsWith(testsDir)
|
||||
let cat = dir[testsDir.len .. ^1]
|
||||
if kind == pcDir and cat notin ["testament", "testdata", "nimcache"]:
|
||||
if kind == pcDir and cat notin ["testdata", "nimcache"]:
|
||||
cmds.add(myself & " cat " & quoteShell(cat) & rest)
|
||||
for cat in AdditionalCategories:
|
||||
cmds.add(myself & " cat " & quoteShell(cat) & rest)
|
||||
@@ -10,7 +10,7 @@ execute the compiled binary, you need to specify a spec with an ``action`` key
|
||||
|
||||
Each test can contain a spec in a ``discard """ ... """`` block.
|
||||
|
||||
**Check out the [``parseSpec`` procedure](https://github.com/nim-lang/Nim/blob/devel/tests/testament/specs.nim#L124) in the ``specs`` module for a full and reliable reference**
|
||||
**Check out the [``parseSpec`` procedure](https://github.com/nim-lang/Nim/blob/devel/testament/specs.nim#L124) in the ``specs`` module for a full and reliable reference**
|
||||
|
||||
## action
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
discard """
|
||||
# Since the tests for nre are all bundled together we treat failure in one test as an nre failure
|
||||
# When running 'tests/testament/tester' a failed check() in the test suite will cause the exit
|
||||
# When running 'testament/tester' a failed check() in the test suite will cause the exit
|
||||
# codes to differ and be reported as a failure
|
||||
|
||||
output:
|
||||
|
||||
Reference in New Issue
Block a user