Ticket #1227: config_gen_crypto_digest_t.patch

File config_gen_crypto_digest_t.patch, 2.5 KB (added by bubaflub, 12 years ago)

patch for config/gen/crypto/digest_t.in

  • config/gen/crypto/digest_t.in

    diff --git config/gen/crypto/digest_t.in config/gen/crypto/digest_t.in
    index 5a3ae17..5357e29 100644
     
    1 #! perl 
    2 # Copyright (C) 2009, Parrot Foundation. 
     1#! parrot 
     2# Copyright (C) 2001-2009, Parrot Foundation. 
    33# $Id$ 
    44 
    5 use strict; 
    6 use warnings; 
    7 use lib qw( . lib ../lib ../../lib ); 
    8 use Test::More; 
    9 use Parrot::Test; 
    10 use Parrot::Config; 
    11  
    125=head1 NAME 
    136 
    147t/dynpmc/@TEMP_md_file@.t - test the @TEMP_md_name@ PMC (part of digest_group) 
     
    2316 
    2417=cut 
    2518 
    26 if ( !$PConfig{has_crypto} ) { 
    27     plan skip_all => "No crypto library available"; 
    28 } 
    29 elsif ( $PConfig{openssl_version} lt '@TEMP_md_skip@' ) { 
    30     plan skip_all => "Too old library"; 
    31 } 
    32 else { 
    33     plan tests => 2; 
    34 } 
     19.sub main :main 
     20    .include 'test_more.pir' 
     21    .include 'iglobals.pasm' 
     22    .local pmc config_hash, interp 
     23 
     24    plan(2) 
     25    interp = getinterp 
     26    config_hash = interp[.IGLOBALS_CONFIG_HASH] 
     27    $S0 = config_hash['has_crypto'] 
     28    $S1 = config_hash['openssl_version'] 
     29    unless $S0 goto no_crypto 
     30    if $S1 < '0.9' goto old_openssl 
     31 
     32    test_typeof() 
     33    test_digest() 
     34    .return() 
     35  no_crypto: 
     36    skip(2, 'No crypto library available') 
     37    .return() 
     38  old_openssl: 
     39    skip(2, 'Too old openssl library, needs at least 0.9') 
     40.end 
     41 
    3542 
    36 pir_output_is( << 'CODE', << 'OUTPUT', '@TEMP_md_name@ typeof' ); 
    37 .sub test :main 
     43.sub test_typeof 
    3844    $P0 = loadlib 'digest_group' 
    3945    .local pmc md 
    4046    md = new '@TEMP_md_name@' 
    4147    $S0 = typeof md 
    42     say $S0 
     48    is($S0, '@TEMP_md_name@', '@TEMP_md_name@ typeof') 
    4349.end 
    44 CODE 
    45 @TEMP_md_name@ 
    46 OUTPUT 
    4750 
    48 pir_output_like( << 'CODE', << 'OUTPUT', '@TEMP_md_name@ digest' ); 
    49 .sub test :main 
     51.sub test_digest 
    5052    $P0 = loadlib 'digest_group' 
    5153    .local pmc md 
    5254    md = new '@TEMP_md_name@' 
     
    5759    $P0 = split '', $S0 
    5860    new $P1, 'FixedPMCArray' 
    5961    set $P1, 1 
     62    $S3 = '' 
    6063  L1: 
    6164    unless $P0 goto L2 
    6265    $S1 = shift $P0 
    6366    $I1 = ord $S1 
    6467    $P1[0] = $I1 
    6568    $S2 = sprintf '%02x', $P1 
    66     print $S2 
     69    $S3 .= $S2 
    6770    goto L1 
    6871  L2: 
    69     print "\n" 
     72    like($S3, '@TEMP_md_result@', '@TEMP_md_name@ digest') 
    7073.end 
    71 CODE 
    72 /^@TEMP_md_result@$/ 
    73 OUTPUT 
    7474 
    7575# Local Variables: 
    7676#   mode: cperl 
    7777#   cperl-indent-level: 4 
    7878#   fill-column: 100 
    7979# End: 
    80 # vim: expandtab shiftwidth=4: 
     80# vim: expandtab shiftwidth=4 filetype=pir: