cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH 3/3] runtests.pl: use exit code of child for gdb

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 17 Nov 2014 22:47:16 +0100

On Mon, Nov 17, 2014 at 06:06:26PM +0100, Peter Wu wrote:
> test916 would be detect as fail when ran under gdb. Fix this by
> returning the child exit code from gdb rather than assuming 0.
>
> Signed-off-by: Peter Wu <peter_at_lekensteyn.nl>
> ---
> tests/runtests.pl | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/tests/runtests.pl b/tests/runtests.pl
> index 3f8d160..ca17138 100755
> --- a/tests/runtests.pl
> +++ b/tests/runtests.pl
> @@ -684,9 +684,9 @@ sub torture {
>
> logmsg "*** Alloc number $limit is now set to fail ***\n" if($gdbthis);
>
> - my $ret = 0;
> + my $ret;
> if($gdbthis) {
> - runclient(%gdbline)
> + $ret = runclient(%gdbline)
> }
> else {
> $ret = runclient(%testcmd);
> @@ -3565,6 +3565,7 @@ sub singletest {
> cmd => [
> $gdb,
> "--directory", "libtest",
> + "-return-child-result",

When was this option added to gdb? Since it's added unconditionally, it will
break -g debugging altogether if it's run on an older system where it's not
recognized, and curl runs on a lot of older systems.

> $DBGCURL,
> "-x", "$LOGDIR/gdbcmd"
> ],
> @@ -3573,16 +3574,17 @@ sub singletest {
> }
> elsif($gdbthis) {
> my $GDBW = ($gdbxwin) ? "-w" : "";
> - runclient(
> + $cmdres = runclient(
> cmd => [
> $gdb,
> "--directory", "libtest",
> + "-return-child-result",
> $DBGCURL,
> $GDBW,
> "-x", "$LOGDIR/gdbcmd",
> ]
> );
> - $cmdres=0; # makes it always continue after a debugged run
> + $cmdres >>= 8;
> }
> else {
> $cmdres = runclient(%test_command);
> --
> 2.1.2
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-11-17