Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tool for checking if '# pure' files still contain fudging #118

Closed
p6rt opened this issue Jun 5, 2008 · 6 comments
Closed

tool for checking if '# pure' files still contain fudging #118

p6rt opened this issue Jun 5, 2008 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 5, 2008

Migrated from rt.perl.org#55346 (status was 'resolved')

Searchable as RT55346$

@p6rt
Copy link
Author

p6rt commented Jun 5, 2008

From @moritz

Attached patch adds a script to tools/ that walks through a test
specification file (t/spectest_regression.data by default) and prints a
list of files that are marked as pure, but still contain '#?rakudo'
fudge directives.

particle++ for suggesting it.

It's only tested under linux so far, so please also test on MacOS and
Windows before applying.

Cheers,
Moritz

--
Moritz Lenz
http://moritz.faui2k3.org/ | http://perl-6.de/

@p6rt
Copy link
Author

p6rt commented Jun 5, 2008

From @moritz

purity_inspector.patch
Index: MANIFEST
===================================================================
--- MANIFEST	(revision 28098)
+++ MANIFEST	(working copy)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Wed Jun  4 20:37:00 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Thu Jun  5 15:13:47 2008 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -1961,6 +1961,7 @@
 languages/perl6/t/harness                                   [perl6]
 languages/perl6/t/pmc/mutable.t                             [perl6]
 languages/perl6/t/spectest_regression.data                  [perl6]
+languages/perl6/tools/fudge_purity_inspector.pl             [perl6]
 languages/perl6/tools/update_passing_test_data.pl           [perl6]
 languages/pheme/MAINTAINER                                  [pheme]
 languages/pheme/MANIFEST                                    [pheme]
Index: languages/perl6/tools/fudge_purity_inspector.pl
===================================================================
--- languages/perl6/tools/fudge_purity_inspector.pl	(revision 0)
+++ languages/perl6/tools/fudge_purity_inspector.pl	(revision 0)
@@ -0,0 +1,39 @@
+#! perl -w
+# Copyright (C) 2008, The Perl Foundation.
+# $Id$
+use strict;
+use warnings;
+
+my $input_file = shift @ARGV || 't/spectest_regression.data';
+my $impl = 'rakudo';
+
+open my $fh, '<', $input_file
+    or die "Can't open '$input_file' for reading: $!";
+
+print "The following files, if any, contain fudge directives,\n";
+print "although they are marked as pure:\n";
+
+while (<$fh>){
+    chomp;
+    next if  m/^#/ || m/^\s*$/;
+    my ($file, $comment) = split m/\s*#\s*/;
+    if ($comment && $comment eq 'pure'){
+        check_file_and_warn($file);
+    }
+}
+
+sub check_file_and_warn {
+    my $filename = shift;
+    $filename = "t/spec/$filename";
+#    warn "checking file <$filename>\n";
+    open my $fh, '<', $filename
+        or die "Can't opne file '$filename' for reading: $!";
+    my $re = qr{^\s*#\?$impl};
+    while (<$fh>) {
+        if (m/$re/){
+            print $filename, "\n";
+            last;
+        }
+    }
+    close $fh;
+}

Property changes on: languages/perl6/tools/fudge_purity_inspector.pl
___________________________________________________________________
Name: svn:mime-type
   + text/plain; charset=UTF-8
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

@p6rt
Copy link
Author

p6rt commented Jun 5, 2008

@particle - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jun 5, 2008

From @particle

thanks, applied as r28105.
~jerry

@p6rt
Copy link
Author

p6rt commented Jun 5, 2008

@particle - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jun 5, 2008
@p6rt
Copy link
Author

p6rt commented Jun 5, 2008

From @coke

On Thu, Jun 5, 2008 at 11​:06 AM, via RT Moritz Lenz
<perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Moritz Lenz
# Please include the string​: [perl #​55346]
# in the subject line of all future correspondence about this issue.
# <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=55346 >

Attached patch adds a script to tools/ that walks through a test
specification file (t/spectest_regression.data by default) and prints a
list of files that are marked as pure, but still contain '#?rakudo'
fudge directives.

particle++ for suggesting it.

It's only tested under linux so far, so please also test on MacOS and
Windows before applying.

Cheers,
Moritz

--
Moritz Lenz
http://moritz.faui2k3.org/ | http://perl-6.de/

typo​:
+ or die "Can't opne file '$filename' for reading​: $!";

You can avoid that entirely by using "use Fatal qw(open);".

Regards.

--
Will "Coke" Coleda

@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant