diff --git a/binrz/rz-test/run.c b/binrz/rz-test/run.c index 635cfbe7234..863659fe343 100644 --- a/binrz/rz-test/run.c +++ b/binrz/rz-test/run.c @@ -278,6 +278,7 @@ RZ_API RzAsmTestOutput *rz_test_run_asm_test(RzTestRunConfig *config, RzAsmTest if (!out) { return NULL; } + out->as_ret = out->disas_ret = out->il_ret = INT_MAX; RzPVector args; rz_pvector_init(&args, NULL); @@ -318,7 +319,8 @@ RZ_API RzAsmTestOutput *rz_test_run_asm_test(RzTestRunConfig *config, RzAsmTest out->as_timeout = true; goto rip; } - if (rz_subprocess_ret(proc) != 0) { + out->as_ret = rz_subprocess_ret(proc); + if (out->as_ret != 0) { goto rip; } char *hex = (char *)crlf2lf(rz_subprocess_out(proc, NULL)); @@ -352,7 +354,8 @@ RZ_API RzAsmTestOutput *rz_test_run_asm_test(RzTestRunConfig *config, RzAsmTest out->disas_timeout = true; goto ship; } - if (rz_subprocess_ret(proc) != 0) { + out->disas_ret = rz_subprocess_ret(proc); + if (out->disas_ret != 0) { goto ship; } char *disasm = (char *)crlf2lf(rz_subprocess_out(proc, NULL)); @@ -382,7 +385,8 @@ RZ_API RzAsmTestOutput *rz_test_run_asm_test(RzTestRunConfig *config, RzAsmTest rz_str_trim(il_err); out->il = il; out->il_report = il_err; - out->il_failed = rz_subprocess_ret(proc) != 0; + out->il_ret = rz_subprocess_ret(proc); + out->il_failed = out->il_ret != 0; } free(hex); rz_pvector_pop(&args); diff --git a/binrz/rz-test/rz-test.c b/binrz/rz-test/rz-test.c index 25a9ae19388..23eed30fdd9 100644 --- a/binrz/rz-test/rz-test.c +++ b/binrz/rz-test/rz-test.c @@ -780,6 +780,18 @@ static RzSubprocessOutput *print_runner(const char *file, const char *args[], si return NULL; } +static void print_asm_exit_status(const char *mode, bool timeout, int ret) { + printf("-- %s exit status: ", mode); + if (timeout) { + printf(Color_CYAN "TIMEOUT" Color_RESET); + } else if (ret != 0) { + printf(Color_RED "%d" Color_RESET, ret); + } else { + printf("0"); + } + printf("\n"); +} + static void print_result_diff(RzTestRunConfig *config, RzTestResultInfo *result) { if (result->run_failed) { printf(Color_RED "RUN FAILED (e.g. wrong rizin path)" Color_RESET "\n"); @@ -856,6 +868,15 @@ static void print_result_diff(RzTestRunConfig *config, RzTestResultInfo *result) printf(Color_RED "%s" Color_RESET "\n", report); } } + if (test->mode & RZ_ASM_TEST_MODE_DISASSEMBLE) { + print_asm_exit_status("disasm", out->disas_timeout, out->disas_ret); + } + if (test->mode & RZ_ASM_TEST_MODE_ASSEMBLE) { + print_asm_exit_status("asm", out->as_timeout, out->as_ret); + } + if (test->il) { + print_asm_exit_status("IL", out->il_timeout, out->il_ret); + } free(expect_hex); break; } diff --git a/binrz/rz-test/rz_test.h b/binrz/rz-test/rz_test.h index ff13837fd7f..7cd272b7347 100644 --- a/binrz/rz-test/rz_test.h +++ b/binrz/rz-test/rz_test.h @@ -156,6 +156,9 @@ typedef struct rz_test_asm_test_output_t { bool as_timeout; bool disas_timeout; bool il_timeout; + int as_ret; + int disas_ret; + int il_ret; } RzAsmTestOutput; typedef enum rz_test_test_result_t {