subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1875188 - /subversion/trunk/subversion/tests/libsvn_subr/mergeinfo-test.c
Date Sat, 14 Mar 2020 11:38:57 GMT
Author: stsp
Date: Sat Mar 14 11:38:57 2020
New Revision: 1875188

URL: http://svn.apache.org/viewvc?rev=1875188&view=rev
Log:
Plug error leaks in newly added mergeinfo tests.

Found by: svn-bb-openbsd buildbot
https://ci.apache.org/builders/svn-bb-openbsd/builds/510/steps/Test/logs/faillog-ra_svn-fsfs

[[[
subversion/tests/svn_test_main.c:475: (apr_err=SVN_ERR_TEST_FAILED)
svn_tests: E200006: Test crashed (run in debugger with '--allow-segfaults')
FAIL:  mergeinfo-test 25: test rangelist merge random non-validated inputs
]]]

Core was generated by `mergeinfo-test'.
Program terminated with signal SIGABRT, Aborted.
#0  *_libc_abort () at /usr/src/lib/libc/stdlib/abort.c:57
57              memset(&sa, 0, sizeof(sa));
(gdb) up
#1  0x0000010070bcff68 in err_abort (data=0x10022671880)
156         abort();
(gdb) list
151     {
152       svn_error_t *err = data;  /* For easy viewing in a debugger */
153       SVN_UNUSED(err);
154
155       if (!getenv("SVN_DBG_NO_ABORT_ON_ERROR_LEAK"))
156         abort();
157       return APR_SUCCESS;
158     }
159     #endif
160
(gdb) p *err
$3 = {apr_err = 235000,
  message = 0x1001bc9c280 "In file 'subversion/libsvn_subr/mergeinfo.c' line 1096: assertion
failed (rangelist_is_sorted(chg))", child = 0x0,
  pool = 0x10085adbc00,
  file = 0x10070d799b0 "subversion/libsvn_subr/mergeinfo.c", line = 1096}
(gdb)

* subversion/tests/libsvn_subr/mergeinfo-test.c
  (clear_failure_mode_errors): New helper function. Clears errors accumulated
   during a test run.
  (test_rangelist_merge_random_canonical_inputs,
   test_rangelist_merge_random_semi_c_inputs,
   test_rangelist_merge_random_non_validated_inputs): Clear accumulated errors.

Modified:
    subversion/trunk/subversion/tests/libsvn_subr/mergeinfo-test.c

Modified: subversion/trunk/subversion/tests/libsvn_subr/mergeinfo-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/mergeinfo-test.c?rev=1875188&r1=1875187&r2=1875188&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/mergeinfo-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/mergeinfo-test.c Sat Mar 14 11:38:57 2020
@@ -2212,6 +2212,20 @@ add_failure_mode(svn_error_t *err_chain,
     }
 }
 
+static void
+clear_failure_mode_errors(apr_hash_t *failure_modes, apr_pool_t *scratch_pool)
+{
+  apr_hash_index_t *hi;
+
+  for (hi = apr_hash_first(scratch_pool, failure_modes);
+       hi;
+       hi = apr_hash_next(hi))
+    {
+      svn_error_t *err = apr_hash_this_val(hi);
+      svn_error_clear(err);
+    }
+}
+
 static svn_error_t *
 test_rangelist_merge_random_canonical_inputs(apr_pool_t *pool)
 {
@@ -2248,12 +2262,13 @@ test_rangelist_merge_random_canonical_in
                    rangelist_to_string(rly, iterpool),
                    failure_mode);
             /*svn_handle_error(err, stdout, FALSE);*/
-            svn_error_clear(err);
             pass = FALSE;
           }
       }
    }
 
+  clear_failure_mode_errors(failure_modes, pool);
+
   if (!pass)
     return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
                              "Test failed: %d failure modes",
@@ -2300,12 +2315,13 @@ test_rangelist_merge_random_semi_c_input
                    rangelist_to_string(rly, iterpool),
                    failure_mode);
             /*svn_handle_error(err, stdout, FALSE);*/
-            svn_error_clear(err);
             pass = FALSE;
           }
       }
    }
 
+  clear_failure_mode_errors(failure_modes, pool);
+
   if (!pass)
     return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
                              "Test failed: %d failure modes",
@@ -2343,13 +2359,12 @@ test_rangelist_merge_random_non_validate
         rangelist_random_non_validated(&rly, &seed, iterpool);
 
         err = svn_error_trace(rangelist_merge_random_inputs(rlx, rly, iterpool));
-        if (add_failure_mode(err, failure_modes))
-          {
-            svn_error_clear(err);
-          }
+        add_failure_mode(err, failure_modes);
       }
    }
 
+   clear_failure_mode_errors(failure_modes, pool);
+
   return SVN_NO_ERROR;
 }
 



Mime
View raw message