There is no pthread_sigmask on VMS, so use sigprocmask instead.
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / arch_check.t
CommitLineData
5bdf71cc 1#!/usr/bin/perl -w
2
5bc8648c 3BEGIN {
4 if ($ENV{PERL_CORE}) {
5 chdir 't' if -d 't';
6 @INC = qw(../lib lib);
7 }
8}
9
5bdf71cc 10use strict;
11use lib 't/lib';
12
13use TieOut;
14use Test::More 'no_plan';
15
16use Config;
17use ExtUtils::MakeMaker;
18
19ok( my $stdout = tie *STDOUT, 'TieOut' );
20
21# Create a normalized MM object to test with
22my $mm = bless {}, "MM";
23$mm->{PERL_SRC} = 0;
24$mm->{UNINSTALLED_PERL} = 0;
25
26my $rel2abs = sub { $mm->rel2abs($mm->catfile(@_)) };
27
28ok $mm->arch_check(
29 $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
30 $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
31);
32
33
34# Different architecures.
35{
36 ok !$mm->arch_check(
37 $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
38 $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)),
39 );
40
41 like $stdout->read, qr{\Q
42Your perl and your Config.pm seem to have different ideas about the
43architecture they are running on.
44Perl thinks: [arch1]
45Config says: [$Config{archname}]
46This may or may not cause problems. Please check your installation of perl
47if you have problems building this extension.
48};
49
50}
51
52
53# Different file path separators [rt.cpan.org 46416]
54SKIP: {
55 skip "Can't load File::Spec::Win32" unless eval "require File::Spec::Win32";
56 local @File::Spec::ISA = qw(File::Spec::Win32);
57 ok $mm->arch_check(
58 "/_64/perl1004/lib/Config.pm",
59 '\\_64\\perl1004\\lib\\Config.pm',
60 );
61}
62
63
64# PERL_SRC is set, no check is done
65{
66 local $mm->{PERL_SRC} = 1;
67 ok $mm->arch_check(
68 $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
69 $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)),
70 );
71
72 is $stdout->read, '';
73}
74
75
76# UNINSTALLED_PERL is set, no message is sent
77{
78 local $mm->{UNINSTALLED_PERL} = 1;
79 ok !$mm->arch_check(
80 $rel2abs->(qw(. t testdata reallylongdirectoryname arch1 Config.pm)),
81 $rel2abs->(qw(. t testdata reallylongdirectoryname arch2 Config.pm)),
82 );
83
84 like $stdout->read, qr{^Have .*\nWant .*$};
85}