Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/3] Remove some GDB specific stuff from selftest.c
Date: Fri, 11 Aug 2017 15:31:00 -0000	[thread overview]
Message-ID: <1502465408-24668-3-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1502465408-24668-1-git-send-email-yao.qi@linaro.org>

The next patch moves selftest.c to common/selftest.c, so that GDBserver
can use it as well.  However selftest.c uses something isn't "portable" on
GDB and GDBserver.

First, this patch removes QUIT.  I don't expect that we type ctrl-c during
self/unit tests, and each test shouldn't take long time.  Secondly, I
replace exception_fprintf and printf_filtered with debug_printf.  Verified
that unit tests still catch fails.

gdb:

2017-08-09  Yao Qi  <yao.qi@linaro.org>

	* selftest.c (run_tests): Don't call QUIT.  Call debug_printf
	instead of exception_fprintf and printf_filtered.
---
 gdb/selftest.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/gdb/selftest.c b/gdb/selftest.c
index 31d16af..eb7728b 100644
--- a/gdb/selftest.c
+++ b/gdb/selftest.c
@@ -44,8 +44,6 @@ run_tests (void)
 
   for (int i = 0; i < tests.size (); ++i)
     {
-      QUIT;
-
       TRY
 	{
 	  tests[i] ();
@@ -53,7 +51,7 @@ run_tests (void)
       CATCH (ex, RETURN_MASK_ERROR)
 	{
 	  ++failed;
-	  exception_fprintf (gdb_stderr, ex, _("Self test failed: "));
+	  debug_printf ("Self test failed: %s\n", ex.message);
 	}
       END_CATCH
 
@@ -62,7 +60,7 @@ run_tests (void)
       reinit_frame_cache ();
     }
 
-  printf_filtered (_("Ran %lu unit tests, %d failed\n"),
-		   (long) tests.size (), failed);
+  debug_printf ("Ran %lu unit tests, %d failed\n",
+		(long) tests.size (), failed);
 }
 } // namespace selftests
-- 
1.9.1


  parent reply	other threads:[~2017-08-11 15:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-11 15:31 [PATCH 0/3] Use selftest.c in GDBserver Yao Qi
2017-08-11 15:31 ` [PATCH 3/3] GDBserver self tests Yao Qi
2017-08-11 16:01   ` Eli Zaretskii
2017-08-11 17:10   ` Pedro Alves
2017-08-18  8:16     ` Yao Qi
2017-08-11 15:31 ` Yao Qi [this message]
2017-08-11 15:31 ` [PATCH 1/3] Put selftests api into selftests namespace Yao Qi
2017-08-11 17:11 ` [PATCH 0/3] Use selftest.c in GDBserver Pedro Alves

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=1502465408-24668-3-git-send-email-yao.qi@linaro.org \
    --to=qiyaoltc@gmail.com \
    --cc=gdb-patches@sourceware.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