--- Gabor Szabo <[EMAIL PROTECTED]> wrote:

> The issue was raised on the Oslo Hackathon that it would be cool
> if we could keep the tests around so that they can be executed
> later again making sure that even after one has upgraded other
> parts of his system the previously installed modules still work as
> expected.

I've been thinking about this a lot and want a solution.  The main
issue with "keeping the tests" is that you probably already have a lot
of modules installed and it's not always easy to tell which
distributions you have to get the tests for.

brian d foy tells me that in about a month he hopes to have software
which, given a particular file, will tell you which distribution (if
any) it's from.  With that, what we can do is this:

  my %files_in;
  my @unknown_distributions;
  for my $file (pm_files_in_inc()) {
    if ( my $distribution = distribution_for($file) ) {
      $files_in{$distribution} ||= [];
      push $files_in{$distribution} => $file;
    }
    else {
      push @unknown_distributions => $file;
    }
  }
  for my $dist_name (keys $files_in) {

    # with local caching, obviously
    my $distribution = get_from_cpan_or_backpan($dist_name);

    # should extract into dirs named after the dist
    extract_tests($distribution, 'installation_tests/');
  }

There are *all* sorts of caveats with this, but basically:

  1.  You can produce a report of packages from unknown distributions.
  2.  Run tests against your current setup.
  3.  CPAN hooks to see how the tests will pass with a new module.

There has never been a serious way to test your Perl installation. 
Some tests won't be able to pass because they require environment
variables, access to the Web, ponies, etc.  However, it could be a good
starting solution.

Cheers,
Ovid

--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/

Reply via email to