1#!/pro/bin/perl 2 3use strict; 4use warnings; 5 6BEGIN { 7 use Test::More; 8 my $tests = 125; 9 unless ($ENV{PERL_CORE}) { 10 require Test::NoWarnings; 11 Test::NoWarnings->import (); 12 $tests++; 13 } 14 15 plan tests => $tests; 16 } 17 18use Config::Perl::V; 19 20ok (my $conf = Config::Perl::V::plv2hash (<DATA>), "Read perl -v block"); 21ok (exists $conf->{$_}, "Has $_ entry") for qw( build environment config inc ); 22 23is ($conf->{build}{osname}, $conf->{config}{osname}, "osname"); 24is ($conf->{build}{stamp}, "Jan 9 2014 09:22:04", "Build time"); 25is ($conf->{config}{version}, "5.18.2", "reconstructed \$Config{version}"); 26 27my $opt = Config::Perl::V::plv2hash ("")->{build}{options}; 28foreach my $o (sort qw( 29 HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV 30 PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP 31 PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_INT 32 USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE 33 USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LONG_DOUBLE 34 USE_PERLIO USE_PERL_ATOF 35 )) { 36 is ($conf->{build}{options}{$o}, 1, "Runtime option $o set"); 37 delete $opt->{$o}; 38 } 39foreach my $o (sort keys %$opt) { 40 is ($conf->{build}{options}{$o}, 0, "Runtime option $o unset"); 41 } 42 43eval { require Digest::MD5; }; 44my $md5 = $@ ? "0" x 32 : "874325856acfea3dab7e7c944660f398"; 45ok (my $sig = Config::Perl::V::signature ($conf), "Get signature"); 46 47SKIP: { 48 ord "A" == 65 or skip "ASCII-centric test", 1; 49 is ($sig, $md5, "MD5"); 50 } 51 52is_deeply ($conf->{build}{patches}, [], "No local patches"); 53 54my %check = ( 55 alignbytes => 4, 56 api_version => 18, 57 bincompat5005 => "undef", 58 byteorder => 12345678, 59 cc => "cc", 60 cccdlflags => "-fPIC", 61 ccdlflags => "-Wl,-E", 62 config_args => "-Duse64bitint -Duselongdouble -des", 63 gccversion => "4.8.1 20130909 [gcc-4_8-branch revision 202388]", 64 gnulibc_version => "2.18", 65 ivsize => 8, 66 ivtype => "long long", 67 ld => "cc", 68 lddlflags => "-shared -O2 -L/pro/local/lib -fstack-protector", 69 ldflags => "-L/pro/local/lib -fstack-protector", 70 libc => "/lib/libc-2.18.so", 71 lseektype => "off_t", 72 osvers => "3.11.6-4-desktop", 73 use64bitint => "define", 74 ); 75is ($conf->{config}{$_}, $check{$_}, "reconstructed \$Config{$_}") for sort keys %check; 76 77__END__ 78Summary of my perl5 (revision 5 version 18 subversion 2) configuration: 79 80 Platform: 81 osname=linux, osvers=3.11.6-4-desktop, archname=i686-linux-64int-ld 82 uname='linux lx09 3.11.6-4-desktop #1 smp preempt wed oct 30 18:04:56 utc 2013 (e6d4a27) i686 i686 i386 gnulinux ' 83 config_args='-Duse64bitint -Duselongdouble -des' 84 hint=recommended, useposix=true, d_sigaction=define 85 useithreads=undef, usemultiplicity=undef 86 useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef 87 use64bitint=define, use64bitall=undef, uselongdouble=define 88 usemymalloc=n, bincompat5005=undef 89 Compiler: 90 cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', 91 optimize='-O2', 92 cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/pro/local/include' 93 ccversion='', gccversion='4.8.1 20130909 [gcc-4_8-branch revision 202388]', gccosandvers='' 94 intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 95 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 96 ivtype='long long', ivsize=8, nvtype='long double', nvsize=12, Off_t='off_t', lseeksize=8 97 alignbytes=4, prototype=define 98 Linker and Libraries: 99 ld='cc', ldflags ='-L/pro/local/lib -fstack-protector' 100 libpth=/pro/local/lib /lib /usr/lib /usr/local/lib 101 libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat 102 perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc 103 libc=/lib/libc-2.18.so, so=so, useshrplib=false, libperl=libperl.a 104 gnulibc_version='2.18' 105 Dynamic Linking: 106 dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' 107 cccdlflags='-fPIC', lddlflags='-shared -O2 -L/pro/local/lib -fstack-protector' 108 109 110Characteristics of this binary (from libperl): 111 Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV 112 PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP 113 PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_INT 114 USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE 115 USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LONG_DOUBLE 116 USE_PERLIO USE_PERL_ATOF 117 Built under linux 118 Compiled at Jan 9 2014 09:22:04 119 @INC: 120 /pro/lib/perl5/site_perl/5.18.2/i686-linux-64int-ld 121 /pro/lib/perl5/site_perl/5.18.2 122 /pro/lib/perl5/5.18.2/i686-linux-64int-ld 123 /pro/lib/perl5/5.18.2 124 . 125