public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/modula-2] PR-101391 gm2 testsuite now contains basic link to C symbol tests.
@ 2022-01-28 16:04 Gaius Mulley
0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2022-01-28 16:04 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:5f6e0d8f3a0f65c84baa5d64a1ab6176227f347e
commit 5f6e0d8f3a0f65c84baa5d64a1ab6176227f347e
Author: Gaius Mulley <gaius.mulley@southwales.ac.uk>
Date: Fri Jan 28 16:02:07 2022 +0000
PR-101391 gm2 testsuite now contains basic link to C symbol tests.
This patch provides basic link tests to the C modules used by the pim
library which must exist in the Modula-2 symbol universe if pimlib is used.
libgm2/ChangeLog:
* libgm2/libm2pim/Selective.c (_M2_Selective_finish): Added
newline prior to function start.
gcc/testsuite/gm2/ChangeLog:
* pimc/pass/README: (New file).
* pimc/pass/link-pimc-pass.exp: (New file).
* pimc/pass/testdtoa.mod: (New file).
* pimc/pass/testerrno.mod: (New file).
* pimc/pass/testgetopt.mod: (New file).
* pimc/pass/testldtoa.mod: (New file).
* pimc/pass/testlibc.mod: (New file).
* pimc/pass/testlibc2.mod: (New file).
* pimc/pass/testsckt.mod: (New file).
* pimc/pass/testselective.mod: (New file).
* pimc/pass/testsysexceptions.mod: (New file).
* pimc/pass/testtermios.mod: (New file).
* pimc/pass/testunixargs.mod: (New file).
* pimc/pass/testwrapc.mod: (New file).
Signed-off-by: Gaius Mulley <gaius.mulley@southwales.ac.uk>
Diff:
---
gcc/testsuite/gm2/link/pimc/pass/README | 3 +
.../gm2/link/pimc/pass/link-pimc-pass.exp | 37 ++++++++
gcc/testsuite/gm2/link/pimc/pass/testdtoa.mod | 9 ++
gcc/testsuite/gm2/link/pimc/pass/testerrno.mod | 11 +++
gcc/testsuite/gm2/link/pimc/pass/testgetopt.mod | 102 +++++++++++++++++++++
gcc/testsuite/gm2/link/pimc/pass/testldtoa.mod | 9 ++
gcc/testsuite/gm2/link/pimc/pass/testlibc.mod | 10 ++
gcc/testsuite/gm2/link/pimc/pass/testlibc2.mod | 16 ++++
gcc/testsuite/gm2/link/pimc/pass/testsckt.mod | 9 ++
gcc/testsuite/gm2/link/pimc/pass/testselective.mod | 9 ++
.../gm2/link/pimc/pass/testsysexceptions.mod | 8 ++
gcc/testsuite/gm2/link/pimc/pass/testtermios.mod | 7 ++
gcc/testsuite/gm2/link/pimc/pass/testunixargs.mod | 14 +++
gcc/testsuite/gm2/link/pimc/pass/testwrapc.mod | 9 ++
libgm2/libm2pim/Selective.c | 1 +
15 files changed, 254 insertions(+)
diff --git a/gcc/testsuite/gm2/link/pimc/pass/README b/gcc/testsuite/gm2/link/pimc/pass/README
new file mode 100644
index 00000000000..04389b13384
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/README
@@ -0,0 +1,3 @@
+The tests in this directory serve to test whether the C object files
+in the pimlib have been built, are visible to the linker and
+accessible to the user via gm2.
diff --git a/gcc/testsuite/gm2/link/pimc/pass/link-pimc-pass.exp b/gcc/testsuite/gm2/link/pimc/pass/link-pimc-pass.exp
new file mode 100644
index 00000000000..9c9a011f2c8
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/link-pimc-pass.exp
@@ -0,0 +1,37 @@
+# Expect driver script for GCC Regression Tests
+# Copyright (C) 2022 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 GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# This file was written by Gaius Mulley (gaius.mulley@southwales.ac.uk)
+# for GNU Modula-2.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# load support procs
+load_lib gm2-torture.exp
+
+gm2_init_pim "${srcdir}/gm2/link/pimc/pass"
+
+foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $testcase] then {
+ continue
+ }
+
+ gm2-torture $testcase
+}
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testdtoa.mod b/gcc/testsuite/gm2/link/pimc/pass/testdtoa.mod
new file mode 100644
index 00000000000..6e8eb789193
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testdtoa.mod
@@ -0,0 +1,9 @@
+MODULE testdtoa ;
+
+(* A trivial test to test for the presence of dtoa. *)
+
+IMPORT dtoa ;
+
+
+BEGIN
+END testdtoa.
\ No newline at end of file
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testerrno.mod b/gcc/testsuite/gm2/link/pimc/pass/testerrno.mod
new file mode 100644
index 00000000000..16b40dd49a6
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testerrno.mod
@@ -0,0 +1,11 @@
+(* testerrno test for the presence of errno. *)
+MODULE testerrno ;
+
+
+FROM errno IMPORT geterrno ;
+
+VAR
+ i: INTEGER ;
+BEGIN
+ i := geterrno ()
+END testerrno.
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testgetopt.mod b/gcc/testsuite/gm2/link/pimc/pass/testgetopt.mod
new file mode 100644
index 00000000000..f84f7666516
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testgetopt.mod
@@ -0,0 +1,102 @@
+MODULE testgetopt ;
+
+FROM DynamicStrings IMPORT String, InitString, KillString ;
+FROM StringConvert IMPORT stoc ;
+FROM StrIO IMPORT WriteString, WriteLn ;
+FROM StdIO IMPORT Write ;
+FROM ASCII IMPORT nul ;
+FROM GetOpt IMPORT GetOpt ;
+FROM libc IMPORT printf, exit ;
+
+IMPORT UnixArgs ;
+
+
+VAR
+ MinRoomLength,
+ MaxRoomLength,
+ MinCorridorLength,
+ MaxCorridorLength,
+ TotalCorridorLength,
+ Seed,
+ MaxX,
+ MaxY : INTEGER ;
+
+CONST
+ programName = "testgetopt" ;
+
+
+(*
+ help -
+*)
+
+PROCEDURE help (code: INTEGER) ;
+BEGIN
+ printf ("Usage %s [-a minroomsize] [-b maxroomsize] [-c mincorridorlength] [-d maxcorridorlength] [-e totalcorridorlength] [-h] [-o outputfile] [-s seed] [-x maxx] [-y maxy]\n", programName) ;
+ printf (" -a minroomsize (default is %d)\n", MinRoomLength) ;
+ printf (" -b maxroomsize (default is %d)\n", MaxRoomLength) ;
+ printf (" -c mincorridorsize (default is %d)\n", MinCorridorLength) ;
+ printf (" -d maxcorridorsize (default is %d)\n", MaxCorridorLength) ;
+ printf (" -e totalcorridorlength (default is %d)\n", TotalCorridorLength) ;
+ printf (" -o outputfile (default is stdout)\n") ;
+ printf (" -s seed (default is %d)\n", Seed) ;
+ printf (" -x minx for whole map (default is %d)\n", MaxX) ;
+ printf (" -y maxy for whole map (default is %d)\n", MaxY) ;
+ exit (code)
+END help ;
+
+
+(*
+ HandleOptions -
+*)
+
+PROCEDURE HandleOptions ;
+VAR
+ optind,
+ opterr,
+ optopt: INTEGER ;
+ arg,
+ s, l : String ;
+ ch : CHAR ;
+BEGIN
+ l := InitString (':a:b:c:d:e:o:s:hx:y:') ;
+ s := NIL ;
+ arg := NIL ;
+ ch := GetOpt (UnixArgs.ArgC, UnixArgs.ArgV, l,
+ arg, optind, opterr, optopt) ;
+ WHILE ch # nul DO
+ CASE ch OF
+
+ 'a': MinRoomLength := stoc (arg) |
+ 'b': MaxRoomLength := stoc (arg) |
+ 'c': MinCorridorLength := stoc (arg) |
+ 'd': MaxCorridorLength := stoc (arg) |
+ 'e': TotalCorridorLength := stoc (arg) |
+ 'h': help (0) |
+ 'o': |
+ 's': Seed := stoc (arg) |
+ 'x': MaxX := stoc (arg) |
+ 'y': MaxY := stoc (arg) |
+ '?': printf ("illegal option\n") ; help (1)
+
+ ELSE
+ WriteString ("unrecognised option '-") ; Write (ch) ; WriteString ('"') ; WriteLn ;
+ exit (1)
+ END ;
+ arg := KillString (arg) ;
+ ch := GetOpt (UnixArgs.ArgC, UnixArgs.ArgV, l,
+ arg, optind, opterr, optopt)
+ END
+END HandleOptions ;
+
+
+BEGIN
+ MinRoomLength := 5 ;
+ MaxRoomLength := 10 ;
+ MinCorridorLength := 10 ;
+ MaxCorridorLength := 15 ;
+ TotalCorridorLength := 30 ;
+ Seed := 1 ;
+ MaxX := 30 ;
+ MaxY := 30 ;
+ HandleOptions
+END testgetopt.
\ No newline at end of file
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testldtoa.mod b/gcc/testsuite/gm2/link/pimc/pass/testldtoa.mod
new file mode 100644
index 00000000000..01bae86b39f
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testldtoa.mod
@@ -0,0 +1,9 @@
+MODULE testldtoa ;
+
+(* A trivial test to test for the presence of ldtoa. *)
+
+IMPORT ldtoa ;
+
+
+BEGIN
+END testldtoa.
\ No newline at end of file
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testlibc.mod b/gcc/testsuite/gm2/link/pimc/pass/testlibc.mod
new file mode 100644
index 00000000000..ec82986fcbb
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testlibc.mod
@@ -0,0 +1,10 @@
+(* testlibc a trivial test for the existence of libc. *)
+
+MODULE testlibc ;
+
+
+FROM libc IMPORT exit ;
+
+BEGIN
+ exit (0)
+END testlibc.
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testlibc2.mod b/gcc/testsuite/gm2/link/pimc/pass/testlibc2.mod
new file mode 100644
index 00000000000..56c24d3dadf
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testlibc2.mod
@@ -0,0 +1,16 @@
+(* testlibc2 test for the presence of printf and the ability to pass varargs. *)
+
+MODULE testlibc2 ;
+
+FROM libc IMPORT printf ;
+
+VAR
+ i: INTEGER ;
+ r: REAL ;
+BEGIN
+ printf ("hello world\n");
+ i := 12 ;
+ printf ("int value of 12 = %d\n", i);
+ r := 3.14159 ; (* REAL is a double. *)
+ printf ("REAL approx of pi = %g\n", r);
+END testlibc2.
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testsckt.mod b/gcc/testsuite/gm2/link/pimc/pass/testsckt.mod
new file mode 100644
index 00000000000..1718dacf56e
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testsckt.mod
@@ -0,0 +1,9 @@
+MODULE testsckt ;
+
+(* A trivial test to test for the presence of sckt. *)
+
+IMPORT sckt ;
+
+
+BEGIN
+END testsckt.
\ No newline at end of file
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testselective.mod b/gcc/testsuite/gm2/link/pimc/pass/testselective.mod
new file mode 100644
index 00000000000..29e2c8247a8
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testselective.mod
@@ -0,0 +1,9 @@
+MODULE testselective ;
+
+(* A trivial test to test for the presence of dtoa. *)
+
+IMPORT Selective ;
+
+
+BEGIN
+END testselective.
\ No newline at end of file
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testsysexceptions.mod b/gcc/testsuite/gm2/link/pimc/pass/testsysexceptions.mod
new file mode 100644
index 00000000000..41c02626181
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testsysexceptions.mod
@@ -0,0 +1,8 @@
+(* testsysexceptions trivial test importing SysExceptions. *)
+
+MODULE testsysexceptions ;
+
+IMPORT SysExceptions ;
+
+BEGIN
+END testsysexceptions.
\ No newline at end of file
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testtermios.mod b/gcc/testsuite/gm2/link/pimc/pass/testtermios.mod
new file mode 100644
index 00000000000..d01e85332d2
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testtermios.mod
@@ -0,0 +1,7 @@
+(* testtermios tiny test to check termios is visible. *)
+MODULE testtermios ;
+
+IMPORT termios ;
+
+BEGIN
+END testtermios.
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testunixargs.mod b/gcc/testsuite/gm2/link/pimc/pass/testunixargs.mod
new file mode 100644
index 00000000000..8b524f51306
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testunixargs.mod
@@ -0,0 +1,14 @@
+MODULE testunixargs ;
+
+(* A trivial test to test for the existence of UnixArgs and SYSTEM. *)
+
+FROM UnixArgs IMPORT ArgV, ArgC ;
+FROM SYSTEM IMPORT ADDRESS ;
+
+VAR
+ ptr: ADDRESS ;
+ num: CARDINAL ;
+BEGIN
+ ptr := ArgV ;
+ num := ArgC
+END testunixargs.
\ No newline at end of file
diff --git a/gcc/testsuite/gm2/link/pimc/pass/testwrapc.mod b/gcc/testsuite/gm2/link/pimc/pass/testwrapc.mod
new file mode 100644
index 00000000000..ae9ab7e8509
--- /dev/null
+++ b/gcc/testsuite/gm2/link/pimc/pass/testwrapc.mod
@@ -0,0 +1,9 @@
+MODULE testwrapc ;
+
+(* A trivial test to test for the presence of wrapc. *)
+
+IMPORT wrapc ;
+
+
+BEGIN
+END testwrapc.
\ No newline at end of file
diff --git a/libgm2/libm2pim/Selective.c b/libgm2/libm2pim/Selective.c
index 20681000226..0f7703bebf9 100644
--- a/libgm2/libm2pim/Selective.c
+++ b/libgm2/libm2pim/Selective.c
@@ -298,6 +298,7 @@ void
_M2_Selective_init ()
{
}
+
void
_M2_Selective_finish ()
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-28 16:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28 16:04 [gcc/devel/modula-2] PR-101391 gm2 testsuite now contains basic link to C symbol tests Gaius Mulley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).