signal_set_.remove(signum);
} catch (const boost::system::system_error& ex) {
isc_throw(isc::Unexpected,
- "Failed to add signal " << signum << ": " << ex.what());
+ "Failed to remove signal " << signum << ": " << ex.what());
}
}
ProcessSpawnImpl::isAnyRunning() const {
lock_guard<std::mutex> lk(mutex_);
if (process_collection_.find(this) != process_collection_.end()) {
- for (auto& proc : process_collection_[this]) {
+ for (auto const& proc : process_collection_[this]) {
if (proc.second->running_) {
return (true);
}
// Now check that signal value is correct.
EXPECT_EQ(SIGINT, processed_signals_[0]);
+
+ // Set test fail safe.
+ setTestTime(1000);
+
+ // Unregister the receive of SIGINT.
+ ASSERT_NO_THROW(io_signal_set_->remove(SIGINT));
+
+ // Use TimedSignal to generate SIGINT 100 ms after we start IOService::run.
+ TimedSignal sig_int_too_late(*io_service_, SIGINT, 100);
+
+ // The first handler executed is the IOSignal's internal timer expire
+ // callback.
+ io_service_->run_one();
+
+ // The next handler executed is IOSignal's handler.
+ io_service_->run_one();
+
+ // Polling once to be sure.
+ io_service_->poll();
+
+ // Verify that we did not process the signal.
+ ASSERT_EQ(1, processed_signals_.size());
}
// Test verifies that signals can be delivered rapid-fire without falling over.
ASSERT_EQ(SIGCHLD, processed_signals_[0]);
EXPECT_EQ(32, process.getExitStatus(pid));
+
+ ASSERT_NO_THROW(pid = process.spawn(true));
+
+ // Set test fail safe.
+ setTestTime(1000);
+
+ // The next handler executed is IOSignal's handler.
+ io_service_->run_one();
+
+ // The first handler executed is the IOSignal's internal timer expire
+ // callback.
+ io_service_->run_one();
+
+ // Polling once to be sure.
+ io_service_->poll();
+
+ ASSERT_EQ(2, processed_signals_.size());
+ ASSERT_EQ(SIGCHLD, processed_signals_[0]);
+ ASSERT_EQ(SIGCHLD, processed_signals_[1]);
+
+ EXPECT_THROW(process.getExitStatus(pid), InvalidOperation);
}
// This test verifies that the EXIT_FAILURE code is returned when