This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 3/8] Add self-test framework to gdb
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 28 Apr 2016 11:28:03 +0100
- Subject: Re: [PATCH v2 3/8] Add self-test framework to gdb
- Authentication-results: sourceware.org; auth=none
- References: <1461789279-15996-1-git-send-email-tom at tromey dot com> <1461789279-15996-4-git-send-email-tom at tromey dot com>
Tom Tromey <tom@tromey.com> 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
rust_lex_tests
breakpoint_tests
linespec_tests
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_start
gdb_test "maint selftest $test" "Ran $decimal unit tests"
gdb_exit
}
--
Yao (éå)