testament: joinable is now an explicit concept of a test spec
This commit is contained in:
parent
46820b94a6
commit
ac785b0623
17 changed files with 55 additions and 51 deletions
|
|
@ -35,31 +35,9 @@ const
|
||||||
"testdata",
|
"testdata",
|
||||||
"nimcache",
|
"nimcache",
|
||||||
"coroutines",
|
"coroutines",
|
||||||
"osproc"
|
"osproc",
|
||||||
]
|
"shouldfail",
|
||||||
|
"dir with space"
|
||||||
|
|
||||||
# these tests still have bugs. At some point when the bugs are fixd
|
|
||||||
# this should become empty.
|
|
||||||
|
|
||||||
# exclude for various reasons
|
|
||||||
const
|
|
||||||
specialDisabedTests = [
|
|
||||||
"tests/dir with space/tspace.nim", # can't import dir with spaces.
|
|
||||||
"tests/method/tmultim.nim", # (77, 8) Error: method is not a base
|
|
||||||
"tests/system/talloc2.nim", # too much memory
|
|
||||||
"tests/collections/ttables.nim", # takes too long
|
|
||||||
"tests/system/tparams.nim", # executes itself with parameters
|
|
||||||
"tests/stdlib/tquit.nim", # not testing for obvious reasons
|
|
||||||
"tests/system/trealloc.nim", # out of memory
|
|
||||||
"tests/system/t7894.nim", # causes out of memory in later tests
|
|
||||||
"tests/types/tissues_types.nim", # causes out of memory with --gc:boehm
|
|
||||||
"tests/pragmas/tused.nim", # paths in nimout differ when imported
|
|
||||||
"tests/generics/trtree.nim", # very very ugly test
|
|
||||||
"tests/array/tarray.nim", #
|
|
||||||
"tests/destructor/turn_destroy_into_finalizer.nim", # fails when imported
|
|
||||||
"tests/misc/tnew.nim",
|
|
||||||
"tests/misc/tcmdline.nim"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# included from tester.nim
|
# included from tester.nim
|
||||||
|
|
@ -536,11 +514,11 @@ proc processSingleTest(r: var TResults, cat: Category, options, test: string) =
|
||||||
proc isJoinableSpec(spec: TSpec): bool =
|
proc isJoinableSpec(spec: TSpec): bool =
|
||||||
result = not spec.sortoutput and
|
result = not spec.sortoutput and
|
||||||
spec.action == actionRun and
|
spec.action == actionRun and
|
||||||
spec.file.replace('\\', '/') notin specialDisabedTests and
|
|
||||||
not fileExists(spec.file.changeFileExt("cfg")) and
|
not fileExists(spec.file.changeFileExt("cfg")) and
|
||||||
not fileExists(parentDir(spec.file) / "nim.cfg") and
|
not fileExists(parentDir(spec.file) / "nim.cfg") and
|
||||||
spec.cmd.len == 0 and
|
spec.cmd.len == 0 and
|
||||||
spec.err != reIgnored and
|
spec.err != reDisabled and
|
||||||
|
not spec.unjoinable and
|
||||||
spec.exitCode == 0 and
|
spec.exitCode == 0 and
|
||||||
spec.input.len == 0 and
|
spec.input.len == 0 and
|
||||||
spec.nimout.len == 0 and
|
spec.nimout.len == 0 and
|
||||||
|
|
@ -600,11 +578,12 @@ proc processCategory(r: var TResults, cat: Category, options: string, runJoinabl
|
||||||
else:
|
else:
|
||||||
var testsRun = 0
|
var testsRun = 0
|
||||||
for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"):
|
for name in os.walkFiles("tests" & DirSep &.? cat.string / "t*.nim"):
|
||||||
let test = makeTest(name, options, cat)
|
var test = makeTest(name, options, cat)
|
||||||
if runJoinableTests or not isJoinableSpec(test.spec):
|
if runJoinableTests or not isJoinableSpec(test.spec):
|
||||||
testSpec r, test
|
discard "run the test"
|
||||||
else:
|
else:
|
||||||
echo "filter out: ", test.name
|
test.spec.err = reJoined
|
||||||
|
testSpec r, test
|
||||||
inc testsRun
|
inc testsRun
|
||||||
if testsRun == 0:
|
if testsRun == 0:
|
||||||
echo "[Warning] - Invalid category specified \"", cat.string, "\", no tests were run"
|
echo "[Warning] - Invalid category specified \"", cat.string, "\", no tests were run"
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@ type
|
||||||
reExeNotFound,
|
reExeNotFound,
|
||||||
reInstallFailed # package installation failed
|
reInstallFailed # package installation failed
|
||||||
reBuildFailed # package building failed
|
reBuildFailed # package building failed
|
||||||
reIgnored, # test is ignored
|
reDisabled, # test is disabled
|
||||||
|
reJoined, # test is disabled because it was joined into the megatest
|
||||||
reSuccess # test was successful
|
reSuccess # test was successful
|
||||||
reInvalidSpec # test had problems to parse the spec
|
reInvalidSpec # test had problems to parse the spec
|
||||||
|
|
||||||
|
|
@ -66,6 +67,7 @@ type
|
||||||
targets*: set[TTarget]
|
targets*: set[TTarget]
|
||||||
nimout*: string
|
nimout*: string
|
||||||
parseErrors*: string # when the spec definition is invalid, this is not empty.
|
parseErrors*: string # when the spec definition is invalid, this is not empty.
|
||||||
|
unjoinable*: bool
|
||||||
|
|
||||||
proc getCmd*(s: TSpec): string =
|
proc getCmd*(s: TSpec): string =
|
||||||
if s.cmd.len == 0:
|
if s.cmd.len == 0:
|
||||||
|
|
@ -182,26 +184,28 @@ proc parseSpec*(filename: string): TSpec =
|
||||||
result.action = actionReject
|
result.action = actionReject
|
||||||
of "nimout":
|
of "nimout":
|
||||||
result.nimout = e.value
|
result.nimout = e.value
|
||||||
|
of "joinable":
|
||||||
|
result.unjoinable = not parseCfgBool(e.value)
|
||||||
of "disabled":
|
of "disabled":
|
||||||
case e.value.normalize
|
case e.value.normalize
|
||||||
of "y", "yes", "true", "1", "on": result.err = reIgnored
|
of "y", "yes", "true", "1", "on": result.err = reDisabled
|
||||||
of "n", "no", "false", "0", "off": discard
|
of "n", "no", "false", "0", "off": discard
|
||||||
of "win", "windows":
|
of "win", "windows":
|
||||||
when defined(windows): result.err = reIgnored
|
when defined(windows): result.err = reDisabled
|
||||||
of "linux":
|
of "linux":
|
||||||
when defined(linux): result.err = reIgnored
|
when defined(linux): result.err = reDisabled
|
||||||
of "bsd":
|
of "bsd":
|
||||||
when defined(bsd): result.err = reIgnored
|
when defined(bsd): result.err = reDisabled
|
||||||
of "macosx":
|
of "macosx":
|
||||||
when defined(macosx): result.err = reIgnored
|
when defined(macosx): result.err = reDisabled
|
||||||
of "unix":
|
of "unix":
|
||||||
when defined(unix): result.err = reIgnored
|
when defined(unix): result.err = reDisabled
|
||||||
of "posix":
|
of "posix":
|
||||||
when defined(posix): result.err = reIgnored
|
when defined(posix): result.err = reDisabled
|
||||||
of "travis":
|
of "travis":
|
||||||
if isTravis: result.err = reIgnored
|
if isTravis: result.err = reDisabled
|
||||||
of "appveyor":
|
of "appveyor":
|
||||||
if isAppVeyor: result.err = reIgnored
|
if isAppVeyor: result.err = reDisabled
|
||||||
else:
|
else:
|
||||||
result.parseErrors.addLine "cannot interpret as a bool: ", e.value
|
result.parseErrors.addLine "cannot interpret as a bool: ", e.value
|
||||||
of "cmd":
|
of "cmd":
|
||||||
|
|
@ -237,6 +241,4 @@ proc parseSpec*(filename: string): TSpec =
|
||||||
result.parseErrors.addLine e.msg
|
result.parseErrors.addLine e.msg
|
||||||
of cfgEof:
|
of cfgEof:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
close(p)
|
close(p)
|
||||||
|
|
|
||||||
|
|
@ -233,8 +233,10 @@ proc addResult(r: var TResults, test: TTest, target: TTarget,
|
||||||
r.data.addf("$#\t$#\t$#\t$#", name, expected, given, $success)
|
r.data.addf("$#\t$#\t$#\t$#", name, expected, given, $success)
|
||||||
if success == reSuccess:
|
if success == reSuccess:
|
||||||
maybeStyledEcho fgGreen, "PASS: ", fgCyan, alignLeft(name, 60), fgBlue, " (", durationStr, " secs)"
|
maybeStyledEcho fgGreen, "PASS: ", fgCyan, alignLeft(name, 60), fgBlue, " (", durationStr, " secs)"
|
||||||
elif success == reIgnored:
|
elif success == reDisabled:
|
||||||
maybeStyledEcho styleDim, fgYellow, "SKIP: ", styleBright, fgCyan, name
|
maybeStyledEcho styleDim, fgYellow, "SKIP: ", styleBright, fgCyan, name
|
||||||
|
elif success == reJoined:
|
||||||
|
maybeStyledEcho styleDim, fgYellow, "JOINED: ", styleBright, fgCyan, name
|
||||||
else:
|
else:
|
||||||
maybeStyledEcho styleBright, fgRed, "FAIL: ", fgCyan, name
|
maybeStyledEcho styleBright, fgRed, "FAIL: ", fgCyan, name
|
||||||
maybeStyledEcho styleBright, fgCyan, "Test \"", test.name, "\"", " in category \"", test.cat.string, "\""
|
maybeStyledEcho styleBright, fgCyan, "Test \"", test.name, "\"", " in category \"", test.cat.string, "\""
|
||||||
|
|
@ -248,7 +250,7 @@ proc addResult(r: var TResults, test: TTest, target: TTarget,
|
||||||
let (outcome, msg) =
|
let (outcome, msg) =
|
||||||
if success == reSuccess:
|
if success == reSuccess:
|
||||||
("Passed", "")
|
("Passed", "")
|
||||||
elif success == reIgnored:
|
elif success in {reDisabled, reJoined}:
|
||||||
("Skipped", "")
|
("Skipped", "")
|
||||||
else:
|
else:
|
||||||
("Failed", "Failure: " & $success & "\nExpected:\n" & expected & "\n\n" & "Gotten:\n" & given)
|
("Failed", "Failure: " & $success & "\nExpected:\n" & expected & "\n\n" & "Gotten:\n" & given)
|
||||||
|
|
@ -357,9 +359,9 @@ proc testSpec(r: var TResults, test: TTest, targets: set[TTarget] = {}) =
|
||||||
inc(r.total)
|
inc(r.total)
|
||||||
return
|
return
|
||||||
|
|
||||||
if expected.err == reIgnored:
|
if expected.err in {reDisabled, reJoined}:
|
||||||
# targetC is a lie, but parameter is required
|
# targetC is a lie, but parameter is required
|
||||||
r.addResult(test, targetC, "", "", reIgnored)
|
r.addResult(test, targetC, "", "", expected.err)
|
||||||
inc(r.skipped)
|
inc(r.skipped)
|
||||||
inc(r.total)
|
inc(r.total)
|
||||||
return
|
return
|
||||||
|
|
@ -571,7 +573,7 @@ proc main() =
|
||||||
of "c", "cat", "category":
|
of "c", "cat", "category":
|
||||||
var cat = Category(p.key)
|
var cat = Category(p.key)
|
||||||
p.next
|
p.next
|
||||||
processCategory(r, cat, p.cmdLineRest.string, runJoinableTests = false)
|
processCategory(r, cat, p.cmdLineRest.string, runJoinableTests = true)
|
||||||
of "r", "run":
|
of "r", "run":
|
||||||
let (dir, file) = splitPath(p.key.string)
|
let (dir, file) = splitPath(p.key.string)
|
||||||
let (_, subdir) = splitPath(dir)
|
let (_, subdir) = splitPath(dir)
|
||||||
|
|
@ -579,7 +581,7 @@ proc main() =
|
||||||
processSingleTest(r, cat, p.cmdLineRest.string, file)
|
processSingleTest(r, cat, p.cmdLineRest.string, file)
|
||||||
of "html":
|
of "html":
|
||||||
generateHtml(resultsFile, optFailing)
|
generateHtml(resultsFile, optFailing)
|
||||||
of "stats":
|
of "megatest":
|
||||||
discard runJoinedTest(testsDir)
|
discard runJoinedTest(testsDir)
|
||||||
else:
|
else:
|
||||||
quit Usage
|
quit Usage
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ dflfdjkl__abcdefgasfsgdfgsgdfggsdfasdfsafewfkljdsfajsdf
|
||||||
kgdchlfniambejop
|
kgdchlfniambejop
|
||||||
fjpmholcibdgeakn
|
fjpmholcibdgeakn
|
||||||
'''
|
'''
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
block tarray:
|
block tarray:
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,11 @@ And we get here
|
||||||
2
|
2
|
||||||
3
|
3
|
||||||
'''
|
'''
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
import hashes, sequtils, tables
|
import hashes, sequtils, tables
|
||||||
|
|
||||||
|
# test should not be joined because it takes too long.
|
||||||
block tableadds:
|
block tableadds:
|
||||||
proc main =
|
proc main =
|
||||||
var tab = newTable[string, string]()
|
var tab = newTable[string, string]()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
output: "turn_destroy_into_finalizer works"
|
output: "turn_destroy_into_finalizer works"
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,11 @@ discard """
|
||||||
output: '''1 [2, 3, 4, 7]
|
output: '''1 [2, 3, 4, 7]
|
||||||
[0, 0]'''
|
[0, 0]'''
|
||||||
target: "c"
|
target: "c"
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# don't join because the code is too messy.
|
||||||
|
|
||||||
# Nim RTree and R*Tree implementation
|
# Nim RTree and R*Tree implementation
|
||||||
# S. Salewski, 06-JAN-2018
|
# S. Salewski, 06-JAN-2018
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,10 @@ collide: unit, thing
|
||||||
collide: unit, thing
|
collide: unit, thing
|
||||||
collide: thing, unit
|
collide: thing, unit
|
||||||
collide: thing, thing
|
collide: thing, thing
|
||||||
collide: unit, thing | collide: unit, thing | collide: thing, unit |
|
collide: unit, thing | collide: unit, thing | collide: thing, unit |
|
||||||
do nothing
|
do nothing
|
||||||
'''
|
'''
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
outputsub: "Number of parameters: 0"
|
outputsub: "Number of parameters: 0"
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
# Test the command line
|
# Test the command line
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ outputsub: '''
|
||||||
Simple tree node allocation worked!
|
Simple tree node allocation worked!
|
||||||
Simple cycle allocation worked!
|
Simple cycle allocation worked!
|
||||||
'''
|
'''
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Test the implementation of the new operator
|
# Test the implementation of the new operator
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,10 @@ compile start
|
||||||
tused.nim(15, 8) Hint: 'tused.echoSub(a: int, b: int)[declared in tused.nim(15, 7)]' is declared but not used [XDeclaredButNotUsed]
|
tused.nim(15, 8) Hint: 'tused.echoSub(a: int, b: int)[declared in tused.nim(15, 7)]' is declared but not used [XDeclaredButNotUsed]
|
||||||
compile end'''
|
compile end'''
|
||||||
output: "8\n8"
|
output: "8\n8"
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# not joinable because paths in nimout differ when imported
|
||||||
static:
|
static:
|
||||||
echo "compile start"
|
echo "compile start"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ discard """
|
||||||
output: '''
|
output: '''
|
||||||
just exiting...
|
just exiting...
|
||||||
'''
|
'''
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Test the new beforeQuit variable:
|
# Test the new beforeQuit variable:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
discard """
|
discard """
|
||||||
disabled: "travis"
|
disabled: "travis"
|
||||||
disabled: "appveyor"
|
disabled: "appveyor"
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# CI integration servers are out of memory for this test
|
# CI integration servers are out of memory for this test
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
disabled: "windows"
|
disabled: "windows"
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# appveyor is "out of memory"
|
# appveyor is "out of memory"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
discard """
|
||||||
|
joinable: false
|
||||||
|
"""
|
||||||
|
|
||||||
|
# not joinable because it executes itself with parameters
|
||||||
import os
|
import os
|
||||||
import osproc
|
import osproc
|
||||||
import parseopt2
|
import parseopt2
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''success'''
|
output: '''success'''
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# bug #4818
|
# bug #4818
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,9 @@ ptr Foo
|
||||||
(member: "hello world", x: ...)
|
(member: "hello world", x: ...)
|
||||||
(member: 123.456, x: ...)
|
(member: 123.456, x: ...)
|
||||||
'''
|
'''
|
||||||
|
joinable: false
|
||||||
"""
|
"""
|
||||||
|
# not joinable because it causes out of memory with --gc:boehm
|
||||||
import typetraits
|
import typetraits
|
||||||
|
|
||||||
block t1252:
|
block t1252:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue