This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Remove some GDB specific stuff from selftest.c


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=86dcbf50fe5f59fbc35f38f02ab6c1803c29f383

commit 86dcbf50fe5f59fbc35f38f02ab6c1803c29f383
Author: Yao Qi <yao.qi@linaro.org>
Date:   Fri Aug 18 09:20:43 2017 +0100

    Remove some GDB specific stuff from selftest.c
    
    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-18  Yao Qi  <yao.qi@linaro.org>
    
    	* selftest.c (run_tests): Don't call QUIT.  Call debug_printf
    	instead of exception_fprintf and printf_filtered.

Diff:
---
 gdb/ChangeLog  | 5 +++++
 gdb/selftest.c | 8 +++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ec138de..4a0f3e7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2017-08-18  Yao Qi  <yao.qi@linaro.org>
 
+	* selftest.c (run_tests): Don't call QUIT.  Call debug_printf
+	instead of exception_fprintf and printf_filtered.
+
+2017-08-18  Yao Qi  <yao.qi@linaro.org>
+
 	* selftest.c (register_self_test): Rename it to
 	selftests::register_test.
 	(run_self_tests): selftest::run_tests.
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]