[gdb/testsuite] Fix gdb.cp/cpexprs-debug-types.exp inclusion
authorTom de Vries <tdevries@suse.de>
Mon, 11 May 2020 18:36:11 +0000 (20:36 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 11 May 2020 18:36:11 +0000 (20:36 +0200)
commit113ee09a649a5e192408a10286b95e89bc48706a
tree0fbb3dceb90203f63cf4ecdaf17f808770c29fb9
parentba3e70b008d63b13207339443ad3b9a61ab996bc
[gdb/testsuite] Fix gdb.cp/cpexprs-debug-types.exp inclusion

When running tests using RUNTESTFLAGS="cpexprs.exp cpexprs-debug-types.exp",
we have:
...
Running src/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp ...
Running src/gdb/testsuite/gdb.cp/cpexprs.exp ...
...

In the first test-case, we have -fdebug-types-section as expected:
...
Running src/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp ...
g++ -fno-stack-protector -fdiagnostics-color=never \
  -fdebug-types-section \
  -c -g \
  -o outputs/gdb.cp/cpexprs-debug-types/cpexprs-debug-types0.o \
  src/gdb/testsuite/gdb.cp/cpexprs.cc
...
but in the second test-case, we have also have -fdebug-types-section:
...
Running src/gdb/testsuite/gdb.cp/cpexprs.exp ...
g++ -fno-stack-protector -fdiagnostics-color=never \
  -fdebug-types-section \
  -c -g -g \
  -o outputs/gdb.cp/cpexprs/cpexprs0.o \
  src/gdb/testsuite/gdb.cp/cpexprs.cc
...

This is due to using a global variable flags, which is set in
cpexprs-debug-types.exp and tested for existence in cpexprs.exp.

Fix this by using a more robust inclusion mechanism, that is:
- move the bulk of the test-case cpexprs.exp to cpexprs.exp.in,
- include it from cpexprs.exp and cpexprs-debug-types.exp, and
- set flags in both .exp files

gdb/testsuite/ChangeLog:

2020-05-11  Tom de Vries  <tdevries@suse.de>

* gdb.cp/cpexprs.exp: Move everything except flags setting ...
* gdb.cp/cpexprs.exp.in: .. here.
* gdb.cp/cpexprs-debug-types.exp: Include cpexprs.exp.in instead of
cpexprs.exp.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/cpexprs-debug-types.exp
gdb/testsuite/gdb.cp/cpexprs.exp
gdb/testsuite/gdb.cp/cpexprs.exp.in [new file with mode: 0644]