1#!/pro/bin/perl 2 3use strict; 4use warnings; 5 6BEGIN { 7 use Test::More; 8 my $tests = 134; 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 qw( summary ); 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}, "Jun 26 2018 12:17:32", "Build time"); 25is ($conf->{config}{version}, "5.28.0", "reconstructed \$Config{version}"); 26 27my $opt = Config::Perl::V::plv2hash ("")->{build}{options}; 28foreach my $o (sort qw( 29 HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_COPY_ON_WRITE 30 PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP 31 PERL_OP_PARENT PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT 32 USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE 33 USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME 34 USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API 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 : "4add7fd04b60c2048a46ff47087e6952"; 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 => 16, 56 api_version => 28, 57 bincompat5005 => "undef", 58 byteorder => 12345678, 59 cc => "cc", 60 cccdlflags => "-fPIC", 61 ccdlflags => "-Wl,-E", 62 config_args => "-Dusethreads -Duseithreads -Duse64bitall -Duselongdouble -des", 63 gccversion => "8.1.1 20180523 [gcc-8-branch revision 260570]", 64 gnulibc_version => "2.27", 65 ivsize => 8, 66 ivtype => "long", 67 ld => "cc", 68 lddlflags => "-shared -O2 -L/pro/local/lib -fstack-protector-strong", 69 ldflags => "-L/pro/local/lib -fstack-protector-strong", 70 libc => "libc-2.27.so", 71 lseektype => "off_t", 72 osvers => "4.17.2-1-default", 73 use64bitall => "define", 74 use64bitint => "define", 75 usemymalloc => "n", 76 default_inc_excludes_dot 77 => "define", 78 ); 79is ($conf->{config}{$_}, $check{$_}, "reconstructed \$Config{$_}") for sort keys %check; 80 81ok (my $info = summary ($conf), "A summary"); 82ok (exists $info->{$_}, "Summary has $_") for qw( cc config_args usemymalloc default_inc_excludes_dot ); 83is ($info->{default_inc_excludes_dot}, "define", "This build has . NOT in INC"); 84 85__END__ 86Summary of my perl5 (revision 5 version 28 subversion 0) configuration: 87 88 Platform: 89 osname=linux 90 osvers=4.17.2-1-default 91 archname=x86_64-linux-thread-multi-ld 92 uname='linux lx09 4.17.2-1-default #1 smp preempt sat jun 16 10:58:03 utc 2018 (ddde22d) x86_64 x86_64 x86_64 gnulinux ' 93 config_args='-Dusethreads -Duseithreads -Duse64bitall -Duselongdouble -des' 94 hint=recommended 95 useposix=true 96 d_sigaction=define 97 useithreads=define 98 usemultiplicity=define 99 use64bitint=define 100 use64bitall=define 101 uselongdouble=define 102 usemymalloc=n 103 default_inc_excludes_dot=define 104 bincompat5005=undef 105 Compiler: 106 cc='cc' 107 ccflags ='-D_REENTRANT -D_GNU_SOURCE -fPIC -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' 108 optimize='-O2' 109 cppflags='-D_REENTRANT -D_GNU_SOURCE -fPIC -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/pro/local/include' 110 ccversion='' 111 gccversion='8.1.1 20180523 [gcc-8-branch revision 260570]' 112 gccosandvers='' 113 intsize=4 114 longsize=8 115 ptrsize=8 116 doublesize=8 117 byteorder=12345678 118 doublekind=3 119 d_longlong=define 120 longlongsize=8 121 d_longdbl=define 122 longdblsize=16 123 longdblkind=3 124 ivtype='long' 125 ivsize=8 126 nvtype='long double' 127 nvsize=16 128 Off_t='off_t' 129 lseeksize=8 130 alignbytes=16 131 prototype=define 132 Linker and Libraries: 133 ld='cc' 134 ldflags ='-L/pro/local/lib -fstack-protector-strong' 135 libpth=/usr/local/lib /usr/lib64/gcc/x86_64-suse-linux/8/include-fixed /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/lib /usr/lib /pro/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64 136 libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat 137 perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc 138 libc=libc-2.27.so 139 so=so 140 useshrplib=false 141 libperl=libperl.a 142 gnulibc_version='2.27' 143 Dynamic Linking: 144 dlsrc=dl_dlopen.xs 145 dlext=so 146 d_dlsymun=undef 147 ccdlflags='-Wl,-E' 148 cccdlflags='-fPIC' 149 lddlflags='-shared -O2 -L/pro/local/lib -fstack-protector-strong' 150 151 152Characteristics of this binary (from libperl): 153 Compile-time options: 154 HAS_TIMES 155 MULTIPLICITY 156 PERLIO_LAYERS 157 PERL_COPY_ON_WRITE 158 PERL_DONT_CREATE_GVSV 159 PERL_IMPLICIT_CONTEXT 160 PERL_MALLOC_WRAP 161 PERL_OP_PARENT 162 PERL_PRESERVE_IVUV 163 USE_64_BIT_ALL 164 USE_64_BIT_INT 165 USE_ITHREADS 166 USE_LARGE_FILES 167 USE_LOCALE 168 USE_LOCALE_COLLATE 169 USE_LOCALE_CTYPE 170 USE_LOCALE_NUMERIC 171 USE_LOCALE_TIME 172 USE_LONG_DOUBLE 173 USE_PERLIO 174 USE_PERL_ATOF 175 USE_REENTRANT_API 176 Built under linux 177 Compiled at Jun 26 2018 12:17:32 178 @INC: 179 /pro/lib/perl5/site_perl/5.28.0/x86_64-linux-thread-multi-ld 180 /pro/lib/perl5/site_perl/5.28.0 181 /pro/lib/perl5/5.28.0/x86_64-linux-thread-multi-ld 182 /pro/lib/perl5/5.28.0 183