diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2004-04-30 10:37:40 +0000 | 
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2004-04-30 10:37:40 +0000 | 
| commit | 6e118ce50fa42b732c274d65b8af9f1aeb89762d (patch) | |
| tree | 443a276739fd4c73388411a192ffc9cca09c9c31 | |
| parent | 34be9df773066bc0fe2bfa973bc6bc1984956a97 (diff) | |
Display "exit OK" when the exit code has been verified to be OK, and added
initial basic valgrind-log scan for memory leaks it could detect.
| -rwxr-xr-x | tests/runtests.pl | 59 | 
1 files changed, 44 insertions, 15 deletions
| diff --git a/tests/runtests.pl b/tests/runtests.pl index 305cde92a..1d8a0f37a 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -1195,23 +1195,21 @@ sub singletest {          }              } -    if($errorcode || $cmdres) { -        if($errorcode == $cmdres) { -            $errorcode =~ s/\n//; -            if($verbose) { -                print " received errorcode $errorcode OK"; -            } -            elsif(!$short) { -                print " error OK"; -            } +    if($errorcode == $cmdres) { +        $errorcode =~ s/\n//; +        if($verbose) { +            print " received exitcode $errorcode OK";          } -        else { -            if(!$short) { -                print "curl returned $cmdres, ".(0+$errorcode)." was expected\n"; -            } -            print " error FAILED\n"; -            return 1; +        elsif(!$short) { +            print " exit OK"; +        } +    } +    else { +        if(!$short) { +            print "curl returned $cmdres, ".(0+$errorcode)." was expected\n";          } +        print " exit FAILED\n"; +        return 1;      }      # the test succeeded, remove all log files @@ -1260,6 +1258,37 @@ sub singletest {              }          }      } +    if($valgrind) { +        opendir(DIR, "log") || +            return 0; # can't open log dir +        my @files = readdir(DIR); +        closedir DIR; +        my $f; +        my $l; +        foreach $f (@files) { +            if($f =~ /^valgrind$testnum/) { +                $l = $f; +                last; +            } +        } +        my $leak; +        open(VAL, "<$l"); +        while(<VAL>) { +            if($_ =~ /definitely lost: (\d*) bytes/) { +                $leak = $1; +                last; +            } +        } +        close(VAL); +        if($leak) { +            print " valgrind ERROR "; +        } +        elsif(!$short) { +            print " valgrind OK"; +        } + +         +    }      if($short) {          print "OK";      } | 
