mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-12 12:16:04 +08:00
7649770c8e
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.
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
/* GDB self-testing.
|
|
Copyright (C) 2016-2017 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef SELFTEST_H
|
|
#define SELFTEST_H
|
|
|
|
/* A test is just a function that does some checks and throws an
|
|
exception if something has gone wrong. */
|
|
|
|
typedef void self_test_function (void);
|
|
|
|
namespace selftests
|
|
{
|
|
|
|
/* Register a new self-test. */
|
|
|
|
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_tests (void);
|
|
|
|
}
|
|
|
|
/* Check that VALUE is true, and, if not, throw an exception. */
|
|
|
|
#define SELF_CHECK(VALUE) \
|
|
do { \
|
|
if (!(VALUE)) \
|
|
error (_("self-test failed at %s:%d"), __FILE__, __LINE__); \
|
|
} while (0)
|
|
|
|
#endif /* SELFTEST_H */
|