/[make]/make/tests/test_driver.pl
ViewVC logotype

Diff of /make/tests/test_driver.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by psmith, Mon Feb 28 07:48:23 2005 UTC revision 1.15 by psmith, Tue Jul 12 04:35:13 2005 UTC
# Line 32  $tests_passed = 0; Line 32  $tests_passed = 0;
32  # Yeesh.  This whole test environment is such a hack!  # Yeesh.  This whole test environment is such a hack!
33  $test_passed = 1;  $test_passed = 1;
34    
35  sub toplevel  
36    # %makeENV is the cleaned-out environment.
37    %makeENV = ();
38    
39    # %extraENV are any extra environment variables the tests might want to set.
40    # These are RESET AFTER EVERY TEST!
41    %extraENV = ();
42    
43    # %origENV is the caller's original environment
44    %origENV = %ENV;
45    
46    sub resetENV
47  {  {
48    # Get a clean environment    # We used to say "%ENV = ();" but this doesn't work in Perl 5.000
49      # through Perl 5.004.  It was fixed in Perl 5.004_01, but we don't
50      # want to require that here, so just delete each one individually.
51      foreach $v (keys %ENV) {
52        delete $ENV{$v};
53      }
54    
55    %makeENV = ();    %ENV = %makeENV;
56      foreach $v (keys %extraENV) {
57        $ENV{$v} = $extraENV{$v};
58        delete $extraENV{$v};
59      }
60    }
61    
62    sub toplevel
63    {
64    # Pull in benign variables from the user's environment    # Pull in benign variables from the user's environment
65    #    #
66    foreach (# UNIX-specific things    foreach (# UNIX-specific things
# Line 57  sub toplevel Line 80  sub toplevel
80    #    #
81    %origENV = %ENV;    %origENV = %ENV;
82    
83    # We used to say "%ENV = ();" but this doesn't work in Perl 5.000    resetENV();
   # through Perl 5.004.  It was fixed in Perl 5.004_01, but we don't  
   # want to require that here, so just delete each one individually.  
   
   foreach $v (keys %ENV) {  
     delete $ENV{$v};  
   }  
   
   %ENV = %makeENV;  
84    
85    $| = 1;                     # unbuffered output    $| = 1;                     # unbuffered output
86    
# Line 744  sub run_command Line 759  sub run_command
759  {  {
760    local ($code);    local ($code);
761    
762      # We reset this before every invocation.  On Windows I think there is only
763      # one environment, not one per process, so I think that variables set in
764      # test scripts might leak into subsequent tests if this isn't reset--???
765      resetENV();
766    
767    print "\nrun_command: @_\n" if $debug;    print "\nrun_command: @_\n" if $debug;
768    $code = system @_;    $code = system @_;
769    print "run_command: \"@_\" returned $code.\n" if $debug;    print "run_command: \"@_\" returned $code.\n" if $debug;
# Line 761  sub run_command_with_output Line 781  sub run_command_with_output
781    local ($filename) = shift;    local ($filename) = shift;
782    local ($code);    local ($code);
783    
784      # We reset this before every invocation.  On Windows I think there is only
785      # one environment, not one per process, so I think that variables set in
786      # test scripts might leak into subsequent tests if this isn't reset--???
787      resetENV();
788    
789    &attach_default_output ($filename);    &attach_default_output ($filename);
790    $code = system @_;    $code = system @_;
791    &detach_default_output;    &detach_default_output;

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26