Ticket #1680: t.steps.gen.opengl.patch

File t.steps.gen.opengl.patch, 4.5 KB (added by jkeenan, 12 years ago)

Patch to skip some tests in t/steps/gen/opengl-01.t when OpenGL not really present

  • t/steps/gen/opengl-01.t

     
    55 
    66use strict; 
    77use warnings; 
    8 use Test::More tests =>  20; 
     8use Test::More qw(no_plan); # tests =>  20; 
    99use Carp; 
    1010use lib qw( lib ); 
    1111use_ok('config::gen::opengl'); 
     
    2828my $conf = Parrot::Configure::Step::Test->new; 
    2929$conf->include_config_results( $args ); 
    3030 
     31my $real_opengl_status = $conf->data->get('has_opengl'); 
     32 
    3133my ($pkg, $step, $result); 
    3234my $serialized = $conf->pcfreeze(); 
    3335 
     
    4244ok($result, "runstep() returned true value"); 
    4345is($step->result(), q{skipped}, "Got expected result when no 'has_opengl'" ); 
    4446 
    45 $conf->replenish($serialized); 
     47SKIP: { 
     48    skip 'opengl not detected', 
     49    13 unless $real_opengl_status; 
    4650 
    47 ########### verbose ########### 
     51    # The complex nature of gen::opengl::runstep() makes it difficult to write 
     52    # tests that will DTRT when OpenGL is not really present on this machine. 
     53    # In particular, tests for verbose output will fail when 
     54    # $real_opengl_status is false.  So we'll SKIP. 
    4855 
    49 ($args, $step_list_ref) = process_options( { 
    50     argv => [ q{--verbose} ], 
    51     mode => q{configure}, 
    52 } ); 
    53  
    54 $conf->add_steps($pkg); 
    55 $conf->options->set( %{$args} ); 
    56 $step = test_step_constructor_and_description($conf); 
    57 { 
    58     my ($stdout, $stderr); 
    59     capture( 
    60         sub { $result = $step->runstep($conf); }, 
    61         \$stdout, 
    62         \$stderr, 
    63     ); 
    64     ok($result, "runstep() returned true value"); 
    65     like( $stdout, 
    66         qr/Checking for OpenGL headers using the following globs/s, 
    67         "Got expected verbose output" 
    68     ); 
    69     like( $stdout, 
    70         qr/Found the following OpenGL headers/s, 
    71         "Got expected verbose output" 
    72     ); 
    73     like( $stdout, 
    74         qr/PASS\s+FAIL\s+IGNORE\s+HEADER/s, 
    75         "Got expected verbose output" 
    76     ); 
    77     like( $stdout, 
    78         qr/unique signatures successfully translated/s, 
    79         "Got expected verbose output" 
    80     ); 
     56    $conf->replenish($serialized); 
     57     
     58    ########### verbose ########### 
     59     
     60    ($args, $step_list_ref) = process_options( { 
     61        argv => [ q{--verbose} ], 
     62        mode => q{configure}, 
     63    } ); 
     64     
     65    $conf->add_steps($pkg); 
     66    $conf->options->set( %{$args} ); 
     67    $step = test_step_constructor_and_description($conf); 
     68    { 
     69        my ($stdout, $stderr); 
     70        capture( 
     71            sub { $result = $step->runstep($conf); }, 
     72            \$stdout, 
     73            \$stderr, 
     74        ); 
     75        ok($result, "runstep() returned true value"); 
     76        like( $stdout, 
     77            qr/Checking for OpenGL headers using the following globs/s, 
     78            "Got expected verbose output" 
     79        ); 
     80        like( $stdout, 
     81            qr/Found the following OpenGL headers/s, 
     82            "Got expected verbose output" 
     83        ); 
     84        like( $stdout, 
     85            qr/PASS\s+FAIL\s+IGNORE\s+HEADER/s, 
     86            "Got expected verbose output" 
     87        ); 
     88        like( $stdout, 
     89            qr/unique signatures successfully translated/s, 
     90            "Got expected verbose output" 
     91        ); 
     92    } 
     93     
     94    $conf->replenish($serialized); 
     95     
     96    ########### extra verbose ########### 
     97     
     98    ($args, $step_list_ref) = process_options( { 
     99        argv => [ q{--verbose=3} ], 
     100        mode => q{configure}, 
     101    } ); 
     102     
     103    $conf->add_steps($pkg); 
     104    $conf->options->set( %{$args} ); 
     105    $step = test_step_constructor_and_description($conf); 
     106    { 
     107        my ($stdout, $stderr); 
     108        capture( 
     109            sub { $result = $step->runstep($conf); }, 
     110            \$stdout, 
     111            \$stderr, 
     112        ); 
     113        ok($result, "runstep() returned true value"); 
     114        like( $stdout, 
     115            qr/COUNT\s+NCI SIGNATURE/s, 
     116            "Got expected verbose output" 
     117        ); 
     118    } 
    81119} 
    82120 
    83 $conf->replenish($serialized); 
    84  
    85 ########### extra verbose ########### 
    86  
    87 ($args, $step_list_ref) = process_options( { 
    88     argv => [ q{--verbose=3} ], 
    89     mode => q{configure}, 
    90 } ); 
    91  
    92 $conf->add_steps($pkg); 
    93 $conf->options->set( %{$args} ); 
    94 $step = test_step_constructor_and_description($conf); 
    95 { 
    96     my ($stdout, $stderr); 
    97     capture( 
    98         sub { $result = $step->runstep($conf); }, 
    99         \$stdout, 
    100         \$stderr, 
    101     ); 
    102     ok($result, "runstep() returned true value"); 
    103     like( $stdout, 
    104         qr/COUNT\s+NCI SIGNATURE/s, 
    105         "Got expected verbose output" 
    106     ); 
    107 } 
    108  
    109121pass("Completed all tests in $0"); 
    110122 
    111123################### DOCUMENTATION ###################