]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Split up multi-exec test-cases
authorTom de Vries <tdevries@suse.de>
Thu, 14 May 2020 15:24:49 +0000 (17:24 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 14 May 2020 15:24:49 +0000 (17:24 +0200)
With test-case gdb.base/align.exp and target board native-gdbserver, we run
into:
...
(gdb) file outputs/gdb.base/align/c/align^M
Reading symbols from outputs/gdb.base/align/c/align...^M
(gdb) delete breakpoints^M
(gdb) info breakpoints^M
No breakpoints or watchpoints.^M
(gdb) break main^M
Breakpoint 1 at 0x4004ab: file outputs/gdb.base/align/c/align.c, line 838.^M
(gdb) kill^M
The program is not being run.^M
(gdb) spawn gdbserver --once localhost:2592 outputs/gdb.base/align/align^M
Process outputs/gdb.base/align/align created; pid = 6946^M
Listening on port 2592^M
target remote localhost:2592^M
Remote debugging using localhost:2592^M
warning: Mismatch between current exec-file outputs/gdb.base/align/c/align^M
and automatically determined exec-file outputs/gdb.base/align/align^M
exec-file-mismatch handling is currently "ask"^M
Load new symbol table from "outputs/gdb.base/align/align"? (y or n) Quit^M
(gdb) ERROR: test suppressed
...

Fix this by turning this and similar test-cases into regular, single
executable test-cases.

This fixes 100+ FAILs with target board native-gdbserver.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

* gdb.base/align.exp: Split into ...
* gdb.base/align.exp.in: ...
* gdb.base/align-c++.exp: ...
* gdb.base/align-c.exp: ... these.
* gdb.base/infcall-nested-structs.exp: Split into ...
* gdb.base/infcall-nested-structs.exp.in: ...
* gdb.base/infcall-nested-structs-c++.exp: ...
* gdb.base/infcall-nested-structs-c.exp: ... these.
* gdb.base/info-types.exp: Split into ...
* gdb.base/info-types.exp.in: ...
* gdb.base/info-types-c++.exp: ...
* gdb.base/info-types-c.exp: ... these.
* gdb.base/max-depth.exp: Split into ...
* gdb.base/max-depth.exp.in: ...
* gdb.base/max-depth-c++.exp: ...
* gdb.base/max-depth-c.exp: ... these.
* gdb.cp/infcall-nodebug.exp: Split into ...
* gdb.cp/infcall-nodebug.exp.in: ...
* gdb.cp/infcall-nodebug-c++-d0.exp: ...
* gdb.cp/infcall-nodebug-c++-d1.exp: ...
* gdb.cp/infcall-nodebug-c-d0.exp: ...
* gdb.cp/infcall-nodebug-c-d1.exp: ... these.

18 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/align-c++.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/align-c.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/align.exp.in [moved from gdb/testsuite/gdb.base/align.exp with 87% similarity]
gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/infcall-nested-structs-c.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/infcall-nested-structs.exp.in [moved from gdb/testsuite/gdb.base/infcall-nested-structs.exp with 90% similarity]
gdb/testsuite/gdb.base/info-types-c++.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/info-types-c.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/info-types.exp.in [moved from gdb/testsuite/gdb.base/info-types.exp with 90% similarity]
gdb/testsuite/gdb.base/max-depth-c++.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/max-depth-c.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/max-depth.exp.in [moved from gdb/testsuite/gdb.base/max-depth.exp with 94% similarity]
gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp [new file with mode: 0644]
gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp [new file with mode: 0644]
gdb/testsuite/gdb.cp/infcall-nodebug-c-d0.exp [new file with mode: 0644]
gdb/testsuite/gdb.cp/infcall-nodebug-c-d1.exp [new file with mode: 0644]
gdb/testsuite/gdb.cp/infcall-nodebug.exp.in [moved from gdb/testsuite/gdb.cp/infcall-nodebug.exp with 82% similarity]

index c987c829c45d92d1cf16872ff23b0b3df17325e9..5f1b04f6c349846e4e27e8ca21b2618d4911e08a 100644 (file)
@@ -1,3 +1,28 @@
+2020-05-14  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.base/align.exp: Split into ...
+       * gdb.base/align.exp.in: ...
+       * gdb.base/align-c++.exp: ...
+       * gdb.base/align-c.exp: ... these.
+       * gdb.base/infcall-nested-structs.exp: Split into ...
+       * gdb.base/infcall-nested-structs.exp.in: ...
+       * gdb.base/infcall-nested-structs-c++.exp: ...
+       * gdb.base/infcall-nested-structs-c.exp: ... these.
+       * gdb.base/info-types.exp: Split into ...
+       * gdb.base/info-types.exp.in: ...
+       * gdb.base/info-types-c++.exp: ...
+       * gdb.base/info-types-c.exp: ... these.
+       * gdb.base/max-depth.exp: Split into ...
+       * gdb.base/max-depth.exp.in: ...
+       * gdb.base/max-depth-c++.exp: ...
+       * gdb.base/max-depth-c.exp: ... these.
+       * gdb.cp/infcall-nodebug.exp: Split into ...
+       * gdb.cp/infcall-nodebug.exp.in: ...
+       * gdb.cp/infcall-nodebug-c++-d0.exp: ...
+       * gdb.cp/infcall-nodebug-c++-d1.exp: ...
+       * gdb.cp/infcall-nodebug-c-d0.exp: ...
+       * gdb.cp/infcall-nodebug-c-d1.exp: ... these.
+
 2020-05-14  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
            Pedro Alves  <palves@redhat.com>
 
diff --git a/gdb/testsuite/gdb.base/align-c++.exp b/gdb/testsuite/gdb.base/align-c++.exp
new file mode 100644 (file)
index 0000000..09632d8
--- /dev/null
@@ -0,0 +1,27 @@
+# Copyright 2018-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the gdb testsuite
+
+# This tests that C++11 alignof works in gdb, and that it agrees with the
+# compiler.
+
+# Only test C++ if we are able.
+if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+    return -1
+}
+set lang c++
+
+source $srcdir/$subdir/align.exp.in
diff --git a/gdb/testsuite/gdb.base/align-c.exp b/gdb/testsuite/gdb.base/align-c.exp
new file mode 100644 (file)
index 0000000..d7852f4
--- /dev/null
@@ -0,0 +1,23 @@
+# Copyright 2018-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the gdb testsuite
+
+# This tests that C11 _Alignof works in gdb, and that it agrees with the
+# compiler.
+
+set lang c
+
+source $srcdir/$subdir/align.exp.in
similarity index 87%
rename from gdb/testsuite/gdb.base/align.exp
rename to gdb/testsuite/gdb.base/align.exp.in
index 26827eb5a91b0940fb713f9569ddca035961a4e5..0653371c04b11e821e2fb2c09ae69a63830d69a9 100644 (file)
 
 # This file is part of the gdb testsuite
 
-# This tests that C11 _Alignof and C++11 alignof works in gdb, and
-# that it agrees with the compiler.
-
-# Only test C++ if we are able.  Always use C.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
-    set lang {c}
-} else {
-    set lang {c c++}
-}
-
 # The types we're going to test.
 
 set typelist {
@@ -60,7 +50,7 @@ proc prepare_test_source_file { lang } {
        set align_func "_Alignof"
     }
 
-    set filename [standard_output_file "$lang/align.$suffix"]
+    set filename [standard_output_file "align.$suffix"]
     set outfile [open $filename w]
 
     # Prologue.
@@ -140,7 +130,7 @@ proc run_alignment_test { lang } {
        lappend flags "additional_flags=-std=c++11"
     }
     standard_testfile $filename
-    if {[prepare_for_testing "failed to prepare" "$lang/$testfile" $srcfile $flags]} {
+    if {[prepare_for_testing "failed to prepare" "$testfile" $srcfile $flags]} {
        return -1
     }
 
@@ -186,14 +176,4 @@ proc run_alignment_test { lang } {
     }
 }
 
-# Create nested 'c' and 'c++' directories within this tests directory.
-foreach l $lang {
-    set dir "$l"
-    remote_exec host "rm -rf [standard_output_file ${dir}]"
-    remote_exec host "mkdir -p [standard_output_file ${dir}]"
-}
-
-# Now run the test for each language.
-foreach_with_prefix l $lang {
-    run_alignment_test $l
-}
+run_alignment_test $lang
diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp b/gdb/testsuite/gdb.base/infcall-nested-structs-c++.exp
new file mode 100644 (file)
index 0000000..9da0621
--- /dev/null
@@ -0,0 +1,24 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2018-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Only test C++ if we are able.
+if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+    return -1
+}
+set lang c++
+
+source $srcdir/$subdir/infcall-nested-structs.exp.in
diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs-c.exp b/gdb/testsuite/gdb.base/infcall-nested-structs-c.exp
new file mode 100644 (file)
index 0000000..a715c5b
--- /dev/null
@@ -0,0 +1,20 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2018-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set lang {c}
+
+source $srcdir/$subdir/infcall-nested-structs.exp.in
similarity index 90%
rename from gdb/testsuite/gdb.base/infcall-nested-structs.exp
rename to gdb/testsuite/gdb.base/infcall-nested-structs.exp.in
index 48c0373712e82e2ef7bdd79e53f535e6b9b0c9fa..f7409612f80ed95d8e53542e800cae90e893f12f 100644 (file)
@@ -15,7 +15,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-
 # Some targets can't call functions, so don't even bother with this
 # test.
 
@@ -24,20 +23,6 @@ if [target_info exists gdb,cannot_call_functions] {
     continue
 }
 
-# Only test C++ if we are able.  Always use C.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
-    set lang {c}
-} else {
-    set lang {c c++}
-}
-
-foreach l $lang {
-    set dir "$l"
-    remote_exec host "rm -rf [standard_output_file ${dir}]"
-    remote_exec host "mkdir -p [standard_output_file ${dir}]"
-}
-
-
 set int_types { tc ts ti tl tll }
 set float_types { tf td tld }
 set complex_types { tfc tdc tldc }
@@ -67,8 +52,7 @@ proc start_nested_structs_test { lang types } {
     global srcdir
     global compile_flags
 
-    standard_testfile .c
-    set dir "$lang"
+    standard_testfile infcall-nested-structs.c
 
     # Create the additional flags
     set flags $compile_flags
@@ -82,7 +66,6 @@ proc start_nested_structs_test { lang types } {
        append testfile "-" "$t"
     }
 
-    set binfile [standard_output_file ${dir}/${testfile}]
     if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags}"] != "" } {
        unresolved "failed to compile"
        return 0
@@ -161,11 +144,9 @@ proc start_gdb_and_run_tests { lang types } {
        append prefix "-" "${t}"
     }
 
-    foreach_with_prefix l $lang {
-       with_test_prefix $prefix {
-           if { [start_nested_structs_test $l $types] } {
-               run_tests $l $prefix
-           }
+    with_test_prefix $prefix {
+       if { [start_nested_structs_test $lang $types] } {
+           run_tests $lang $prefix
        }
     }
 }
diff --git a/gdb/testsuite/gdb.base/info-types-c++.exp b/gdb/testsuite/gdb.base/info-types-c++.exp
new file mode 100644 (file)
index 0000000..4f44369
--- /dev/null
@@ -0,0 +1,22 @@
+# Copyright 2019-2020 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Only test C++ if we are able.
+if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+    return -1
+}
+set lang c++
+
+source $srcdir/$subdir/info-types.exp.in
diff --git a/gdb/testsuite/gdb.base/info-types-c.exp b/gdb/testsuite/gdb.base/info-types-c.exp
new file mode 100644 (file)
index 0000000..800d638
--- /dev/null
@@ -0,0 +1,18 @@
+# Copyright 2019-2020 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set lang {c}
+
+source $srcdir/$subdir/info-types.exp.in
similarity index 90%
rename from gdb/testsuite/gdb.base/info-types.exp
rename to gdb/testsuite/gdb.base/info-types.exp.in
index 7cce756e92d033a3d605c10490cec18c18813d72..8c065b1c5f4e16d14dd103f72003f4305b89f561 100644 (file)
 # Check that 'info types' produces the expected output for an inferior
 # containing a number of different types.
 
-# Only test C++ if we are able.  Always use C.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
-    set lang {c}
-} else {
-    set lang {c c++}
-}
-
-foreach l $lang {
-    set dir "$l"
-    remote_exec host "rm -rf [standard_output_file ${dir}]"
-    remote_exec host "mkdir -p [standard_output_file ${dir}]"
-}
-
 # Run 'info types' test, compiling the test file for language LANG,
 # which should be either 'c' or 'c++'.
 proc run_test { lang } {
@@ -39,10 +26,10 @@ proc run_test { lang } {
     global srcdir
     global compile_flags
 
-    standard_testfile .c
+    standard_testfile info-types.c
 
     if {[prepare_for_testing "failed to prepare" \
-            "${lang}/${testfile}" $srcfile "debug $lang"]} {
+            "${testfile}" $srcfile "debug $lang"]} {
        return -1
     }
 
@@ -140,6 +127,4 @@ proc run_test { lang } {
     }
 }
 
-foreach_with_prefix l $lang {
-    run_test $l
-}
+run_test $lang
diff --git a/gdb/testsuite/gdb.base/max-depth-c++.exp b/gdb/testsuite/gdb.base/max-depth-c++.exp
new file mode 100644 (file)
index 0000000..b88b2c1
--- /dev/null
@@ -0,0 +1,22 @@
+# Copyright 2019-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Only test C++ if we are able.
+if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+    return -1
+}
+set lang c++
+
+source $srcdir/$subdir/max-depth.exp.in
diff --git a/gdb/testsuite/gdb.base/max-depth-c.exp b/gdb/testsuite/gdb.base/max-depth-c.exp
new file mode 100644 (file)
index 0000000..3bd9309
--- /dev/null
@@ -0,0 +1,18 @@
+# Copyright 2019-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set lang {c}
+
+source $srcdir/$subdir/max-depth.exp.in
similarity index 94%
rename from gdb/testsuite/gdb.base/max-depth.exp
rename to gdb/testsuite/gdb.base/max-depth.exp.in
index 7a0fe2455aef2240099a27282c50db294640b9af..8c0d7120d171a98c7b2e7437e1e963fe7958ac93 100644 (file)
 
 # Tests GDB's handling of 'set print max-depth'.
 
-# Only test C++ if we are able.  Always use C.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
-    set lang {c}
-} else {
-    set lang {c c++}
-}
-
-foreach l $lang {
-    set dir "$l"
-    remote_exec host "rm -rf [standard_output_file ${dir}]"
-    remote_exec host "mkdir -p [standard_output_file ${dir}]"
-}
-
 proc compile_and_run_tests { lang } {
     global testfile
     global srcfile
     global binfile
     global hex
 
-    standard_testfile .c
+    standard_testfile max-depth.c
 
     # Create the additional flags.
     set flags "debug"
@@ -43,8 +30,6 @@ proc compile_and_run_tests { lang } {
        lappend flags "additional_flags=-std=c++11"
     }
 
-    set dir "$lang"
-    set binfile [standard_output_file ${dir}/${testfile}]
     if { [prepare_for_testing "failed to prepare" "${binfile}" "${srcfile}" "${flags}"] } {
        return 0
     }
@@ -163,6 +148,4 @@ proc compile_and_run_tests { lang } {
     }
 }
 
-foreach_with_prefix l $lang {
-    compile_and_run_tests $l
-}
+compile_and_run_tests $lang
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp b/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d0.exp
new file mode 100644 (file)
index 0000000..f06ab08
--- /dev/null
@@ -0,0 +1,25 @@
+# This testcase is part of GDB, the GNU debugger.
+# Copyright 2018-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Only test C++ if we are able.  Always use C.
+if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+    return -1
+}
+set lang {c++}
+
+set debug nodebug
+
+source $srcdir/$subdir/infcall-nodebug.exp.in
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp b/gdb/testsuite/gdb.cp/infcall-nodebug-c++-d1.exp
new file mode 100644 (file)
index 0000000..d9dd14f
--- /dev/null
@@ -0,0 +1,25 @@
+# This testcase is part of GDB, the GNU debugger.
+# Copyright 2018-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Only test C++ if we are able.  Always use C.
+if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
+    return -1
+}
+set lang {c++}
+
+set debug debug
+
+source $srcdir/$subdir/infcall-nodebug.exp.in
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-c-d0.exp b/gdb/testsuite/gdb.cp/infcall-nodebug-c-d0.exp
new file mode 100644 (file)
index 0000000..cd65dd0
--- /dev/null
@@ -0,0 +1,21 @@
+# This testcase is part of GDB, the GNU debugger.
+# Copyright 2018-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set lang {c}
+
+set debug nodebug
+
+source $srcdir/$subdir/infcall-nodebug.exp.in
diff --git a/gdb/testsuite/gdb.cp/infcall-nodebug-c-d1.exp b/gdb/testsuite/gdb.cp/infcall-nodebug-c-d1.exp
new file mode 100644 (file)
index 0000000..4cb26ad
--- /dev/null
@@ -0,0 +1,21 @@
+# This testcase is part of GDB, the GNU debugger.
+# Copyright 2018-2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set lang {c}
+
+set debug debug
+
+source $srcdir/$subdir/infcall-nodebug.exp.in
similarity index 82%
rename from gdb/testsuite/gdb.cp/infcall-nodebug.exp
rename to gdb/testsuite/gdb.cp/infcall-nodebug.exp.in
index 53d080dfcd5362370cf0cca10f257286504c0121..23466196270376691cbb20bd55604e5a95425e8d 100644 (file)
@@ -24,13 +24,6 @@ if [target_info exists gdb,cannot_call_functions] {
     continue
 }
 
-# Only test C++ if we are able.  Always use C.
-if { [skip_cplus_tests] || [get_compiler_info "c++"] } {
-    set lang {c}
-} else {
-    set lang {c c++}
-}
-
 set main_basename infcall-nodebug-main
 set lib_basename infcall-nodebug-lib
 standard_testfile ${main_basename}.c ${lib_basename}.c
@@ -53,19 +46,13 @@ proc build_and_run_test { lang symbols } {
        set debug_flags ""
     }
 
-    # Setup directory.
-
-    set dir "$lang-$symbols"
-    remote_exec build "rm -rf [standard_output_file ${dir}]"
-    remote_exec build "mkdir -p [standard_output_file ${dir}]"
-
     # Compile both files to objects, then link together.
 
     set main_flags "$lang debug"
     set lib_flags "$lang $debug_flags"
-    set main_o [standard_output_file ${dir}/${main_basename}.o]
-    set lib_o [standard_output_file ${dir}/${lib_basename}.o]
-    set binfile [standard_output_file ${dir}/${testfile}]
+    set main_o [standard_output_file ${main_basename}.o]
+    set lib_o [standard_output_file ${lib_basename}.o]
+    set binfile [standard_output_file ${testfile}]
 
     if { [gdb_compile $mainsrc $main_o object ${main_flags}] != "" } {
        untested "failed to compile main file to object"
@@ -111,9 +98,4 @@ proc build_and_run_test { lang symbols } {
 
 }
 
-foreach_with_prefix l $lang {
-    foreach_with_prefix s {debug nodebug} {
-       build_and_run_test $l $s
-    }
-}
-
+build_and_run_test $lang $debug