__EXPECT() currently prints the stringified arguments on failure but not their value, which is not very helpful.
Let's use the same message as the original macro in kselftest_harness.h, printing the values too. For simplicity's sake they are always printed as signed, which is generally appropriate (only 64-bit unsigned values with the top bit set are an issue, and these are rarely encountered).
Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com --- tools/testing/selftests/arm64/morello/freestanding.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/arm64/morello/freestanding.h b/tools/testing/selftests/arm64/morello/freestanding.h index 2beb52eafae1..8dab905d2b54 100644 --- a/tools/testing/selftests/arm64/morello/freestanding.h +++ b/tools/testing/selftests/arm64/morello/freestanding.h @@ -91,8 +91,12 @@ int __attribute__ ((format(printf, 1, 2))) printf(const char *fmt, ...); /* this macro emulates its harness counterpart but is not API compatible */ #define __EXPECT(exp, seen, op, exit_on_fail) \ do { \ - if (!((exp) op (seen))) { \ - __TH_LOG_ERROR("'(%s) %s (%s)' was false", #exp, #op, #seen); \ + __typeof__(exp) __exp = (exp); \ + __typeof__(seen) __seen = (seen); \ + if (!((__exp) op (__seen))) { \ + __TH_LOG_ERROR("Expected %s (%lld) %s %s (%lld)", \ + #exp, (long long)__exp, #op, \ + #seen, (long long)__seen); \ __cur_test->message = 1; \ } \ } while (0); \