[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.