Skip to content
Snippets Groups Projects
Commit c939d75f authored by blaakmeer's avatar blaakmeer
Browse files

BugID: 802

Added abort handler to check application cleanup
parent 0255166e
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <csignal>
#include "TST_Protocol.ph" #include "TST_Protocol.ph"
#include <Suite/suite.h> #include <Suite/suite.h>
...@@ -75,6 +76,10 @@ Application::~Application() ...@@ -75,6 +76,10 @@ Application::~Application()
} }
void Application::abort()
{
FINISH;
}
GCFEvent::TResult Application::initial(GCFEvent& e, GCFPortInterface& /*p*/) GCFEvent::TResult Application::initial(GCFEvent& e, GCFPortInterface& /*p*/)
{ {
...@@ -1352,16 +1357,28 @@ void Application::run() ...@@ -1352,16 +1357,28 @@ void Application::run()
} // namespace GCF } // namespace GCF
} // namespace LOFAR } // 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[]) 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"); LOG_INFO("MACProcessScope: GCF.TEST.MAC.App1");
Suite s("GCF Test", &cerr); 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.run();
s.report(); s.report();
s.free(); s.free();
......
...@@ -25,7 +25,8 @@ class Application : public TM::GCFTask, public ::Test ...@@ -25,7 +25,8 @@ class Application : public TM::GCFTask, public ::Test
Application(); Application();
virtual ~Application(); virtual ~Application();
void run(); void run();
void abort();
private: private:
TM::GCFEvent::TResult initial(TM::GCFEvent& e, TM::GCFPortInterface& p); TM::GCFEvent::TResult initial(TM::GCFEvent& e, TM::GCFPortInterface& p);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment