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}, "Feb 27 2017 15:02:41", "Build time");
25is ($conf->{config}{version}, "5.25.11", "reconstructed \$Config{version}");
26
27my $opt = Config::Perl::V::plv2hash ("")->{build}{options};
28foreach my $o (sort qw(
29	DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_COPY_ON_WRITE
30	PERL_DONT_CREATE_GVSV PERL_TRACK_MEMPOOL PERL_IMPLICIT_CONTEXT
31	PERL_MALLOC_WRAP PERL_OP_PARENT PERL_PRESERVE_IVUV PERL_USE_DEVEL
32	USE_64_BIT_ALL
33	USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
34	USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME
35	USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API
36	)) {
37    is ($conf->{build}{options}{$o}, 1, "Runtime option $o set");
38    delete $opt->{$o};
39    }
40foreach my $o (sort keys %$opt) {
41    is ($conf->{build}{options}{$o}, 0, "Runtime option $o unset");
42    }
43
44eval { require Digest::MD5; };
45my $md5 = $@ ? "0" x 32 : "f0e463400e40ca35b67cec3834b5b9b7";
46ok (my $sig = Config::Perl::V::signature ($conf), "Get signature");
47
48SKIP: {
49    ord "A" == 65 or skip "ASCII-centric test", 1;
50    is ($sig, $md5, "MD5");
51    }
52
53is_deeply ($conf->{build}{patches},
54    [ "SMOKEaa9ac6cf00899a6f55881d4ca6c1214215dc83ee" ], "Local patches");
55
56my %check = (
57    alignbytes      => 16,
58    api_version     => 25,
59    bincompat5005   => "undef",
60    byteorder       => 12345678,
61    cc              => "cc",
62    cccdlflags      => "-fPIC",
63    ccdlflags       => "-Wl,-E",
64    config_args     => "-des -Dusedevel -Duseithreads -Duse64bitall -Duselongdouble -DDEBUGGING",
65    gccversion      => "6.3.1 20170202 [gcc-6-branch revision 245119]",
66    gnulibc_version => "2.24",
67    ivsize          => 8,
68    ivtype          => "long",
69    ld              => "cc",
70    lddlflags       => "-shared -O2 -g -L/pro/local/lib -fstack-protector-strong",
71    ldflags         => "-L/pro/local/lib -fstack-protector-strong",
72    libc            => "libc-2.24.so",
73    lseektype       => "off_t",
74    osvers          => "4.10.0-1-default",
75    use64bitall     => "define",
76    use64bitint     => "define",
77    usemymalloc     => "n",
78    default_inc_excludes_dot
79		    => "undef",
80    );
81is ($conf->{config}{$_}, $check{$_}, "reconstructed \$Config{$_}") for sort keys %check;
82
83ok (my $info = summary ($conf), "A summary");
84ok (exists $info->{$_}, "Summary has $_") for qw( cc config_args usemymalloc default_inc_excludes_dot );
85is ($info->{default_inc_excludes_dot}, "undef", "This build has . in INC");
86
87__END__
88Summary of my perl5 (revision 5 version 25 subversion 11) configuration:
89  Snapshot of: aa9ac6cf00899a6f55881d4ca6c1214215dc83ee
90  Platform:
91    osname=linux
92    osvers=4.10.0-1-default
93    archname=x86_64-linux-thread-multi-ld
94    uname='linux lx09 4.10.0-1-default #1 smp preempt mon feb 20 16:47:26 utc 2017 (81ace5a) x86_64 x86_64 x86_64 gnulinux '
95    config_args='-des -Dusedevel -Duseithreads -Duse64bitall -Duselongdouble -DDEBUGGING'
96    hint=recommended
97    useposix=true
98    d_sigaction=define
99    useithreads=define
100    usemultiplicity=define
101    use64bitint=define
102    use64bitall=define
103    uselongdouble=define
104    usemymalloc=n
105    default_inc_excludes_dot=undef
106    bincompat5005=undef
107  Compiler:
108    cc='cc'
109    ccflags ='-D_REENTRANT -D_GNU_SOURCE -fPIC -DDEBUGGING -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
110    optimize='-O2 -g'
111    cppflags='-D_REENTRANT -D_GNU_SOURCE -fPIC -DDEBUGGING -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/pro/local/include'
112    ccversion=''
113    gccversion='6.3.1 20170202 [gcc-6-branch revision 245119]'
114    gccosandvers=''
115    intsize=4
116    longsize=8
117    ptrsize=8
118    doublesize=8
119    byteorder=12345678
120    doublekind=3
121    d_longlong=define
122    longlongsize=8
123    d_longdbl=define
124    longdblsize=16
125    longdblkind=3
126    ivtype='long'
127    ivsize=8
128    nvtype='long double'
129    nvsize=16
130    Off_t='off_t'
131    lseeksize=8
132    alignbytes=16
133    prototype=define
134  Linker and Libraries:
135    ld='cc'
136    ldflags ='-L/pro/local/lib -fstack-protector-strong'
137    libpth=/usr/local/lib /usr/lib64/gcc/x86_64-suse-linux/6/include-fixed /usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/lib /usr/lib /pro/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
138    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
139    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
140    libc=libc-2.24.so
141    so=so
142    useshrplib=false
143    libperl=libperl.a
144    gnulibc_version='2.24'
145  Dynamic Linking:
146    dlsrc=dl_dlopen.xs
147    dlext=so
148    d_dlsymun=undef
149    ccdlflags='-Wl,-E'
150    cccdlflags='-fPIC'
151    lddlflags='-shared -O2 -g -L/pro/local/lib -fstack-protector-strong'
152
153
154Characteristics of this binary (from libperl):
155  Compile-time options:
156    DEBUGGING
157    HAS_TIMES
158    MULTIPLICITY
159    PERLIO_LAYERS
160    PERL_COPY_ON_WRITE
161    PERL_DONT_CREATE_GVSV
162    PERL_IMPLICIT_CONTEXT
163    PERL_MALLOC_WRAP
164    PERL_OP_PARENT
165    PERL_PRESERVE_IVUV
166    PERL_TRACK_MEMPOOL
167    PERL_USE_DEVEL
168    USE_64_BIT_ALL
169    USE_64_BIT_INT
170    USE_ITHREADS
171    USE_LARGE_FILES
172    USE_LOCALE
173    USE_LOCALE_COLLATE
174    USE_LOCALE_CTYPE
175    USE_LOCALE_NUMERIC
176    USE_LOCALE_TIME
177    USE_LONG_DOUBLE
178    USE_PERLIO
179    USE_PERL_ATOF
180    USE_REENTRANT_API
181  Locally applied patches:
182    SMOKEaa9ac6cf00899a6f55881d4ca6c1214215dc83ee
183  Built under linux
184  Compiled at Feb 27 2017 15:02:41
185  @INC:
186    lib
187    /pro/lib/perl5/site_perl/5.25.11/x86_64-linux-thread-multi-ld
188    /pro/lib/perl5/site_perl/5.25.11
189    /pro/lib/perl5/5.25.11/x86_64-linux-thread-multi-ld
190    /pro/lib/perl5/5.25.11
191    .
192