[PATCH 1/2] tests: Add symtab test suite

Dodji Seketeli dodji@seketeli.org
Tue May 26 14:00:33 GMT 2020


Hello,

Matthias Maennich <maennich@google.com> a écrit:

[...]

> +++ b/tests/test-symtab.cc

> +TEST_CASE("Symtab::Empty", "[symtab, basic]")
> +{
> +  const std::string	     binary = "basic/empty.so";

You see, the main criteria I care about in testing is actually the
capacity for someone who is running the test to debug it (when it fails)
without having to know about the details about a particular testing
framework.  I know other people favor "fancy test outputs" and other
niceties.  I don't really care about those :-) What I care the most
about is to be able to pratically debug and fix stuff because I think
that's what matters ultimately, fixing stuff to make it work.

That means, I should be able to run the test under the debugger, set a
breakpoint in the source code of the test that I am reading and go from
there.

So for instance, in this example, I can't do that.  I can't set a
breakpoint at the line where the variable "binary" is defined, without
knowing about the function that is automatically generated by the macro
TEST_CASE("blah") etc.  To me, that's a real loss of functionality
compared to the other libabigail tests.  I was a bit reluctant to accept
the use of libCatch, because of that.  But I think there is a middle
ground we can strike here.

How about we decide that each test case should be its own function? I.e,
having:

void
test_case1()
{
  //blah.
}

and then

TEST_CASE("Symtab::Empty", "[symtab, basic]")
{
  test_case1();
}


That way, when the "Symtab::Empty" test fails, I can do:

$ gdb --args runtestsymtab
> break test_case1
> run

And then break inside test_case1 and work from there.

Or something along those lines.  This might seem like a minor point to
you today, but when we are gone and someone else has (or maybe us 10
years from now when we forgot everything about today) to fix issues
raised by this test failing, being able to single step from the failing
test will prove invaluable.  So I really care about this.

What do you think?  I am probably missing something.  Maybe you have a better idea?

Cheers,

-- 
		Dodji


More information about the Libabigail mailing list