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 19 2021 15:51:32", "Build time");
25is ($conf->{config}{version}, "5.34.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_THREAD_SAFE_LOCALE
32	USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
33	USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC
34	USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API USE_QUADMATH
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 : "12cfb15586bf005d29ff4c7ce770aefe";
45ok (my $sig = Config::Perl::V::signature ($conf), "Get signature");
46is ($sig, $md5, "MD5");
47
48is_deeply ($conf->{build}{patches}, [ ], "No patches");
49
50my %check = (
51    alignbytes      => 16,
52    api_version     => 34,
53    bincompat5005   => undef,
54    byteorder       => 12345678,
55    cc              => "cc",
56    cccdlflags      => "-fPIC",
57    ccdlflags       => "-Wl,-E -Wl,-rpath,/pro/lib/perl5/5.34.0/x86_64-linux-thread-multi-quadmath/CORE",
58    config_args     => "-Uversiononly -Dinc_version_list=none -Duse64bitall -Dusethreads -Duseithreads -Dusequadmath -Duseshrplib -des",
59    gccversion      => "7.5.0",
60    gnulibc_version => "2.26",
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.26.so",
67    lseektype       => "off_t",
68    osvers          => "5.3.18-lp152.78-preempt",
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 34 subversion 0) configuration:
83
84  Platform:
85    osname=linux
86    osvers=5.3.18-lp152.78-preempt
87    archname=x86_64-linux-thread-multi-quadmath
88    uname='linux pc09 5.3.18-lp152.78-preempt #1 smp preempt tue jun 1 14:53:21 utc 2021 (556d823) x86_64 x86_64 x86_64 gnulinux '
89    config_args='-Uversiononly -Dinc_version_list=none -Duse64bitall -Dusethreads -Duseithreads -Dusequadmath -Duseshrplib -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=undef
98    usemymalloc=n
99    default_inc_excludes_dot=define
100  Compiler:
101    cc='cc'
102    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 -D_FORTIFY_SOURCE=2'
103    optimize='-O2'
104    cppflags='-D_REENTRANT -D_GNU_SOURCE -fPIC -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/pro/local/include'
105    ccversion=''
106    gccversion='7.5.0'
107    gccosandvers=''
108    intsize=4
109    longsize=8
110    ptrsize=8
111    doublesize=8
112    byteorder=12345678
113    doublekind=3
114    d_longlong=define
115    longlongsize=8
116    d_longdbl=define
117    longdblsize=16
118    longdblkind=3
119    ivtype='long'
120    ivsize=8
121    nvtype='__float128'
122    nvsize=16
123    Off_t='off_t'
124    lseeksize=8
125    alignbytes=16
126    prototype=define
127  Linker and Libraries:
128    ld='cc'
129    ldflags ='-L/pro/local/lib -fstack-protector-strong'
130    libpth=/usr/local/lib /usr/x86_64-suse-linux/lib /usr/lib /pro/local/lib /lib64 /usr/lib64 /lib /usr/local/lib64
131    libs=-lpthread -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat -lquadmath
132    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc -lquadmath
133    libc=libc-2.26.so
134    so=so
135    useshrplib=true
136    libperl=libperl.so
137    gnulibc_version='2.26'
138  Dynamic Linking:
139    dlsrc=dl_dlopen.xs
140    dlext=so
141    d_dlsymun=undef
142    ccdlflags='-Wl,-E -Wl,-rpath,/pro/lib/perl5/5.34.0/x86_64-linux-thread-multi-quadmath/CORE'
143    cccdlflags='-fPIC'
144    lddlflags='-shared -O2 -L/pro/local/lib -fstack-protector-strong'
145
146
147Characteristics of this binary (from libperl):
148  Compile-time options:
149    HAS_TIMES
150    MULTIPLICITY
151    PERLIO_LAYERS
152    PERL_COPY_ON_WRITE
153    PERL_DONT_CREATE_GVSV
154    PERL_IMPLICIT_CONTEXT
155    PERL_MALLOC_WRAP
156    PERL_OP_PARENT
157    PERL_PRESERVE_IVUV
158    USE_64_BIT_ALL
159    USE_64_BIT_INT
160    USE_ITHREADS
161    USE_LARGE_FILES
162    USE_LOCALE
163    USE_LOCALE_COLLATE
164    USE_LOCALE_CTYPE
165    USE_LOCALE_NUMERIC
166    USE_LOCALE_TIME
167    USE_PERLIO
168    USE_PERL_ATOF
169    USE_QUADMATH
170    USE_REENTRANT_API
171    USE_THREAD_SAFE_LOCALE
172  Built under linux
173  Compiled at Jun 19 2021 15:51:32
174  %ENV:
175    PERL6LIB="inst#/pro/3gl/CPAN/rakudo/install"
176  @INC:
177    lib
178    /pro/lib/perl5/site_perl/5.34.0/x86_64-linux-thread-multi-quadmath
179    /pro/lib/perl5/site_perl/5.34.0
180    /pro/lib/perl5/5.34.0/x86_64-linux-thread-multi-quadmath
181    /pro/lib/perl5/5.34.0
182