subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1659016 - in /subversion/trunk/subversion/tests: libsvn_ra/ra-test.c svn_test.h
Date Wed, 11 Feb 2015 17:55:52 GMT
Author: brane
Date: Wed Feb 11 17:55:52 2015
New Revision: 1659016

URL: http://svn.apache.org/r1659016
Log:
Follow up to r1659010: Instead of killin the child svnserve process
in ra-test, attempt to stop it by closing the process pipes and
waiting for the process to exit normally.

* subversion/tests/svn_test.h: Include stdio.h.
  (SVN_TEST_ASSERT_NO_RETURN): New assertion macro.

* subversion/tests/libsvn_ra/ra-test.c
  (close_tunnel): Close pipes and wait for the subprocess to exit.

Modified:
    subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
    subversion/trunk/subversion/tests/svn_test.h

Modified: subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_ra/ra-test.c?rev=1659016&r1=1659015&r2=1659016&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_ra/ra-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_ra/ra-test.c Wed Feb 11 17:55:52 2015
@@ -240,7 +240,21 @@ close_tunnel(void *tunnel_context, void
   if (b->magic != CLOSE_MAGIC)
     abort();
   if (--b->tb->open_count == 0)
-    apr_proc_kill(b->proc, SIGTERM);
+    {
+      apr_status_t child_exit_status;
+      int child_exit_code;
+      apr_exit_why_e child_exit_why;
+
+      SVN_TEST_ASSERT_NO_RETURN(0 == apr_file_close(b->proc->in));
+      SVN_TEST_ASSERT_NO_RETURN(0 == apr_file_close(b->proc->out));
+
+      child_exit_status =
+        apr_proc_wait(b->proc, &child_exit_code, &child_exit_why, APR_WAIT);
+
+      SVN_TEST_ASSERT_NO_RETURN(child_exit_status == APR_CHILD_DONE);
+      SVN_TEST_ASSERT_NO_RETURN(child_exit_code == 0);
+      SVN_TEST_ASSERT_NO_RETURN(child_exit_why == APR_PROC_EXIT);
+    }
 }
 
 

Modified: subversion/trunk/subversion/tests/svn_test.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test.h?rev=1659016&r1=1659015&r2=1659016&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test.h (original)
+++ subversion/trunk/subversion/tests/svn_test.h Wed Feb 11 17:55:52 2015
@@ -27,6 +27,8 @@
 #define SVN_DEPRECATED
 #endif /* ! SVN_ENABLE_DEPRECATION_WARNINGS_IN_TESTS */
 
+#include <stdio.h>
+
 #include <apr_pools.h>
 
 #include "svn_delta.h"
@@ -54,6 +56,23 @@ extern "C" {
                                #expr, __FILE__, __LINE__);        \
   } while (0)
 
+/**
+ * Macro for testing assumptions when the context does not allow
+ * returning an svn_error_t*.
+ *
+ * Will write to stderr and cause a segfault if EXPR is false.
+ */
+#define SVN_TEST_ASSERT_NO_RETURN(expr)                           \
+  do {                                                            \
+    if (!(expr))                                                  \
+      {                                                           \
+        unsigned int z_e_r_o_p_a_g_e__;                           \
+        fprintf(stderr, "TEST ASSERTION FAILED: %s\n", #expr);    \
+        z_e_r_o_p_a_g_e__ = *(volatile unsigned int*)0;           \
+        *(volatile unsigned int*)0 = z_e_r_o_p_a_g_e__;           \
+      }                                                           \
+  } while (0)
+
 /** Handy macro for testing an expected svn_error_t return value.
  * EXPECTED must be a real error (neither SVN_NO_ERROR nor APR_SUCCESS).
  * The error returned by EXPR will be cleared.



Mime
View raw message