From 9056504483ad5f1c6a24eeebc01ac47b325a9b14 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 9 Dec 2006 10:38:11 +0000 Subject: [PATCH] handle abnormal program exit during regtest --- src/run-tests.pl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/run-tests.pl b/src/run-tests.pl index bdbcee4..396c474 100755 --- a/src/run-tests.pl +++ b/src/run-tests.pl @@ -281,10 +281,11 @@ sub killcfg() # $options sub runsync($) { +# open FILE, "valgrind -q --log-fd=3 ../mbsync ".shift()." -c .mbsyncrc test 3>&2 2>&1 |"; open FILE, "../mbsync -D ".shift()." -c .mbsyncrc test 2>&1 |"; my @out = ; close FILE or push(@out, $! ? "*** error closing mbsync: $!\n" : "*** mbsync exited with signal ".($?&127).", code ".($?>>8)."\n"); - return @out; + return $?, @out; } @@ -584,7 +585,18 @@ sub test($$) mkchan($$sx[0], $$sx[1], @{ $$sx[2] }); &writecfg(@{ $$tx[0] }); - my @ret = runsync("-J"); + my ($xc, @ret) = runsync("-J"); + if ($xc) { + print "Input:\n"; + printchan($$sx[0], $$sx[1], @{ $$sx[2] }); + print "Options:\n"; + print " [ ".join(", ", map('"'.qm($_).'"', @{ $$tx[0] }))." ]\n"; + print "Expected result:\n"; + printchan($$tx[1], $$tx[2], @{ $$tx[3] }); + print "Debug output:\n"; + print @ret; + exit 1; + } if (ckchan($$tx[1], $$tx[2], @{ $$tx[3] })) { print "Input:\n"; printchan($$sx[0], $$sx[1], @{ $$sx[2] });