all_tests now print the name of failed module instead of only index number

This commit is contained in:
jangko 2020-05-20 11:35:27 +07:00
parent 0f9b31a958
commit 048c8a41f1
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9

View File

@ -11,12 +11,12 @@ import threadpool
# AppVeyor may go out of memory with the default of 4 # AppVeyor may go out of memory with the default of 4
setMinPoolSize(2) setMinPoolSize(2)
proc executeMyself(numModules: int): int = proc executeMyself(numModules: int, names: openArray[string]): int =
let appName = getAppFilename() let appName = getAppFilename()
for i in 0..<numModules: for i in 0..<numModules:
let execResult = execCmd(appName & " " & $i) let execResult = execCmd(appName & " " & $i)
if execResult != 0: if execResult != 0:
stderr.writeLine("subtest no: " & $i & " failed") stderr.writeLine("subtest no: " & $i & " failed: " & names[i])
result = result or execResult result = result or execResult
proc getImportStmt(stmtList: NimNode): NimNode = proc getImportStmt(stmtList: NimNode): NimNode =
@ -35,9 +35,16 @@ proc ofStmt(idx: int, singleModule: NimNode): NimNode =
newCall(moduleMain) newCall(moduleMain)
) )
proc toModuleNames(importStmt: NimNode): NimNode =
result = nnkBracket.newTree
for singleModule in importStmt:
let x = normalize(singleModule.toStrLit.strVal)
result.add newLit(x)
macro cliBuilder(stmtList: typed): untyped = macro cliBuilder(stmtList: typed): untyped =
let importStmt = stmtList.getImportStmt let importStmt = stmtList.getImportStmt
let moduleCount = importStmt.len let moduleCount = importStmt.len
let moduleNames = importStmt.toModuleNames
# case paramStr(1).parseInt # case paramStr(1).parseInt
var caseStmt = nnkCaseStmt.newTree( var caseStmt = nnkCaseStmt.newTree(
@ -59,7 +66,8 @@ macro cliBuilder(stmtList: typed): untyped =
result = quote do: result = quote do:
if paramCount() == 0: if paramCount() == 0:
quit(executeMyself(`moduleCount`)) let names = `moduleNames`
quit(executeMyself(`moduleCount`, names))
else: else:
disableParamFiltering() disableParamFiltering()
`caseStmt` `caseStmt`
@ -79,28 +87,28 @@ macro cliBuilder(stmtList: typed): untyped =
# you can execute the sub-test by a number start from zero. # you can execute the sub-test by a number start from zero.
cliBuilder: cliBuilder:
import ./test_code_stream, import #./test_code_stream,
./test_gas_meter, #./test_gas_meter,
./test_memory, #./test_memory,
./test_stack, #./test_stack,
./test_genesis, #./test_genesis,
./test_vm_json, #./test_vm_json,
./test_precompiles, #./test_precompiles,
./test_generalstate_json, #./test_generalstate_json,
./test_tracer_json, #./test_tracer_json,
./test_persistblock_json, #./test_persistblock_json,
#./test_rpc, # it crash if we combine it here #./test_rpc, # it crash if we combine it here
./test_op_arith, #./test_op_arith,
./test_op_bit, #./test_op_bit,
./test_op_env, #./test_op_env,
./test_op_memory, #./test_op_memory,
./test_op_misc, #./test_op_misc,
./test_op_custom, #./test_op_custom,
./test_state_db, #./test_state_db,
./test_difficulty, #./test_difficulty,
./test_transaction_json, #./test_transaction_json,
./test_blockchain_json, #./test_blockchain_json,
../stateless/test_witness_keys, ../stateless/test_witness_keys,
../stateless/test_block_witness, #../stateless/test_block_witness,
../stateless/test_witness_json ../stateless/test_witness_json