Commit | Line | Data |
---|---|---|
0598b5ab NC |
1 | #!../miniperl -w |
2 | ||
3 | BEGIN { | |
4 | @INC = qw(../win32 ../lib); | |
0724ad87 | 5 | require './test.pl'; |
028bf728 NC |
6 | skip_all('FindExt not portable') |
7 | if $^O eq 'VMS'; | |
0598b5ab NC |
8 | } |
9 | use strict; | |
d6fb8979 | 10 | use Config; |
0598b5ab | 11 | |
0724ad87 NC |
12 | # Test that Win32/FindExt.pm is consistent with Configure in determining the |
13 | # types of extensions. | |
14 | # It's not possible to check the list of built dynamic extensions, as that | |
15 | # varies based on which headers are present, and which options ./Configure was | |
16 | # invoked with. | |
17 | ||
0b4dcbc1 JD |
18 | if ($^O eq "MSWin32" && !defined $ENV{PERL_STATIC_EXT}) { |
19 | skip_all "PERL_STATIC_EXT must be set to the list of static extensions"; | |
20 | } | |
21 | ||
d6fb8979 TC |
22 | unless (defined $Config{usedl}) { |
23 | skip_all "FindExt just plain broken for static perl."; | |
24 | } | |
25 | ||
0724ad87 | 26 | plan tests => 10; |
0598b5ab | 27 | use FindExt; |
0598b5ab | 28 | |
557ab4cb | 29 | FindExt::apply_config(\%Config); |
57ad57e0 | 30 | FindExt::scan_ext('../cpan'); |
0724ad87 | 31 | FindExt::scan_ext('../dist'); |
0598b5ab | 32 | FindExt::scan_ext('../ext'); |
0b4dcbc1 | 33 | FindExt::set_static_extensions(split ' ', $ENV{PERL_STATIC_EXT}) if $^O eq "MSWin32"; |
d6fb8979 | 34 | FindExt::set_static_extensions(split ' ', $Config{static_ext}) unless $^O eq "MSWin32"; |
0598b5ab NC |
35 | |
36 | # Config.pm and FindExt.pm make different choices about what should be built | |
37 | my @config_built; | |
38 | my @found_built; | |
39 | { | |
40 | foreach my $type (qw(static dynamic nonxs)) { | |
41 | push @found_built, eval "FindExt::${type}_ext()"; | |
42 | push @config_built, split ' ', $Config{"${type}_ext"}; | |
43 | } | |
44 | } | |
45 | @config_built = sort @config_built; | |
46 | @found_built = sort @found_built; | |
47 | ||
48 | foreach (['static_ext', | |
49 | [FindExt::static_ext()], $Config{static_ext}], | |
50 | ['nonxs_ext', | |
51 | [FindExt::nonxs_ext()], $Config{nonxs_ext}], | |
52 | ['known_extensions', | |
53 | [FindExt::known_extensions()], $Config{known_extensions}], | |
54 | ['"config" dynamic + static + nonxs', | |
55 | \@config_built, $Config{extensions}], | |
56 | ['"found" dynamic + static + nonxs', | |
57 | \@found_built, join " ", FindExt::extensions()], | |
58 | ) { | |
59 | my ($type, $found, $config) = @$_; | |
60 | my @config = sort split ' ', $config; | |
61 | is (scalar @$found, scalar @config, | |
62 | "We find the same number of $type"); | |
0724ad87 | 63 | is ("@$found", "@config", "We find the same list of $type"); |
0598b5ab | 64 | } |