https://gcc.gnu.org/g:a39aee6c5dcd0ae84e4b610e0a707d49f25eb005

commit r17-4759-ga39aee6c5dcd0ae84e4b610e0a707d49f25eb005
Author: Xavier Del Campo Romero <[email protected]>
Date:   Tue Sep 29 16:34:03 2026 +0200

    cobol: Add POSIX tests
    
    gcc/testsuite/ChangeLog:
    
            * cobol.dg/group2/Hello.cob: New test.
            * cobol.dg/group2/Hello.out: New test.
            * cobol.dg/group2/Read_and_write_errno.cob: New test.
            * cobol.dg/group2/Read_and_write_errno.out: New test.

Diff:
---
 gcc/testsuite/cobol.dg/group2/Hello.cob              | 17 +++++++++++++++++
 gcc/testsuite/cobol.dg/group2/Hello.out              |  6 ++++++
 .../cobol.dg/group2/Read_and_write_errno.cob         | 20 ++++++++++++++++++++
 .../cobol.dg/group2/Read_and_write_errno.out         |  2 ++
 4 files changed, 45 insertions(+)

diff --git a/gcc/testsuite/cobol.dg/group2/Hello.cob 
b/gcc/testsuite/cobol.dg/group2/Hello.cob
new file mode 100644
index 000000000000..bdf4f7db3c23
--- /dev/null
+++ b/gcc/testsuite/cobol.dg/group2/Hello.cob
@@ -0,0 +1,17 @@
+      *> Do not edit this generated file.  See README.txt
+      *> { dg-do run }
+       *> { dg-output-file "group2/Hello.out" }
+        identification   division.
+        program-id.      prog.
+        data             division.
+        working-storage  section.
+        01 msg pic x(10) value "Hello".
+        procedure        division.
+            display """" msg """"
+            display "Note the quotes. autoconf is allergic to trailing spaces."
+            display "The alternative is to use FUNCTION TRIM, or autoconf 
quadrigraphs."
+            display FUNCTION TRIM(msg)
+            display msg
+            goback.
+        end program     prog.
+
diff --git a/gcc/testsuite/cobol.dg/group2/Hello.out 
b/gcc/testsuite/cobol.dg/group2/Hello.out
new file mode 100644
index 000000000000..41b2d8750577
--- /dev/null
+++ b/gcc/testsuite/cobol.dg/group2/Hello.out
@@ -0,0 +1,6 @@
+"Hello     "
+Note the quotes. autoconf is allergic to trailing spaces.
+The alternative is to use FUNCTION TRIM, or autoconf quadrigraphs.
+Hello
+Hello     
+
diff --git a/gcc/testsuite/cobol.dg/group2/Read_and_write_errno.cob 
b/gcc/testsuite/cobol.dg/group2/Read_and_write_errno.cob
new file mode 100644
index 000000000000..517f36574e96
--- /dev/null
+++ b/gcc/testsuite/cobol.dg/group2/Read_and_write_errno.cob
@@ -0,0 +1,20 @@
+      *> Do not edit this generated file.  See README.txt
+      *> { dg-do run }
+       *> { dg-output-file "group2/Read_and_write_errno.out" }
+[
+        copy "posix-errno.cpy".
+        id division.
+        program-id. prog.
+        data division.
+        working-storage section.
+        01 msg pic x(64).
+        77 my-errno binary-long.
+        procedure division.
+          move 2 to my-errno.
+          move function posix-errno(msg, my-errno) to my-errno.
+          move 0 to my-errno.
+          move function posix-errno(msg) to my-errno.
+          display "errno=" my-errno.
+
+        end program prog.
+]
diff --git a/gcc/testsuite/cobol.dg/group2/Read_and_write_errno.out 
b/gcc/testsuite/cobol.dg/group2/Read_and_write_errno.out
new file mode 100644
index 000000000000..6a8ccb36460c
--- /dev/null
+++ b/gcc/testsuite/cobol.dg/group2/Read_and_write_errno.out
@@ -0,0 +1,2 @@
+errno=+0000000002
+

Reply via email to