Once more into the breach...

These changes work on x86_64-linux

Okay for trunk?

cobol: add cobol.dg/group1/escape.cob test; modify cobol.dg/gd.exp to
handle it

gcc/testsuite

        * cobol.dg/dg.exp: modified to recurse into directories without
        .exp files and find *.cob files therein
        * cobol.dg/group1/escape.cob: New testcase
---
 gcc/testsuite/cobol.dg/dg.exp            | 17 +++++++++++++++--
 gcc/testsuite/cobol.dg/group1/escape.cob | 11 +++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/cobol.dg/group1/escape.cob

diff --git a/gcc/testsuite/cobol.dg/dg.exp b/gcc/testsuite/cobol.dg/dg.exp
index e75e3ab1895..d40cbd54e99 100644
--- a/gcc/testsuite/cobol.dg/dg.exp
+++ b/gcc/testsuite/cobol.dg/dg.exp
@@ -33,10 +33,23 @@ set cobol_test_path $srcdir/$subdir

 set all_flags $DEFAULT_COBFLAGS

+# Recursively find files in $dir and subdirs, do not walk into subdirs
+# that contain their own .exp file.
+proc find-cob-tests { dir suffix } {
+    set tests [lsort [glob -nocomplain -directory $dir "*.$suffix" ]]
+    foreach subdir [lsort [glob -nocomplain -type d -directory $dir *]] {
+        if { [glob -nocomplain -directory $subdir *.exp] eq "" } {
+            eval lappend tests [find-cob-tests $subdir $suffix]
+        }
+    }
+    return $tests
+}
+
+set tests [find-cob-tests $srcdir/$subdir {cob}]
+
 # Main loop.
 if [check_effective_target_cobol] {
-    cobol-dg-runtest [lsort \
-       [glob -nocomplain $srcdir/$subdir/*.cob ] ] "" $all_flags
+    cobol-dg-runtest $tests "" $all_flags
 }

 # All done.
diff --git a/gcc/testsuite/cobol.dg/group1/escape.cob
b/gcc/testsuite/cobol.dg/group1/escape.cob
new file mode 100644
index 00000000000..45ae483a17f
--- /dev/null
+++ b/gcc/testsuite/cobol.dg/group1/escape.cob
@@ -0,0 +1,11 @@
+*> { dg-do run }
+*> { dg-output {Testing the testing(\n|\r\n|\r)} }
+*> { dg-output {\.\^\$\*\+\-\?\(\)\[\]\{\}\\\|(\n|\r\n|\r)} }
+*> { dg-output {"\.\^\$\*\+\-\?\(\)\[\]\{\}\\\|"(\n|\r\n|\r)} }
+        identification division.
+        program-id. escape.
+        procedure division.
+        display "Testing the testing"
+        display ".^$*+-?()[]{}\|"
+        display '".^$*+-?()[]{}\|"'  .
+        end program escape.
--
2.34.1

Reply via email to