VirtualBox

Ignore:
Timestamp:
May 16, 2005 4:54:02 PM (19 years ago)
Author:
bird
Message:

Current make snaphot, 2005-05-16.

Location:
branches/GNU/src/gmake
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/gmake

    • Property svn:ignore
      •  

        old new  
        3434README.DOS
        3535README.W32
         36README.OS2
        3637aclocal.m4
        3738autom4te.cache
  • branches/GNU/src/gmake/tests/test_driver.pl

    r53 r280  
    1 #!/usr/local/bin/perl
     1#!/usr/bin/perl
    22# -*-perl-*-
    33
     
    1212# this routine controls the whole mess; each test suite sets up a few
    1313# variables and then calls &toplevel, which does all the real work.
     14
     15# $Id: test_driver.pl,v 1.14 2005/02/28 07:48:23 psmith Exp $
     16
     17
     18# The number of test categories we've run
     19$categories_run = 0;
     20# The number of test categroies that have passed
     21$categories_passed = 0;
     22# The total number of individual tests that have been run
     23$total_tests_run = 0;
     24# The total number of individual tests that have passed
     25$total_tests_passed = 0;
     26# The number of tests in this category that have been run
     27$tests_run = 0;
     28# The number of tests in this category that have passed
     29$tests_passed = 0;
     30
     31
     32# Yeesh.  This whole test environment is such a hack!
     33$test_passed = 1;
    1434
    1535sub toplevel
     
    151171  $| = 1;
    152172
    153   if ($num_failed)
    154   {
    155     print "\n$num_failed Test";
    156     print "s" unless $num_failed == 1;
     173  $categories_failed = $categories_run - $categories_passed;
     174  $total_tests_failed = $total_tests_run - $total_tests_passed;
     175
     176  if ($total_tests_failed)
     177  {
     178    print "\n$total_tests_failed Test";
     179    print "s" unless $total_tests_failed == 1;
     180    print " in $categories_failed Categor";
     181    print ($categories_failed == 1 ? "y" : "ies");
    157182    print " Failed (See .$diffext files in $workdir dir for details) :-(\n\n";
    158183    return 0;
     
    160185  else
    161186  {
    162     print "\n$counter Test";
    163     print "s" unless $counter == 1;
     187    print "\n$total_tests_passed Test";
     188    print "s" unless $total_tests_passed == 1;
     189    print " in $categories_passed Categor";
     190    print ($categories_passed == 1 ? "y" : "ies");
    164191    print " Complete ... No Failures :-)\n\n";
    165192    return 1;
     
    349376sub run_each_test
    350377{
    351   $counter = 0;
     378  $categories_run = 0;
    352379
    353380  foreach $testname (sort @TESTS)
    354381  {
    355     $counter++;
    356     $test_passed = 1;       # reset by test on failure
     382    ++$categories_run;
     383    $suite_passed = 1;       # reset by test on failure
    357384    $num_of_logfiles = 0;
    358385    $num_of_tmpfiles = 0;
    359386    $description = "";
    360387    $details = "";
     388    $old_makefile = undef;
    361389    $testname =~ s/^$scriptpath$pathsep//;
    362390    $perl_testname = "$scriptpath$pathsep$testname";
     
    391419
    392420    # Run the actual test!
    393     #
     421    $tests_run = 0;
     422    $tests_passed = 0;
    394423    $code = do $perl_testname;
     424
     425    $total_tests_run += $tests_run;
     426    $total_tests_passed += $tests_passed;
     427
     428    # How did it go?
    395429    if (!defined($code))
    396430    {
    397       $test_passed = 0;
     431      $suite_passed = 0;
    398432      if (length ($@))
    399433      {
     
    406440    }
    407441    elsif ($code == -1) {
    408       $test_passed = 0;
     442      $suite_passed = 0;
    409443    }
    410444    elsif ($code != 1 && $code != -1) {
    411       $test_passed = 0;
     445      $suite_passed = 0;
    412446      warn "\n*** Test returned $code\n";
    413447    }
    414448
    415     if ($test_passed) {
    416       $status = "ok";
     449    if ($suite_passed) {
     450      ++$categories_passed;
     451      $status = "ok     ($tests_passed passed)";
    417452      for ($i = $num_of_tmpfiles; $i; $i--)
    418453      {
    419         &delete ($tmp_filename . &num_suffix ($i) );
     454        &rmfiles ($tmp_filename . &num_suffix ($i) );
    420455      }
    421456
    422457      for ($i = $num_of_logfiles ? $num_of_logfiles : 1; $i; $i--)
    423458      {
    424         &delete ($log_filename . &num_suffix ($i) );
    425         &delete ($base_filename . &num_suffix ($i) );
     459        &rmfiles ($log_filename . &num_suffix ($i) );
     460        &rmfiles ($base_filename . &num_suffix ($i) );
    426461      }
    427462    }
    428463    elsif ($code > 0) {
    429       $status = "FAILED";
    430       $num_failed++;
     464      $status = "FAILED ($tests_passed/$tests_run passed)";
    431465    }
    432466    elsif ($code < 0) {
    433467      $status = "N/A";
    434       --$counter;
     468      --$categories_run;
    435469    }
    436470
     
    467501# are sent to it.
    468502
    469 sub delete
     503sub rmfiles
    470504{
    471505  local(@files) = @_;
     
    578612{
    579613  local($answer,$logfile) = @_;
    580   local($slurp);
    581 
    582   if ($debug)
    583   {
    584     print "Comparing Output ........ ";
    585   }
     614  local($slurp, $answer_matched) = ('', 0);
     615
     616  print "Comparing Output ........ " if $debug;
    586617
    587618  $slurp = &read_file_into_string ($logfile);
     
    592623  $slurp =~ s/^.*Clock skew detected.*\n//gm;
    593624
    594   if ($slurp eq $answer)
    595   {
    596     if ($debug)
    597     {
    598       print "ok\n";
    599     }
     625  ++$tests_run;
     626
     627  if ($slurp eq $answer) {
     628    $answer_matched = 1;
     629  } else {
     630    # See if it is a slash or CRLF problem
     631    local ($answer_mod) = $answer;
     632
     633    $answer_mod =~ tr,\\,/,;
     634    $answer_mod =~ s,\r\n,\n,gs;
     635
     636    $slurp =~ tr,\\,/,;
     637    $slurp =~ s,\r\n,\n,gs;
     638
     639    $answer_matched = ($slurp eq $answer_mod);
     640  }
     641
     642  if ($answer_matched && $test_passed)
     643  {
     644    print "ok\n" if $debug;
     645    ++$tests_passed;
    600646    return 1;
    601647  }
    602   else
    603   {
    604     if ($debug)
    605     {
    606       print "DIFFERENT OUTPUT\n";
    607     }
    608     $test_passed = 0;
     648
     649  if (! $answer_matched) {
     650    print "DIFFERENT OUTPUT\n" if $debug;
     651
    609652    &create_file (&get_basefile, $answer);
    610653
    611     if ($debug)
    612     {
    613       print "\nCreating Difference File ...\n";
    614     }
     654    print "\nCreating Difference File ...\n" if $debug;
     655
    615656    # Create the difference file
     657
    616658    local($command) = "diff -c " . &get_basefile . " " . $logfile;
    617659    &run_command_with_output(&get_difffile,$command);
    618 
    619     return 0;
    620   }
     660  }
     661
     662  $suite_passed = 0;
     663  return 0;
    621664}
    622665
     
    702745  local ($code);
    703746
    704   if ($debug)
    705   {
    706     print "\nrun_command: @_\n";
    707     $code = system @_;
    708     print "run_command: \"@_\" returned $code.\n";
    709     return $code;
    710   }
    711 
    712   return system @_;
     747  print "\nrun_command: @_\n" if $debug;
     748  $code = system @_;
     749  print "run_command: \"@_\" returned $code.\n" if $debug;
     750
     751  return $code;
    713752}
    714753
     
    726765  $code = system @_;
    727766  &detach_default_output;
    728   if ($debug)
    729   {
    730     print "run_command_with_output: \"@_\" returned $code.\n";
    731   }
     767
     768  print "run_command_with_output: '@_' returned $code.\n" if $debug;
    732769
    733770  return $code;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette