Author: julianfoad
Date: Thu Jul 1 14:38:38 2010
New Revision: 959683
URL: http://svn.apache.org/viewvc?rev=959683&view=rev
Log:
Make the C test harness main function trap SVN_ERR_ASSERT failures only when
run within the test suite, not when run within a debugger. More precisely,
add a "trap assertion failures" flag that is off by default and make the
test suite pass that flag. A follow-up to r958583 in which I added the trap
unconditionally.
* build/run_tests.py
(TestHarness._run_test): Pass '--trap-assertion-failures' to the C tests.
* subversion/tests/svn_test_main.c
(trap_assertion_failures, trap_assert_opt): New variable and option id.
(cl_options): Add a '--trap-assertion-failures' option.
(main): Check for the option and only trap assertion failures if it's set.
Modified:
subversion/trunk/build/run_tests.py
subversion/trunk/subversion/tests/svn_test_main.c
Modified: subversion/trunk/build/run_tests.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/build/run_tests.py?rev=959683&r1=959682&r2=959683&view=diff
==============================================================================
--- subversion/trunk/build/run_tests.py (original)
+++ subversion/trunk/build/run_tests.py Thu Jul 1 14:38:38 2010
@@ -257,6 +257,7 @@ class TestHarness:
'--srcdir=' + os.path.join(self.srcdir, progdir)]
if self.config_file is not None:
cmdline.append('--config-file=' + self.config_file)
+ cmdline.append('--trap-assertion-failures')
else:
print('Don\'t know what to do about ' + progbase)
sys.exit(1)
Modified: subversion/trunk/subversion/tests/svn_test_main.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_main.c?rev=959683&r1=959682&r2=959683&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_main.c (original)
+++ subversion/trunk/subversion/tests/svn_test_main.c Thu Jul 1 14:38:38 2010
@@ -50,6 +50,13 @@ const char **test_argv;
/* Test option: Print more output */
static svn_boolean_t verbose_mode = FALSE;
+/* Test option: Trap SVN_ERR_ASSERT failures in the code under test. Default
+ * is false so the test can easily be run in a debugger with the debugger
+ * catching the assertion failure. Test suites should enable this in order
+ * to be able to continue with other sub-tests and report the results even
+ * when a test hits an assertion failure. */
+static svn_boolean_t trap_assertion_failures = FALSE;
+
/* Test option: Print only unexpected results */
static svn_boolean_t quiet_mode = FALSE;
@@ -62,6 +69,7 @@ enum {
fstype_opt,
list_opt,
verbose_opt,
+ trap_assert_opt,
quiet_opt,
config_opt,
server_minor_version_opt
@@ -82,6 +90,8 @@ static const apr_getopt_option_t cl_opti
{"server-minor-version", server_minor_version_opt, 1,
N_("set the minor version for the server ('3', '4',\n"
"'5', or '6')")},
+ {"trap-assertion-failures", trap_assert_opt, 0,
+ N_("catch and report SVN_ERR_ASSERT failures")},
{"quiet", quiet_opt, 0,
N_("print only unexpected results")},
{0, 0, 0, 0}
@@ -351,6 +361,9 @@ main(int argc, const char *argv[])
case verbose_opt:
verbose_mode = TRUE;
break;
+ case trap_assert_opt:
+ trap_assertion_failures = TRUE;
+ break;
case quiet_opt:
quiet_mode = TRUE;
break;
@@ -384,7 +397,8 @@ main(int argc, const char *argv[])
cleanup_pool = svn_pool_create(pool);
test_pool = svn_pool_create(pool);
- svn_error_set_malfunction_handler(svn_error_raise_on_malfunction);
+ if (trap_assertion_failures)
+ svn_error_set_malfunction_handler(svn_error_raise_on_malfunction);
if (argc >= 2) /* notice command-line arguments */
{