source: trunk/essentials/dev-lang/perl/lib/h2xs.t

Last change on this file was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 6.8 KB
Line 
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
12BEGIN {
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
24use File::Path; # for cleaning up with rmtree()
25use Test::More;
26use File::Spec;
27use File::Find;
28use ExtUtils::Manifest;
29# Don't want its diagnostics getting in the way of ours.
30$ExtUtils::Manifest::Quiet=1;
31my $up = File::Spec->updir();
32
33my $extracted_program = '../utils/h2xs'; # unix, nt, ...
34if ($^O eq 'VMS') { $extracted_program = '[-.utils]h2xs.com'; }
35if ($^O eq 'MacOS') { $extracted_program = '::utils:h2xs'; }
36if (!(-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, ...
44my $dupe = '2>&1';
45# ok on unix, nt, The extra \" are for VMS
46my $lib = '"-I../lib" "-I../../lib"';
47# The >&1 would create a file named &1 on MPW (STDERR && STDOUT are
48# already merged).
49if ($^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.
56my $name = 'h2xst';
57my $header = "$name.h";
58my $thisversion = sprintf "%vd", $^V;
59
60# If this test has failed previously a copy may be left.
61rmtree($name);
62
63my @tests = (
64"-f -n $name", $], <<"EOXSFILES",
65Defaulting to backwards compatibility with perl $thisversion
66If you intend this module to be compatible with earlier perl versions, please
67specify a minimum perl version with the -b option.
68
69Writing $name/ppport.h
70Writing $name/lib/$name.pm
71Writing $name/$name.xs
72Writing $name/fallback/const-c.inc
73Writing $name/fallback/const-xs.inc
74Writing $name/Makefile.PL
75Writing $name/README
76Writing $name/t/$name.t
77Writing $name/Changes
78Writing $name/MANIFEST
79EOXSFILES
80
81"-f -n $name -b $thisversion", $], <<"EOXSFILES",
82Writing $name/ppport.h
83Writing $name/lib/$name.pm
84Writing $name/$name.xs
85Writing $name/fallback/const-c.inc
86Writing $name/fallback/const-xs.inc
87Writing $name/Makefile.PL
88Writing $name/README
89Writing $name/t/$name.t
90Writing $name/Changes
91Writing $name/MANIFEST
92EOXSFILES
93
94"-f -n $name -b 5.6.1", "5.006001", <<"EOXSFILES",
95Writing $name/ppport.h
96Writing $name/lib/$name.pm
97Writing $name/$name.xs
98Writing $name/fallback/const-c.inc
99Writing $name/fallback/const-xs.inc
100Writing $name/Makefile.PL
101Writing $name/README
102Writing $name/t/$name.t
103Writing $name/Changes