public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: David Malcolm <dmalcolm@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/3] selftests: improve reported failure locations
Date: Mon, 13 Jun 2016 18:21:00 -0000	[thread overview]
Message-ID: <e1a0bf54-9ccc-987f-ecab-cb78663919ad@redhat.com> (raw)
In-Reply-To: <1465497729-42544-3-git-send-email-dmalcolm@redhat.com>

On 06/09/2016 12:42 PM, David Malcolm wrote:
> This patch introduce a selftest::location struct to wrap up __FILE__
> and __LINE__ information (and __FUNCTION__) throughout the selftests,
> allowing location information to be passed around.
>
> It updates the helper functions in pretty-print.c to pass through
> the precise location of each test, so that if a failure occurs, the
> correct line number is printed, rather than a line within a helper
> function.
>
> gcc/ChangeLog:
> 	* input.c (test_reading_source_line): Use SELFTEST_LOCATION.
> 	* pretty-print.c (assert_pp_format_va): Add location param and use
> 	it with ASSERT_STREQ_AT.
> 	(assert_pp_format): Add location param and pass it to
> 	assert_pp_format_va.
> 	(assert_pp_format_colored): Likewise.
> 	(ASSERT_PP_FORMAT_1): New.
> 	(ASSERT_PP_FORMAT_2): New.
> 	(ASSERT_PP_FORMAT_3): New.
> 	(test_pp_format): Provide SELFTEST_LOCATION throughout, either
> 	explicitly, or implicitly via the above macros.
> 	* selftest.c (selftest::pass): Use a selftest::location rather
> 	than file and line.
> 	(selftest::fail): Likewise.  Print the function name.
> 	(selftest::fail_formatted): Likewise.
> 	(selftest::assert_streq): Use a selftest::location rather than
> 	file and line.
> 	* selftest.h (selftest::location): New struct.
> 	(SELFTEST_LOCATION): New macro.
> 	(selftest::pass): Accept a const location & rather than file
> 	and line.
> 	(selftest::fail): Likewise.
> 	(selftest::fail_formatted): Likewise.
> 	(selftest::assert_streq): Likewise.
> 	(ASSERT_TRUE): Update for above changes, using SELFTEST_LOCATION.
> 	(ASSERT_FALSE): Likewise.
> 	(ASSERT_EQ): Likewise.
> 	(ASSERT_NE): Likewise.
> 	(ASSERT_STREQ): Likewise.
> 	(ASSERT_PRED1): Likewise.
> 	(ASSERT_STREQ_AT): New macro.
OK.
jeff

  reply	other threads:[~2016-06-13 18:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-09 18:15 [PATCH 0/3] selftest improvements David Malcolm
2016-06-09 18:15 ` [PATCH 2/3] selftests: improve reported failure locations David Malcolm
2016-06-13 18:21   ` Jeff Law [this message]
2016-06-09 18:15 ` [PATCH 1/3] selftest: show values when ASSERT_STREQ fails David Malcolm
2016-06-13 18:20   ` Jeff Law
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1a0bf54-9ccc-987f-ecab-cb78663919ad@redhat.com \
    --to=law@redhat.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).