2 Copyright (C) 2016 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 typedef self_test_function *self_test_function_ptr;
25 DEF_VEC_P (self_test_function_ptr);
27 /* All the tests that have been registered. */
29 static VEC (self_test_function_ptr) *tests;
34 register_self_test (self_test_function *function)
36 VEC_safe_push (self_test_function_ptr, tests, function);
45 self_test_function_ptr func;
48 for (i = 0; VEC_iterate (self_test_function_ptr, tests, i, func); ++i)
56 CATCH (ex, RETURN_MASK_ERROR)
59 exception_fprintf (gdb_stderr, ex,
60 _("Self test threw exception"));
65 printf_filtered (_("Ran %u unit tests, %d failed\n"),
66 VEC_length (self_test_function_ptr, tests), failed);