X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=include%2Fanna%2Ftesting%2FTestStep.hpp;h=844b6bec797c5d81bf75f322dd580dc728dccd84;hp=4442f66aa684be8b46d6bdf97b6468a47a3b589c;hb=21054b5919e21b14627fac09e718262ae2812af4;hpb=882e3764e48fdf93aeb078c1832b10a956288da3 diff --git a/include/anna/testing/TestStep.hpp b/include/anna/testing/TestStep.hpp index 4442f66..844b6be 100644 --- a/include/anna/testing/TestStep.hpp +++ b/include/anna/testing/TestStep.hpp @@ -13,6 +13,7 @@ #include #include #include +#include // Project #include @@ -102,6 +103,7 @@ class TestStepTimeout : public TestStep { public: TestStepTimeout(TestCase *testCase) : TestStep(testCase), a_timeout(0), a_timer(NULL) { a_type = Type::Timeout; } + ~TestStepTimeout() { do_reset(); } // setter & getters void setTimeout(const anna::Millisecond &t) throw() { a_timeout = t; } @@ -133,7 +135,7 @@ class TestStepSendDiameterXml : public TestStep { a_expired(false), a_originHost(NULL), a_waitForRequestStepNumber(-1) {;} - ~TestStepSendDiameterXml() {;} + ~TestStepSendDiameterXml() { do_reset(); } // setter & getters void setOriginHost(anna::diameter::comm::OriginHost *host) throw() { a_originHost = host; } @@ -167,6 +169,7 @@ class TestStepDelay : public TestStep { public: TestStepDelay(TestCase *testCase) : TestStep(testCase), a_delay(0), a_timer(NULL) { a_type = Type::Delay; } + ~TestStepDelay() { do_reset(); } // setter & getters void setDelay(const anna::Millisecond &d) throw() { a_delay = d; } @@ -193,7 +196,7 @@ class TestStepWaitDiameter : public TestStep { a_clientSession = NULL; a_serverSession = NULL; } - ~TestStepWaitDiameter() {;} + ~TestStepWaitDiameter() { do_reset(); } // setter & getters void setCondition(bool fromEntity, @@ -226,7 +229,7 @@ class TestStepCmd : public TestStep { std::string a_script; std::thread a_thread; - bool a_threadRunning; + std::atomic a_threadRunning; bool a_threadDeprecated; int a_resultCode; std::string a_errorMsg; @@ -236,9 +239,13 @@ class TestStepCmd : public TestStep { public: TestStepCmd(TestCase *testCase) : TestStep(testCase), a_threadRunning(false), a_threadDeprecated(false), a_resultCode(-2)/*, a_output("")*/, a_errorMsg(""), a_childPid(-1) { a_type = Type::Cmd; } + ~TestStepCmd() { do_reset(); } // setter & getters - void setThreadRunning(bool running) throw() { a_threadRunning = running; } + void setThreadRunning() throw() { a_threadRunning = true; } + void setThreadNotRunning() throw() { a_threadRunning = false; } + bool threadRunning() const throw() { return a_threadRunning; } + bool threadNotRunning() const throw() { return !a_threadRunning; } void setResultCode(int rc) throw() { a_resultCode = rc; } int getResultCode() const throw() { return a_resultCode; } @@ -266,6 +273,7 @@ class TestStepIpLimit : public TestStep { public: TestStepIpLimit(TestCase *testCase) : TestStep(testCase), a_ipLimit(1) { a_type = Type::IpLimit; } + ~TestStepIpLimit() { do_reset(); } // setter & getters void setIpLimit(unsigned int limit) throw() { a_ipLimit = limit; }