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 10 2022 14:46:57", "Build time");
25is ($conf->{config}{version}, "5.36.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_MALLOC_WRAP PERL_OP_PARENT
31	PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS
32	USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
33	USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF
34	USE_QUADMATH USE_REENTRANT_API USE_THREAD_SAFE_LOCALE
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 : "e8348134908b3d371c277aff6da654b8";
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     => 36,
53    bincompat5005   => undef,
54    byteorder       => 12345678,
55    cc              => "cc",
56    cccdlflags      => "-fPIC",
57    ccdlflags       => "-Wl,-E -Wl,-rpath,/pro/lib/perl5/5.36.0/x86_64-linux-thread-multi-quadmath/CORE",
58    config_args     => "-Uversiononly -Dinc_version_list=none -Duse64bitall -Dusethreads -Duseithreads -Dusequadmath -Duseshrplib -des",
59    gccversion      => "12.1.0",
60    gnulibc_version => "2.35",
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            => "/lib/../lib64/libc.so.6",
67    lseektype       => "off_t",
68    osvers          => "5.18.1-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 36 subversion 0) configuration:
83   
84  Platform:
85    osname=linux
86    osvers=5.18.1-1-default
87    archname=x86_64-linux-thread-multi-quadmath
88    uname='linux lx09 5.18.1-1-default #1 smp preempt_dynamic mon may 30 07:49:01 utc 2022 (d00e88d) 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 -pie -fPIE -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 -pie -fPIE -fPIC -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/pro/local/include'
105    ccversion=''
106    gccversion='12.1.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 /data/pro/local/lib /usr/lib64 /usr/local/lib64
131    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat -lquadmath
132    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -lquadmath
133    libc=/lib/../lib64/libc.so.6
134    so=so
135    useshrplib=true
136    libperl=libperl.so
137    gnulibc_version='2.35'
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.36.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_MALLOC_WRAP
155    PERL_OP_PARENT
156    PERL_PRESERVE_IVUV
157    USE_64_BIT_ALL
158    USE_64_BIT_INT
159    USE_ITHREADS
160    USE_LARGE_FILES
161    USE_LOCALE
162    USE_LOCALE_COLLATE
163    USE_LOCALE_CTYPE
164    USE_LOCALE_NUMERIC
165    USE_LOCALE_TIME
166    USE_PERLIO
167    USE_PERL_ATOF
168    USE_QUADMATH
169    USE_REENTRANT_API
170    USE_THREAD_SAFE_LOCALE
171  Built under linux
172  Compiled at Jun 10 2022 14:46:57
173  %ENV:
174    PERL6LIB="inst#/pro/3gl/CPAN/rakudo/install"
175  @INC:
176    /pro/lib/perl5/site_perl/5.36.0/x86_64-linux-thread-multi-quadmath
177    /pro/lib/perl5/site_perl/5.36.0
178    /pro/lib/perl5/5.36.0/x86_64-linux-thread-multi-quadmath
179    /pro/lib/perl5/5.36.0
180