Skip to content

Commit bbb5a9e

Browse files
committed
Update Makefile.
Improve logging on failure.
1 parent 4af0d96 commit bbb5a9e

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ FORCE_BUILD_ALONE_ALL_TESTS_DEPS :=
354354
endif
355355
force_build_alone_all_tests: | $(FORCE_BUILD_ALONE_ALL_TESTS_DEPS)
356356

357-
all_tests: | build deps nimbus_signing_node force_build_alone_all_tests
357+
all_tests: | build deps nimbus_beacon_node nimbus_signing_node ncli_testnet nimbus_validator_client force_build_alone_all_tests
358358
+ echo -e $(BUILD_MSG) "build/$@" && \
359359
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \
360360
$@ \

tests/test_keymanager_api.nim

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,10 @@ proc prepareNetwork() {.async.} =
179179
"--insecure-netkey-password=true",
180180
"--genesis-offset=0"
181181
]
182+
let binaryPath = absolutePath("build/ncli_testnet")
182183

183184
let process =
184-
await startProcess("build/ncli_testnet",
185+
await startProcess(binaryPath,
185186
arguments = arguments,
186187
options = {AsyncProcessOption.StdErrToStdOut},
187188
stdoutHandle = AsyncProcess.Pipe)
@@ -193,7 +194,9 @@ proc prepareNetwork() {.async.} =
193194
else:
194195
notice "Unable to create testnet", rescode = rescode
195196
let res = await process.stdoutStream.read()
197+
echo "===== [", binaryPath, "] exited with [", rescode, "] ====="
196198
echo bytesToString(res)
199+
echo "====="
197200
finally:
198201
await process.closeWait()
199202

@@ -354,8 +357,10 @@ proc startBeaconNode(basePort: int): Future[TestProcess] {.async.} =
354357
"--doppelganger-detection=off"
355358
]
356359

360+
let binaryPath = absolutePath("build/nimbus_beacon_node")
361+
357362
let res =
358-
await startProcess("build/nimbus_beacon_node",
363+
await startProcess(binaryPath,
359364
arguments = arguments,
360365
options = {AsyncProcessOption.StdErrToStdOut},
361366
stdoutHandle = AsyncProcess.Pipe)
@@ -364,7 +369,7 @@ proc startBeaconNode(basePort: int): Future[TestProcess] {.async.} =
364369
)
365370

366371
notice "Beacon node process has been started",
367-
process_id = tp.process.pid()
372+
process_id = tp.process.pid(), binary_path = binaryPath
368373

369374
let
370375
address = initTAddress("127.0.0.1:" &
@@ -373,12 +378,15 @@ proc startBeaconNode(basePort: int): Future[TestProcess] {.async.} =
373378

374379
if not(flag):
375380
notice "Unable to establish connection with `nimbus_beacon_node` process",
376-
process_id = tp.process.pid()
377-
let exitCode = await killAndWaitForExit(tp.process, 5.seconds)
378-
echo "\n===== `nimbus_beacon_node` [", exitCode, "], logs ====="
379-
let output = await tp.reader
380-
echo bytesToString(output)
381+
process_id = tp.process.pid(), binary_path = binaryPath
382+
let
383+
exitCode = await killAndWaitForExit(tp.process, 5.seconds)
384+
output = await tp.reader
385+
381386
await tp.process.closeWait()
387+
echo "===== [", binaryPath, "] exited with [", exitCode, "] ====="
388+
echo bytesToString(output)
389+
echo "====="
382390
raiseAssert "Unable to continue test"
383391

384392
return tp
@@ -399,8 +407,10 @@ proc startValidatorClient(basePort: int): Future[TestProcess] {.async.} =
399407
"--keymanager-token-file=" & tokenFilePath
400408
]
401409

410+
let binaryPath = absolutePath("build/nimbus_validator_client")
411+
402412
let res =
403-
await startProcess("build/nimbus_validator_client",
413+
await startProcess(binaryPath,
404414
arguments = arguments,
405415
options = {AsyncProcessOption.StdErrToStdOut},
406416
stdoutHandle = AsyncProcess.Pipe)
@@ -409,7 +419,7 @@ proc startValidatorClient(basePort: int): Future[TestProcess] {.async.} =
409419
)
410420

411421
notice "Validator client process has been started",
412-
process_id = tp.process.pid()
422+
process_id = tp.process.pid(), binary_path = binaryPath
413423

414424
let
415425
address = initTAddress("127.0.0.1:" &
@@ -418,12 +428,15 @@ proc startValidatorClient(basePort: int): Future[TestProcess] {.async.} =
418428

419429
if not(flag):
420430
notice "Unable to establish connection with `nimbus_validator_client` " &
421-
"process", process_id = tp.process.pid()
422-
discard await killAndWaitForExit(tp.process, 5.seconds)
423-
echo "\n===== `nimbus_validator_client` logs ====="
424-
let output = await tp.reader
425-
echo bytesToString(output)
431+
"process", process_id = tp.process.pid(), binary_path = binaryPath
432+
let
433+
exitCode = await killAndWaitForExit(tp.process, 5.seconds)
434+
output = await tp.reader
435+
426436
await tp.process.closeWait()
437+
echo "===== [", binaryPath, "] exited with [", exitCode, "] ====="
438+
echo bytesToString(output)
439+
echo "====="
427440
raiseAssert "Unable to continue test"
428441

429442
return tp

0 commit comments

Comments
 (0)