[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1169851 - /subversion/trunk/subversion/tests/svn_test_main.c

From: Hyrum K Wright <hyrum.wright_at_wandisco.com>
Date: Mon, 12 Sep 2011 15:46:45 -0500

It is no different than passing --trap-assertion-failures. I didn't
even know that option existed prior to your mail.

However, --trap-assertion-failures has the unfortunate property that
it isn't enabled by default in a standard 'make check' run, so the
tests still abort() rather than continue.

I'll revert this change as unneeded if folks so desire.

-Hyrum

On Mon, Sep 12, 2011 at 2:10 PM, Daniel Shahaf <d.s_at_daniel.shahaf.name> wrote:
> 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... */
>>
>>
>

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Received on 2011-09-12 22:47:17 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.