From 2a66f783f18d627788922e8a22502af9aff0abc9 Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Tue, 11 Sep 2012 10:13:49 -0500 Subject: MDIA interface for PRD to determine MDIA is running. Change-Id: I3d23b584fb28a66eb2c92cb7c272b5fde59983f4 RTC: 45395 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1718 Tested-by: Jenkins Server Reviewed-by: Zane Shelley Reviewed-by: Christopher T. Phan Reviewed-by: A. Patrick Williams III --- src/usr/diag/mdia/mdia.C | 4 +- src/usr/diag/mdia/mdiasm.C | 9 ++++ src/usr/diag/mdia/mdiasm.H | 51 ++++++++++--------- src/usr/diag/mdia/test/mdiatestsm.H | 99 ++++++++++++++++++++++++++++--------- 4 files changed, 116 insertions(+), 47 deletions(-) (limited to 'src/usr/diag/mdia') diff --git a/src/usr/diag/mdia/mdia.C b/src/usr/diag/mdia/mdia.C index 9237c1d85..4c356c60d 100644 --- a/src/usr/diag/mdia/mdia.C +++ b/src/usr/diag/mdia/mdia.C @@ -109,8 +109,6 @@ errlHndl_t processEvent(MaintCommandEvent & i_event) void waitingForMaintCmdEvents(bool & o_waiting) { - // TODO unstub RTC 45395 - - o_waiting = true; + Singleton::instance().running(o_waiting); } } diff --git a/src/usr/diag/mdia/mdiasm.C b/src/usr/diag/mdia/mdiasm.C index cafeaff0a..9598fbd6c 100644 --- a/src/usr/diag/mdia/mdiasm.C +++ b/src/usr/diag/mdia/mdiasm.C @@ -45,6 +45,15 @@ using namespace fapi; namespace MDIA { +void StateMachine::running(bool & o_running) +{ + mutex_lock(&iv_mutex); + + o_running = !iv_done; + + mutex_unlock(&iv_mutex); +} + errlHndl_t StateMachine::run(const WorkFlowAssocMap & i_list) { // load the workflow properties diff --git a/src/usr/diag/mdia/mdiasm.H b/src/usr/diag/mdia/mdiasm.H index 58668d7a3..60abe14b1 100644 --- a/src/usr/diag/mdia/mdiasm.H +++ b/src/usr/diag/mdia/mdiasm.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/diag/mdia/mdiasm.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/mdia/mdiasm.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __MDIA_MDIASM_H #define __MDIA_MDIASM_H @@ -43,6 +43,13 @@ class StateMachine { public: + /** + * @brief running State machine in progress indicator. + * + * @param[out] o_running In progress indicator. + */ + void running(bool & o_running); + /** * @brief used by Maint cmd monitor to notify that * maint cmd timed out - called in monitor thread context diff --git a/src/usr/diag/mdia/test/mdiatestsm.H b/src/usr/diag/mdia/test/mdiatestsm.H index dcfd04085..5d95975c0 100644 --- a/src/usr/diag/mdia/test/mdiatestsm.H +++ b/src/usr/diag/mdia/test/mdiatestsm.H @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/diag/mdia/test/mdiatestsm.H $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2012 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/mdia/test/mdiatestsm.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #ifndef __TEST_MDIATESTSM_H #define __TEST_MDIATESTSM_H @@ -34,6 +34,9 @@ #include "../mdiasmimpl.H" #include +using namespace MDIA; +using namespace TARGETING; + class MdiaSmTest : public CxxTest::TestSuite { private: @@ -630,5 +633,57 @@ class MdiaSmTest : public CxxTest::TestSuite TS_TRACE(EXIT_MRK "testSmDoMaintCommand"); } + + void testSmRunning(void) + { + TS_TRACE(ENTER_MRK "testSmRunning"); + + StateMachine s; + + bool running = false; + + do { + + s.running(running); + + if(running) + { + TS_FAIL("unexpected result calling running (1)"); + break; + } + + WorkFlowAssocMap wkFlentries; + + TargetHandleList targets; + getTargets(1, targets); + + wkFlentries[targets[0]].push_back(START_SCRUB); + + s.setup(wkFlentries); + + s.running(running); + + if(!running) + { + TS_FAIL("unexpected result calling running (2)"); + break; + } + + s.reset(); + + s.run(wkFlentries); + + s.running(running); + + if(running) + { + TS_FAIL("unexpected result calling running (3)"); + break; + } + + } while(0); + + TS_TRACE(EXIT_MRK "testSmRunning"); + } }; #endif -- cgit v1.2.1