Re: GDB version as convenience variable

Joel Brobecker
2019-03-26T20:57:21Z

> Apparently, the test default.exp needs to be changed in any case,
> because it adds new convenience variables. Without modification, the
> "show convenience" test fails because there is a new entry it doesn't
> know about.
>
> So for now, I would suggest adding the modification below to your
> patch to keep the test passing. It is not obvious to change the test
> to match the convenience variable value against a variable or even
> against a regexp, because it uses gdb_test_list_exact, which does
> straight string comparison.
>
> Also, I am not sure if reading the output of "show version" and
> testing against that would be a really good test, because the
> implementation and the test would work essentially work the same way.
> So if the version string erroneously becomes 0.0.0 because of some bug
> in some script, the test would still pass, even though the values are
> wrong.
>
> At least, the following is simple and robust.

Hmmm, the direct string comparison thing is a bit annoying.

This is going to be one more manual test to do after each branch,
and I'm a bit concerned about that. We can start with that, as we want
the test to pass. But I'm wondering if, instead of getting the output
from "show version" to determine the expected values, we could parse
gdb/version.in instead. If needed, we could so the parsing as part of
the build process (ig do it in the makefile, and store the result in
a couple of files). Something like that.

> diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp
> index ece1428e617e..9ff5144448d8 100644
> --- a/gdb/testsuite/gdb.base/default.exp
> +++ b/gdb/testsuite/gdb.base/default.exp
> @@ -602,6 +602,8 @@ set show_conv_list \
> {$_probe_arg10 = <error: No frame selected>} \
> {$_probe_arg11 = <error: No frame selected>} \
> {$_isvoid = <internal function _isvoid>} \
> + {$_gdb_major = 8} \
> + {$_gdb_minor = 4} \
> }
> if ![skip_python_tests] {
> append show_conv_list \
>
>
>
> Simon

--
Joel