diff --git a/MAC/Test/GCF/MAC/src/Application1.cc b/MAC/Test/GCF/MAC/src/Application1.cc index 57fb1895f1b4f3206a73ba576b6d30d893c15a8f..b80e39bc83d5e202329fc3c0de8ee10c80a2c29b 100644 --- a/MAC/Test/GCF/MAC/src/Application1.cc +++ b/MAC/Test/GCF/MAC/src/Application1.cc @@ -14,6 +14,7 @@ #include <math.h> #include <stdio.h> #include <unistd.h> +#include <csignal> #include "TST_Protocol.ph" #include <Suite/suite.h> @@ -75,6 +76,10 @@ Application::~Application() } +void Application::abort() +{ + FINISH; +} GCFEvent::TResult Application::initial(GCFEvent& e, GCFPortInterface& /*p*/) { @@ -1352,16 +1357,28 @@ void Application::run() } // namespace GCF } // namespace LOFAR -using namespace LOFAR::GCF; +static LOFAR::GCF::Test::Application* pApp = 0; + +void sigintHandler(/*@unused@*/int signum) +{ + LOG_INFO(LOFAR::formatString("SIGINT signal detected (%d)",signum)); + if(0 != pApp) + pApp->abort(); +} int main(int argc, char* argv[]) { - TM::GCFTask::init(argc, argv); + LOFAR::GCF::TM::GCFTask::init(argc, argv); LOG_INFO("MACProcessScope: GCF.TEST.MAC.App1"); Suite s("GCF Test", &cerr); - s.addTest(new LOFAR::GCF::Test::Application); + pApp = new LOFAR::GCF::Test::Application; + s.addTest(pApp); + + /* install ctrl-c signal handler */ + (void)signal(SIGINT,sigintHandler); + s.run(); s.report(); s.free(); diff --git a/MAC/Test/GCF/MAC/src/Application1.h b/MAC/Test/GCF/MAC/src/Application1.h index a80d95a5b470c2cbc6a6ff7f0a8682e926312f83..7d8899d9e055fc7d6047eb33898dd55ccab898f5 100644 --- a/MAC/Test/GCF/MAC/src/Application1.h +++ b/MAC/Test/GCF/MAC/src/Application1.h @@ -25,7 +25,8 @@ class Application : public TM::GCFTask, public ::Test Application(); virtual ~Application(); - void run(); + void run(); + void abort(); private: TM::GCFEvent::TResult initial(TM::GCFEvent& e, TM::GCFPortInterface& p);