]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove some GDB specific stuff from selftest.c
authorYao Qi <yao.qi@linaro.org>
Fri, 18 Aug 2017 08:20:43 +0000 (09:20 +0100)
committerYao Qi <yao.qi@linaro.org>
Fri, 18 Aug 2017 08:20:43 +0000 (09:20 +0100)
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.

gdb/ChangeLog
gdb/selftest.c

index ec138de66f063d99ab97f6e01bf5c87e4d4f8475..4a0f3e72ebde63c427a93fda169c10cab84b3cb6 100644 (file)
@@ -1,3 +1,8 @@
+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
index 31d16af4eabaf5610f4f1f5238209ff46e364b21..eb7728b014996ce5cd969003c03e8e603a0403fc 100644 (file)
@@ -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