Update Makefile.

Improve logging on failure.
This commit is contained in:
cheatfate 2023-08-04 04:59:14 +03:00
parent 7e15be653a
commit 12415220f1
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
2 changed files with 29 additions and 16 deletions

View File

@ -354,7 +354,7 @@ FORCE_BUILD_ALONE_ALL_TESTS_DEPS :=
endif endif
force_build_alone_all_tests: | $(FORCE_BUILD_ALONE_ALL_TESTS_DEPS) force_build_alone_all_tests: | $(FORCE_BUILD_ALONE_ALL_TESTS_DEPS)
all_tests: | build deps nimbus_signing_node force_build_alone_all_tests all_tests: | build deps nimbus_beacon_node nimbus_signing_node ncli_testnet nimbus_validator_client force_build_alone_all_tests
+ echo -e $(BUILD_MSG) "build/$@" && \ + echo -e $(BUILD_MSG) "build/$@" && \
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \ MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \
$@ \ $@ \

View File

@ -179,9 +179,10 @@ proc prepareNetwork() {.async.} =
"--insecure-netkey-password=true", "--insecure-netkey-password=true",
"--genesis-offset=0" "--genesis-offset=0"
] ]
let binaryPath = absolutePath("build/ncli_testnet")
let process = let process =
await startProcess("build/ncli_testnet", await startProcess(binaryPath,
arguments = arguments, arguments = arguments,
options = {AsyncProcessOption.StdErrToStdOut}, options = {AsyncProcessOption.StdErrToStdOut},
stdoutHandle = AsyncProcess.Pipe) stdoutHandle = AsyncProcess.Pipe)
@ -193,7 +194,9 @@ proc prepareNetwork() {.async.} =
else: else:
notice "Unable to create testnet", rescode = rescode notice "Unable to create testnet", rescode = rescode
let res = await process.stdoutStream.read() let res = await process.stdoutStream.read()
echo "===== [", binaryPath, "] exited with [", rescode, "] ====="
echo bytesToString(res) echo bytesToString(res)
echo "====="
finally: finally:
await process.closeWait() await process.closeWait()
@ -354,8 +357,10 @@ proc startBeaconNode(basePort: int): Future[TestProcess] {.async.} =
"--doppelganger-detection=off" "--doppelganger-detection=off"
] ]
let binaryPath = absolutePath("build/nimbus_beacon_node")
let res = let res =
await startProcess("build/nimbus_beacon_node", await startProcess(binaryPath,
arguments = arguments, arguments = arguments,
options = {AsyncProcessOption.StdErrToStdOut}, options = {AsyncProcessOption.StdErrToStdOut},
stdoutHandle = AsyncProcess.Pipe) stdoutHandle = AsyncProcess.Pipe)
@ -364,7 +369,7 @@ proc startBeaconNode(basePort: int): Future[TestProcess] {.async.} =
) )
notice "Beacon node process has been started", notice "Beacon node process has been started",
process_id = tp.process.pid() process_id = tp.process.pid(), binary_path = binaryPath
let let
address = initTAddress("127.0.0.1:" & address = initTAddress("127.0.0.1:" &
@ -373,12 +378,15 @@ proc startBeaconNode(basePort: int): Future[TestProcess] {.async.} =
if not(flag): if not(flag):
notice "Unable to establish connection with `nimbus_beacon_node` process", notice "Unable to establish connection with `nimbus_beacon_node` process",
process_id = tp.process.pid() process_id = tp.process.pid(), binary_path = binaryPath
let exitCode = await killAndWaitForExit(tp.process, 5.seconds) let
echo "\n===== `nimbus_beacon_node` [", exitCode, "], logs =====" exitCode = await killAndWaitForExit(tp.process, 5.seconds)
let output = await tp.reader output = await tp.reader
echo bytesToString(output)
await tp.process.closeWait() await tp.process.closeWait()
echo "===== [", binaryPath, "] exited with [", exitCode, "] ====="
echo bytesToString(output)
echo "====="
raiseAssert "Unable to continue test" raiseAssert "Unable to continue test"
return tp return tp
@ -399,8 +407,10 @@ proc startValidatorClient(basePort: int): Future[TestProcess] {.async.} =
"--keymanager-token-file=" & tokenFilePath "--keymanager-token-file=" & tokenFilePath
] ]
let binaryPath = absolutePath("build/nimbus_validator_client")
let res = let res =
await startProcess("build/nimbus_validator_client", await startProcess(binaryPath,
arguments = arguments, arguments = arguments,
options = {AsyncProcessOption.StdErrToStdOut}, options = {AsyncProcessOption.StdErrToStdOut},
stdoutHandle = AsyncProcess.Pipe) stdoutHandle = AsyncProcess.Pipe)
@ -409,7 +419,7 @@ proc startValidatorClient(basePort: int): Future[TestProcess] {.async.} =
) )
notice "Validator client process has been started", notice "Validator client process has been started",
process_id = tp.process.pid() process_id = tp.process.pid(), binary_path = binaryPath
let let
address = initTAddress("127.0.0.1:" & address = initTAddress("127.0.0.1:" &
@ -418,12 +428,15 @@ proc startValidatorClient(basePort: int): Future[TestProcess] {.async.} =
if not(flag): if not(flag):
notice "Unable to establish connection with `nimbus_validator_client` " & notice "Unable to establish connection with `nimbus_validator_client` " &
"process", process_id = tp.process.pid() "process", process_id = tp.process.pid(), binary_path = binaryPath
discard await killAndWaitForExit(tp.process, 5.seconds) let
echo "\n===== `nimbus_validator_client` logs =====" exitCode = await killAndWaitForExit(tp.process, 5.seconds)
let output = await tp.reader output = await tp.reader
echo bytesToString(output)
await tp.process.closeWait() await tp.process.closeWait()
echo "===== [", binaryPath, "] exited with [", exitCode, "] ====="
echo bytesToString(output)
echo "====="
raiseAssert "Unable to continue test" raiseAssert "Unable to continue test"
return tp return tp