]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdbsupport/selftest.h
gdbsupport/selftest: Allow lazy registration
[thirdparty/binutils-gdb.git] / gdbsupport / selftest.h
index 5ca9bdcc598c1eb4d1bb604d948a0928a83b552f..661431dbfca0bfdc37f5a908c7ec30c85c00989e 100644 (file)
@@ -23,6 +23,7 @@
 #include "gdbsupport/function-view.h"
 #include "gdbsupport/iterator-range.h"
 #include <set>
+#include <vector>
 
 /* A test is just a function that does some checks and throws an
    exception if something has gone wrong.  */
@@ -61,6 +62,16 @@ extern bool run_verbose ();
 extern void register_test (const std::string &name,
                           std::function<void(void)> function);
 
+/* A selftest generator is a callback function used to delay the generation
+   of selftests.  */
+
+using selftests_generator = std::function<std::vector<selftest> (void)>;
+
+/* Register a function which can lazily register selftests once GDB is fully
+   initialized. */
+
+extern void add_lazy_generator (selftests_generator generator);
+
 /* Run all the self tests.  This print a message describing the number
    of test and the number of failures.