testament: generic N-fold batching: windows CI 37mn=>16m (#14823)

* testament: run CI faster thanks to batching
* move ta_in, tstdin into existing tosproc
* move ta_out,tafalse,texitcode,tstderr into existing tosproc
* joinable osproc
* move tstdout into existing tosproc
* spec: batchable; fix tests
* fixup
This commit is contained in:
Timothee Cour 2020-06-27 07:51:17 -07:00 • committed by GitHub
commit 90808877c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 172 additions and 181 deletions

View file

@ -8,6 +8,15 @@
#
import sequtils, parseutils, strutils, os, streams, parsecfg
from hashes import hash
type TestamentData* = ref object
# better to group globals under 1 object; could group the other ones here too
batchArg*: string
testamentNumBatch*: int
testamentBatch*: int
let testamentData0* = TestamentData()
var compilerPrefix* = findExe("nim")
@ -68,11 +77,13 @@ type
ccodeCheck*: string
maxCodeSize*: int
err*: TResultEnum
inCurrentBatch*: bool
targets*: set[TTarget]
matrix*: seq[string]
nimout*: string
parseErrors*: string # when the spec definition is invalid, this is not empty.
unjoinable*: bool
unbatchable*: bool
useValgrind*: bool
timeout*: float # in seconds, fractions possible,
# but don't rely on much precision
@ -138,6 +149,12 @@ proc addLine*(self: var string; a,b: string) =
proc initSpec*(filename: string): TSpec =
result.file = filename
proc isCurrentBatch(testamentData: TestamentData, filename: string): bool =
if testamentData.testamentNumBatch != 0:
hash(filename) mod testamentData.testamentNumBatch == testamentData.testamentBatch
else:
true
proc parseSpec*(filename: string): TSpec =
result.file = filename
let specStr = extractSpec(filename)
@ -203,6 +220,8 @@ proc parseSpec*(filename: string): TSpec =
result.action = actionReject
of "nimout":
result.nimout = e.value
of "batchable":
result.unbatchable = not parseCfgBool(e.value)
of "joinable":
result.unjoinable = not parseCfgBool(e.value)
of "valgrind":
@ -297,3 +316,7 @@ proc parseSpec*(filename: string): TSpec =
if skips.anyIt(it in result.file):
result.err = reDisabled
result.inCurrentBatch = isCurrentBatch(testamentData0, filename) or result.unbatchable
if not result.inCurrentBatch:
result.err = reDisabled