testament --verbose: prints commands; gitignore ic artifacts (#17716)

This commit is contained in:
Timothee Cour
2021-04-14 00:44:07 -07:00
committed by GitHub
parent 840e13deb7
commit 25b4a0ab0a
2 changed files with 16 additions and 5 deletions

7
.gitignore vendored
View File

@@ -72,14 +72,17 @@ testament.db
.*/
~*
# testament cruft; TODO: generate these in a gitignore'd dir in the first place.
# testament cruft; TODO: generate these in a gitignore'd dir (./build) in the first place.
testresults/
test.txt
/test.ini
tweeter.db
tweeter_test.db
megatest.nim
/tests/megatest.nim
/tests/ic/*_temp.nim
/outputExpected.txt
/outputGotten.txt

View File

@@ -21,6 +21,11 @@ from lib/stdtest/specialpaths import splitTestFile
var useColors = true
var backendLogging = true
var simulate = false
var optVerbose = false
proc verboseCmd(cmd: string) =
if optVerbose:
echo "executing: ", cmd
const
failString* = "FAIL: " # ensures all failures can be searched with 1 keyword in CI logs
@@ -38,7 +43,8 @@ Command:
Arguments:
arguments are passed to the compiler
Options:
--print also print results to the console
--print print results to the console
--verbose print commands (compiling and running tests)
--simulate see what tests would be run but don't run them (for debugging)
--failing only show failing/ignored tests
--targets:"c cpp js objc" run tests for specified targets (default: all)
@@ -113,6 +119,7 @@ proc execCmdEx2(command: string, args: openArray[string]; workingDir, input: str
for arg in args:
result.cmdLine.add ' '
result.cmdLine.add quoteShell(arg)
verboseCmd(result.cmdLine)
var p = startProcess(command, workingDir = workingDir, args = args,
options = {poStdErrToStdOut, poUsePath})
var outp = outputStream(p)
@@ -155,6 +162,7 @@ proc callCompiler(cmdTemplate, filename, options, nimcache: string,
let c = prepareTestArgs(cmdTemplate, filename, options, nimcache, target,
extraOptions)
result.cmd = quoteShellCommand(c)
verboseCmd(c.quoteShellCommand)
var p = startProcess(command = c[0], args = c[1 .. ^1],
options = {poStdErrToStdOut, poUsePath})
let outp = p.outputStream
@@ -491,7 +499,6 @@ proc testSpecHelper(r: var TResults, test: var TTest, expected: TSpec,
valgrindOptions.add "--leak-check=yes"
args = valgrindOptions & exeCmd & args
exeCmd = "valgrind"
# xxx honor `testament --verbose` here
var (_, buf, exitCode) = execCmdEx2(exeCmd, args, input = expected.input)
# Treat all failure codes from nodejs as 1. Older versions of nodejs used
# to return other codes, but for us it is sufficient to know that it's not 0.
@@ -663,7 +670,8 @@ proc main() =
p.next()
while p.kind in {cmdLongOption, cmdShortOption}:
case p.key.normalize
of "print", "verbose": optPrintResults = true
of "print": optPrintResults = true
of "verbose": optVerbose = true
of "failing": optFailing = true
of "pedantic": discard # deadcode refs https://github.com/nim-lang/Nim/issues/16731
of "targets":