Skip to content

Commit

Permalink
-g runs the specified test(s) with gdb!
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed Feb 20, 2001
1 parent e259043 commit 63b5748
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions tests/runtests.pl
Expand Up @@ -51,6 +51,7 @@
my $verbose;
my $debugprotocol;
my $anyway;
my $gdbthis; # run test case with gdb debugger

#######################################################################
# Return the pid of the server as found in the given pid file
Expand Down Expand Up @@ -397,22 +398,34 @@ sub singletest {
}

# run curl, add -v for debug information output
my $CMDLINE="$CURL $out--include -v --silent $cmd >$STDOUT 2>$STDERR";
my $cmdargs="$out--include -v --silent $cmd";

my $STDINFILE="$TESTDIR/stdin$NUMBER.txt";
if(-f $STDINFILE) {
$CMDLINE .= " < $STDINFILE";
$cmdargs .= " < $STDINFILE";
}
my $CMDLINE="$CURL $cmdargs >$STDOUT 2>$STDERR";

if($verbose) {
print "$CMDLINE\n";
}

print CMDLOG "$CMDLINE\n";

my $res;
# run the command line we built
my $res = system("$CMDLINE");
$res /= 256;
if($gdbthis) {
open(GDBCMD, ">log/gdbcmd");
print GDBCMD "set args $cmdargs\n";
print GDBCMD "show args\n";
close(GDBCMD);
system("gdb $CURL -x log/gdbcmd");
$res =0; # makes it always continue after a debugged run
}
else {
$res = system("$CMDLINE");
$res /= 256;
}

my $ERRORCODE = "$TESTDIR/error$NUMBER.txt";

Expand Down Expand Up @@ -560,6 +573,10 @@ sub singletest {
# have the servers display protocol output
$debugprotocol=1;
}
elsif ($ARGV[0] eq "-g") {
# run this test with gdb
$gdbthis=1;
}
elsif($ARGV[0] eq "-s") {
# short output
$short=1;
Expand All @@ -574,6 +591,7 @@ sub singletest {
Usage: runtests.pl [-h][-s][-v][numbers]
-a continue even if a test fails
-d display server debug info
-g run the test case with gdb
-h this help text
-s short output
-v verbose output
Expand Down

0 comments on commit 63b5748

Please sign in to comment.