This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 3/8] Add self-test framework to gdb

Tom Tromey <> writes:

Hi Tom,
this framework is sufficient in current needs, but I'd like to think
more about it because it is a framework, and more and more tests may use
it in the future.

> In development mode, test functions are registered with the self test
> module.  A test function is just a function that does some checks, and
> aborts on failure.  I chose this rather than something fancier because
> I think any such failure will require debugging anyhow.

In this framework, all unit tests are running in one GDB instance, so:

 - if one test fails, the following tests won't be run, even they are
   from different modules,
 - tests may change the GDB state, and the following tests may be affected,

I'd like the framework to only run tests from one module in one gdb
instance, restart gdb after they are finished, and continue running
tests from other modules.  For example, we have registered three self
tests in different modules,

register_self_test (rust_lex_tests);
register_self_test (breakpoint_tests);
register_self_test (linespec_tests);

In gdb.gdb/unittest.exp, we can get the list of self tests from
different modules via command "maint info selftest", like

$ (gdb) maint info selftest

and the output can be saved in $list_of_tests, start a fresh gdb every
time, and execute these tests one by one, like

foreach test $list_of_tests {
  gdb_test "maint selftest $test" "Ran $decimal unit tests"

Yao (éå)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]