+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.
+ * selftest.h: Update declarations.
+ * selftest-arch.c (register_self_test_foreach_arch): Rename it to
+ selftests::register_test_foreach_arch.
+ * selftest-arch.h: Update declaration.
+ * aarch64-tdep.c: Update.
+ * arm-tdep.c: Likewise.
+ * disasm-selftests.c: Likewise.
+ * dwarf2loc.c: Likewise.
+ * dwarf2-frame.c: Likewise.
+ * findvar.c: Likewise.
+ * gdbarch-selftests.c: Likewise.
+ * maint.c (maintenance_selftest): Likewise.
+ * regcache.c: Likewise.
+ * rust-exp.y: Likewise.
+ * selftest-arch.c: Likewise.
+ * unittests/environ-selftests.c: Likewise.
+ * unittests/function-view-selftests.c: Likewise.
+ * unittests/offset-type-selftests.c: Likewise.
+ * unittests/optional-selftests.c: Likewise.
+ * unittests/scoped_restore-selftests.c: Likewise.
+ * utils-selftests.c: Likewise.
+
2017-08-17 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (source_command): Delete 'old_source_verbose'
&setdebuglist, &showdebuglist);
#if GDB_SELF_TEST
- register_self_test (selftests::aarch64_analyze_prologue_test);
- register_self_test (selftests::aarch64_process_record_test);
+ selftests::register_test (selftests::aarch64_analyze_prologue_test);
+ selftests::register_test (selftests::aarch64_process_record_test);
#endif
}
&setdebuglist, &showdebuglist);
#if GDB_SELF_TEST
- register_self_test (selftests::arm_record_test);
+ selftests::register_test (selftests::arm_record_test);
#endif
}
_initialize_disasm_selftests (void)
{
#if GDB_SELF_TEST
- register_self_test_foreach_arch (selftests::print_one_insn_test);
- register_self_test_foreach_arch (selftests::memory_error_test);
+ selftests::register_test_foreach_arch (selftests::print_one_insn_test);
+ selftests::register_test_foreach_arch (selftests::memory_error_test);
#endif
}
dwarf2_frame_objfile_data = register_objfile_data ();
#if GDB_SELF_TEST
- register_self_test_foreach_arch (selftests::execute_cfa_program_test);
+ selftests::register_test_foreach_arch (selftests::execute_cfa_program_test);
#endif
}
&setdebuglist, &showdebuglist);
#if GDB_SELF_TEST
- register_self_test (selftests::copy_bitwise_tests);
+ selftests::register_test (selftests::copy_bitwise_tests);
#endif
}
_initialize_findvar (void)
{
#if GDB_SELF_TEST
- register_self_test (selftests::findvar_tests::copy_integer_to_size_test);
+ selftests::register_test (selftests::findvar_tests::copy_integer_to_size_test);
#endif
}
_initialize_gdbarch_selftests (void)
{
#if GDB_SELF_TEST
- register_self_test_foreach_arch (selftests::register_to_value_test);
+ selftests::register_test_foreach_arch (selftests::register_to_value_test);
#endif
}
static void
maintenance_selftest (char *args, int from_tty)
{
- run_self_tests ();
+ selftests::run_tests ();
}
\f
Takes an optional file parameter."),
&maintenanceprintlist);
#if GDB_SELF_TEST
- register_self_test (selftests::current_regcache_test);
+ selftests::register_test (selftests::current_regcache_test);
#endif
}
gdb_assert (code == 0);
#if GDB_SELF_TEST
- register_self_test (rust_lex_tests);
+ selftests::register_test (rust_lex_tests);
#endif
}
#include "selftest-arch.h"
#include "arch-utils.h"
+namespace selftests {
+
static std::vector<self_test_foreach_arch_function *> gdbarch_tests;
void
-register_self_test_foreach_arch (self_test_foreach_arch_function *function)
+register_test_foreach_arch (self_test_foreach_arch_function *function)
{
gdbarch_tests.push_back (function);
}
-namespace selftests {
-
static void
tests_with_arch ()
{
_initialize_selftests_foreach_arch ()
{
#if GDB_SELF_TEST
- register_self_test (selftests::tests_with_arch);
+ selftests::register_test (selftests::tests_with_arch);
#endif
}
typedef void self_test_foreach_arch_function (struct gdbarch *);
+namespace selftests
+{
extern void
- register_self_test_foreach_arch (self_test_foreach_arch_function *function);
+ register_test_foreach_arch (self_test_foreach_arch_function *function);
+}
#endif /* SELFTEST_ARCH_H */
#include "selftest.h"
#include <vector>
+namespace selftests
+{
+
/* All the tests that have been registered. */
static std::vector<self_test_function *> tests;
/* See selftest.h. */
void
-register_self_test (self_test_function *function)
+register_test (self_test_function *function)
{
tests.push_back (function);
}
/* See selftest.h. */
void
-run_self_tests (void)
+run_tests (void)
{
int failed = 0;
printf_filtered (_("Ran %lu unit tests, %d failed\n"),
(long) tests.size (), failed);
}
+} // namespace selftests
typedef void self_test_function (void);
+namespace selftests
+{
+
/* Register a new self-test. */
-extern void register_self_test (self_test_function *function);
+extern void register_test (self_test_function *function);
/* Run all the self tests. This print a message describing the number
of test and the number of failures. */
-extern void run_self_tests (void);
+extern void run_tests (void);
+
+}
/* Check that VALUE is true, and, if not, throw an exception. */
void
_initialize_environ_selftests ()
{
- register_self_test (selftests::gdb_environ_tests::run_tests);
+ selftests::register_test (selftests::gdb_environ_tests::run_tests);
}
void
_initialize_function_view_selftests ()
{
- register_self_test (selftests::function_view::run_tests);
+ selftests::register_test (selftests::function_view::run_tests);
}
void
_initialize_offset_type_selftests ()
{
- register_self_test (selftests::offset_type::run_tests);
+ selftests::register_test (selftests::offset_type::run_tests);
}
void
_initialize_optional_selftests ()
{
- register_self_test (selftests::optional::run_tests);
+ selftests::register_test (selftests::optional::run_tests);
}
void
_initialize_scoped_restore_selftests ()
{
- register_self_test (selftests::scoped_restore_tests::run_tests);
+ selftests::register_test (selftests::scoped_restore_tests::run_tests);
}
_initialize_utils_selftests (void)
{
#if GDB_SELF_TEST
- register_self_test (selftests::common_utils_tests);
+ selftests::register_test (selftests::common_utils_tests);
#endif
}