On Wednesday 18 May 2005 07:52, Leopold Toetsch wrote:
> Dino Morelli wrote:
> > I'm seeing the following test failure at r8113
> >
> > t/src/manifest....NOK 6#     Failed test (t/src/manifest.t at line 79)
>
> I'd say we just drop this test. Whenever you do reasoanble work in the
> working tree, you got test files, editor swap file and whatnot.

The original version of t/src/manifest.t which i have written back in 2002 
just tests that version control (CVS at that time) and MANIFEST are in sync.
There were no checks for extra file, because this would lead exact to the
above effects.

Still it is one of the most often failing tests, because people tend to
forget to update MANIFEST when adding files to CVS. 
Garret Goebel wrote a commitinfo file which warned a commiter if he/she
forgot to update the MANIFEST.

I have an updated version of t/src/manifest.t I was about to commit but is
now conflicting with this latest version.

This new manifest.t introduces no new features (checking of MANIFEST.SKIP)
but just changes from CVS to SVN. While at it, I removed the reliance on
the interal files like CVS/Entries. In SVN this is no longer necessary 
because working Perl-Bindings exist. A new version for the precommit-script
is still to be investigated.

I can commit this version, but first I want to reach consensus if this is
the right way to go.

bye
boe
#! perl -w
# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
# $Id: manifest.t 7803 2005-04-11 13:37:27Z leo $

=head1 NAME

t/src/manifest.t - MANIFEST File

=head1 SYNOPSIS

        % perl -Ilib t/src/manifest.t

=head1 DESCRIPTION

Checks that the distribution and the MANIFEST file agree.

=cut

use Test::More tests => 4;

use strict;
no warnings qw(once);

use ExtUtils::Manifest;
use Cwd;

ok (-e $ExtUtils::Manifest::MANIFEST, 'MANIFEST exists');

$ExtUtils::Manifest::Quiet = 1;
my @missing = ExtUtils::Manifest::manicheck ();
unless (ok ([EMAIL PROTECTED], 'manicheck ()')) {
  print "# Missing files:\n";
  print "# $_\n" foreach @missing;
}

sub svn_check;

SKIP: {
  if (-e '.svn') {
    eval {
      require SVN::Client;
      require SVN::Wc;
    };
    if ($@) {
      skip ('SVN Perlbindings not installed', 2);
    }
    svn_check;
  }

  # XXX: somebody can add SVK tests here

  else {
    skip ('Not under version control', 2);
  }
}

sub svn_check {
  my (@mani_miss, @svn_miss);
  my $cwd = cwd ();

  my %manifest = ();
  {
    my $manifest = ExtUtils::Manifest::maniread ();

    while (my ($key, $value) = each %$manifest) {
      $key = "$cwd/$key";
      $manifest{$key} = $value;
    }
  }

  my $ctx = new SVN::Client;

  $ctx->status ($cwd, 'WORKING', \&check_func, 1, 1, 0, 1);

  sub check_func () {
    my ($path, $status) = @_;

    my $textstatus = $status->text_status();

    if ($textstatus == $SVN::Wc::Status::normal) {
      push @mani_miss, $path
        unless -d $path or exists $manifest{$path};
    }
    elsif ($textstatus == $SVN::Wc::Status::modified) {
      push @mani_miss, "$path [modified]"
        unless -d $path or exists $manifest{$path};
    }
    elsif ($textstatus == $SVN::Wc::Status::conflicted) {
      push @mani_miss, "$path [conflicted]"
        unless -d $path or exists $manifest{$path};
    }      
    elsif ($textstatus == $SVN::Wc::Status::added) {
      push @mani_miss, "$path [added]"
        unless -d $path or exists $manifest{$path};
    }
    elsif ($textstatus == $SVN::Wc::Status::replaced) {
      push @mani_miss, "$path [re-added]"
        unless -d $path or exists $manifest{$path};
    }
    elsif ($textstatus == $SVN::Wc::Status::missing) {
      # This is a bit strange the file is still in SVN
      # but missing in the WC
      push @mani_miss, "$path [missing]"
        unless -d $path or exists $manifest{$path};
    }

    elsif ($textstatus == $SVN::Wc::Status::unversioned) {
      push @svn_miss, $path
        if exists $manifest{$path};
    }
    elsif ($textstatus == $SVN::Wc::Status::ignored) {
      push @svn_miss, "$path [ignored]"
        if exists $manifest{$path};
    }
    elsif ($textstatus == $SVN::Wc::Status::deleted) {
      push @svn_miss, "$path [deleted]"
        if exists $manifest{$path};
    }

    else { 
      # Unknown $textstatus, output some debuginfo
      print "# [$textstatus] $path\n";
    }

  }

  local $" = "\n\t";

  ok ([EMAIL PROTECTED], 'all files in MANIFEST are in SVN')
    or diag ("Missing files in SVN:[EMAIL PROTECTED]");

  ok ([EMAIL PROTECTED], 'all files in SVN are in MANIFEST')
    or diag ("Missing files in MANIFEST:[EMAIL PROTECTED]");
}

Reply via email to