Add selftests run filtering
[deliverable/binutils-gdb.git] / gdb / common / selftest.h
index e211c340c1b0a99d6d7eb59e05cf32aa2904a231..35a344ff6cff8860485fc58d19473b5be33479c7 100644 (file)
@@ -27,18 +27,38 @@ typedef void self_test_function (void);
 namespace selftests
 {
 
+/* Interface for the various kinds of selftests.  */
+
+struct selftest
+{
+  virtual void operator() () const = 0;
+};
+
 /* Register a new self-test.  */
 
-extern void register_test (self_test_function *function);
+extern void register_test (const std::string &name, selftest *test);
+
+/* Register a new self-test.  */
+
+extern void register_test (const std::string &name,
+                          self_test_function *function);
 
 /* Run all the self tests.  This print a message describing the number
-   of test and the number of failures.  */
+   of test and the number of failures.
+
+   If FILTER is not NULL and not empty, only tests with names containing FILTER
+   will be ran.  */
 
-extern void run_tests (void);
+extern void run_tests (const char *filter);
 
 /* Reset GDB or GDBserver's internal state.  */
 extern void reset ();
 
+typedef void for_each_selftest_ftype (const std::string &name);
+
+/* Call FUNC for each registered selftest.  */
+
+extern void for_each_selftest (for_each_selftest_ftype func);
 }
 
 /* Check that VALUE is true, and, if not, throw an exception.  */
This page took 0.024912 seconds and 4 git commands to generate.