test_all.t 833 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/perl
  2. # Creates $file.t for each @ARGV
  3. # Then calls runtests for all these files
  4. use strict;
  5. use Test::Harness;
  6. use Getopt::Std;
  7. my $opts = {};
  8. getopts("v", $opts) or die "Getopt failed";
  9. $Test::Harness::verbose = $opts->{v};
  10. $Test::Harness::switches="";
  11. my $special_errors = {
  12. test_ini => "please enable parse-ini to test",
  13. test_opts => "please enable parse-ini to test",
  14. };
  15. my $default_error = "could not compile";
  16. my @tests;
  17. foreach my $file (@ARGV) {
  18. my $file_t = "$file.t";
  19. my $error = $special_errors->{ $file } || $default_error;
  20. open F, ">", $file_t or die "Cannot open $file_t for writing";
  21. print F <<EOF;
  22. use Test::More;
  23. if (! -e "$file") {
  24. plan skip_all => "./$file not compiled - $error";
  25. }
  26. exec "./$file";
  27. EOF
  28. close F;
  29. push @tests, $file_t;
  30. }
  31. chmod 0750, @tests;
  32. runtests @tests;
  33. unlink @tests;