You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Madan U S <ma...@collab.net> on 2006/12/31 04:05:15 UTC
[PATCH] Display stderr before throwing exception in the python test suite
Hi,
I was stuck with a failure of checkout_tests in the incomplete-directories branch, because the test was throwing an exception 'EXCEPTION: SVNProcessTerminatedBySignal', but I had no clue what was failing.
This was thrown from run_command_stdin(), if the exit code was not 0. It would have been very convinient to solve the root-cause of failure, if only I could the stderr - if any, at this point.
Please find attached a patch that does this (the patch is for trunk - I can later forward port it to incomplete-directories).
Regards,
Madan.
Re: [PATCH] Display stderr before throwing exception in the python test suite
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On 1/2/07, Daniel Rall <dl...@collab.net> wrote:
> When dealing with segfaults like this, I usually run just that test in
> --verbose mode, figure out what line it's failing on based on the
> output, re-run the test with a local edit which makes it stop before
> attempting the behavior that segfaults (performing the set up for me),
> then run just the failing command in the debugger.
Yah, same thing here. (Except I don't both to edit the tests tho. I
just have to read the tests to figure out how to produce the same
sequence and create a batch script which sets it up...)
> Something which simplified this process would be great. With some
> tests, there's sometimes not enough output to determine exactly where
> a failure occurs with a println-based binary search through the test.
Perhaps a way to tell the test framework to run X commands before
stopping? And, have --verbose print the number for each command?
i.e. it could fail on 'command' 1512, and you could pass it
--stop-at=1512 or something. A thought. -- justin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Display stderr before throwing exception in the python test suite
Posted by Daniel Rall <dl...@collab.net>.
On Tue, 02 Jan 2007, Malcolm Rowe wrote:
> On Sun, Dec 31, 2006 at 09:35:15AM +0530, Madan U S wrote:
> > I was stuck with a failure of checkout_tests in the incomplete-directories branch, because the test was throwing an exception 'EXCEPTION: SVNProcessTerminatedBySignal', but I had no clue what was failing.
>
> Without commenting on the implementation, I'd find something like this
> useful as well, particularly for tracking down assertion failures.
When dealing with segfaults like this, I usually run just that test in
--verbose mode, figure out what line it's failing on based on the
output, re-run the test with a local edit which makes it stop before
attempting the behavior that segfaults (performing the set up for me),
then run just the failing command in the debugger.
Something which simplified this process would be great. With some
tests, there's sometimes not enough output to determine exactly where
a failure occurs with a println-based binary search through the test.
Re: [PATCH] Display stderr before throwing exception in the python test suite
Posted by Malcolm Rowe <ma...@farside.org.uk>.
On Sun, Dec 31, 2006 at 09:35:15AM +0530, Madan U S wrote:
> I was stuck with a failure of checkout_tests in the incomplete-directories branch, because the test was throwing an exception 'EXCEPTION: SVNProcessTerminatedBySignal', but I had no clue what was failing.
>
Without commenting on the implementation, I'd find something like this
useful as well, particularly for tracking down assertion failures.
Regards,
Malcolm
Re: [PATCH] Display stderr before throwing exception in the python test suite
Posted by David James <ja...@cs.toronto.edu>.
On 12/31/06, Kamesh Jayachandran <ka...@collab.net> wrote:
> Madan,
> Why to map sys.stdout.write of invoker to stderr_lines of child?
> If the purpose is to help in identifying the root cause, why not make use
> of stdout_lines also?
> Or may be,
> + map(sys.stdout.write, stdout_lines)
> + map(sys.stderr.write, stderr_lines)
It is unusual to pass in a function which has side-effects to "map",
because this function is usually used for functional programming. In
Python, it is more idiomatic to join together the lines before
printing them out, like this:
sys.stdout.write("".join(stdout_lines))
sys.stderr.write("".join(stderr_lines))
Cheers,
David
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
RE: [PATCH] Display stderr before throwing exception in the python test suite
Posted by Kamesh Jayachandran <ka...@collab.net>.
Madan,
Why to map sys.stdout.write of invoker to stderr_lines of child?
If the purpose is to help in identifying the root cause, why not make use of stdout_lines also?
Or may be,
+ map(sys.stdout.write, stdout_lines)
+ map(sys.stderr.write, stderr_lines)
Somehow I am seeing less use for this patch, I may be wrong!.
IIRC SVNProcessTerminatedBySignal is raised for segfaults and aborts. In both the cases you may not have anything useful in the stderr stream. I have verified the current trunk and could confirm that we never write anything to stderr prior to abort.
May be useful for 'abort invoked through asserts'. Did you encounter such aborts?
With regards
Kamesh Jayachandran
-----Original Message-----
From: Madan U S [mailto:madan@collab.net]
Sent: Sun 12/31/2006 9:35 AM
To: dev@subversion.tigris.org
Subject: [PATCH] Display stderr before throwing exception in the python test suite
Hi,
I was stuck with a failure of checkout_tests in the incomplete-directories branch, because the test was throwing an exception 'EXCEPTION: SVNProcessTerminatedBySignal', but I had no clue what was failing.
This was thrown from run_command_stdin(), if the exit code was not 0. It would have been very convinient to solve the root-cause of failure, if only I could the stderr - if any, at this point.
Please find attached a patch that does this (the patch is for trunk - I can later forward port it to incomplete-directories).
Regards,
Madan.
Re: [PATCH] Display stderr before throwing exception in the python test suite
Posted by Malcolm Rowe <ma...@farside.org.uk>.
On Tue, Jan 09, 2007 at 07:59:34AM -0800, Justin Erenkrantz wrote:
> On 1/9/07, Malcolm Rowe <ma...@farside.org.uk> wrote:
> >I just had this problem myself again. While I certainly edit the tests
> >myself to set the problem condition up in some cases, it's also useful
> >to have the failing output for the cases where the output tells you
> >exactly what's wrong.
> >
> >How about this patch?
>
> +1. -- justin
>
r22947, thanks.
Regards,
Malcolm
Re: [PATCH] Display stderr before throwing exception in the python test suite
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On 1/9/07, Malcolm Rowe <ma...@farside.org.uk> wrote:
> I just had this problem myself again. While I certainly edit the tests
> myself to set the problem condition up in some cases, it's also useful
> to have the failing output for the cases where the output tells you
> exactly what's wrong.
>
> How about this patch?
+1. -- justin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Display stderr before throwing exception in the python test suite
Posted by Malcolm Rowe <ma...@farside.org.uk>.
On Sun, Dec 31, 2006 at 09:35:15AM +0530, Madan U S wrote:
> I was stuck with a failure of checkout_tests in the incomplete-directories branch, because the test was throwing an exception 'EXCEPTION: SVNProcessTerminatedBySignal', but I had no clue what was failing.
>
I just had this problem myself again. While I certainly edit the tests
myself to set the problem condition up in some cases, it's also useful
to have the failing output for the cases where the output tells you
exactly what's wrong.
How about this patch?
[[[
When executing commands as part of the test framework, if a command
fails due to a signal (coredump, etc), output the stdout and stderr
before raising the exception, to aid debugging.
* subversion/tests/cmdline/svntest/main.py
(run_command_stdin): Write stdout_lines and stderr_lines to stdout
and stderr before raising an exception.
Suggested by: madanus, kameshj
Patch by: djames
]]]
Regards,
Malcolm