1#!/pro/bin/perl
2
3use strict;
4use warnings;
5
6BEGIN {
7    use Test::More;
8    my $tests = 119;
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");
46is ($sig, $md5, "MD5");
47
48is_deeply ($conf->{build}{patches}, [], "No local patches");
49
50my %check = (
51    alignbytes      => 4,
52    api_version     => 18,
53    bincompat5005   => "undef",
54    byteorder       => 12345678,
55    cc              => "cc",
56    cccdlflags      => "-fPIC",
57    ccdlflags       => "-Wl,-E",
58    config_args     => "-Duse64bitint -Duselongdouble -des",
59    gccversion      => "4.8.1 20130909 [gcc-4_8-branch revision 202388]",
60    gnulibc_version => "2.18",
61    ivsize          => 8,
62    ivtype          => "long long",
63    ld              => "cc",
64    lddlflags       => "-shared -O2 -L/pro/local/lib -fstack-protector",
65    ldflags         => "-L/pro/local/lib -fstack-protector",
66    libc            => "/lib/libc-2.18.so",
67    lseektype       => "off_t",
68    osvers          => "3.11.6-4-desktop",
69    use64bitint     => "define",
70    );
71is ($conf->{config}{$_}, $check{$_}, "reconstructed \$Config{$_}") for sort keys %check;
72
73__END__
74Summary of my perl5 (revision 5 version 18 subversion 2) configuration:
75
76  Platform:
77    osname=linux, osvers=3.11.6-4-desktop, archname=i686-linux-64int-ld
78    uname='linux lx09 3.11.6-4-desktop #1 smp preempt wed oct 30 18:04:56 utc 2013 (e6d4a27) i686 i686 i386 gnulinux '
79    config_args='-Duse64bitint -Duselongdouble -des'
80    hint=recommended, useposix=true, d_sigaction=define
81    useithreads=undef, usemultiplicity=undef
82    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
83    use64bitint=define, use64bitall=undef, uselongdouble=define
84    usemymalloc=n, bincompat5005=undef
85  Compiler:
86    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
87    optimize='-O2',
88    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/pro/local/include'
89    ccversion='', gccversion='4.8.1 20130909 [gcc-4_8-branch revision 202388]', gccosandvers=''
90    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
91    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
92    ivtype='long long', ivsize=8, nvtype='long double', nvsize=12, Off_t='off_t', lseeksize=8
93    alignbytes=4, prototype=define
94  Linker and Libraries:
95    ld='cc', ldflags ='-L/pro/local/lib -fstack-protector'
96    libpth=/pro/local/lib /lib /usr/lib /usr/local/lib
97    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
98    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
99    libc=/lib/libc-2.18.so, so=so, useshrplib=false, libperl=libperl.a
100    gnulibc_version='2.18'
101  Dynamic Linking:
102    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
103    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/pro/local/lib -fstack-protector'
104
105
106Characteristics of this binary (from libperl):
107  Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
108                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
109                        PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_INT
110                        USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
111                        USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LONG_DOUBLE
112                        USE_PERLIO USE_PERL_ATOF
113  Built under linux
114  Compiled at Jan  9 2014 09:22:04
115  @INC:
116    /pro/lib/perl5/site_perl/5.18.2/i686-linux-64int-ld
117    /pro/lib/perl5/site_perl/5.18.2
118    /pro/lib/perl5/5.18.2/i686-linux-64int-ld
119    /pro/lib/perl5/5.18.2
120    .
121