File: 000prereq.t

package info (click to toggle)
libcompress-raw-zlib-perl 2.213-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,148 kB
  • sloc: ansic: 6,992; perl: 2,934; makefile: 11
file content (223 lines) | stat: -rw-r--r-- 5,857 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
BEGIN {
    if ($ENV{PERL_CORE}) {
        chdir 't' if -d 't';
        @INC = ("../lib", "lib/compress");
    }
}

use lib qw(t t/compress);
use strict ;
use warnings ;

use Test::More ;

BEGIN
{

    diag "Running Perl version  $]\n";

    # use Test::NoWarnings, if available
    my $extra = 0 ;
    $extra = 1
        if eval { require Test::NoWarnings ;  import Test::NoWarnings; 1 };


    my $VERSION = '2.213';
    my @NAMES = qw(

			);

    my @OPT = qw(

			);

    plan tests => 1 + @NAMES + @OPT + $extra ;

    ok 1;

    foreach my $name (@NAMES)
    {
        use_ok($name, $VERSION);
    }


    foreach my $name (@OPT)
    {
        eval " require $name " ;
        if ($@)
        {
            ok 1, "$name not available"
        }
        else
        {
            my $ver = eval("\$${name}::VERSION");
            is $ver, $VERSION, "$name version should be $VERSION"
                or diag "$name version is $ver, need $VERSION" ;
        }
    }

}

sub bit
{
    return 1 << $_[0];
}

{
    # Print our versions of all modules used

    use Compress::Raw::Zlib;

    my @results = ( [ 'Perl', $] ] );
    my @modules = qw(
                    Compress::Raw::Zlib
                    );

    my %have = ();

    for my $module (@modules)
    {
        my $ver = packageVer($module) ;
        my $v = defined $ver
                    ? $ver
                    : "Not Installed" ;
        push @results, [$module, $v] ;
        $have{$module} ++
            if $ver ;
    }

    push @results, ['',''];
    push @results, ["zlib_version (from zlib library)", Compress::Raw::Zlib::zlib_version() ];
    push @results, ["ZLIB_VERSION (from zlib.h)", Compress::Raw::Zlib::ZLIB_VERSION ];
    push @results, ["ZLIB_VERNUM", sprintf("0x%x", Compress::Raw::Zlib::ZLIB_VERNUM) ];
    push @results, ['',''];

    push @results, ['BUILD_ZLIB',  $Compress::Raw::Zlib::BUILD_ZLIB];
    push @results, ['GZIP_OS_CODE',  $Compress::Raw::Zlib::gzip_os_code];
    push @results, ['',''];

    if (Compress::Raw::Zlib::is_zlibng)
    {
        push @results, ["Using zlib-ng", "Yes" ];

        push @results, ["zlibng_version", Compress::Raw::Zlib::zlibng_version() ];

        if (Compress::Raw::Zlib::is_zlibng_compat)
        {
            push @results, ["zlib-ng Mode", "Compat" ];
        }
        else
        {
            push @results, ["zlib-ng Mode", "Native" ];
        }

        my @ng = qw(
            ZLIBNG_VERSION
            ZLIBNG_VER_MAJOR
            ZLIBNG_VER_MINOR
            ZLIBNG_VER_REVISION
            ZLIBNG_VER_STATUS
            ZLIBNG_VER_MODIFIED
            );

        for my $n (@ng)
        {
            no strict 'refs';
            push @results, ["  $n", &{ "Compress::Raw::Zlib::$n" } ];
        }

        no strict 'refs';
        push @results, ["  ZLIBNG_VERNUM", sprintf("0x%x", &{ "Compress::Raw::Zlib::ZLIBNG_VERNUM" }) ];

    }
    else
    {
        push @results, ["Using zlib-ng", "No" ];
    }

    push @results, ['',''];
    push @results, ["is_zlib_native",   Compress::Raw::Zlib::is_zlib_native() ? 1 : 0 ];
    push @results, ["is_zlibng",        Compress::Raw::Zlib::is_zlibng() ?1 : 0];
    push @results, ["is_zlibng_native", Compress::Raw::Zlib::is_zlibng_native() ? 1 : 0 ];
    push @results, ["is_zlibng_compat", Compress::Raw::Zlib::is_zlibng_compat() ? 1 : 0];


    my $zlib_h = ZLIB_VERSION ;
    my $libz   = Compress::Raw::Zlib::zlib_version;
    my $ZLIB_VERNUM = sprintf ("0x%X", Compress::Raw::Zlib::ZLIB_VERNUM()) ;
    my $flags = Compress::Raw::Zlib::zlibCompileFlags();

    push @results, ['',''];
    push @results, ['zlibCompileFlags', $flags];
    push @results, ['  Type Sizes', ''];

    my %sizes = (
        0   => '16 bit',
        1   => '32 bit',
        2   => '64 bit',
        3   => 'other'
    );

    push @results, ['    size of uInt',      $sizes{ ($flags >> 0) & 0x3 } ];
    push @results, ['    size of uLong',     $sizes{ ($flags >> 2) & 0x3 } ];
    push @results, ['    size of pointer',   $sizes{ ($flags >> 4) & 0x3 } ];
    push @results, ['    size of z_off_t',   $sizes{ ($flags >> 6) & 0x3 } ];

    my @compiler_options;
    push @compiler_options, 'ZLIB_DEBUG'  if $flags & bit(8) ;
    push @compiler_options, 'ASM'         if $flags & bit(9) ;
    push @compiler_options, 'ZLIB_WINAPI' if $flags & bit(10) ;
    push @compiler_options, 'None'        unless @compiler_options;
    push @results, ['  Compiler Options', join ", ", @compiler_options];

    my @one_time;
    push @one_time, 'BUILDFIXED'  if $flags & bit(12) ;
    push @one_time, 'DYNAMIC_CRC_TABLE'  if $flags & bit(13) ;
    push @one_time, 'None'        unless @one_time;
    push @results, ['  One-time table building', join ", ", @one_time];

    my @library;
    push @library, 'NO_GZCOMPRESS'  if $flags & bit(16) ;
    push @library, 'NO_GZIP'  if $flags & bit(17) ;
    push @library, 'None'        unless @library;
    push @results, ['  Library content', join ", ", @library];

    my @operational;
    push @operational, 'PKZIP_BUG_WORKAROUND'  if $flags & bit(20) ;
    push @operational, 'FASTEST'  if $flags & bit(21) ;
    push @operational, 'None'        unless @operational;
    push @results, ['  Operation variations', join ", ", @operational];



    if ($have{"Compress::Raw::Lzma"})
    {
        my $ver = eval { Compress::Raw::Lzma::lzma_version_string(); } || "unknown";
        push @results, ["lzma", $ver] ;
    }

    use List::Util qw(max);
    my $width = max map { length $_->[0] } @results;

    diag "\n\n" ;
    for my $m (@results)
    {
        my ($name, $ver) = @$m;

        my $b = " " x (1 + $width - length $name);

        diag $name . $b . $ver . "\n" ;
    }

    diag "\n\n" ;
}

sub packageVer
{
    no strict 'refs';
    my $package = shift;

    eval "use $package;";
    return ${ "${package}::VERSION" };

}