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