Re: [PATCH v3 17/19] modula2 front end: dejagnu expect library scripts

2023-01-10 Thread Gaius Mulley via Gcc-patches
Jason Merrill  writes:

> On 12/6/22 09:47, Gaius Mulley via Gcc-patches wrote:
>> Here are the dejagnu expect library scripts for the gm2
>> testsuite.
>
> A couple of weeks ago I noticed on a testrun that the modula tests
> didn't seem to be timing out properly, so I made this change.  It
> looks like they didn't run at all in the bootstrap/test I did just
> now, so I don't know if this change is actually helpful, but here it
> is if you think it makes sense:

awesome, many thanks for the patch - it certainly looks as if the
timeout library was absent from lib/gm2.exp (and also gm2-torture.exp).
I've also applied this fix to gm2-torture.exp and will git commit/git
push your patch

regards,
Gaius


Re: [PATCH v3 17/19] modula2 front end: dejagnu expect library scripts

2023-01-09 Thread Jason Merrill via Gcc-patches

On 12/6/22 09:47, Gaius Mulley via Gcc-patches wrote:

Here are the dejagnu expect library scripts for the gm2
testsuite.


A couple of weeks ago I noticed on a testrun that the modula tests 
didn't seem to be timing out properly, so I made this change.  It looks 
like they didn't run at all in the bootstrap/test I did just now, so I 
don't know if this change is actually helpful, but here it is if you 
think it makes sense:


From 6c9007800b8793c68921ee3d24f3a5000b44a100 Mon Sep 17 00:00:00 2001
From: Jason Merrill 
Date: Wed, 21 Dec 2022 17:01:50 -0500
Subject: [PATCH] testsuite: use same timeout for gm2 as other front-ends
To: gcc-patches@gcc.gnu.org

I noticed Modula tests running forever in a regression test run, and then
that its .exp wasn't using timeout.exp like the other front-ends.

gcc/testsuite/ChangeLog:

	* lib/gm2.exp: Use timeout.exp.
---
 gcc/testsuite/lib/gm2.exp | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/lib/gm2.exp b/gcc/testsuite/lib/gm2.exp
index 9eba195291a..1fa62d8e6ea 100644
--- a/gcc/testsuite/lib/gm2.exp
+++ b/gcc/testsuite/lib/gm2.exp
@@ -22,7 +22,7 @@ load_lib libgloss.exp
 load_lib prune.exp
 load_lib gcc-defs.exp
 load_lib target-libpath.exp
-
+load_lib timeout.exp
 
 #
 # GCC_UNDER_TEST is the compiler under test.
@@ -183,9 +183,7 @@ proc gm2_target_compile_default { source dest type options } {
 if [info exists TOOL_OPTIONS] {
 	lappend options "additional_flags=$TOOL_OPTIONS"
 }
-if [target_info exists gcc,timeout] {
-	lappend options "timeout=[target_info gcc,timeout]"
-}
+lappend options "timeout=[timeout_value]"
 lappend options "compiler=$GCC_UNDER_TEST"
 # puts stderr "options = $options\n"
 # puts stderr "* target_compile: $source $dest $type $options\n"
-- 
2.31.1



[PATCH v3 17/19] modula2 front end: dejagnu expect library scripts

2022-12-06 Thread Gaius Mulley via Gcc-patches
 

Here are the dejagnu expect library scripts for the gm2
testsuite.

 
--8<--8<--8<--8<--8<--8< 
diff -ruw /dev/null gcc-git-devel-modula2/gcc/testsuite/lib/gm2.exp
--- /dev/null   2022-08-24 16:22:16.88870 +0100
+++ gcc-git-devel-modula2/gcc/testsuite/lib/gm2.exp 2022-12-06 
02:56:51.424775814 +
@@ -0,0 +1,498 @@
+# Copyright (C) 2003-2020 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
+# .
+
+# This file was written by Gaius Mulley (gaius.mul...@southwales.ac.uk)
+# for GNU Modula-2.
+
+# we want to use libgloss so we can get find_gcc.
+load_lib libgloss.exp
+load_lib prune.exp
+load_lib gcc-defs.exp
+load_lib target-libpath.exp
+
+
+#
+# GCC_UNDER_TEST is the compiler under test.
+#
+
+#
+# default_gcc_version -- extract and print the version number of the compiler
+#
+
+proc default_gcc_version { } {
+global GCC_UNDER_TEST
+
+gm2_init;
+
+# ignore any arguments after the command
+set compiler [lindex $GCC_UNDER_TEST 0]
+
+if ![is_remote host] {
+   set compiler_name [which $compiler];
+} else {
+   set compiler_name $compiler;
+}
+
+# verify that the compiler exists
+if { $compiler_name != 0 } then {
+   set tmp [remote_exec host "$compiler --version"]
+   set status [lindex $tmp 0];
+   set output [lindex $tmp 1];
+   regexp "version.*$" $output version
+   if { $status == 0 && [info exists version] } then {
+   clone_output "$compiler_name $version\n"
+   } else {
+   clone_output "Couldn't determine version of $compiler_name: 
$output\n"
+   }
+} else {
+   # compiler does not exist (this should have already been detected)
+   warning "$compiler does not exist"
+}
+}
+
+#
+# gcc_version -- Call default_gcc_version, so we can override it if needed.
+#
+
+proc gcc_version { } {
+default_gcc_version;
+}
+
+#
+# gm2_init -- called at the start of each .exp script.
+#
+# There currently isn't much to do, but always using it allows us to
+# make some enhancements without having to go back and rewrite the scripts.
+#
+
+set gm2_initialized 0;
+set gm2_compile_method "default";
+set gm2_link_path "";
+set gm2_link_libraries "m2pim m2iso";
+set gm2_link_objects "";
+
+proc gm2_set_compile_method { arg } {
+global gm2_compile_method;
+
+send_log "\n"
+send_log " setting gm2_compile_method to $arg \n"
+send_log "\n"
+set gm2_compile_method $arg;
+}
+
+
+proc gm2_init { args } {
+global tmpdir;
+global objdir;
+global rootme;
+global base_dir;
+global tool_root_dir;
+global gluefile wrap_flags;
+global gm2_initialized;
+global GCC_UNDER_TEST;
+global TOOL_EXECUTABLE;
+global gm2_link_libraries;
+global gm2_link_objects;
+global gm2_link_path;
+global HAVE_LIBSTDCXX_V3;
+
+if { $gm2_initialized == 1 } { return; }
+
+set gm2_link_objects "";
+set GCC_UNDER_TEST [lookfor_file $rootme gm2];
+append GCC_UNDER_TEST " " -B[file dirname $rootme]/gcc " " ${args};
+append GCC_UNDER_TEST " " -fno-diagnostics-show-caret
+append GCC_UNDER_TEST " " -fno-diagnostics-show-line-numbers
+append GCC_UNDER_TEST " " -fdiagnostics-color=never
+send_log "GCC_UNDER_TEST is ${GCC_UNDER_TEST}\n"
+
+if ![info exists tmpdir] then {
+   set tmpdir /tmp;
+}
+if {[target_info needs_status_wrapper] != "" && \
+   [target_info needs_status_wrapper] != "0" && \
+   ![info exists gluefile]} {
+   set gluefile ${tmpdir}/gcc-testglue.o;
+   set result [build_wrapper $gluefile];
+   if { $result != "" } {
+   set gluefile [lindex $result 0];
+   set wrap_flags [lindex $result 1];
+   } else {
+   unset gluefile
+   }
+}
+
+set gm2_link_path "[gm2_link_flags [get_multilibs]]";
+verbose $gm2_link_path 1
+}
+
+#
+# gm2_target_compile_default -- compile a source file
+#
+
+proc gm2_target_compile_default { source dest type options } {
+global gluefile wrap_flags
+global GCC_UNDER_TEST
+global TOOL_OPTIONS
+global TEST_ALWAYS_FLAGS
+global gm2_link_objects
+global gm2_link_libraries
+global gm2_link_path
+
+if {[target_info