1#!/pro/bin/perl
2
3use strict;
4use warnings;
5
6BEGIN {
7    use Test::More;
8    my $tests = 135;
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}, "Aug 21 2022 08:56:37", "Build time");
25is ($conf->{config}{version}, "5.37.3", "reconstructed \$Config{version}");
26
27my $opt = Config::Perl::V::plv2hash ("")->{build}{options};
28foreach my $o (sort qw(
29	DEBUGGING HAS_TIMES MULTIPLICITY PERL_COPY_ON_WRITE
30	PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_SIPHASH13 PERL_HASH_USE_SBOX32
31	PERLIO_LAYERS PERL_MALLOC_WRAP PERL_OP_PARENT PERL_PRESERVE_IVUV
32	PERL_TRACK_MEMPOOL PERL_USE_DEVEL PERL_USE_SAFE_PUTENV USE_64_BIT_ALL
33	USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE
34	USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME
35	USE_LONG_DOUBLE USE_PERL_ATOF USE_PERLIO USE_REENTRANT_API
36	USE_THREAD_SAFE_LOCALE
37	)) {
38    is ($conf->{build}{options}{$o}, 1, "Runtime option $o set");
39    delete $opt->{$o};
40    }
41foreach my $o (sort keys %$opt) {
42    is ($conf->{build}{options}{$o}, 0, "Runtime option $o unset");
43    }
44
45eval { require Digest::MD5; };
46my $md5 = $@ ? "0" x 32 : "ff4175ca52fccf9c03c33d34af942b0d";
47ok (my $sig = Config::Perl::V::signature ($conf), "Get signature");
48
49SKIP: {
50    ord "A" == 65 or skip "ASCII-centric test", 1;
51    is ($sig, $md5, "MD5");
52    }
53
54is_deeply ($conf->{build}{patches}, [ ], "No patches");
55
56my %check = (
57    alignbytes      => 16,
58    api_version     => 37,
59    bincompat5005   => undef,	# GONE, chainsawed
60    byteorder       => 12345678,
61    cc              => "cc",
62    cccdlflags      => "-fPIC",
63    ccdlflags       => "-Wl,-E",
64    config_args     => "-Dusedevel -Dusethreads -Duseithreads -Duse64bitall -Duselongdouble -desr -Dusedevel -Uinstallusrbinperl -Dprefix=/media/Tux/perls-t",
65    gccversion      => "12.1.1 20220812 [revision 6b7d570a5001bb79e34c0d1626a8c7f55386dac7]",
66    gnulibc_version => "2.35",
67    ivsize          => 8,
68    ivtype          => "long",
69    ld              => "cc",
70    lddlflags       => "-shared -O2 -L/pro/local/lib -fstack-protector-strong",
71    ldflags         => "-L/pro/local/lib -fstack-protector-strong",
72    libc            => "/lib/../lib64/libc.so.6",
73    lseektype       => "off_t",
74    osvers          => "5.19.1-1-default",
75    use64bitall     => "define",
76    use64bitint     => "define",
77    usemymalloc     => "n",
78    default_inc_excludes_dot
79		    => "define",
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}, "define", "This build has . NOT in INC");
86
87__END__
88Summary of my perl5 (revision 5 version 37 subversion 3) configuration:
89   
90  Platform:
91    osname=linux
92    osvers=5.19.1-1-default
93    archname=x86_64-linux-thread-multi-ld
94    uname='linux lx09 5.19.1-1-default #1 smp preempt_dynamic thu aug 11 11:32:52 utc 2022 (a5bf6c0) x86_64 x86_64 x86_64 gnulinux '
95    config_args='-Dusedevel -Dusethreads -Duseithreads -Duse64bitall -Duselongdouble -desr -Dusedevel -Uinstallusrbinperl -Dprefix=/media/Tux/perls-t'
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=define
106  Compiler:
107    cc='cc'
108    ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
109    optimize='-O2'
110    cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/pro/local/include'
111    ccversion=''
112    gccversion='12.1.1 20220812 [revision 6b7d570a5001bb79e34c0d1626a8c7f55386dac7]'
113    gccosandvers=''
114    intsize=4
115    longsize=8
116    ptrsize=8
117    doublesize=8
118    byteorder=12345678
119    doublekind=3
120    d_longlong=define
121    longlongsize=8
122    d_longdbl=define
123    longdblsize=16
124    longdblkind=3
125    ivtype='long'
126    ivsize=8
127    nvtype='long double'
128    nvsize=16
129    Off_t='off_t'
130    lseeksize=8
131    alignbytes=16
132    prototype=define
133  Linker and Libraries:
134    ld='cc'
135    ldflags ='-L/pro/local/lib -fstack-protector-strong'
136    libpth=/usr/local/lib /usr/x86_64-suse-linux/lib /usr/lib /data/pro/local/lib /usr/lib64 /usr/local/lib64
137    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
138    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
139    libc=/lib/../lib64/libc.so.6
140    so=so
141    useshrplib=false
142    libperl=libperl.a
143    gnulibc_version='2.35'
144  Dynamic Linking:
145    dlsrc=dl_dlopen.xs
146    dlext=so
147    d_dlsymun=undef
148    ccdlflags='-Wl,-E'
149    cccdlflags='-fPIC'
150    lddlflags='-shared -O2 -L/pro/local/lib -fstack-protector-strong'
151
152
153Characteristics of this binary (from libperl): 
154  Compile-time options:
155    DEBUGGING
156    HAS_TIMES
157    MULTIPLICITY
158    PERLIO_LAYERS
159    PERL_COPY_ON_WRITE
160    PERL_DONT_CREATE_GVSV
161    PERL_HASH_FUNC_SIPHASH13
162    PERL_HASH_USE_SBOX32
163    PERL_MALLOC_WRAP
164    PERL_OP_PARENT
165    PERL_PRESERVE_IVUV
166    PERL_TRACK_MEMPOOL
167    PERL_USE_DEVEL
168    PERL_USE_SAFE_PUTENV
169    USE_64_BIT_ALL
170    USE_64_BIT_INT
171    USE_ITHREADS
172    USE_LARGE_FILES
173    USE_LOCALE
174    USE_LOCALE_COLLATE
175    USE_LOCALE_CTYPE
176    USE_LOCALE_NUMERIC
177    USE_LOCALE_TIME
178    USE_LONG_DOUBLE
179    USE_PERLIO
180    USE_PERL_ATOF
181    USE_REENTRANT_API
182    USE_THREAD_SAFE_LOCALE
183  Built under linux
184  Compiled at Aug 21 2022 08:56:37
185  %ENV:
186    PERL6LIB="inst#/pro/3gl/CPAN/rakudo/install"
187  @INC:
188    /media/Tux/perls-t/lib/site_perl/5.37.3/x86_64-linux-thread-multi-ld
189    /media/Tux/perls-t/lib/site_perl/5.37.3
190    /media/Tux/perls-t/lib/5.37.3/x86_64-linux-thread-multi-ld
191    /media/Tux/perls-t/lib/5.37.3
192