| 1 | #!./perl -w
|
|---|
| 2 |
|
|---|
| 3 | # Some quick tests to see if h2xs actually runs and creates files as
|
|---|
| 4 | # expected. File contents include date stamps and/or usernames
|
|---|
| 5 | # hence are not checked. File existence is checked with -e though.
|
|---|
| 6 | # This test depends on File::Path::rmtree() to clean up with.
|
|---|
| 7 | # - pvhp
|
|---|
| 8 | #
|
|---|
| 9 | # We are now checking that the correct use $version; is present in
|
|---|
| 10 | # Makefile.PL and $module.pm
|
|---|
| 11 |
|
|---|
| 12 | BEGIN {
|
|---|
| 13 | chdir 't' if -d 't';
|
|---|
| 14 | @INC = '../lib';
|
|---|
| 15 | # FIXME (or rather FIXh2xs)
|
|---|
| 16 | require Config;
|
|---|
| 17 | if (($Config::Config{'extensions'} !~ m!\bDevel/PPPort\b!) ){
|
|---|
| 18 | print "1..0 # Skip -- Perl configured without Devel::PPPort module\n";
|
|---|
| 19 | exit 0;
|
|---|
| 20 | }
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | # use strict; # we are not really testing this
|
|---|
| 24 | use File::Path; # for cleaning up with rmtree()
|
|---|
| 25 | use Test::More;
|
|---|
| 26 | use File::Spec;
|
|---|
| 27 | use File::Find;
|
|---|
| 28 | use ExtUtils::Manifest;
|
|---|
| 29 | # Don't want its diagnostics getting in the way of ours.
|
|---|
| 30 | $ExtUtils::Manifest::Quiet=1;
|
|---|
| 31 | my $up = File::Spec->updir();
|
|---|
| 32 |
|
|---|
| 33 | my $extracted_program = '../utils/h2xs'; # unix, nt, ...
|
|---|
| 34 | if ($^O eq 'VMS') { $extracted_program = '[-.utils]h2xs.com'; }
|
|---|
| 35 | if ($^O eq 'MacOS') { $extracted_program = '::utils:h2xs'; }
|
|---|
| 36 | if (!(-e $extracted_program)) {
|
|---|
| 37 | print "1..0 # Skip: $extracted_program was not built\n";
|
|---|
| 38 | exit 0;
|
|---|
| 39 | }
|
|---|
| 40 | # You might also wish to bail out if your perl platform does not
|
|---|
| 41 | # do `$^X -e 'warn "Writing h2xst"' 2>&1`; duplicity.
|
|---|
| 42 |
|
|---|
| 43 | # ok on unix, nt, VMS, ...
|
|---|
| 44 | my $dupe = '2>&1';
|
|---|
| 45 | # ok on unix, nt, The extra \" are for VMS
|
|---|
| 46 | my $lib = '"-I../lib" "-I../../lib"';
|
|---|
| 47 | # The >&1 would create a file named &1 on MPW (STDERR && STDOUT are
|
|---|
| 48 | # already merged).
|
|---|
| 49 | if ($^O eq 'MacOS') {
|
|---|
| 50 | $dupe = '';
|
|---|
| 51 | # -x overcomes MPW $Config{startperl} anomaly
|
|---|
| 52 | $lib = '-x -I::lib: -I:::lib:';
|
|---|
| 53 | }
|
|---|
| 54 | # $name should differ from system header file names and must
|
|---|
| 55 | # not already be found in the t/ subdirectory for perl.
|
|---|
| 56 | my $name = 'h2xst';
|
|---|
| 57 | my $header = "$name.h";
|
|---|
| 58 | my $thisversion = sprintf "%vd", $^V;
|
|---|
| 59 |
|
|---|
| 60 | # If this test has failed previously a copy may be left.
|
|---|
| 61 | rmtree($name);
|
|---|
| 62 |
|
|---|
| 63 | my @tests = (
|
|---|
| 64 | "-f -n $name", $], <<"EOXSFILES",
|
|---|
| 65 | Defaulting to backwards compatibility with perl $thisversion
|
|---|
| 66 | If you intend this module to be compatible with earlier perl versions, please
|
|---|
| 67 | specify a minimum perl version with the -b option.
|
|---|
| 68 |
|
|---|
| 69 | Writing $name/ppport.h
|
|---|
| 70 | Writing $name/lib/$name.pm
|
|---|
| 71 | Writing $name/$name.xs
|
|---|
| 72 | Writing $name/fallback/const-c.inc
|
|---|
| 73 | Writing $name/fallback/const-xs.inc
|
|---|
| 74 | Writing $name/Makefile.PL
|
|---|
| 75 | Writing $name/README
|
|---|
| 76 | Writing $name/t/$name.t
|
|---|
| 77 | Writing $name/Changes
|
|---|
| 78 | Writing $name/MANIFEST
|
|---|
| 79 | EOXSFILES
|
|---|
| 80 |
|
|---|
| 81 | "-f -n $name -b $thisversion", $], <<"EOXSFILES",
|
|---|
| 82 | Writing $name/ppport.h
|
|---|
| 83 | Writing $name/lib/$name.pm
|
|---|
| 84 | Writing $name/$name.xs
|
|---|
| 85 | Writing $name/fallback/const-c.inc
|
|---|
| 86 | Writing $name/fallback/const-xs.inc
|
|---|
| 87 | Writing $name/Makefile.PL
|
|---|
| 88 | Writing $name/README
|
|---|
| 89 | Writing $name/t/$name.t
|
|---|
| 90 | Writing $name/Changes
|
|---|
| 91 | Writing $name/MANIFEST
|
|---|
| 92 | EOXSFILES
|
|---|
| 93 |
|
|---|
| 94 | "-f -n $name -b 5.6.1", "5.006001", <<"EOXSFILES",
|
|---|
| 95 | Writing $name/ppport.h
|
|---|
| 96 | Writing $name/lib/$name.pm
|
|---|
| 97 | Writing $name/$name.xs
|
|---|
| 98 | Writing $name/fallback/const-c.inc
|
|---|
| 99 | Writing $name/fallback/const-xs.inc
|
|---|
| 100 | Writing $name/Makefile.PL
|
|---|
| 101 | Writing $name/README
|
|---|
| 102 | Writing $name/t/$name.t
|
|---|
| 103 | Writing $name/Changes
|
|---|
|
|---|