public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] modula-2, testsuite: Make libs and interfaces consistent.
@ 2023-01-17 17:06 Iain Sandoe
  2023-01-19 15:20 ` Gaius Mulley
  0 siblings, 1 reply; 2+ messages in thread
From: Iain Sandoe @ 2023-01-17 17:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: gaiusmod2

Tested on x86_64-linux-gnu (with a 32b multilib), powerpc, i686 and
x86_64-darwin.  OK for trunk?
thanks,
Iain

--- 8< ---

In some case the libraries list was being set before gm2_init_xxx was
called.  In some cases it was omitted - this could lead to a difference
between the link libs and the interfaces (the effect of this would be
dependent on the order in which the .exps were run, which makes it also
depend on the -j and the system).

To avoid a mismatch between the module include paths and the added libs
we now make sure that they are both added in the gm_init_xxxx functions
(if finer control over granularity is needed, then we should as a TODO
add a generic gm_init_xxx that takes a library list and ensures that the
imports and libs are matched in the same order).

Also we cannot use a default variable in tcl if the source for that
variable could be absent, but something else follows, there is no way
to put an empty placeholder in.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/testsuite/ChangeLog:

	* gm2/complex/run/pass/complex-run-pass.exp: Remove gm2_link_lib.
	* gm2/iso/run/pass/iso-run-pass.exp: Likewise.
	* gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp:
	* gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp: Likewise.
	* gm2/pimlib/run/pass/pimlib-run-pass.exp: Likewise.
	* gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp:
	Likewise.
	* gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp:
	Likewise.
	* gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp:
	Likewise.
	* gm2/sets/run/pass/sets-run-pass.exp: Likewise.
	* gm2/switches/none/run/pass/gm2-none.exp: Likewise.
	* gm2/switches/pic/run/pass/switches-pic-run-pass.exp: Likewise.
	* gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp:
	Likewise, and also ensure that the -g option is appended to avoid it
	being taken as a path.
	* lib/gm2.exp: Ensure for each gm2_init_xxxx function that the set of
	libraries added matches the set of -I and -L options.
---
 .../gm2/complex/run/pass/complex-run-pass.exp |  1 -
 .../gm2/iso/run/pass/iso-run-pass.exp         |  1 -
 .../pass/link-externalscaffold-pass.exp       |  1 -
 .../run/pass/pimlib-logitech-run-pass.exp     |  2 --
 .../gm2/pimlib/run/pass/pimlib-run-pass.exp   |  2 --
 .../halma/projects-iso-run-pass-halma.exp     |  1 -
 .../hello/projects-iso-run-pass-hello.exp     |  1 -
 .../hello/projects-pim-run-pass-hello.exp     |  1 -
 .../random/projects-pim-run-pass-random.exp   | 29 +++++++++----------
 .../gm2/sets/run/pass/sets-run-pass.exp       |  1 -
 .../gm2/switches/none/run/pass/gm2-none.exp   |  1 -
 .../pic/run/pass/switches-pic-run-pass.exp    |  2 --
 gcc/testsuite/lib/gm2.exp                     | 20 ++++++++-----
 13 files changed, 26 insertions(+), 37 deletions(-)

diff --git a/gcc/testsuite/gm2/complex/run/pass/complex-run-pass.exp b/gcc/testsuite/gm2/complex/run/pass/complex-run-pass.exp
index a715ec27d82..399f30b89ef 100644
--- a/gcc/testsuite/gm2/complex/run/pass/complex-run-pass.exp
+++ b/gcc/testsuite/gm2/complex/run/pass/complex-run-pass.exp
@@ -27,7 +27,6 @@ load_lib gm2-torture.exp
 
 set gm2src ${srcdir}/../gm2
 
-gm2_link_lib "m2iso m2pim"
 gm2_init_iso "${srcdir}/gm2/complex/run/pass"
 
 
diff --git a/gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp b/gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp
index 95b13038cd0..09d04ee910d 100644
--- a/gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp
+++ b/gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp
@@ -24,7 +24,6 @@ if $tracelevel then {
 # load support procs
 load_lib gm2-torture.exp
 
-gm2_link_lib "m2iso m2pim"
 gm2_init_iso "${srcdir}/gm2/iso/run/pass" -fsoft-check-all
 gm2_link_obj fileio.o
 
diff --git a/gcc/testsuite/gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp b/gcc/testsuite/gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp
index 26c91553dfc..32d4315aebd 100644
--- a/gcc/testsuite/gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp
+++ b/gcc/testsuite/gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp
@@ -25,7 +25,6 @@ if $tracelevel then {
 # load support procs
 load_lib gm2-torture.exp
 
-gm2_link_lib "m2pim"
 gm2_init_pim "${srcdir}/gm2/pim/pass" -fscaffold-main -fno-scaffold-dynamic
 gm2_link_obj scaffold.o
 set output [target_compile $srcdir/$subdir/scaffold.c scaffold.o object "-g"]
diff --git a/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp b/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp
index 912c4570520..cfe9ff84a08 100644
--- a/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp
+++ b/gcc/testsuite/gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp
@@ -27,10 +27,8 @@ load_lib gm2-torture.exp
 
 set gm2src ${srcdir}/../m2
 
-gm2_link_lib "m2log m2pim m2iso"
 gm2_init_log
 
-
 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 {
diff --git a/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp b/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp
index 99fdb7128b8..cfe9ff84a08 100644
--- a/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp
+++ b/gcc/testsuite/gm2/pimlib/run/pass/pimlib-run-pass.exp
@@ -27,10 +27,8 @@ load_lib gm2-torture.exp
 
 set gm2src ${srcdir}/../m2
 
-gm2_link_lib "m2pim m2log m2iso"
 gm2_init_log
 
-
 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 {
diff --git a/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp b/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp
index 8cb19a16155..b943798e709 100644
--- a/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp
+++ b/gcc/testsuite/gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp
@@ -27,7 +27,6 @@ load_lib gm2-torture.exp
 
 set gm2src ${srcdir}/../m2
 
-gm2_link_lib "m2iso m2pim"
 gm2_init_iso
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
diff --git a/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp b/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp
index 8cb19a16155..b943798e709 100644
--- a/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp
+++ b/gcc/testsuite/gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp
@@ -27,7 +27,6 @@ load_lib gm2-torture.exp
 
 set gm2src ${srcdir}/../m2
 
-gm2_link_lib "m2iso m2pim"
 gm2_init_iso
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
diff --git a/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp b/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp
index 1c46f81efaa..0737b908a25 100644
--- a/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp
+++ b/gcc/testsuite/gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp
@@ -27,7 +27,6 @@ load_lib gm2-torture.exp
 
 set gm2src ${srcdir}/../m2
 
-gm2_link_lib "m2pim m2log m2iso"
 gm2_init_pim
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
diff --git a/gcc/testsuite/gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp b/gcc/testsuite/gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp
index 5ae14eca5a5..012caa61c96 100644
--- a/gcc/testsuite/gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp
+++ b/gcc/testsuite/gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp
@@ -25,27 +25,26 @@ if $tracelevel then {
 # load support procs
 load_lib gm2-torture.exp
 
-set gm2src ${srcdir}/../m2
-
-gm2_link_lib "m2pim m2log m2iso"
-gm2_init_pim "-g -I$srcdir/$subdir"
+gm2_init_pim "$srcdir/$subdir" -g
 gm2_link_obj "WriteMap.o AdvMap.o BoxMap.o Chance.o Geometry.o MakeBoxes.o MapOptions.o Options.o RoomMap.o StoreCoords.o"
 
+# If we want these to be re-built for each torture option we need some different 
+# logic.
+gm2_target_compile $srcdir/$subdir/AdvMap.mod AdvMap.o object "-g -I$srcdir/$subdir/"
+gm2_target_compile $srcdir/$subdir/BoxMap.mod BoxMap.o object "-g -I$srcdir/$subdir/"
+gm2_target_compile $srcdir/$subdir/Chance.mod Chance.o object "-g -I$srcdir/$subdir/"
+gm2_target_compile $srcdir/$subdir/Geometry.mod Geometry.o object "-g -I$srcdir/$subdir/"
+gm2_target_compile $srcdir/$subdir/MakeBoxes.mod MakeBoxes.o object "-g -I$srcdir/$subdir/"
+gm2_target_compile $srcdir/$subdir/MapOptions.mod MapOptions.o object "-g -I$srcdir/$subdir/"
+gm2_target_compile $srcdir/$subdir/Options.mod Options.o object "-g -I$srcdir/$subdir/"
+gm2_target_compile $srcdir/$subdir/RoomMap.mod RoomMap.o object "-g -I$srcdir/$subdir/"
+gm2_target_compile $srcdir/$subdir/StoreCoords.mod StoreCoords.o object "-g -I$srcdir/$subdir/"
+gm2_target_compile $srcdir/$subdir/WriteMap.mod WriteMap.o object "-g -I$srcdir/$subdir/"
+
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/Map.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_target_compile $srcdir/$subdir/AdvMap.mod AdvMap.o object "-g -I$srcdir/$subdir/"
-    gm2_target_compile $srcdir/$subdir/BoxMap.mod BoxMap.o object "-g -I$srcdir/$subdir/"
-    gm2_target_compile $srcdir/$subdir/Chance.mod Chance.o object "-g -I$srcdir/$subdir/"
-    gm2_target_compile $srcdir/$subdir/Geometry.mod Geometry.o object "-g -I$srcdir/$subdir/"
-    gm2_target_compile $srcdir/$subdir/MakeBoxes.mod MakeBoxes.o object "-g -I$srcdir/$subdir/"
-    gm2_target_compile $srcdir/$subdir/MapOptions.mod MapOptions.o object "-g -I$srcdir/$subdir/"
-    gm2_target_compile $srcdir/$subdir/Options.mod Options.o object "-g -I$srcdir/$subdir/"
-    gm2_target_compile $srcdir/$subdir/RoomMap.mod RoomMap.o object "-g -I$srcdir/$subdir/"
-    gm2_target_compile $srcdir/$subdir/StoreCoords.mod StoreCoords.o object "-g -I$srcdir/$subdir/"
-    gm2_target_compile $srcdir/$subdir/WriteMap.mod WriteMap.o object "-g -I$srcdir/$subdir/"
     gm2-torture-execute $testcase "" "pass"
 }
diff --git a/gcc/testsuite/gm2/sets/run/pass/sets-run-pass.exp b/gcc/testsuite/gm2/sets/run/pass/sets-run-pass.exp
index d0cb7b056eb..a439526f428 100644
--- a/gcc/testsuite/gm2/sets/run/pass/sets-run-pass.exp
+++ b/gcc/testsuite/gm2/sets/run/pass/sets-run-pass.exp
@@ -27,7 +27,6 @@ load_lib gm2-torture.exp
 
 set gm2src ${srcdir}/../m2
 
-gm2_link_lib "m2iso m2pim"
 gm2_init_iso "${srcdir}/gm2/sets/run/pass/"
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
diff --git a/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp b/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp
index 747c474b6d5..cf77d5a7840 100644
--- a/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp
+++ b/gcc/testsuite/gm2/switches/none/run/pass/gm2-none.exp
@@ -26,7 +26,6 @@ load_lib gm2-simple.exp
 
 set gm2src ${srcdir}/../m2
 
-gm2_link_lib "m2pim m2iso"
 gm2_init_pim
 
 foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
diff --git a/gcc/testsuite/gm2/switches/pic/run/pass/switches-pic-run-pass.exp b/gcc/testsuite/gm2/switches/pic/run/pass/switches-pic-run-pass.exp
index a2af765831f..67ee502b8d4 100644
--- a/gcc/testsuite/gm2/switches/pic/run/pass/switches-pic-run-pass.exp
+++ b/gcc/testsuite/gm2/switches/pic/run/pass/switches-pic-run-pass.exp
@@ -26,10 +26,8 @@ load_lib gm2-torture.exp
 
 set gm2src ${srcdir}/../m2
 
-gm2_link_lib "m2pim m2iso"
 gm2_init_pim "${srcdir}/gm2/switches/pic/run/pass" -fPIC
 
-
 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 {
diff --git a/gcc/testsuite/lib/gm2.exp b/gcc/testsuite/lib/gm2.exp
index 1e93d6a769b..41a2fa03bef 100644
--- a/gcc/testsuite/lib/gm2.exp
+++ b/gcc/testsuite/lib/gm2.exp
@@ -352,6 +352,7 @@ proc gm2_init_pimx { dialect {path ""} args } {
 	append theIpath " -I"
 	append theIpath ${path}
     }
+    gm2_link_lib "m2pim m2iso"
     gm2_init {*}${theIpath} {*}${dialect} {*}${theLpath} {*}${args};
 }
 
@@ -422,6 +423,7 @@ proc gm2_init_iso { {path ""} args } {
 	append theIpath ${path}
     }
 
+    gm2_link_lib "m2iso m2pim m2cor"
     gm2_init {*}${theIpath} -fiso {*}${theLpath} {*}${args};
 }
 
@@ -450,6 +452,7 @@ proc gm2_init_ulm { {path ""} args } {
 	append theIpath ${path}
     }
 
+    gm2_link_lib "m2ulm m2pim"
     gm2_init {*}${theIpath} -fpim {*}${theLpath} {*}${args};
 }
 
@@ -540,24 +543,26 @@ proc gm2_init_cor { {path ""} args } {
 proc gm2_init_minx { dialect {path ""} args } {
     global srcdir;
     global gccpath;
-
     set gm2src ${srcdir}/../m2;
 
     send_log "srcdir is $srcdir\n"
     send_log "gccpath is $gccpath\n"
     send_log "gm2src is $gm2src\n"
 
-    set minIpath "${gccpath}/libgm2/libm2min";
-    set minLpath "${gccpath}/libgm2/libm2min/.libs";
+    set theIpath " -I${gccpath}/libgm2/libm2min"
+    append theIpath " -I${gm2src}/gm2-libs-min"
 
-    set theIpath "-I${minIpath}";
-    set theLpath "-L${minLpath}";
+    set theLpath " -L${gccpath}/libgm2/libm2min/.libs";
 
     if { $path != "" } then {
 	append theIpath " -I"
 	append theIpath ${path}
     }
-    gm2_init {*}${theIpath} {*}${dialect} {*}${theLpath} {*}${args};
+
+    gm2_link_lib "m2min"
+    append args " -fno-exceptions "
+    append args " -fno-libs=- "
+    gm2_init {*}${theIpath} {*}${dialect} {*}${theLpath} {*}${args}
 }
 
 #
@@ -566,6 +571,5 @@ proc gm2_init_minx { dialect {path ""} args } {
 #
 
 proc gm2_init_min { {path ""} args } {
-    append args " -fno-exceptions"
-    gm2_init_minx -fpim {*}${path} {*}${args};
+    gm2_init_minx -fpim {*}${path} {*}${args}
 }
-- 
2.37.1 (Apple Git-137.1)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] modula-2, testsuite: Make libs and interfaces consistent.
  2023-01-17 17:06 [PATCH] modula-2, testsuite: Make libs and interfaces consistent Iain Sandoe
@ 2023-01-19 15:20 ` Gaius Mulley
  0 siblings, 0 replies; 2+ messages in thread
From: Gaius Mulley @ 2023-01-19 15:20 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: gcc-patches, iain

Iain Sandoe <iains.gcc@gmail.com> writes:

> Tested on x86_64-linux-gnu (with a 32b multilib), powerpc, i686 and
> x86_64-darwin.  OK for trunk?
> thanks,
> Iain

LGTM, thank you

regards,
Gaius

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-19 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 17:06 [PATCH] modula-2, testsuite: Make libs and interfaces consistent Iain Sandoe
2023-01-19 15:20 ` 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).