1#!/pro/bin/perl
2
3use strict;
4use warnings;
5
6BEGIN {
7    use Test::More;
8    my $tests = 118;
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}, "May 18 2013 17:34:20", "Build time");
25is ($conf->{config}{version}, "5.18.0", "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 : "8f46b07a7775e6a92347d4cd564b8f03";
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.7.2 20130108 [gcc-4_7-branch revision 195012]",
60    gnulibc_version => "2.17",
61    ivsize          => 8,
62    ivtype          => "long long",
63    ld              => "cc",
64    lddlflags       => "-shared -O3 -L/pro/local/lib -fstack-protector",
65    ldflags         => "-L/pro/local/lib -fstack-protector",
66    libc            => "/lib/libc-2.17.so",
67    lseektype       => "off_t",
68    osvers          => "3.7.10-1.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 0) configuration:
75
76  Platform:
77    osname=linux, osvers=3.7.10-1.4-desktop, archname=i686-linux-64int-ld
78    uname='linux test 3.7.10-1.4-desktop #1 smp preempt fri apr 19 12:06:34 utc 2013 (8ef74f8) 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='-O3',
88    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/pro/local/include'
89    ccversion='', gccversion='4.7.2 20130108 [gcc-4_7-branch revision 195012]', 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.17.so, so=so, useshrplib=false, libperl=libperl.a
100    gnulibc_version='2.17'
101  Dynamic Linking:
102    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
103    cccdlflags='-fPIC', lddlflags='-shared -O3 -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 May 18 2013 17:34:20
115  @INC:
116    /pro/lib/perl5/site_perl/5.18.0/i686-linux-64int-ld
117    /pro/lib/perl5/site_perl/5.18.0
118    /pro/lib/perl5/5.18.0/i686-linux-64int-ld
119    /pro/lib/perl5/5.18.0
120    .
121