Packets: Add reserve() / capacity() to PacketData interface
[senf.git] / Utils / Daemon / Daemon.test.cc
index cdf74b8..584761f 100644 (file)
@@ -73,7 +73,7 @@ namespace {
         }
     };
 
-    int myMain(int argc, char ** argv)
+    int myMain(int argc, char const ** argv)
     {
         MyDaemon instance;
         return instance.start(argc, argv);
@@ -94,6 +94,7 @@ namespace {
         if (pid < 0) throw senf::SystemException("::fork()");
         if (pid == 0) {
             signal(SIGABRT, &backtrace);
+            signal(SIGCHLD, SIG_IGN);
             try {
                 ::_exit(myMain(argc, argv));
             } catch (std::exception & ex) {
@@ -103,6 +104,7 @@ namespace {
             }
             ::_exit(125);
         }
+        signal(SIGCHLD, SIG_DFL);
         int status;
         if (::waitpid(pid, &status, 0) < 0) 
             throw senf::SystemException("::waitpid()");
@@ -118,10 +120,11 @@ namespace {
 
 BOOST_AUTO_UNIT_TEST(testDaemon)
 {
-    char * args[] = { "run", 
-                      "--console-log=testDaemon.log", 
-                      "--pid-file=testDaemon.pid" };
-    BOOST_CHECK_EQUAL( run(sizeof(args)/sizeof(*args),args), 0 );
+    char const * args[] = { "run", 
+                            "--console-log=testDaemon.log", 
+                            "--pid-file=testDaemon.pid" };
+
+    SENF_CHECK_NO_THROW( BOOST_CHECK_EQUAL( run(sizeof(args)/sizeof(*args), const_cast<char **>(args)), 0 ) );
 
     BOOST_CHECK( ! boost::filesystem::exists("invalid.log") );
     BOOST_CHECK( ! boost::filesystem::exists("invalid.pid") );