From 3a560fb4fa5b52ba9b5118892080338d61b2f0c9 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Mon, 27 Jun 2022 00:13:57 +0100 Subject: [PATCH] Testsuite fixes to enable coroutine linking. This patch allows the remaining coroutine regression tests to link with the new dynamic module ctors and new scaffold mechanism. 2022-06-27 Gaius Mulley gcc/testsuite/gm2/ChangeLog: * coroutines/pim/run/pass/coroutines-pim-run-pass.exp (gm2_link_with) Assigned to "-lm2cor -lm2pim -lm2iso". * iso/run/pass/iso-run-pass.exp: Avoid linking the library module. * isocoroutines/run/pass/coroutine.mod (main): Renamed mainc. * isocoroutines/run/pass/isocoroutines-run-pass.exp (gm2_init_pim): Configure with -fscaffold-main -fno-scaffold-dynamic. * link/externalscaffold/pass/scaffold.c (_M2_SYSTEM_finish): Renamed _M2_SYSTEM_fini. (_M2_M2RTS_finish) Renamed _M2_M2RTS_fini. (_M2_RTExceptions_finish) Renamed _M2_RTExceptions_fini. (_M2_hello_finish) Renamed _M2_hello_fini. * pim/options/optimize/run/pass/pim-options-optimize-run-pass.exp (gm2_link_with): Assigned to addition.o. * pim/run/pass/pim-run-pass.exp (gm2_link_with): Assigned to sys.o. Avoid linking sys.mod. * pimcoroutines/run/pass/pimcoroutines-run-pass.exp (gm2_link_with): Assigned to "-lm2cor -lm2pim -lm2iso". * switches/check-all/run/fail/switches-check-all-run-fail.exp (gm2_link_with): Assigned to rangesupport.o. Signed-off-by: Gaius Mulley --- .../pim/run/pass/coroutines-pim-run-pass.exp | 2 +- .../gm2/iso/run/pass/iso-run-pass.exp | 6 ++-- .../gm2/isocoroutines/run/pass/coroutine.mod | 8 ++--- .../run/pass/isocoroutines-run-pass.exp | 1 - .../pass/link-externalscaffold-pass.exp | 2 +- .../gm2/link/externalscaffold/pass/scaffold.c | 34 +++++++++---------- .../pass/pim-options-optimize-run-pass.exp | 2 +- .../gm2/pim/run/pass/pim-run-pass.exp | 7 ++-- .../run/pass/pimcoroutines-run-pass.exp | 7 ++-- .../run/fail/switches-check-all-run-fail.exp | 1 + 10 files changed, 38 insertions(+), 32 deletions(-) diff --git a/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp b/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp index ec2483bbc60..e7f5b9563bd 100644 --- a/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp +++ b/gcc/testsuite/gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp @@ -28,7 +28,7 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../gm2 gm2_init_cor -gm2_link_with "-lm2cor" +gm2_link_with "-lm2cor -lm2pim -lm2iso" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. 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 7f284ec4a99..ec9a473fbef 100644 --- a/gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp +++ b/gcc/testsuite/gm2/iso/run/pass/iso-run-pass.exp @@ -33,6 +33,8 @@ foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { continue } - gm2_target_compile $srcdir/$subdir/fileio.mod fileio.o object "-g" - gm2-torture-execute $testcase "" "pass" + if { $testcase != "$srcdir/$subdir/fileio.mod" } { + gm2_target_compile $srcdir/$subdir/fileio.mod fileio.o object "-g" + gm2-torture-execute $testcase "" "pass" + } } diff --git a/gcc/testsuite/gm2/isocoroutines/run/pass/coroutine.mod b/gcc/testsuite/gm2/isocoroutines/run/pass/coroutine.mod index bdf5248db70..05b4d4477d8 100644 --- a/gcc/testsuite/gm2/isocoroutines/run/pass/coroutine.mod +++ b/gcc/testsuite/gm2/isocoroutines/run/pass/coroutine.mod @@ -37,7 +37,7 @@ BEGIN IF x=1000 THEN printf ("finished!\n") ; - TRANSFER (c1, main) + TRANSFER (c1, mainc) ELSE TRANSFER (c1, c2) END ; @@ -56,7 +56,7 @@ END second ; VAR - main, + mainc, c1, c2: COROUTINE ; w1, w2: ADDRESS ; BEGIN @@ -65,6 +65,6 @@ BEGIN ALLOCATE (w2, Workspace) ; NEWCOROUTINE (second, w2, Workspace, c2) ; printf ("first context switch to c1\n") ; - TRANSFER (main, c1) ; - printf ("back to main and all done\n\n") + TRANSFER (mainc, c1) ; + printf ("back to mainc and all done\n\n") END coroutine. diff --git a/gcc/testsuite/gm2/isocoroutines/run/pass/isocoroutines-run-pass.exp b/gcc/testsuite/gm2/isocoroutines/run/pass/isocoroutines-run-pass.exp index f552492db31..1239f769985 100644 --- a/gcc/testsuite/gm2/isocoroutines/run/pass/isocoroutines-run-pass.exp +++ b/gcc/testsuite/gm2/isocoroutines/run/pass/isocoroutines-run-pass.exp @@ -27,7 +27,6 @@ load_lib gm2-torture.exp gm2_init_iso "${srcdir}/gm2/iso/run/pass" -gm2_link_with "-lpthread" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it. 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 35890cf119a..7b221b4ac28 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,7 @@ if $tracelevel then { # load support procs load_lib gm2-torture.exp -gm2_init_pim "${srcdir}/gm2/pim/pass" +gm2_init_pim "${srcdir}/gm2/pim/pass" -fscaffold-main -fno-scaffold-dynamic gm2_link_with scaffold.o set output [target_compile $srcdir/$subdir/scaffold.c scaffold.o object "-g"] diff --git a/gcc/testsuite/gm2/link/externalscaffold/pass/scaffold.c b/gcc/testsuite/gm2/link/externalscaffold/pass/scaffold.c index e5a2f20ae74..52f4cd1460e 100644 --- a/gcc/testsuite/gm2/link/externalscaffold/pass/scaffold.c +++ b/gcc/testsuite/gm2/link/externalscaffold/pass/scaffold.c @@ -1,37 +1,37 @@ extern void exit (int); extern void _M2_SYSTEM_init (int argc, char *argv[]); -extern void _M2_SYSTEM_finish (void); +extern void _M2_SYSTEM_fini (void); extern void _M2_M2RTS_init (int argc, char *argv[]); -extern void _M2_M2RTS_finish (void); +extern void _M2_M2RTS_fini (void); extern void _M2_RTExceptions_init (int argc, char *argv[]); -extern void _M2_RTExceptions_finish (void); +extern void _M2_RTExceptions_fini (void); extern void _M2_hello_init (int argc, char *argv[]); -extern void _M2_hello_finish (void); +extern void _M2_hello_fini (void); extern void M2RTS_Terminate (void); static void init (int argc, char *argv[]) { - _M2_SYSTEM_init (argc, argv); - _M2_M2RTS_init (argc, argv); - _M2_RTExceptions_init (argc, argv); - _M2_hello_init (argc, argv); + _M2_SYSTEM_init (argc, argv); + _M2_M2RTS_init (argc, argv); + _M2_RTExceptions_init (argc, argv); + _M2_hello_init (argc, argv); } static void finish (void) { - M2RTS_Terminate (); - _M2_hello_finish (); - _M2_RTExceptions_finish (); - _M2_M2RTS_finish (); - _M2_SYSTEM_finish (); - exit (0); + M2RTS_Terminate (); + _M2_hello_fini (); + _M2_RTExceptions_fini (); + _M2_M2RTS_fini (); + _M2_SYSTEM_fini (); + exit (0); } int main (int argc, char *argv[]) { - init (argc, argv); - finish (); - return (0); + init (argc, argv); + finish (); + return (0); } diff --git a/gcc/testsuite/gm2/pim/options/optimize/run/pass/pim-options-optimize-run-pass.exp b/gcc/testsuite/gm2/pim/options/optimize/run/pass/pim-options-optimize-run-pass.exp index 746cb5f296b..8f77e9c3909 100644 --- a/gcc/testsuite/gm2/pim/options/optimize/run/pass/pim-options-optimize-run-pass.exp +++ b/gcc/testsuite/gm2/pim/options/optimize/run/pass/pim-options-optimize-run-pass.exp @@ -82,7 +82,7 @@ proc gm2_target_compile_options_optimize { source dest type options } { set gm2src ${srcdir}/../m2 gm2_init_pim "${srcdir}/gm2/pim/options/optimize/run/pass" -# gm2_link_with "-lm2pim -lm2iso -lpthread" +gm2_link_with "addition.o" # # compile library file diff --git a/gcc/testsuite/gm2/pim/run/pass/pim-run-pass.exp b/gcc/testsuite/gm2/pim/run/pass/pim-run-pass.exp index 79ce46075f3..329af84abd2 100644 --- a/gcc/testsuite/gm2/pim/run/pass/pim-run-pass.exp +++ b/gcc/testsuite/gm2/pim/run/pass/pim-run-pass.exp @@ -27,8 +27,7 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 gm2_init_pim "${srcdir}/gm2/pim/run/pass" -gm2_link_with "-lm2pim -lm2iso -lpthread" - +gm2_link_with sys.o foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { set output [gm2_target_compile $srcdir/$subdir/sys.mod sys.o object "-g -I$srcdir/../m2/gm2-libs -I$srcdir/$subdir -I$srcdir/../m2/gm2-compiler -I../m2/gm2-libs -I../m2/gm2-compiler -fpim"] @@ -38,5 +37,7 @@ foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { continue } - gm2-torture-execute $testcase "" "pass" + if { $testcase != "$srcdir/$subdir/sys.mod" } { + gm2-torture-execute $testcase "" "pass" + } } diff --git a/gcc/testsuite/gm2/pimcoroutines/run/pass/pimcoroutines-run-pass.exp b/gcc/testsuite/gm2/pimcoroutines/run/pass/pimcoroutines-run-pass.exp index a6157d0233a..15498a32173 100644 --- a/gcc/testsuite/gm2/pimcoroutines/run/pass/pimcoroutines-run-pass.exp +++ b/gcc/testsuite/gm2/pimcoroutines/run/pass/pimcoroutines-run-pass.exp @@ -27,7 +27,8 @@ load_lib gm2-torture.exp set gm2src ${srcdir}/../m2 gm2_init_cor "${srcdir}/gm2/pim/run/pass" -gm2_link_with "-lm2cor" +# gm2_link_with "-flibs=cor,pim,iso" +gm2_link_with "-lm2cor -lm2pim -lm2iso" foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { @@ -38,5 +39,7 @@ foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { continue } - gm2-torture-execute $testcase "" "pass" + if { $testcase != "$srcdir/$subdir/sys.mod" } { + gm2-torture-execute $testcase "" "pass" + } } diff --git a/gcc/testsuite/gm2/switches/check-all/run/fail/switches-check-all-run-fail.exp b/gcc/testsuite/gm2/switches/check-all/run/fail/switches-check-all-run-fail.exp index 38acb74db8c..2bdd9ddd974 100644 --- a/gcc/testsuite/gm2/switches/check-all/run/fail/switches-check-all-run-fail.exp +++ b/gcc/testsuite/gm2/switches/check-all/run/fail/switches-check-all-run-fail.exp @@ -34,6 +34,7 @@ gm2_init_pim "${srcdir}/gm2/switches/check-all/run/fail" -fsoft-check-all -fno-m # gm2_target_compile $srcdir/$subdir/rangesupport.mod rangesupport.o object "-g -I$srcdir/$subdir/" +gm2_link_with rangesupport.o foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { # If we're only testing specific files and this isn't one of them, skip it.