While playing around with the test suite on the way back from ApacheCon I noticed that if you kill testall at just the wrong time it'll leave stray shm sections around and further test runs will all fail. Here's a patch and log message that removes shm sections proactively before trying to create them, avoiding the problem.

-garrett
If testall is killed at just the wrong time you can leave a shared memory
segment on the machine and all subsequent runs of the test will fail. To
avoid this problem we now proactively remove named shared memory segments
before trying to create them.

* test/testshm.c
  (test_named): remove shm segment for SHARED_FILENAME before creating it.
  (test_named_remove): ditto.

Index: test/testshm.c
===================================================================
--- test/testshm.c      (revision 65537)
+++ test/testshm.c      (working copy)
@@ -166,6 +166,8 @@
     apr_exit_why_e why;
     const char *args[4];
 
+    apr_shm_remove(SHARED_FILENAME, p);
+
     rv = apr_shm_create(&shm, SHARED_SIZE, SHARED_FILENAME, p);
     APR_ASSERT_SUCCESS(tc, "Error allocating shared memory block", rv);
     if (rv != APR_SUCCESS) {
@@ -220,6 +222,8 @@
     apr_status_t rv;
     apr_shm_t *shm;
 
+    apr_shm_remove(SHARED_FILENAME, p);
+
     rv = apr_shm_create(&shm, SHARED_SIZE, SHARED_FILENAME, p);
     APR_ASSERT_SUCCESS(tc, "Error allocating shared memory block", rv);
     if (rv != APR_SUCCESS) {

Reply via email to