| 1 |
use Test2::V0 -no_srand => 1; |
| 2 |
use Config; |
| 3 |
|
| 4 |
eval { require 'Test/More.pm' }; |
| 5 |
|
| 6 |
# This .t file is generated. |
| 7 |
# make changes instead to dist.ini |
| 8 |
|
| 9 |
my %modules; |
| 10 |
my $post_diag; |
| 11 |
|
| 12 |
$modules{$_} = $_ for qw( |
| 13 |
Alien::Base |
| 14 |
Alien::FFI |
| 15 |
Capture::Tiny |
| 16 |
Devel::Hide |
| 17 |
ExtUtils::CBuilder |
| 18 |
ExtUtils::MakeMaker |
| 19 |
ExtUtils::ParseXS |
| 20 |
FFI::CheckLib |
| 21 |
File::Spec::Functions |
| 22 |
IPC::Cmd |
| 23 |
JSON::PP |
| 24 |
List::Util |
| 25 |
Math::LongDouble |
| 26 |
PkgConfig |
| 27 |
Test2::API |
| 28 |
Test2::V0 |
| 29 |
autodie |
| 30 |
constant |
| 31 |
forks |
| 32 |
parent |
| 33 |
); |
| 34 |
|
| 35 |
$post_diag = sub { |
| 36 |
eval { |
| 37 |
require lib; |
| 38 |
lib->import('inc'); |
| 39 |
require FFI::Platypus::ShareConfig; |
| 40 |
require My::BuildConfig; |
| 41 |
my $build_config = My::BuildConfig->new; |
| 42 |
my $share_config = 'FFI::Platypus::ShareConfig'; |
| 43 |
my $class = $build_config->get('alien')->{class}; |
| 44 |
my $pm = "$class.pm"; |
| 45 |
$pm =~ s/::/\//g; |
| 46 |
require $pm; |
| 47 |
$Alien::FFI::pkgconfig::VERBOSE = |
| 48 |
$Alien::FFI::pkgconfig::VERBOSE = 0; |
| 49 |
require FFI::Platypus; |
| 50 |
require FFI::Platypus::Memory; |
| 51 |
diag "mode : ", $build_config->get('alien')->{mode}; |
| 52 |
diag "$class->VERSION = ", $class->VERSION; |
| 53 |
diag "$class->install_type = ", $class->install_type; |
| 54 |
diag "$class->cflags = ", $class->cflags; |
| 55 |
diag "$class->libs = ", $class->libs; |
| 56 |
diag "$class->version = ", $class->config('version'); |
| 57 |
diag "my_configure = ", $class->runtime_prop->{my_configure} if defined $class->runtime_prop->{my_configure}; |
| 58 |
spacer(); |
| 59 |
my %type_map = %{ $share_config->get('type_map') }; |
| 60 |
my $diag = $build_config->get('diag'); |
| 61 |
foreach my $key (sort keys %{ $diag->{args} }) |
| 62 |
{ |
| 63 |
diag "mb.args.$key=", $diag->{args}->{$key}; |
| 64 |
} |
| 65 |
foreach my $key (sort keys %{ $diag->{config} }) |
| 66 |
{ |
| 67 |
diag "config.$key=", $diag->{config}->{$key}; |
| 68 |
} |
| 69 |
diag "ffi.platypus.memory.strdup_impl =@{[ FFI::Platypus::Memory->_strdup_impl ]}"; |
| 70 |
diag "ffi.platypus.memory.strndup_impl=@{[ FFI::Platypus::Memory->_strndup_impl ]}"; |
| 71 |
spacer(); |
| 72 |
my %r; |
| 73 |
foreach my $k (keys %type_map) |
| 74 |
{ |
| 75 |
my $v = $type_map{$k}; |
| 76 |
push @{ $r{$v} }, $k; |
| 77 |
} |
| 78 |
diag "Types:"; |
| 79 |
foreach my $type (sort keys %r) |
| 80 |
{ |
| 81 |
diag sprintf(" %-8s : %s", $type, join(', ', sort @{ $r{$type} })); |
| 82 |
} |
| 83 |
spacer(); |
| 84 |
my $abi = FFI::Platypus->abis; |
| 85 |
diag "ABIs:"; |
| 86 |
foreach my $key (sort keys %$abi) |
| 87 |
{ |
| 88 |
diag sprintf(" %-20s %s", $key, $abi->{$key}); |
| 89 |
} |
| 90 |
spacer(); |
| 91 |
diag "Probes:"; |
| 92 |
my $probe = $share_config->get("probe"); |
| 93 |
diag sprintf(" %-20s %s", $_, $probe->{$_}) for keys %$probe; |
| 94 |
}; |
| 95 |
diag "extended diagnostic failed: $@" if $@; |
| 96 |
if(-f "/proc/cpuinfo") |
| 97 |
{ |
| 98 |
open my $fh, '<', '/proc/cpuinfo'; |
| 99 |
my @lines = <$fh>; |
| 100 |
close $fh; |
| 101 |
my($model_name) = grep /^model name/, @lines; |
| 102 |
my($flags) = grep /^flags/, @lines; |
| 103 |
my($address_sizes) = grep /^address sizes/, @lines; |
| 104 |
spacer(); |
| 105 |
diag "CPU Info:"; |
| 106 |
diag " $model_name"; |
| 107 |
diag " $flags" if $flags;; |
| 108 |
diag " $address_sizes" if $address_sizes; |
| 109 |
} |
| 110 |
require IPC::Cmd; |
| 111 |
require Capture::Tiny; |
| 112 |
if(IPC::Cmd::can_run('lsb_release')) |
| 113 |
{ |
| 114 |
spacer(); |
| 115 |
diag Capture::Tiny::capture_merged(sub { |
| 116 |
system 'lsb_release', '-a'; |
| 117 |
(); |
| 118 |
}); |
| 119 |
} |
| 120 |
require FFI::Build::Platform; |
| 121 |
spacer(); |
| 122 |
diag "[PLATFORM]\n"; |
| 123 |
diag(FFI::Build::Platform->diag); |
| 124 |
}; |
| 125 |
|
| 126 |
my @modules = sort keys %modules; |
| 127 |
|
| 128 |
sub spacer () |
| 129 |
{ |
| 130 |
diag ''; |
| 131 |
diag ''; |
| 132 |
diag ''; |
| 133 |
} |
| 134 |
|
| 135 |
pass 'okay'; |
| 136 |
|
| 137 |
my $max = 1; |
| 138 |
$max = $_ > $max ? $_ : $max for map { length $_ } @modules; |
| 139 |
our $format = "%-${max}s %s"; |
| 140 |
|
| 141 |
spacer; |
| 142 |
|
| 143 |
my @keys = sort grep /(MOJO|PERL|\A(LC|HARNESS)_|\A(SHELL|LANG)\Z)/i, keys %ENV; |
| 144 |
|
| 145 |
if(@keys > 0) |
| 146 |
{ |
| 147 |
diag "$_=$ENV{$_}" for @keys; |
| 148 |
|
| 149 |
if($ENV{PERL5LIB}) |
| 150 |
{ |
| 151 |
spacer; |
| 152 |
diag "PERL5LIB path"; |
| 153 |
diag $_ for split $Config{path_sep}, $ENV{PERL5LIB}; |
| 154 |
|
| 155 |
} |
| 156 |
elsif($ENV{PERLLIB}) |
| 157 |
{ |
| 158 |
spacer; |
| 159 |
diag "PERLLIB path"; |
| 160 |
diag $_ for split $Config{path_sep}, $ENV{PERLLIB}; |
| 161 |
} |
| 162 |
|
| 163 |
spacer; |
| 164 |
} |
| 165 |
|
| 166 |
diag sprintf $format, 'perl', "$] $^O $Config{archname}"; |
| 167 |
|
| 168 |
foreach my $module (sort @modules) |
| 169 |
{ |
| 170 |
my $pm = "$module.pm"; |
| 171 |
$pm =~ s{::}{/}g; |
| 172 |
if(eval { require $pm; 1 }) |
| 173 |
{ |
| 174 |
my $ver = eval { $module->VERSION }; |
| 175 |
$ver = 'undef' unless defined $ver; |
| 176 |
diag sprintf $format, $module, $ver; |
| 177 |
} |
| 178 |
else |
| 179 |
{ |
| 180 |
diag sprintf $format, $module, '-'; |
| 181 |
} |
| 182 |
} |
| 183 |
|
| 184 |
if($post_diag) |
| 185 |
{ |
| 186 |
spacer; |
| 187 |
$post_diag->(); |
| 188 |
} |
| 189 |
|
| 190 |
spacer; |
| 191 |
|
| 192 |
done_testing; |
| 193 |
|