]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds, mon, osd: with coverage enabled, exit(0) when SIGTERM is received
authorJosh Durgin <josh.durgin@dreamhost.com>
Fri, 10 Jun 2011 00:33:25 +0000 (17:33 -0700)
committerJosh Durgin <josh.durgin@dreamhost.com>
Fri, 10 Jun 2011 00:43:41 +0000 (17:43 -0700)
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
configure.ac
src/mds/MDS.cc
src/mon/Monitor.cc
src/osd/OSD.cc

index d1b22934d88a7fc2c9f09d187a24c19e0e6f0251..dc8da34982fd7aec9eb426e3ca65dc6dc2da7df5 100644 (file)
@@ -147,6 +147,9 @@ AC_ARG_ENABLE([coverage],
             [],
             [enable_coverage=no])
 AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_coverage" != xno)
+if test "x$enable_coverage" != xno; then
+   AC_DEFINE([ENABLE_COVERAGE], [1], [Define if enabling coverage.])
+fi
 AC_SUBST(GCOV_PREFIX_STRIP, `echo $(pwd)/src | tr -dc / | wc -c`)
 
 # radosgw?
index cbc9d0a902426625afcf60a4373ed48f1ec7a4b5..09ebef46a812f1fff2eefa010db0d7d40ec43aea 100644 (file)
 
 
 
+#ifdef ENABLE_COVERAGE
+void handle_signal(int signal)
+{
+  exit(0);
+}
+#endif
 
 // cons/des
 MDS::MDS(const std::string &n, Messenger *m, MonClient *mc) : 
@@ -523,6 +529,11 @@ int MDS::init(int wanted_state)
   open_logger();
 
   mds_lock.Unlock();
+
+#ifdef ENABLE_COVERAGE
+  signal(SIGTERM, handle_signal);
+#endif
+
   return 0;
 }
 
index 1b917071e16c3359a3aebde33f633a0b478e63a0..4ece7a802eca0418cc834d58af3df77a9a459395 100644 (file)
@@ -61,6 +61,7 @@
 
 #include <sstream>
 #include <stdlib.h>
+#include <signal.h>
 
 #define DOUT_SUBSYS mon
 #undef dout_prefix
@@ -85,6 +86,13 @@ const CompatSet::Feature ceph_mon_feature_ro_compat[] =
 const CompatSet::Feature ceph_mon_feature_incompat[] =
   { CEPH_MON_FEATURE_INCOMPAT_BASE , CompatSet::Feature(0, "")};
 
+#ifdef ENABLE_COVERAGE
+void handle_signal(int signal)
+{
+  exit(0);
+}
+#endif
+
 Monitor::Monitor(string nm, MonitorStore *s, Messenger *m, MonMap *map) :
   name(nm),
   rank(-1), 
@@ -175,6 +183,11 @@ void Monitor::init()
   }
   
   lock.Unlock();
+
+#ifdef ENABLE_COVERAGE
+  signal(SIGTERM, handle_signal);
+#endif
+
 }
 
 void Monitor::shutdown()
index 861eead1ebe8eb2abbca4fd1a79956e9d3fd0433..80e7e8afe870b06d373df7196a7c0cf65c5f3f5a 100644 (file)
@@ -490,7 +490,11 @@ void handle_signal(int signal)
   switch (signal) {
   case SIGTERM:
   case SIGINT:
+#ifdef ENABLE_COVERAGE
+    exit(0);
+#else
     got_sigterm = true;
+#endif
     break;
   }
 }
@@ -613,10 +617,9 @@ int OSD::init()
   // tick
   timer.add_event_after(g_conf->osd_heartbeat_interval, new C_Tick(this));
 
-  if (false) {
-    signal(SIGTERM, handle_signal);
-    signal(SIGINT, handle_signal);
-  }
+#ifdef ENABLE_COVERAGE
+  signal(SIGTERM, handle_signal);
+#endif
 #if 0
   int ret = monc->start_auth_rotating(ename, KEY_ROTATE_TIME);
   if (ret < 0) {