xref: /openbsd-src/gnu/usr.bin/perl/cpan/Config-Perl-V/t/30_plv5240.t (revision f2a19305cfc49ea4d1a5feb55cd6c283c6f1e031)
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}, "May 10 2016 15:39:18", "Build time");
25is ($conf->{config}{version}, "5.24.0", "reconstructed \$Config{version}");
26
27my $opt = Config::Perl::V::plv2hash ("")->{build}{options};
28foreach my $o (sort qw(
29	DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_COPY_ON_WRITE
30	PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
31	PERL_TRACK_MEMPOOL PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
32	PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS
33	USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
34	USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME
35	USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API
36	)) {
37    is ($conf->{build}{options}{$o}, 1, "Runtime option $o set");
38    delete $opt->{$o};
39    }
40foreach my $o (sort keys %$opt) {
41    is ($conf->{build}{options}{$o}, 0, "Runtime option $o unset");
42    }
43
44eval { require Digest::MD5; };
45my $md5 = $@ ? "0" x 32 : "3dffae79f6d2c74073f0d64646709101";
46ok (my $sig = Config::Perl::V::signature ($conf), "Get signature");
47
48SKIP: {
49    ord "A" == 65 or skip "ASCII-centric test", 1;
50    is ($sig, $md5, "MD5");
51    }
52
53is_deeply ($conf->{build}{patches}, [], "No local patches");
54
55my %check = (
56    alignbytes      => 16,
57    api_version     => 24,
58    bincompat5005   => "undef",
59    byteorder       => 12345678,
60    cc              => "cc",
61    cccdlflags      => "-fPIC",
62    ccdlflags       => "-Wl,-E",
63    config_args     => "-Duse64bitall -Duselongdouble -Dusethreads -Duseithreads -des",
64    gccversion      => "5.3.1 20160412 [gcc-5-branch revision 234894]",
65    gnulibc_version => "2.23",
66    ivsize          => 8,
67    ivtype          => "long",
68    ld              => "cc",
69    lddlflags       => "-shared -O2 -L/pro/local/lib -fstack-protector-strong",
70    ldflags         => "-L/pro/local/lib -fstack-protector-strong",
71    libc            => "libc-2.23.so",
72    lseektype       => "off_t",
73    osvers          => "4.5.2-1-default",
74    use64bitall     => "define",
75    use64bitint     => "define",
76    usemymalloc     => "n",
77    default_inc_excludes_dot
78		    => "undef",
79    );
80is ($conf->{config}{$_}, $check{$_}, "reconstructed \$Config{$_}") for sort keys %check;
81
82ok (my $info = summary ($conf), "A summary");
83ok (exists $info->{$_}, "Summary has $_") for qw( cc config_args usemymalloc default_inc_excludes_dot );
84is ($info->{default_inc_excludes_dot}, "undef", "This build has . in INC");
85
86__END__
87Summary of my perl5 (revision 5 version 24 subversion 0) configuration:
88
89  Platform:
90    osname=linux, osvers=4.5.2-1-default, archname=x86_64-linux-thread-multi-ld
91    uname='linux lx09 4.5.2-1-default #1 smp preempt thu apr 21 09:07:52 utc 2016 (0454a6e) x86_64 x86_64 x86_64 gnulinux '
92    config_args='-Duse64bitall -Duselongdouble -Dusethreads -Duseithreads -des'
93    hint=recommended, useposix=true, d_sigaction=define
94    useithreads=define, usemultiplicity=define
95    use64bitint=define, use64bitall=define, uselongdouble=define
96    usemymalloc=n, bincompat5005=undef
97  Compiler:
98    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fPIC -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',
99    optimize='-O2',
100    cppflags='-D_REENTRANT -D_GNU_SOURCE -fPIC -DDEBUGGING -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/pro/local/include'
101    ccversion='', gccversion='5.3.1 20160412 [gcc-5-branch revision 234894]', gccosandvers=''
102    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
103    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
104    ivtype='long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8
105    alignbytes=16, prototype=define
106  Linker and Libraries:
107    ld='cc', ldflags ='-L/pro/local/lib -fstack-protector-strong'
108    libpth=/usr/local/lib /usr/lib64/gcc/x86_64-suse-linux/5/include-fixed /usr/lib64/gcc/x86_64-suse-linux/5/../../../../x86_64-suse-linux/lib /usr/lib /pro/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
109    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
110    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
111    libc=libc-2.23.so, so=so, useshrplib=false, libperl=libperl.a
112    gnulibc_version='2.23'
113  Dynamic Linking:
114    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
115    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/pro/local/lib -fstack-protector-strong'
116
117
118Characteristics of this binary (from libperl):
119  Compile-time options: DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS
120                        PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV
121                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
122                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
123                        PERL_PRESERVE_IVUV PERL_TRACK_MEMPOOL USE_64_BIT_ALL
124                        USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
125                        USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
126                        USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_LONG_DOUBLE
127                        USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API
128  Built under linux
129  Compiled at May 10 2016 15:39:18
130  @INC:
131    lib
132    /pro/lib/perl5/site_perl/5.24.0/x86_64-linux-thread-multi-ld
133    /pro/lib/perl5/site_perl/5.24.0
134    /pro/lib/perl5/5.24.0/x86_64-linux-thread-multi-ld
135    /pro/lib/perl5/5.24.0
136    .
137