1*b39c5158Smillert#!/usr/bin/perl -w 2*b39c5158Smillert 3*b39c5158SmillertBEGIN { 4*b39c5158Smillert unshift @INC, 't/lib'; 5*b39c5158Smillert} 6*b39c5158Smillert 7*b39c5158Smillertuse strict; 8*b39c5158Smillert 9*b39c5158Smillert# use lib 't/lib'; 10*b39c5158Smillert 11*b39c5158Smillertuse Test::More; 12*b39c5158Smillertuse File::Spec; 13*b39c5158Smillertuse Test::Harness qw(execute_tests); 14*b39c5158Smillert 15*b39c5158Smillert# unset this global when self-testing ('testcover' and etc issue) 16*b39c5158Smillertlocal $ENV{HARNESS_PERL_SWITCHES}; 17*b39c5158Smillert 18*b39c5158Smillertmy $TEST_DIR = 't/sample-tests'; 19*b39c5158Smillert 20*b39c5158Smillert{ 21*b39c5158Smillert 22*b39c5158Smillert # if the harness wants to save the resulting TAP we shouldn't 23*b39c5158Smillert # do it for our internal calls 24*b39c5158Smillert local $ENV{PERL_TEST_HARNESS_DUMP_TAP} = 0; 25*b39c5158Smillert 26*b39c5158Smillert my $PER_LOOP = 4; 27*b39c5158Smillert 28*b39c5158Smillert my $results = { 29*b39c5158Smillert 'descriptive' => { 30*b39c5158Smillert 'failed' => {}, 31*b39c5158Smillert 'todo' => {}, 32*b39c5158Smillert 'totals' => { 33*b39c5158Smillert 'bad' => 0, 34*b39c5158Smillert 'bonus' => 0, 35*b39c5158Smillert 'files' => 1, 36*b39c5158Smillert 'good' => 1, 37*b39c5158Smillert 'max' => 5, 38*b39c5158Smillert 'ok' => 5, 39*b39c5158Smillert 'skipped' => 0, 40*b39c5158Smillert 'sub_skipped' => 0, 41*b39c5158Smillert 'tests' => 1, 42*b39c5158Smillert 'todo' => 0 43*b39c5158Smillert } 44*b39c5158Smillert }, 45*b39c5158Smillert join( 46*b39c5158Smillert ',', qw( 47*b39c5158Smillert descriptive die die_head_end die_last_minute duplicates 48*b39c5158Smillert head_end head_fail inc_taint junk_before_plan lone_not_bug 49*b39c5158Smillert no_nums no_output schwern sequence_misparse shbang_misparse 50*b39c5158Smillert simple simple_fail skip skip_nomsg skipall skipall_nomsg 51*b39c5158Smillert stdout_stderr taint todo_inline 52*b39c5158Smillert todo_misparse too_many vms_nit 53*b39c5158Smillert ) 54*b39c5158Smillert ) => { 55*b39c5158Smillert 'failed' => { 56*b39c5158Smillert "$TEST_DIR/die" => { 57*b39c5158Smillert 'canon' => '??', 58*b39c5158Smillert 'estat' => 1, 59*b39c5158Smillert 'failed' => '??', 60*b39c5158Smillert 'max' => '??', 61*b39c5158Smillert 'name' => "$TEST_DIR/die", 62*b39c5158Smillert 'wstat' => '256' 63*b39c5158Smillert }, 64*b39c5158Smillert "$TEST_DIR/die_head_end" => { 65*b39c5158Smillert 'canon' => '??', 66*b39c5158Smillert 'estat' => 1, 67*b39c5158Smillert 'failed' => '??', 68*b39c5158Smillert 'max' => '??', 69*b39c5158Smillert 'name' => "$TEST_DIR/die_head_end", 70*b39c5158Smillert 'wstat' => '256' 71*b39c5158Smillert }, 72*b39c5158Smillert "$TEST_DIR/die_last_minute" => { 73*b39c5158Smillert 'canon' => '??', 74*b39c5158Smillert 'estat' => 1, 75*b39c5158Smillert 'failed' => 0, 76*b39c5158Smillert 'max' => 4, 77*b39c5158Smillert 'name' => "$TEST_DIR/die_last_minute", 78*b39c5158Smillert 'wstat' => '256' 79*b39c5158Smillert }, 80*b39c5158Smillert "$TEST_DIR/duplicates" => { 81*b39c5158Smillert 'canon' => '??', 82*b39c5158Smillert 'estat' => '', 83*b39c5158Smillert 'failed' => '??', 84*b39c5158Smillert 'max' => 10, 85*b39c5158Smillert 'name' => "$TEST_DIR/duplicates", 86*b39c5158Smillert 'wstat' => '' 87*b39c5158Smillert }, 88*b39c5158Smillert "$TEST_DIR/head_fail" => { 89*b39c5158Smillert 'canon' => 2, 90*b39c5158Smillert 'estat' => '', 91*b39c5158Smillert 'failed' => 1, 92*b39c5158Smillert 'max' => 4, 93*b39c5158Smillert 'name' => "$TEST_DIR/head_fail", 94*b39c5158Smillert 'wstat' => '' 95*b39c5158Smillert }, 96*b39c5158Smillert "$TEST_DIR/inc_taint" => { 97*b39c5158Smillert 'canon' => 1, 98*b39c5158Smillert 'estat' => 1, 99*b39c5158Smillert 'failed' => 1, 100*b39c5158Smillert 'max' => 1, 101*b39c5158Smillert 'name' => "$TEST_DIR/inc_taint", 102*b39c5158Smillert 'wstat' => '256' 103*b39c5158Smillert }, 104*b39c5158Smillert "$TEST_DIR/no_nums" => { 105*b39c5158Smillert 'canon' => 3, 106*b39c5158Smillert 'estat' => '', 107*b39c5158Smillert 'failed' => 1, 108*b39c5158Smillert 'max' => 5, 109*b39c5158Smillert 'name' => "$TEST_DIR/no_nums", 110*b39c5158Smillert 'wstat' => '' 111*b39c5158Smillert }, 112*b39c5158Smillert "$TEST_DIR/no_output" => { 113*b39c5158Smillert 'canon' => '??', 114*b39c5158Smillert 'estat' => '', 115*b39c5158Smillert 'failed' => '??', 116*b39c5158Smillert 'max' => '??', 117*b39c5158Smillert 'name' => "$TEST_DIR/no_output", 118*b39c5158Smillert 'wstat' => '' 119*b39c5158Smillert }, 120*b39c5158Smillert "$TEST_DIR/simple_fail" => { 121*b39c5158Smillert 'canon' => '2 5', 122*b39c5158Smillert 'estat' => '', 123*b39c5158Smillert 'failed' => 2, 124*b39c5158Smillert 'max' => 5, 125*b39c5158Smillert 'name' => "$TEST_DIR/simple_fail", 126*b39c5158Smillert 'wstat' => '' 127*b39c5158Smillert }, 128*b39c5158Smillert "$TEST_DIR/todo_misparse" => { 129*b39c5158Smillert 'canon' => 1, 130*b39c5158Smillert 'estat' => '', 131*b39c5158Smillert 'failed' => 1, 132*b39c5158Smillert 'max' => 1, 133*b39c5158Smillert 'name' => "$TEST_DIR/todo_misparse", 134*b39c5158Smillert 'wstat' => '' 135*b39c5158Smillert }, 136*b39c5158Smillert "$TEST_DIR/too_many" => { 137*b39c5158Smillert 'canon' => '4-7', 138*b39c5158Smillert 'estat' => 4, 139*b39c5158Smillert 'failed' => 4, 140*b39c5158Smillert 'max' => 3, 141*b39c5158Smillert 'name' => "$TEST_DIR/too_many", 142*b39c5158Smillert 'wstat' => '1024' 143*b39c5158Smillert }, 144*b39c5158Smillert "$TEST_DIR/vms_nit" => { 145*b39c5158Smillert 'canon' => 1, 146*b39c5158Smillert 'estat' => '', 147*b39c5158Smillert 'failed' => 1, 148*b39c5158Smillert 'max' => 2, 149*b39c5158Smillert 'name' => "$TEST_DIR/vms_nit", 150*b39c5158Smillert 'wstat' => '' 151*b39c5158Smillert } 152*b39c5158Smillert }, 153*b39c5158Smillert 'todo' => { 154*b39c5158Smillert "$TEST_DIR/todo_inline" => { 155*b39c5158Smillert 'canon' => 2, 156*b39c5158Smillert 'estat' => '', 157*b39c5158Smillert 'failed' => 1, 158*b39c5158Smillert 'max' => 2, 159*b39c5158Smillert 'name' => "$TEST_DIR/todo_inline", 160*b39c5158Smillert 'wstat' => '' 161*b39c5158Smillert } 162*b39c5158Smillert }, 163*b39c5158Smillert 'totals' => { 164*b39c5158Smillert 'bad' => 12, 165*b39c5158Smillert 'bonus' => 1, 166*b39c5158Smillert 'files' => 27, 167*b39c5158Smillert 'good' => 15, 168*b39c5158Smillert 'max' => 76, 169*b39c5158Smillert 'ok' => 78, 170*b39c5158Smillert 'skipped' => 2, 171*b39c5158Smillert 'sub_skipped' => 2, 172*b39c5158Smillert 'tests' => 27, 173*b39c5158Smillert 'todo' => 2 174*b39c5158Smillert } 175*b39c5158Smillert }, 176*b39c5158Smillert 'die' => { 177*b39c5158Smillert 'failed' => { 178*b39c5158Smillert "$TEST_DIR/die" => { 179*b39c5158Smillert 'canon' => '??', 180*b39c5158Smillert 'estat' => 1, 181*b39c5158Smillert 'failed' => '??', 182*b39c5158Smillert 'max' => '??', 183*b39c5158Smillert 'name' => "$TEST_DIR/die", 184*b39c5158Smillert 'wstat' => '256' 185*b39c5158Smillert } 186*b39c5158Smillert }, 187*b39c5158Smillert 'todo' => {}, 188*b39c5158Smillert 'totals' => { 189*b39c5158Smillert 'bad' => 1, 190*b39c5158Smillert 'bonus' => 0, 191*b39c5158Smillert 'files' => 1, 192*b39c5158Smillert 'good' => 0, 193*b39c5158Smillert 'max' => 0, 194*b39c5158Smillert 'ok' => 0, 195*b39c5158Smillert 'skipped' => 0, 196*b39c5158Smillert 'sub_skipped' => 0, 197*b39c5158Smillert 'tests' => 1, 198*b39c5158Smillert 'todo' => 0 199*b39c5158Smillert } 200*b39c5158Smillert }, 201*b39c5158Smillert 'die_head_end' => { 202*b39c5158Smillert 'failed' => { 203*b39c5158Smillert "$TEST_DIR/die_head_end" => { 204*b39c5158Smillert 'canon' => '??', 205*b39c5158Smillert 'estat' => 1, 206*b39c5158Smillert 'failed' => '??', 207*b39c5158Smillert 'max' => '??', 208*b39c5158Smillert 'name' => "$TEST_DIR/die_head_end", 209*b39c5158Smillert 'wstat' => '256' 210*b39c5158Smillert } 211*b39c5158Smillert }, 212*b39c5158Smillert 'todo' => {}, 213*b39c5158Smillert 'totals' => { 214*b39c5158Smillert 'bad' => 1, 215*b39c5158Smillert 'bonus' => 0, 216*b39c5158Smillert 'files' => 1, 217*b39c5158Smillert 'good' => 0, 218*b39c5158Smillert 'max' => 0, 219*b39c5158Smillert 'ok' => 4, 220*b39c5158Smillert 'skipped' => 0, 221*b39c5158Smillert 'sub_skipped' => 0, 222*b39c5158Smillert 'tests' => 1, 223*b39c5158Smillert 'todo' => 0 224*b39c5158Smillert } 225*b39c5158Smillert }, 226*b39c5158Smillert 'die_last_minute' => { 227*b39c5158Smillert 'failed' => { 228*b39c5158Smillert "$TEST_DIR/die_last_minute" => { 229*b39c5158Smillert 'canon' => '??', 230*b39c5158Smillert 'estat' => 1, 231*b39c5158Smillert 'failed' => 0, 232*b39c5158Smillert 'max' => 4, 233*b39c5158Smillert 'name' => "$TEST_DIR/die_last_minute", 234*b39c5158Smillert 'wstat' => '256' 235*b39c5158Smillert } 236*b39c5158Smillert }, 237*b39c5158Smillert 'todo' => {}, 238*b39c5158Smillert 'totals' => { 239*b39c5158Smillert 'bad' => 1, 240*b39c5158Smillert 'bonus' => 0, 241*b39c5158Smillert 'files' => 1, 242*b39c5158Smillert 'good' => 0, 243*b39c5158Smillert 'max' => 4, 244*b39c5158Smillert 'ok' => 4, 245*b39c5158Smillert 'skipped' => 0, 246*b39c5158Smillert 'sub_skipped' => 0, 247*b39c5158Smillert 'tests' => 1, 248*b39c5158Smillert 'todo' => 0 249*b39c5158Smillert } 250*b39c5158Smillert }, 251*b39c5158Smillert 'duplicates' => { 252*b39c5158Smillert 'failed' => { 253*b39c5158Smillert "$TEST_DIR/duplicates" => { 254*b39c5158Smillert 'canon' => '??', 255*b39c5158Smillert 'estat' => '', 256*b39c5158Smillert 'failed' => '??', 257*b39c5158Smillert 'max' => 10, 258*b39c5158Smillert 'name' => "$TEST_DIR/duplicates", 259*b39c5158Smillert 'wstat' => '' 260*b39c5158Smillert } 261*b39c5158Smillert }, 262*b39c5158Smillert 'todo' => {}, 263*b39c5158Smillert 'totals' => { 264*b39c5158Smillert 'bad' => 1, 265*b39c5158Smillert 'bonus' => 0, 266*b39c5158Smillert 'files' => 1, 267*b39c5158Smillert 'good' => 0, 268*b39c5158Smillert 'max' => 10, 269*b39c5158Smillert 'ok' => 11, 270*b39c5158Smillert 'skipped' => 0, 271*b39c5158Smillert 'sub_skipped' => 0, 272*b39c5158Smillert 'tests' => 1, 273*b39c5158Smillert 'todo' => 0 274*b39c5158Smillert } 275*b39c5158Smillert }, 276*b39c5158Smillert 'head_end' => { 277*b39c5158Smillert 'failed' => {}, 278*b39c5158Smillert 'todo' => {}, 279*b39c5158Smillert 'totals' => { 280*b39c5158Smillert 'bad' => 0, 281*b39c5158Smillert 'bonus' => 0, 282*b39c5158Smillert 'files' => 1, 283*b39c5158Smillert 'good' => 1, 284*b39c5158Smillert 'max' => 4, 285*b39c5158Smillert 'ok' => 4, 286*b39c5158Smillert 'skipped' => 0, 287*b39c5158Smillert 'sub_skipped' => 0, 288*b39c5158Smillert 'tests' => 1, 289*b39c5158Smillert 'todo' => 0 290*b39c5158Smillert } 291*b39c5158Smillert }, 292*b39c5158Smillert 'head_fail' => { 293*b39c5158Smillert 'failed' => { 294*b39c5158Smillert "$TEST_DIR/head_fail" => { 295*b39c5158Smillert 'canon' => 2, 296*b39c5158Smillert 'estat' => '', 297*b39c5158Smillert 'failed' => 1, 298*b39c5158Smillert 'max' => 4, 299*b39c5158Smillert 'name' => "$TEST_DIR/head_fail", 300*b39c5158Smillert 'wstat' => '' 301*b39c5158Smillert } 302*b39c5158Smillert }, 303*b39c5158Smillert 'todo' => {}, 304*b39c5158Smillert 'totals' => { 305*b39c5158Smillert 'bad' => 1, 306*b39c5158Smillert 'bonus' => 0, 307*b39c5158Smillert 'files' => 1, 308*b39c5158Smillert 'good' => 0, 309*b39c5158Smillert 'max' => 4, 310*b39c5158Smillert 'ok' => 3, 311*b39c5158Smillert 'skipped' => 0, 312*b39c5158Smillert 'sub_skipped' => 0, 313*b39c5158Smillert 'tests' => 1, 314*b39c5158Smillert 'todo' => 0 315*b39c5158Smillert } 316*b39c5158Smillert }, 317*b39c5158Smillert 'inc_taint' => { 318*b39c5158Smillert 'failed' => { 319*b39c5158Smillert "$TEST_DIR/inc_taint" => { 320*b39c5158Smillert 'canon' => 1, 321*b39c5158Smillert 'estat' => 1, 322*b39c5158Smillert 'failed' => 1, 323*b39c5158Smillert 'max' => 1, 324*b39c5158Smillert 'name' => "$TEST_DIR/inc_taint", 325*b39c5158Smillert 'wstat' => '256' 326*b39c5158Smillert } 327*b39c5158Smillert }, 328*b39c5158Smillert 'todo' => {}, 329*b39c5158Smillert 'totals' => { 330*b39c5158Smillert 'bad' => 1, 331*b39c5158Smillert 'bonus' => 0, 332*b39c5158Smillert 'files' => 1, 333*b39c5158Smillert 'good' => 0, 334*b39c5158Smillert 'max' => 1, 335*b39c5158Smillert 'ok' => 0, 336*b39c5158Smillert 'skipped' => 0, 337*b39c5158Smillert 'sub_skipped' => 0, 338*b39c5158Smillert 'tests' => 1, 339*b39c5158Smillert 'todo' => 0 340*b39c5158Smillert } 341*b39c5158Smillert }, 342*b39c5158Smillert 'junk_before_plan' => { 343*b39c5158Smillert 'failed' => {}, 344*b39c5158Smillert 'todo' => {}, 345*b39c5158Smillert 'totals' => { 346*b39c5158Smillert 'bad' => 0, 347*b39c5158Smillert 'bonus' => 0, 348*b39c5158Smillert 'files' => 1, 349*b39c5158Smillert 'good' => 1, 350*b39c5158Smillert 'max' => 1, 351*b39c5158Smillert 'ok' => 1, 352*b39c5158Smillert 'skipped' => 0, 353*b39c5158Smillert 'sub_skipped' => 0, 354*b39c5158Smillert 'tests' => 1, 355*b39c5158Smillert 'todo' => 0 356*b39c5158Smillert } 357*b39c5158Smillert }, 358*b39c5158Smillert 'lone_not_bug' => { 359*b39c5158Smillert 'failed' => {}, 360*b39c5158Smillert 'todo' => {}, 361*b39c5158Smillert 'totals' => { 362*b39c5158Smillert 'bad' => 0, 363*b39c5158Smillert 'bonus' => 0, 364*b39c5158Smillert 'files' => 1, 365*b39c5158Smillert 'good' => 1, 366*b39c5158Smillert 'max' => 4, 367*b39c5158Smillert 'ok' => 4, 368*b39c5158Smillert 'skipped' => 0, 369*b39c5158Smillert 'sub_skipped' => 0, 370*b39c5158Smillert 'tests' => 1, 371*b39c5158Smillert 'todo' => 0 372*b39c5158Smillert } 373*b39c5158Smillert }, 374*b39c5158Smillert 'no_nums' => { 375*b39c5158Smillert 'failed' => { 376*b39c5158Smillert "$TEST_DIR/no_nums" => { 377*b39c5158Smillert 'canon' => 3, 378*b39c5158Smillert 'estat' => '', 379*b39c5158Smillert 'failed' => 1, 380*b39c5158Smillert 'max' => 5, 381*b39c5158Smillert 'name' => "$TEST_DIR/no_nums", 382*b39c5158Smillert 'wstat' => '' 383*b39c5158Smillert } 384*b39c5158Smillert }, 385*b39c5158Smillert 'todo' => {}, 386*b39c5158Smillert 'totals' => { 387*b39c5158Smillert 'bad' => 1, 388*b39c5158Smillert 'bonus' => 0, 389*b39c5158Smillert 'files' => 1, 390*b39c5158Smillert 'good' => 0, 391*b39c5158Smillert 'max' => 5, 392*b39c5158Smillert 'ok' => 4, 393*b39c5158Smillert 'skipped' => 0, 394*b39c5158Smillert 'sub_skipped' => 0, 395*b39c5158Smillert 'tests' => 1, 396*b39c5158Smillert 'todo' => 0 397*b39c5158Smillert } 398*b39c5158Smillert }, 399*b39c5158Smillert 'no_output' => { 400*b39c5158Smillert 'failed' => { 401*b39c5158Smillert "$TEST_DIR/no_output" => { 402*b39c5158Smillert 'canon' => '??', 403*b39c5158Smillert 'estat' => '', 404*b39c5158Smillert 'failed' => '??', 405*b39c5158Smillert 'max' => '??', 406*b39c5158Smillert 'name' => "$TEST_DIR/no_output", 407*b39c5158Smillert 'wstat' => '' 408*b39c5158Smillert } 409*b39c5158Smillert }, 410*b39c5158Smillert 'todo' => {}, 411*b39c5158Smillert 'totals' => { 412*b39c5158Smillert 'bad' => 1, 413*b39c5158Smillert 'bonus' => 0, 414*b39c5158Smillert 'files' => 1, 415*b39c5158Smillert 'good' => 0, 416*b39c5158Smillert 'max' => 0, 417*b39c5158Smillert 'ok' => 0, 418*b39c5158Smillert 'skipped' => 0, 419*b39c5158Smillert 'sub_skipped' => 0, 420*b39c5158Smillert 'tests' => 1, 421*b39c5158Smillert 'todo' => 0 422*b39c5158Smillert } 423*b39c5158Smillert }, 424*b39c5158Smillert 'schwern' => { 425*b39c5158Smillert 'failed' => {}, 426*b39c5158Smillert 'todo' => {}, 427*b39c5158Smillert 'totals' => { 428*b39c5158Smillert 'bad' => 0, 429*b39c5158Smillert 'bonus' => 0, 430*b39c5158Smillert 'files' => 1, 431*b39c5158Smillert 'good' => 1, 432*b39c5158Smillert 'max' => 1, 433*b39c5158Smillert 'ok' => 1, 434*b39c5158Smillert 'skipped' => 0, 435*b39c5158Smillert 'sub_skipped' => 0, 436*b39c5158Smillert 'tests' => 1, 437*b39c5158Smillert 'todo' => 0 438*b39c5158Smillert } 439*b39c5158Smillert }, 440*b39c5158Smillert 'sequence_misparse' => { 441*b39c5158Smillert 'failed' => {}, 442*b39c5158Smillert 'todo' => {}, 443*b39c5158Smillert 'totals' => { 444*b39c5158Smillert 'bad' => 0, 445*b39c5158Smillert 'bonus' => 0, 446*b39c5158Smillert 'files' => 1, 447*b39c5158Smillert 'good' => 1, 448*b39c5158Smillert 'max' => 5, 449*b39c5158Smillert 'ok' => 5, 450*b39c5158Smillert 'skipped' => 0, 451*b39c5158Smillert 'sub_skipped' => 0, 452*b39c5158Smillert 'tests' => 1, 453*b39c5158Smillert 'todo' => 0 454*b39c5158Smillert } 455*b39c5158Smillert }, 456*b39c5158Smillert 'shbang_misparse' => { 457*b39c5158Smillert 'failed' => {}, 458*b39c5158Smillert 'todo' => {}, 459*b39c5158Smillert 'totals' => { 460*b39c5158Smillert 'bad' => 0, 461*b39c5158Smillert 'bonus' => 0, 462*b39c5158Smillert 'files' => 1, 463*b39c5158Smillert 'good' => 1, 464*b39c5158Smillert 'max' => 2, 465*b39c5158Smillert 'ok' => 2, 466*b39c5158Smillert 'skipped' => 0, 467*b39c5158Smillert 'sub_skipped' => 0, 468*b39c5158Smillert 'tests' => 1, 469*b39c5158Smillert 'todo' => 0 470*b39c5158Smillert } 471*b39c5158Smillert }, 472*b39c5158Smillert 'simple' => { 473*b39c5158Smillert 'failed' => {}, 474*b39c5158Smillert 'todo' => {}, 475*b39c5158Smillert 'totals' => { 476*b39c5158Smillert 'bad' => 0, 477*b39c5158Smillert 'bonus' => 0, 478*b39c5158Smillert 'files' => 1, 479*b39c5158Smillert 'good' => 1, 480*b39c5158Smillert 'max' => 5, 481*b39c5158Smillert 'ok' => 5, 482*b39c5158Smillert 'skipped' => 0, 483*b39c5158Smillert 'sub_skipped' => 0, 484*b39c5158Smillert 'tests' => 1, 485*b39c5158Smillert 'todo' => 0 486*b39c5158Smillert } 487*b39c5158Smillert }, 488*b39c5158Smillert 'simple_fail' => { 489*b39c5158Smillert 'failed' => { 490*b39c5158Smillert "$TEST_DIR/simple_fail" => { 491*b39c5158Smillert 'canon' => '2 5', 492*b39c5158Smillert 'estat' => '', 493*b39c5158Smillert 'failed' => 2, 494*b39c5158Smillert 'max' => 5, 495*b39c5158Smillert 'name' => "$TEST_DIR/simple_fail", 496*b39c5158Smillert 'wstat' => '' 497*b39c5158Smillert } 498*b39c5158Smillert }, 499*b39c5158Smillert 'todo' => {}, 500*b39c5158Smillert 'totals' => { 501*b39c5158Smillert 'bad' => 1, 502*b39c5158Smillert 'bonus' => 0, 503*b39c5158Smillert 'files' => 1, 504*b39c5158Smillert 'good' => 0, 505*b39c5158Smillert 'max' => 5, 506*b39c5158Smillert 'ok' => 3, 507*b39c5158Smillert 'skipped' => 0, 508*b39c5158Smillert 'sub_skipped' => 0, 509*b39c5158Smillert 'tests' => 1, 510*b39c5158Smillert 'todo' => 0 511*b39c5158Smillert } 512*b39c5158Smillert }, 513*b39c5158Smillert 'skip' => { 514*b39c5158Smillert 'failed' => {}, 515*b39c5158Smillert 'todo' => {}, 516*b39c5158Smillert 'totals' => { 517*b39c5158Smillert 'bad' => 0, 518*b39c5158Smillert 'bonus' => 0, 519*b39c5158Smillert 'files' => 1, 520*b39c5158Smillert 'good' => 1, 521*b39c5158Smillert 'max' => 5, 522*b39c5158Smillert 'ok' => 5, 523*b39c5158Smillert 'skipped' => 0, 524*b39c5158Smillert 'sub_skipped' => 1, 525*b39c5158Smillert 'tests' => 1, 526*b39c5158Smillert 'todo' => 0 527*b39c5158Smillert } 528*b39c5158Smillert }, 529*b39c5158Smillert 'skip_nomsg' => { 530*b39c5158Smillert 'failed' => {}, 531*b39c5158Smillert 'todo' => {}, 532*b39c5158Smillert 'totals' => { 533*b39c5158Smillert 'bad' => 0, 534*b39c5158Smillert 'bonus' => 0, 535*b39c5158Smillert 'files' => 1, 536*b39c5158Smillert 'good' => 1, 537*b39c5158Smillert 'max' => 1, 538*b39c5158Smillert 'ok' => 1, 539*b39c5158Smillert 'skipped' => 0, 540*b39c5158Smillert 'sub_skipped' => 1, 541*b39c5158Smillert 'tests' => 1, 542*b39c5158Smillert 'todo' => 0 543*b39c5158Smillert } 544*b39c5158Smillert }, 545*b39c5158Smillert 'skipall' => { 546*b39c5158Smillert 'failed' => {}, 547*b39c5158Smillert 'todo' => {}, 548*b39c5158Smillert 'totals' => { 549*b39c5158Smillert 'bad' => 0, 550*b39c5158Smillert 'bonus' => 0, 551*b39c5158Smillert 'files' => 1, 552*b39c5158Smillert 'good' => 1, 553*b39c5158Smillert 'max' => 0, 554*b39c5158Smillert 'ok' => 0, 555*b39c5158Smillert 'skipped' => 1, 556*b39c5158Smillert 'sub_skipped' => 0, 557*b39c5158Smillert 'tests' => 1, 558*b39c5158Smillert 'todo' => 0 559*b39c5158Smillert } 560*b39c5158Smillert }, 561*b39c5158Smillert 'skipall_nomsg' => { 562*b39c5158Smillert 'failed' => {}, 563*b39c5158Smillert 'todo' => {}, 564*b39c5158Smillert 'totals' => { 565*b39c5158Smillert 'bad' => 0, 566*b39c5158Smillert 'bonus' => 0, 567*b39c5158Smillert 'files' => 1, 568*b39c5158Smillert 'good' => 1, 569*b39c5158Smillert 'max' => 0, 570*b39c5158Smillert 'ok' => 0, 571*b39c5158Smillert 'skipped' => 1, 572*b39c5158Smillert 'sub_skipped' => 0, 573*b39c5158Smillert 'tests' => 1, 574*b39c5158Smillert 'todo' => 0 575*b39c5158Smillert } 576*b39c5158Smillert }, 577*b39c5158Smillert 'stdout_stderr' => { 578*b39c5158Smillert 'failed' => {}, 579*b39c5158Smillert 'todo' => {}, 580*b39c5158Smillert 'totals' => { 581*b39c5158Smillert 'bad' => 0, 582*b39c5158Smillert 'bonus' => 0, 583*b39c5158Smillert 'files' => 1, 584*b39c5158Smillert 'good' => 1, 585*b39c5158Smillert 'max' => 4, 586*b39c5158Smillert 'ok' => 4, 587*b39c5158Smillert 'skipped' => 0, 588*b39c5158Smillert 'sub_skipped' => 0, 589*b39c5158Smillert 'tests' => 1, 590*b39c5158Smillert 'todo' => 0 591*b39c5158Smillert } 592*b39c5158Smillert }, 593*b39c5158Smillert 'switches' => { 594*b39c5158Smillert 'skip_if' => sub { 595*b39c5158Smillert ( $ENV{PERL5OPT} || '' ) =~ m{(?:^|\s)-[dM]}; 596*b39c5158Smillert }, 597*b39c5158Smillert 'failed' => { 598*b39c5158Smillert "$TEST_DIR/switches" => { 599*b39c5158Smillert 'canon' => 1, 600*b39c5158Smillert 'estat' => '', 601*b39c5158Smillert 'failed' => 1, 602*b39c5158Smillert 'max' => 1, 603*b39c5158Smillert 'name' => "$TEST_DIR/switches", 604*b39c5158Smillert 'wstat' => '' 605*b39c5158Smillert } 606*b39c5158Smillert }, 607*b39c5158Smillert 'todo' => {}, 608*b39c5158Smillert 'totals' => { 609*b39c5158Smillert 'bad' => 1, 610*b39c5158Smillert 'bonus' => 0, 611*b39c5158Smillert 'files' => 1, 612*b39c5158Smillert 'good' => 0, 613*b39c5158Smillert 'max' => 1, 614*b39c5158Smillert 'ok' => 0, 615*b39c5158Smillert 'skipped' => 0, 616*b39c5158Smillert 'sub_skipped' => 0, 617*b39c5158Smillert 'tests' => 1, 618*b39c5158Smillert 'todo' => 0 619*b39c5158Smillert } 620*b39c5158Smillert }, 621*b39c5158Smillert 'taint' => { 622*b39c5158Smillert 'failed' => {}, 623*b39c5158Smillert 'todo' => {}, 624*b39c5158Smillert 'totals' => { 625*b39c5158Smillert 'bad' => 0, 626*b39c5158Smillert 'bonus' => 0, 627*b39c5158Smillert 'files' => 1, 628*b39c5158Smillert 'good' => 1, 629*b39c5158Smillert 'max' => 1, 630*b39c5158Smillert 'ok' => 1, 631*b39c5158Smillert 'skipped' => 0, 632*b39c5158Smillert 'sub_skipped' => 0, 633*b39c5158Smillert 'tests' => 1, 634*b39c5158Smillert 'todo' => 0 635*b39c5158Smillert } 636*b39c5158Smillert }, 637*b39c5158Smillert 'taint_warn' => { 638*b39c5158Smillert 'failed' => {}, 639*b39c5158Smillert 'todo' => {}, 640*b39c5158Smillert 'totals' => { 641*b39c5158Smillert 'bad' => 0, 642*b39c5158Smillert 'bonus' => 0, 643*b39c5158Smillert 'files' => 1, 644*b39c5158Smillert 'good' => 1, 645*b39c5158Smillert 'max' => 1, 646*b39c5158Smillert 'ok' => 1, 647*b39c5158Smillert 'skipped' => 0, 648*b39c5158Smillert 'sub_skipped' => 0, 649*b39c5158Smillert 'tests' => 1, 650*b39c5158Smillert 'todo' => 0 651*b39c5158Smillert }, 652*b39c5158Smillert 'require' => 5.008001, 653*b39c5158Smillert }, 654*b39c5158Smillert 'todo_inline' => { 655*b39c5158Smillert 'failed' => {}, 656*b39c5158Smillert 'todo' => { 657*b39c5158Smillert "$TEST_DIR/todo_inline" => { 658*b39c5158Smillert 'canon' => 2, 659*b39c5158Smillert 'estat' => '', 660*b39c5158Smillert 'failed' => 1, 661*b39c5158Smillert 'max' => 2, 662*b39c5158Smillert 'name' => "$TEST_DIR/todo_inline", 663*b39c5158Smillert 'wstat' => '' 664*b39c5158Smillert } 665*b39c5158Smillert }, 666*b39c5158Smillert 'totals' => { 667*b39c5158Smillert 'bad' => 0, 668*b39c5158Smillert 'bonus' => 1, 669*b39c5158Smillert 'files' => 1, 670*b39c5158Smillert 'good' => 1, 671*b39c5158Smillert 'max' => 3, 672*b39c5158Smillert 'ok' => 3, 673*b39c5158Smillert 'skipped' => 0, 674*b39c5158Smillert 'sub_skipped' => 0, 675*b39c5158Smillert 'tests' => 1, 676*b39c5158Smillert 'todo' => 2 677*b39c5158Smillert } 678*b39c5158Smillert }, 679*b39c5158Smillert 'todo_misparse' => { 680*b39c5158Smillert 'failed' => { 681*b39c5158Smillert "$TEST_DIR/todo_misparse" => { 682*b39c5158Smillert 'canon' => 1, 683*b39c5158Smillert 'estat' => '', 684*b39c5158Smillert 'failed' => 1, 685*b39c5158Smillert 'max' => 1, 686*b39c5158Smillert 'name' => "$TEST_DIR/todo_misparse", 687*b39c5158Smillert 'wstat' => '' 688*b39c5158Smillert } 689*b39c5158Smillert }, 690*b39c5158Smillert 'todo' => {}, 691*b39c5158Smillert 'totals' => { 692*b39c5158Smillert 'bad' => 1, 693*b39c5158Smillert 'bonus' => 0, 694*b39c5158Smillert 'files' => 1, 695*b39c5158Smillert 'good' => 0, 696*b39c5158Smillert 'max' => 1, 697*b39c5158Smillert 'ok' => 0, 698*b39c5158Smillert 'skipped' => 0, 699*b39c5158Smillert 'sub_skipped' => 0, 700*b39c5158Smillert 'tests' => 1, 701*b39c5158Smillert 'todo' => 0 702*b39c5158Smillert } 703*b39c5158Smillert }, 704*b39c5158Smillert 'too_many' => { 705*b39c5158Smillert 'failed' => { 706*b39c5158Smillert "$TEST_DIR/too_many" => { 707*b39c5158Smillert 'canon' => '4-7', 708*b39c5158Smillert 'estat' => 4, 709*b39c5158Smillert 'failed' => 4, 710*b39c5158Smillert 'max' => 3, 711*b39c5158Smillert 'name' => "$TEST_DIR/too_many", 712*b39c5158Smillert 'wstat' => '1024' 713*b39c5158Smillert } 714*b39c5158Smillert }, 715*b39c5158Smillert 'todo' => {}, 716*b39c5158Smillert 'totals' => { 717*b39c5158Smillert 'bad' => 1, 718*b39c5158Smillert 'bonus' => 0, 719*b39c5158Smillert 'files' => 1, 720*b39c5158Smillert 'good' => 0, 721*b39c5158Smillert 'max' => 3, 722*b39c5158Smillert 'ok' => 7, 723*b39c5158Smillert 'skipped' => 0, 724*b39c5158Smillert 'sub_skipped' => 0, 725*b39c5158Smillert 'tests' => 1, 726*b39c5158Smillert 'todo' => 0 727*b39c5158Smillert } 728*b39c5158Smillert }, 729*b39c5158Smillert 'vms_nit' => { 730*b39c5158Smillert 'failed' => { 731*b39c5158Smillert "$TEST_DIR/vms_nit" => { 732*b39c5158Smillert 'canon' => 1, 733*b39c5158Smillert 'estat' => '', 734*b39c5158Smillert 'failed' => 1, 735*b39c5158Smillert 'max' => 2, 736*b39c5158Smillert 'name' => "$TEST_DIR/vms_nit", 737*b39c5158Smillert 'wstat' => '' 738*b39c5158Smillert } 739*b39c5158Smillert }, 740*b39c5158Smillert 'todo' => {}, 741*b39c5158Smillert 'totals' => { 742*b39c5158Smillert 'bad' => 1, 743*b39c5158Smillert 'bonus' => 0, 744*b39c5158Smillert 'files' => 1, 745*b39c5158Smillert 'good' => 0, 746*b39c5158Smillert 'max' => 2, 747*b39c5158Smillert 'ok' => 1, 748*b39c5158Smillert 'skipped' => 0, 749*b39c5158Smillert 'sub_skipped' => 0, 750*b39c5158Smillert 'tests' => 1, 751*b39c5158Smillert 'todo' => 0 752*b39c5158Smillert } 753*b39c5158Smillert } 754*b39c5158Smillert }; 755*b39c5158Smillert 756*b39c5158Smillert my $num_tests = ( keys %$results ) * $PER_LOOP; 757*b39c5158Smillert 758*b39c5158Smillert plan tests => $num_tests; 759*b39c5158Smillert 760*b39c5158Smillert sub local_name { 761*b39c5158Smillert my $name = shift; 762*b39c5158Smillert return File::Spec->catfile( split /\//, $name ); 763*b39c5158Smillert } 764*b39c5158Smillert 765*b39c5158Smillert sub local_result { 766*b39c5158Smillert my $hash = shift; 767*b39c5158Smillert my $new = {}; 768*b39c5158Smillert 769*b39c5158Smillert while ( my ( $file, $want ) = each %$hash ) { 770*b39c5158Smillert if ( exists $want->{name} ) { 771*b39c5158Smillert $want->{name} = local_name( $want->{name} ); 772*b39c5158Smillert } 773*b39c5158Smillert $new->{ local_name($file) } = $want; 774*b39c5158Smillert } 775*b39c5158Smillert return $new; 776*b39c5158Smillert } 777*b39c5158Smillert 778*b39c5158Smillert sub vague_status { 779*b39c5158Smillert my $hash = shift; 780*b39c5158Smillert return $hash unless $^O eq 'VMS'; 781*b39c5158Smillert 782*b39c5158Smillert while ( my ( $file, $want ) = each %$hash ) { 783*b39c5158Smillert for (qw( estat wstat )) { 784*b39c5158Smillert if ( exists $want->{$_} ) { 785*b39c5158Smillert $want->{$_} = $want->{$_} ? 1 : 0; 786*b39c5158Smillert } 787*b39c5158Smillert } 788*b39c5158Smillert } 789*b39c5158Smillert return $hash; 790*b39c5158Smillert } 791*b39c5158Smillert 792*b39c5158Smillert { 793*b39c5158Smillert local $^W = 0; 794*b39c5158Smillert 795*b39c5158Smillert # Silence harness output 796*b39c5158Smillert *TAP::Formatter::Console::_output = sub { 797*b39c5158Smillert 798*b39c5158Smillert # do nothing 799*b39c5158Smillert }; 800*b39c5158Smillert } 801*b39c5158Smillert 802*b39c5158Smillert for my $test_key ( sort keys %$results ) { 803*b39c5158Smillert my $result = $results->{$test_key}; 804*b39c5158Smillert SKIP: { 805*b39c5158Smillert if ( $result->{require} && $] < $result->{require} ) { 806*b39c5158Smillert skip "Test requires Perl $result->{require}, we have $]", 4; 807*b39c5158Smillert } 808*b39c5158Smillert 809*b39c5158Smillert if ( my $skip_if = $result->{skip_if} ) { 810*b39c5158Smillert skip 811*b39c5158Smillert "Test '$test_key' can't run properly in this environment", 4 812*b39c5158Smillert if $skip_if->(); 813*b39c5158Smillert } 814*b39c5158Smillert 815*b39c5158Smillert my @test_names = split( /,/, $test_key ); 816*b39c5158Smillert my @test_files 817*b39c5158Smillert = map { File::Spec->catfile( $TEST_DIR, $_ ) } @test_names; 818*b39c5158Smillert 819*b39c5158Smillert # For now we supress STDERR because it crufts up /our/ test 820*b39c5158Smillert # results. Should probably capture and analyse it. 821*b39c5158Smillert local ( *OLDERR, *OLDOUT ); 822*b39c5158Smillert open OLDERR, '>&STDERR' or die $!; 823*b39c5158Smillert open OLDOUT, '>&STDOUT' or die $!; 824*b39c5158Smillert my $devnull = File::Spec->devnull; 825*b39c5158Smillert open STDERR, ">$devnull" or die $!; 826*b39c5158Smillert open STDOUT, ">$devnull" or die $!; 827*b39c5158Smillert 828*b39c5158Smillert my ( $tot, $fail, $todo, $harness, $aggregate ) 829*b39c5158Smillert = execute_tests( tests => \@test_files ); 830*b39c5158Smillert 831*b39c5158Smillert open STDERR, '>&OLDERR' or die $!; 832*b39c5158Smillert open STDOUT, '>&OLDOUT' or die $!; 833*b39c5158Smillert 834*b39c5158Smillert my $bench = delete $tot->{bench}; 835*b39c5158Smillert isa_ok $bench, 'Benchmark'; 836*b39c5158Smillert 837*b39c5158Smillert # Localise filenames in failed, todo 838*b39c5158Smillert my $lfailed = vague_status( local_result( $result->{failed} ) ); 839*b39c5158Smillert my $ltodo = vague_status( local_result( $result->{todo} ) ); 840*b39c5158Smillert 841*b39c5158Smillert # use Data::Dumper; 842*b39c5158Smillert # diag Dumper( [ $lfailed, $ltodo ] ); 843*b39c5158Smillert 844*b39c5158Smillert is_deeply $tot, $result->{totals}, "totals match for $test_key"; 845*b39c5158Smillert is_deeply vague_status($fail), $lfailed, 846*b39c5158Smillert "failure summary matches for $test_key"; 847*b39c5158Smillert is_deeply vague_status($todo), $ltodo, 848*b39c5158Smillert "todo summary matches for $test_key"; 849*b39c5158Smillert } 850*b39c5158Smillert } 851*b39c5158Smillert} 852