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}, "Jan  1 2022 11:18:27", "Build time");
25is ($conf->{config}{version}, "5.35.8", "reconstructed \$Config{version}");
26
27my $opt = Config::Perl::V::plv2hash ("")->{build}{options};
28foreach my $o (sort qw(
29	HAS_TIMES PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV
30	PERL_MALLOC_WRAP PERL_OP_PARENT PERL_PRESERVE_IVUV PERL_USE_DEVEL
31	USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE
32	USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC
33	USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF USE_QUADMATH
34	)) {
35    is ($conf->{build}{options}{$o}, 1, "Runtime option $o set");
36    delete $opt->{$o};
37    }
38foreach my $o (sort keys %$opt) {
39    is ($conf->{build}{options}{$o}, 0, "Runtime option $o unset");
40    }
41
42eval { require Digest::MD5; };
43my $md5 = $@ ? "0" x 32 : "3a52d65d54ee1032f878b51fb20c8efd";
44ok (my $sig = Config::Perl::V::signature ($conf), "Get signature");
45is ($sig, $md5, "MD5");
46
47is_deeply ($conf->{build}{patches}, [ ], "No patches");
48
49my %check = (
50    alignbytes      => 16,
51    api_version     => 35,
52    bincompat5005   => undef,
53    byteorder       => 12345678,
54    cc              => "cc",
55    cccdlflags      => "-fPIC",
56    ccdlflags       => "-Wl,-E",
57    config_args     => "-Dusedevel -Duse64bitall -Dusequadmath -Uuseperlio -des",
58    gccversion      => "11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b]",
59    gnulibc_version => "2.34",
60    ivsize          => 8,
61    ivtype          => "long",
62    ld              => "cc",
63    lddlflags       => "-shared -O2 -L/pro/local/lib -fstack-protector-strong",
64    ldflags         => "-L/pro/local/lib -fstack-protector-strong",
65    libc            => "/lib/../lib64/libc.so.6",
66    lseektype       => "off_t",
67    osvers          => "5.15.8-1-default",
68    use64bitall     => "define",
69    use64bitint     => "define",
70    usemymalloc     => "n",
71    default_inc_excludes_dot
72		    => "define",
73    );
74is ($conf->{config}{$_}, $check{$_}, "reconstructed \$Config{$_}") for sort keys %check;
75
76ok (my $info = summary ($conf), "A summary");
77ok (exists $info->{$_}, "Summary has $_") for qw( cc config_args usemymalloc default_inc_excludes_dot );
78is ($info->{default_inc_excludes_dot}, "define", "This build has . NOT in INC");
79
80__END__
81Summary of my perl5 (revision 5 version 35 subversion 8) configuration:
82  Snapshot of: 0ccfd062e2cfd32efe146d4c16faf3cae9e3cc84
83  Platform:
84    osname=linux
85    osvers=5.15.8-1-default
86    archname=x86_64-linux-quadmath
87    uname='linux lx09 5.15.8-1-default #1 smp wed dec 15 08:12:54 utc 2021 (0530e5c) x86_64 x86_64 x86_64 gnulinux '
88    config_args='-Dusedevel -Duse64bitall -Dusequadmath -Uuseperlio -des'
89    hint=recommended
90    useposix=true
91    d_sigaction=define
92    useithreads=undef
93    usemultiplicity=undef
94    use64bitint=define
95    use64bitall=define
96    uselongdouble=undef
97    usemymalloc=n
98    default_inc_excludes_dot=define
99  Compiler:
100    cc='cc'
101    ccflags ='-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'
102    optimize='-O2'
103    cppflags='-pie -fPIE -fPIC -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/pro/local/include'
104    ccversion=''
105    gccversion='11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b]'
106    gccosandvers=''
107    intsize=4
108    longsize=8
109    ptrsize=8
110    doublesize=8
111    byteorder=12345678
112    doublekind=3
113    d_longlong=define
114    longlongsize=8
115    d_longdbl=define
116    longdblsize=16
117    longdblkind=3
118    ivtype='long'
119    ivsize=8
120    nvtype='__float128'
121    nvsize=16
122    Off_t='off_t'
123    lseeksize=8
124    alignbytes=16
125    prototype=define
126  Linker and Libraries:
127    ld='cc'
128    ldflags ='-L/pro/local/lib -fstack-protector-strong'
129    libpth=/usr/local/lib /usr/x86_64-suse-linux/lib /usr/lib /data/pro/local/lib /usr/lib64 /usr/local/lib64
130    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat -lquadmath
131    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -lquadmath
132    libc=/lib/../lib64/libc.so.6
133    so=so
134    useshrplib=false
135    libperl=libperl.a
136    gnulibc_version='2.34'
137  Dynamic Linking:
138    dlsrc=dl_dlopen.xs
139    dlext=so
140    d_dlsymun=undef
141    ccdlflags='-Wl,-E'
142    cccdlflags='-fPIC'
143    lddlflags='-shared -O2 -L/pro/local/lib -fstack-protector-strong'
144
145
146Characteristics of this binary (from libperl):
147  Compile-time options:
148    HAS_TIMES
149    PERLIO_LAYERS
150    PERL_COPY_ON_WRITE
151    PERL_DONT_CREATE_GVSV
152    PERL_MALLOC_WRAP
153    PERL_OP_PARENT
154    PERL_PRESERVE_IVUV
155    PERL_USE_DEVEL
156    USE_64_BIT_ALL
157    USE_64_BIT_INT
158    USE_LARGE_FILES
159    USE_LOCALE
160    USE_LOCALE_COLLATE
161    USE_LOCALE_CTYPE
162    USE_LOCALE_NUMERIC
163    USE_LOCALE_TIME
164    USE_PERLIO
165    USE_PERL_ATOF
166    USE_QUADMATH
167  Built under linux
168  Compiled at Jan  1 2022 11:18:27
169  %ENV:
170    PERL6LIB="inst#/pro/3gl/CPAN/rakudo/install"
171  @INC:
172    lib
173    /pro/lib/perl5/site_perl/5.35.8/x86_64-linux-quadmath
174    /pro/lib/perl5/site_perl/5.35.8
175    /pro/lib/perl5/5.35.8/x86_64-linux-quadmath
176    /pro/lib/perl5/5.35.8
177