This is the mail archive of the gdb-patches@sourceware.org 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: GDB version as convenience variable


On 2019-03-25 3:18 p.m., Eli Zaretskii wrote:
>> Date: Mon, 25 Mar 2019 14:51:36 -0400
>> From: Simon Marchi <simark@simark.ca>
>> Cc: gdb-patches@sourceware.org, brobecker@adacore.com
>>
>> comparing the output with gdb --version, or some other automated
>> mean, would be perfect.
> 
> Well, I never wrote any tests for GDB, and I'm not sure I have a
> system on which to run such a test.  So I hope someone else will add
> this test.
> 

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.


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


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