How is that different from using svn_error_raise_on_malfunction()?
i.e., from passing --trap-assertion-failures ?
hwright_at_apache.org wrote on Mon, Sep 12, 2011 at 18:03:42 -0000:
> Author: hwright
> Date: Mon Sep 12 18:03:41 2011
> New Revision: 1169851
>
> URL: http://svn.apache.org/viewvc?rev=1169851&view=rev
> Log:
> Don't let an early abort in the C tests prevent the run of subsequent tests
> in the same test suite.
>
> * subversion/tests/svn_test_main.c
> (abort_handler): New.
> (do_test_num): Set and return the above abort handler.
>
> Modified:
> subversion/trunk/subversion/tests/svn_test_main.c
>
> Modified: subversion/trunk/subversion/tests/svn_test_main.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_main.c?rev=1169851&r1=1169850&r2=1169851&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/tests/svn_test_main.c (original)
> +++ subversion/trunk/subversion/tests/svn_test_main.c Mon Sep 12 18:03:41 2011
> @@ -206,6 +206,22 @@ crash_handler(int signum)
> longjmp(jump_buffer, 1);
> }
>
> +static svn_error_t *
> +abort_handler(svn_boolean_t can_return,
> + const char *file,
> + int line,
> + const char *expr)
> +{
> + if (!can_return)
> + {
> + printf("unrecoverable abort() in %s:%d: '%s'\n", file, line, expr);
> + exit(1);
> + }
> +
> + return svn_error_createf(SVN_ERR_ASSERTION_FAIL, NULL,
> + _("In file '%s' line %d: assertion failed (%s)"),
> + file, line, expr);
> +}
>
> /* Execute a test number TEST_NUM. Pretty-print test name and dots
> according to our test-suite spec, and return the result code.
> @@ -226,6 +242,7 @@ do_test_num(const char *progname,
> const struct svn_test_descriptor_t *desc;
> const int array_size = get_array_size();
> svn_boolean_t run_this_test; /* This test's mode matches DESC->MODE. */
> + svn_error_malfunction_handler_t old_handler;
>
> /* Check our array bounds! */
> if (test_num < 0)
> @@ -258,6 +275,8 @@ do_test_num(const char *progname,
> apr_signal(SIGSEGV, crash_handler);
> }
>
> + old_handler = svn_error_set_malfunction_handler(abort_handler);
> +
> /* We use setjmp/longjmp to recover from the crash. setjmp() essentially
> establishes a rollback point, and longjmp() goes back to that point.
> When we invoke longjmp(), it instructs setjmp() to return non-zero,
> @@ -286,6 +305,8 @@ do_test_num(const char *progname,
> "Test crashed "
> "(run in debugger with '--allow-segfaults')");
>
> + svn_error_set_malfunction_handler(old_handler);
> +
> if (!allow_segfaults)
> {
> /* Now back to your regularly scheduled program... */
>
>
Received on 2011-09-12 21:11:32 CEST