aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2025-03-14 20:32:43 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2025-03-14 20:32:43 +0100
commitb2de4b0926bddbb97b991dd95592c714ee519e1e (patch)
treeada9ecb42e72d96ac96ad35da13b6e0b827e4cf5 /gcc
parent075ec330307c5b1fe5ed166a633c718c06b01437 (diff)
downloadgcc-b2de4b0926bddbb97b991dd95592c714ee519e1e.zip
gcc-b2de4b0926bddbb97b991dd95592c714ee519e1e.tar.gz
gcc-b2de4b0926bddbb97b991dd95592c714ee519e1e.tar.bz2
cobol: Don't run cobol tests with -m32 or -mx32 [PR119290]
The following patch adds cobol effective target and uses it to guard main loop in cobol.dg/dg.exp, so that we don't run the tests on unsupported multilibs. Tested on x86_64-linux with make check-cobol RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} dg.exp' which previously had all FAILs in the -m32 case and now doesn't report any PASSes/FAILs/XFAILs/XPASSes etc, while for -m64 the testsuite is run normally. 2025-03-14 Jakub Jelinek <jakub@redhat.com> PR cobol/119290 * lib/target-supports.exp (check_compile): Use *.cob extension for "*> COBOL" comment. * lib/cobol-dg.exp (check_effective_target_cobol): New procedure. * cobol.dg/dg.exp: Guard main loop with [check_effective_target_cobol] test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/cobol.dg/dg.exp4
-rw-r--r--gcc/testsuite/lib/cobol-dg.exp11
-rw-r--r--gcc/testsuite/lib/target-supports.exp2
3 files changed, 16 insertions, 1 deletions
diff --git a/gcc/testsuite/cobol.dg/dg.exp b/gcc/testsuite/cobol.dg/dg.exp
index c81634a..e75e3ab 100644
--- a/gcc/testsuite/cobol.dg/dg.exp
+++ b/gcc/testsuite/cobol.dg/dg.exp
@@ -34,8 +34,10 @@ set cobol_test_path $srcdir/$subdir
set all_flags $DEFAULT_COBFLAGS
# Main loop.
-cobol-dg-runtest [lsort \
+if [check_effective_target_cobol] {
+ cobol-dg-runtest [lsort \
[glob -nocomplain $srcdir/$subdir/*.cob ] ] "" $all_flags
+}
# All done.
dg-finish
diff --git a/gcc/testsuite/lib/cobol-dg.exp b/gcc/testsuite/lib/cobol-dg.exp
index 51df13d..1c512d5 100644
--- a/gcc/testsuite/lib/cobol-dg.exp
+++ b/gcc/testsuite/lib/cobol-dg.exp
@@ -83,3 +83,14 @@ proc cobol-dg-runtest { testcases flags default-extra-flags } {
torture-finish
}
}
+
+proc check_effective_target_cobol {} {
+ # Check if the COBOL FE can compile trivial programs.
+ return [check_no_compiler_messages cobol assembly {
+*> COBOL
+IDENTIFICATION DIVISION.
+PROGRAM-ID. pass.
+PROCEDURE DIVISION.
+ STOP RUN.
+ }]
+}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index c456f7d..2a3bdd2 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -38,6 +38,7 @@
# "// ObjC++" for ObjC++
# "// Go" for Go
# "// Rust" for Rust
+# "*> COBOL" for COBOL
# and "(* Modula-2" for Modula-2
# If the tool is ObjC/ObjC++ then we overide the extension to .m/.mm to
# allow for ObjC/ObjC++ specific flags.
@@ -72,6 +73,7 @@ proc check_compile {basename type contents args} {
"*/\\* ObjC*" { set src ${basename}[pid].m }
"*// Go*" { set src ${basename}[pid].go }
"*// Rust*" { set src ${basename}[pid].rs }
+ "*\\*> COBOL*" { set src ${basename}[pid].cob }
"*(\\* Modula-2*" { set src ${basename}[pid].mod }
default {
switch -- $tool {