public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/3] selftest improvements
@ 2016-06-09 18:15 David Malcolm
  2016-06-09 18:15 ` [PATCH 3/3] pretty-print.c: skip color selftests if GCC_COLORS is set David Malcolm
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: David Malcolm @ 2016-06-09 18:15 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

PR bootstrap/71471 highlighted the need for selftests to provide more
information when they fail.  The report contained:
  src/gcc/pretty-print.c:1246: FAIL: ASSERT_STREQ (expected, pp_formatted_text (&pp))

This showed a string-equality failure within the helper function
assert_pp_format_va, but didn't show which actual comparison was
failing.

Patch 1 updates ASSERT_STREQ so that the output includes the actual
and expected strings, which would have allowed us to identify the
failing test by searching the source.

Patch 2 introduces a way to pass location information to helper
functions so that the file/line that's printed for a failure points to
the specific case, rather than to the inside of the helper function,
and uses it within pretty-print.c's selftests.  This would have
allowed us to directly identify the failing test.

Patch 3 fixes a bug that turned out not to be the cause of the PR.

I've tested the combination of these patches:
  * successful bootstrap&regrtest on x86_64-pc-linux-gnu
  * successful build/-fselftest of stage 1 on powerpc-ibm-aix7.1.3.0

OK for trunk?

David Malcolm (3):
  selftest: show values when ASSERT_STREQ fails
  selftests: improve reported failure locations
  pretty-print.c: skip color selftests if GCC_COLORS is set

 gcc/input.c        |   4 +-
 gcc/pretty-print.c | 135 +++++++++++++++++++++++++++++++++--------------------
 gcc/selftest.c     |  40 ++++++++++++++--
 gcc/selftest.h     |  76 +++++++++++++++++++++---------
 4 files changed, 177 insertions(+), 78 deletions(-)

-- 
1.8.5.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-13 18:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-09 18:15 [PATCH 0/3] selftest improvements David Malcolm
2016-06-09 18:15 ` [PATCH 3/3] pretty-print.c: skip color selftests if GCC_COLORS is set David Malcolm
2016-06-13 18:20   ` Jeff Law
2016-06-09 18:15 ` [PATCH 2/3] selftests: improve reported failure locations David Malcolm
2016-06-13 18:21   ` Jeff Law
2016-06-09 18:15 ` [PATCH 1/3] selftest: show values when ASSERT_STREQ fails David Malcolm
2016-06-13 18:20   ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).