From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29006 invoked by alias); 27 Mar 2007 16:59:01 -0000 Received: (qmail 28988 invoked by uid 22791); 27 Mar 2007 16:58:59 -0000 X-Spam-Check-By: sourceware.org Received: from WARSL404PIP3.highway.telekom.at (HELO email.aon.at) (195.3.96.115) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 27 Mar 2007 17:58:46 +0100 Received: (qmail 8233 invoked from network); 27 Mar 2007 16:58:41 -0000 Received: from m986p004.adsl.highway.telekom.at (HELO s37.loc) ([62.47.155.36]) (envelope-sender ) by smarthub84.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 27 Mar 2007 16:58:41 -0000 Received: from cow by s37.loc with local (Exim 4.63) (envelope-from ) id 1HWEwB-00030e-H9; Tue, 27 Mar 2007 18:54:23 +0200 Date: Tue, 27 Mar 2007 17:24:00 -0000 From: Bernhard Fischer To: FX Coudert Cc: Brooks Moses , fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [patch, testsuite, committed] Clean up gfortran.dg leftover module files. Message-ID: <20070327165423.GA11354@aon.at> References: <46082A94.2030709@codesourcery.com> <8FCB7046-4436-4B07-B925-E120A52AF907@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <8FCB7046-4436-4B07-B925-E120A52AF907@gmail.com> User-Agent: Mutt/1.5.13 (2006-08-11) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-03/txt/msg01778.txt.bz2 --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 2878 On Mon, Mar 26, 2007 at 10:28:40PM +0200, FX Coudert wrote: >>There are still a lot of module files left over from running >>gfortran.fortran-torture, since (as Kaveh pointed out) that doesn't >>recognize dg-final directives. I've got a patch that adds the >>directives, but not one for recognizing them yet.... > >I'm wondering why we don't simply incorporate all these tests in the >gfortran.dg framework. It's rather easy to do, we just need to add >the compile tests a { dg-do compile } line, and the execution tests >both { dg-do run } and { dg-options "-w" }. There are a few special >cases (the execution tests associated to a .x file), but nothing too >difficult. We could even move them into subdirectory so we don't mix >everything. Short of teaching dejagnu to automagically rm all .mod by scanning the input for 'module [procedure] name', perhaps a quick script like the attached would ease the handling of those? Something for contrib/, perhaps? Just a thought.. Sample output: gfortran.dg$ ~/gfortran.dg-final.cleanup-mods.awk *f *f90 *inc Wrong encoding! sed -i -e 's/\x0D//g' actual_array_constructor_2.f90 [snip a handful of those] Wrong encoding! sed -i -e 's/\x0D//g' used_types_4.f90 alloc_comp_basics_1.f90: no cleanup for module 'alloc_m' assumed_charlen_function_1.f90: no cleanup for module 'integer_sets' equiv_constraint_7.f90: no cleanup for module 'data' error_recovery_1.f90: no cleanup for module 'gfcbug29_import' func_derived_4.f90: no cleanup for module 'class_field' interface_3.f90: no cleanup for module 'test_mod2' keyword_symbol_1.f90: no cleanup for module 'blahblah' sequence_types_1.f90: no cleanup for module 'data_types' simpleif_2.f90: no cleanup for module 'read' sed -i -e '/cleanup-modules/s/\("[[:space:]]*}\)/ \1/' actual_array_constructor_1.f90 sed -i -e '/cleanup-modules/s/\("[[:space:]]*}\)/ alloc_m\1/' alloc_comp_basics_1.f90 sed -i -e '/cleanup-modules/s/\("[[:space:]]*}\)/ integer_sets\1/' assumed_charlen_function_1.f90 sed -i -e '/cleanup-modules/s/\("[[:space:]]*}\)/ data\1/' equiv_constraint_7.f90 sed -i -e '/cleanup-modules/s/\("[[:space:]]*}\)/ gfcbug29_import\1/' error_recovery_1.f90 sed -i -e '/cleanup-modules/s/\("[[:space:]]*}\)/ class_field\1/' func_derived_4.f90 sed -i -e '/cleanup-modules/s/\("[[:space:]]*}\)/ test_mod2\1/' interface_3.f90 sed -i -e '/cleanup-modules/s/\("[[:space:]]*}\)/ blahblah\1/' keyword_symbol_1.f90 sed -i -e '/cleanup-modules/s/\("[[:space:]]*}\)/ data_types\1/' sequence_types_1.f90 The "Wrong encoding" and "no cleanup for module" go to stderr, so to automatically append the missing modules to cleanup-modules, do > /dev/null and eval the rest Untested, so beware.. > >Speaking of which: there's a gfortran.dg/g77 directory, but it looks >like the tests in it are never actually run when I do "make check- >gfortran". Is that expected? > >FX > --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gfortran.dg-final.cleanup-mods.awk" Content-length: 1469 #! /usr/bin/awk -f # Public Domain /[eE][nN][dD][ \t]*[mM][oO][dD][uU][lL][eE]/ { next; } /^[ \t]*[mM][oO][dD][uU][lL][eE][ \t]/ { if (tolower($2) == "procedure") next; pos++; tmp = tolower($2); gsub(/[ \t ]*/, "", tmp); mod[pos] = tmp; file[pos] = FILENAME; # printf("%s:%d saw module '%s'\n", FILENAME, FNR, $2); } /{[ \t]*cleanup-modules/ { cleanup = tolower($0); sub(/.*{[ \t]*cleanup-modules/, "", cleanup); gsub(/[ \t][ \t]*/, " ", cleanup); gsub(/(^[ \t]+|["{}])/, "", cleanup); gsub(/[ \t]*$/, "", cleanup); split(cleanup, mods); for (i in mods) { cleaned++; clean[cleaned] = mods[i]; } } / / { if (warned_encoding[FILENAME] != 1) { warned_encoding[FILENAME] = 1; print "Wrong encoding\x21 sed -i -e 's/\\x0D//g' "FILENAME > "/dev/stderr" } } BEGIN { pos = -1; cleaned = -1; fixup = 1; } END { done = 0; for (i = 0; i <= pos; i++) { for (j in clean) { if (mod[i] == clean[j]) { delete mod[i]; } } } for (i = 0; i <= pos; i++) { if (length(mod[i])) { printf("%s: no cleanup for module '%s'\n", file[i], mod[i]) > "/dev/stderr"; if (fixup) { emit[file[i]] = emit[file[i]] " " mod[i]; gsub(/^[ ]*/, "", emit[file[i]]); } } } if (fixup) { oldfile = file[0]; for (i = 0; i <= pos; i++) { if (length(emit[file[i]]) && (oldfile != file[i])) { printf("sed -i -e '/cleanup-modules/s/\\(\"[[:space:]]*}\\)/ %s\\1/' %s\n", emit[oldfile], oldfile); oldfile = file[i]; } } } } --C7zPtVaVf+AK4Oqc--