diff options
author | Yao Qi <yao.qi@linaro.org> | 2017-08-18 09:20:43 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2017-08-18 09:20:43 +0100 |
commit | 7649770c8e52afe2696a70bb50ac3039c844d381 (patch) | |
tree | c04e12f6c672590e9df9888a80ed3fa23b7cb3a9 /gdb | |
parent | de25939739ffe9a9ad7cec07a35bb2a1e430fe39 (diff) | |
download | gdb-7649770c8e52afe2696a70bb50ac3039c844d381.zip gdb-7649770c8e52afe2696a70bb50ac3039c844d381.tar.gz gdb-7649770c8e52afe2696a70bb50ac3039c844d381.tar.bz2 |
Put selftests api into selftests namespace
This patch changes register_self_test to selftests::register_test,
and run_self_tests to selftest::run_tests.
gdb:
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 27 | ||||
-rw-r--r-- | gdb/aarch64-tdep.c | 4 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 2 | ||||
-rw-r--r-- | gdb/disasm-selftests.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2-frame.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2loc.c | 2 | ||||
-rw-r--r-- | gdb/findvar.c | 2 | ||||
-rw-r--r-- | gdb/gdbarch-selftests.c | 2 | ||||
-rw-r--r-- | gdb/maint.c | 2 | ||||
-rw-r--r-- | gdb/regcache.c | 2 | ||||
-rw-r--r-- | gdb/rust-exp.y | 2 | ||||
-rw-r--r-- | gdb/selftest-arch.c | 8 | ||||
-rw-r--r-- | gdb/selftest-arch.h | 5 | ||||
-rw-r--r-- | gdb/selftest.c | 8 | ||||
-rw-r--r-- | gdb/selftest.h | 9 | ||||
-rw-r--r-- | gdb/unittests/environ-selftests.c | 2 | ||||
-rw-r--r-- | gdb/unittests/function-view-selftests.c | 2 | ||||
-rw-r--r-- | gdb/unittests/offset-type-selftests.c | 2 | ||||
-rw-r--r-- | gdb/unittests/optional-selftests.c | 2 | ||||
-rw-r--r-- | gdb/unittests/scoped_restore-selftests.c | 2 | ||||
-rw-r--r-- | gdb/utils-selftests.c | 2 |
21 files changed, 66 insertions, 27 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 083e312..ec138de 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,30 @@ +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' diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 7816281..5a627a3 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -3068,8 +3068,8 @@ When on, AArch64 specific debugging is enabled."), &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 } diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 9943324..a107584 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9719,7 +9719,7 @@ vfp - VFP co-processor."), &setdebuglist, &showdebuglist); #if GDB_SELF_TEST - register_self_test (selftests::arm_record_test); + selftests::register_test (selftests::arm_record_test); #endif } diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c index 9eb80b4..4d38ccf 100644 --- a/gdb/disasm-selftests.c +++ b/gdb/disasm-selftests.c @@ -214,7 +214,7 @@ void _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 } diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index f8e6522..aaf3aee 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -2406,6 +2406,6 @@ _initialize_dwarf2_frame (void) 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 } diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 927d950..1a1b06a 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -4687,6 +4687,6 @@ _initialize_dwarf2loc (void) &setdebuglist, &showdebuglist); #if GDB_SELF_TEST - register_self_test (selftests::copy_bitwise_tests); + selftests::register_test (selftests::copy_bitwise_tests); #endif } diff --git a/gdb/findvar.c b/gdb/findvar.c index beb127e..de6b6ed 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -1095,6 +1095,6 @@ void _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 } diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c index 096ba97..cb15964 100644 --- a/gdb/gdbarch-selftests.c +++ b/gdb/gdbarch-selftests.c @@ -151,6 +151,6 @@ void _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 } diff --git a/gdb/maint.c b/gdb/maint.c index a0d43ec..28f7287 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -959,7 +959,7 @@ show_per_command_cmd (char *args, int from_tty) static void maintenance_selftest (char *args, int from_tty) { - run_self_tests (); + selftests::run_tests (); } diff --git a/gdb/regcache.c b/gdb/regcache.c index e8f92d6..dcbcedd 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1776,6 +1776,6 @@ remote register number and buffer offset in the g/G packets.\n\ 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 } diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y index 30c0cb4..4cb3aa2 100644 --- a/gdb/rust-exp.y +++ b/gdb/rust-exp.y @@ -2781,6 +2781,6 @@ _initialize_rust_exp (void) gdb_assert (code == 0); #if GDB_SELF_TEST - register_self_test (rust_lex_tests); + selftests::register_test (rust_lex_tests); #endif } diff --git a/gdb/selftest-arch.c b/gdb/selftest-arch.c index c4fe60d..dfcbe27 100644 --- a/gdb/selftest-arch.c +++ b/gdb/selftest-arch.c @@ -23,16 +23,16 @@ #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 () { @@ -101,6 +101,6 @@ void _initialize_selftests_foreach_arch () { #if GDB_SELF_TEST - register_self_test (selftests::tests_with_arch); + selftests::register_test (selftests::tests_with_arch); #endif } diff --git a/gdb/selftest-arch.h b/gdb/selftest-arch.h index d1725cd..dc16c4d 100644 --- a/gdb/selftest-arch.h +++ b/gdb/selftest-arch.h @@ -21,7 +21,10 @@ 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 */ diff --git a/gdb/selftest.c b/gdb/selftest.c index 14b76f6..31d16af 100644 --- a/gdb/selftest.c +++ b/gdb/selftest.c @@ -20,6 +20,9 @@ #include "selftest.h" #include <vector> +namespace selftests +{ + /* All the tests that have been registered. */ static std::vector<self_test_function *> tests; @@ -27,7 +30,7 @@ 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); } @@ -35,7 +38,7 @@ register_self_test (self_test_function *function) /* See selftest.h. */ void -run_self_tests (void) +run_tests (void) { int failed = 0; @@ -62,3 +65,4 @@ run_self_tests (void) printf_filtered (_("Ran %lu unit tests, %d failed\n"), (long) tests.size (), failed); } +} // namespace selftests diff --git a/gdb/selftest.h b/gdb/selftest.h index 94684ff..8a01a5d 100644 --- a/gdb/selftest.h +++ b/gdb/selftest.h @@ -24,14 +24,19 @@ 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. */ diff --git a/gdb/unittests/environ-selftests.c b/gdb/unittests/environ-selftests.c index 28b16f8..1e938e6 100644 --- a/gdb/unittests/environ-selftests.c +++ b/gdb/unittests/environ-selftests.c @@ -155,5 +155,5 @@ run_tests () void _initialize_environ_selftests () { - register_self_test (selftests::gdb_environ_tests::run_tests); + selftests::register_test (selftests::gdb_environ_tests::run_tests); } diff --git a/gdb/unittests/function-view-selftests.c b/gdb/unittests/function-view-selftests.c index 310f2ad..d3018ba 100644 --- a/gdb/unittests/function-view-selftests.c +++ b/gdb/unittests/function-view-selftests.c @@ -174,5 +174,5 @@ run_tests () void _initialize_function_view_selftests () { - register_self_test (selftests::function_view::run_tests); + selftests::register_test (selftests::function_view::run_tests); } diff --git a/gdb/unittests/offset-type-selftests.c b/gdb/unittests/offset-type-selftests.c index a11e908..3e66547 100644 --- a/gdb/unittests/offset-type-selftests.c +++ b/gdb/unittests/offset-type-selftests.c @@ -174,5 +174,5 @@ run_tests () void _initialize_offset_type_selftests () { - register_self_test (selftests::offset_type::run_tests); + selftests::register_test (selftests::offset_type::run_tests); } diff --git a/gdb/unittests/optional-selftests.c b/gdb/unittests/optional-selftests.c index 76343c6..0bcf964 100644 --- a/gdb/unittests/optional-selftests.c +++ b/gdb/unittests/optional-selftests.c @@ -90,5 +90,5 @@ run_tests () void _initialize_optional_selftests () { - register_self_test (selftests::optional::run_tests); + selftests::register_test (selftests::optional::run_tests); } diff --git a/gdb/unittests/scoped_restore-selftests.c b/gdb/unittests/scoped_restore-selftests.c index e97d622..ea7492b 100644 --- a/gdb/unittests/scoped_restore-selftests.c +++ b/gdb/unittests/scoped_restore-selftests.c @@ -106,5 +106,5 @@ 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); } diff --git a/gdb/utils-selftests.c b/gdb/utils-selftests.c index ebaeef0..08feac6 100644 --- a/gdb/utils-selftests.c +++ b/gdb/utils-selftests.c @@ -55,6 +55,6 @@ void _initialize_utils_selftests (void) { #if GDB_SELF_TEST - register_self_test (selftests::common_utils_tests); + selftests::register_test (selftests::common_utils_tests); #endif } |