summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/watchdog/watchdog-test.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2018-12-10 02:00:47 +0300
committerShuah Khan <shuah@kernel.org>2018-12-10 10:55:52 -0700
commitb708a3cc9600390ccaa2b68a88087dd265154b2b (patch)
tree4de16c98eefb71ca447b335d1e15588d03cdeb2f /tools/testing/selftests/watchdog/watchdog-test.c
parent1d956785da5585635eb7e266239729da6bc73e69 (diff)
selftests: do not macro-expand failed assertion expressions
I've stumbled over the current macro-expand behaviour of the test harness: $ gcc -Wall -xc - <<'__EOF__' TEST(macro) { int status = 0; ASSERT_TRUE(WIFSIGNALED(status)); } TEST_HARNESS_MAIN __EOF__ $ ./a.out [==========] Running 1 tests from 1 test cases. [ RUN ] global.macro <stdin>:4:global.macro:Expected 0 (0) != (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) (0) global.macro: Test terminated by assertion [ FAIL ] global.macro [==========] 0 / 1 tests passed. [ FAILED ] With this change the output of the same test looks much more comprehensible: [==========] Running 1 tests from 1 test cases. [ RUN ] global.macro <stdin>:4:global.macro:Expected 0 (0) != WIFSIGNALED(status) (0) global.macro: Test terminated by assertion [ FAIL ] global.macro [==========] 0 / 1 tests passed. [ FAILED ] The issue is very similar to the bug fixed in glibc assert(3) three years ago: https://sourceware.org/bugzilla/show_bug.cgi?id=18604 Cc: Shuah Khan <shuah@kernel.org> Cc: Kees Cook <keescook@chromium.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Will Drewry <wad@chromium.org> Cc: linux-kselftest@vger.kernel.org Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <shuah@kernel.org>
Diffstat (limited to 'tools/testing/selftests/watchdog/watchdog-test.c')
0 files changed, 0 insertions, 0 deletions