summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/attn
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@us.ibm.com>2012-07-11 21:31:58 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-09-10 16:12:28 -0500
commit4f234f1bb43d2be3b84e71504474f97fedbb1826 (patch)
tree90c6a5dd191039cfc2d9f1b5ef07dcc62537cda1 /src/usr/diag/attn
parent4e5c9ec9784fd33d9ea10dee94fac197ec90527b (diff)
downloadtalos-hostboot-4f234f1bb43d2be3b84e71504474f97fedbb1826.tar.gz
talos-hostboot-4f234f1bb43d2be3b84e71504474f97fedbb1826.zip
Refactor unit test for attnsvc module.
RTC: 40441 Change-Id: Id65e4241d3f9afcb142a910980c525b41186bc19 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1364 Tested-by: Jenkins Server Reviewed-by: Zane Shelley <zshelle@us.ibm.com> Reviewed-by: LARINA M. DSOUZA <larsouza@in.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/diag/attn')
-rw-r--r--src/usr/diag/attn/attn.C82
-rw-r--r--src/usr/diag/attn/attnfwd.H9
-rw-r--r--src/usr/diag/attn/attnresolv.H130
-rw-r--r--src/usr/diag/attn/attnsvc.C36
-rw-r--r--src/usr/diag/attn/test/attnfakesys.C276
-rw-r--r--src/usr/diag/attn/test/attnfakesys.H174
-rw-r--r--src/usr/diag/attn/test/attntestsvc.H169
7 files changed, 168 insertions, 708 deletions
diff --git a/src/usr/diag/attn/attn.C b/src/usr/diag/attn/attn.C
index dfe27d26e..da79a6ee1 100644
--- a/src/usr/diag/attn/attn.C
+++ b/src/usr/diag/attn/attn.C
@@ -28,7 +28,6 @@
*/
#include "attnprd.H"
-#include "attnresolv.H"
#include "attnops.H"
#include "attnlist.H"
#include "attntrace.H"
@@ -102,87 +101,6 @@ errlHndl_t PrdWrapper::callPrd(const AttentionList & i_attentions)
return iv_impl->callPrd(i_attentions);
}
-errlHndl_t Resolver::resolve(
- TARGETING::TargetHandle_t i_proc,
- AttentionList & o_attentions)
-{
- // default resolver. determine what attentions are unmasked
- // in the ipoll mask register and query the proc & mem
- // resolvers for active attentions
-
- static ProcOps procOps;
- static MemOps memOps;
-
- errlHndl_t err = 0;
-
- uint64_t ipollMaskScomData = 0;
-
- do {
-
- // get ipoll mask register content and decode
- // unmasked attention types
-
- err = getScom(i_proc, IPOLL::address, ipollMaskScomData);
-
- if(err)
- {
- break;
- }
-
- // query the proc resolver for active attentions
-
- err = procOps.resolve(i_proc, ipollMaskScomData, o_attentions);
-
- if(err)
- {
- break;
- }
-
- // query the mem resolver for active attentions
-
- err = memOps.resolve(i_proc, ipollMaskScomData, o_attentions);
-
- if(err)
- {
- break;
- }
-
- } while(0);
-
- return err;
-}
-
-ResolverWrapper & getResolverWrapper()
-{
- // resolver wrapper singleton access
-
- static ResolverWrapper w;
-
- return w;
-}
-
-ResolverWrapper::ResolverWrapper()
- : iv_impl(&Singleton<Resolver>::instance())
-{
- // default call the real resolver
-}
-
-errlHndl_t ResolverWrapper::resolve(
- TARGETING::TargetHandle_t i_proc,
- AttentionList & o_attentions)
-{
- // forward call to the installed resolver implementation
-
- errlHndl_t err = iv_impl->resolve(i_proc, o_attentions);
-
- if(!err)
- {
- ATTN_DBG("resolved %d using: %p", o_attentions.size(), iv_impl);
- }
-
- return err;
-}
-
int64_t Attention::compare(const Attention & i_rhs) const
{
return ATTN::compare(iv_data, i_rhs.iv_data);
diff --git a/src/usr/diag/attn/attnfwd.H b/src/usr/diag/attn/attnfwd.H
index ac6c49a42..ced3ecb93 100644
--- a/src/usr/diag/attn/attnfwd.H
+++ b/src/usr/diag/attn/attnfwd.H
@@ -54,8 +54,6 @@ class AttentionList;
class AttentionOps;
class PrdWrapper;
class PrdImpl;
-class ResolverWrapper;
-class Resolver;
class TargetService;
class TargetServiceImpl;
class ScomWrapper;
@@ -164,13 +162,6 @@ ScomWrapper & getScomWrapper();
PrdWrapper & getPrdWrapper();
/**
- * @brief getResolverWrapper ResolverWrapper singleton access.
- *
- * @return ResolverWrapper Singleton instance.
- */
-ResolverWrapper & getResolverWrapper();
-
-/**
* @brief getTargetService TargetService singleton access.
*
* @return TargetService Singleton instance.
diff --git a/src/usr/diag/attn/attnresolv.H b/src/usr/diag/attn/attnresolv.H
deleted file mode 100644
index c8c756710..000000000
--- a/src/usr/diag/attn/attnresolv.H
+++ /dev/null
@@ -1,130 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/diag/attn/attnresolv.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_TAG
- */
-#ifndef __ATTN_ATTNRESOLV_H
-#define __ATTN_ATTNRESOLV_H
-
-/**
- * @file attnresolv.H
- *
- * @brief HBATTN Resolver wrapper class definitions.
- */
-
-#include "attnfwd.H"
-
-namespace ATTN
-{
-
-/**
- * @brief Resolver Resolver implementation interface requirement.
- *
- * Default implementation forwards call to Proc & Mem resolvers.
- */
-class Resolver
-{
- public:
-
- /**
- * @brief resolve Find attentions of the supplied type on the
- * supplied target.
- *
- * @param[in] i_proc The proc on which to look for attentions.
- * @param[out] o_attentions Where to put attentions when found.
- *
- * @return errlHndl_t Error log.
- *
- * @retval[0] No error.
- * @retval[!0] Unexpected error occurred.
- */
- virtual errlHndl_t resolve(
- TARGETING::TargetHandle_t i_proc,
- AttentionList & o_attentions);
-
- /**
- * @brief dtor
- */
- virtual ~Resolver() {}
-
- /**
- * @brief ctor
- */
- Resolver() {}
-};
-
-/**
- * @brief ResolverWrapper Hold the installed resolver implementation.
- */
-class ResolverWrapper
-{
- public:
-
- /**
- * @brief resolve Find attentions of the supplied type on the
- * supplied target.
- *
- * @param[in] i_proc The proc on which to look for attentions.
- * @param[out] o_attentions Where to put attentions when found.
- *
- * @return errlHndl_t Error log.
- *
- * @retval[0] No error.
- * @retval[!0] Unexpected error occurred.
- */
- errlHndl_t resolve(
- TARGETING::TargetHandle_t i_proc,
- AttentionList & o_attentions);
-
- /**
- * @brief setImpl Set the active PRD implementation.
- *
- * @param[in] i_prd The PRD implementation to make active.
- */
- void setImpl(Resolver & i_resolver)
- {
- iv_impl = &i_resolver;
- }
-
- /**
- * @brief ctor
- */
- ResolverWrapper();
-
- private:
-
- /**
- * @brief iv_impl The active resolver implementation.
- */
- Resolver * iv_impl;
-
- /**
- * @brief copy Disabled.
- */
- ResolverWrapper(const ResolverWrapper &);
-
- /**
- * @brief assignment Disabled.
- */
- ResolverWrapper & operator=(const ResolverWrapper &);
-};
-}
-#endif
diff --git a/src/usr/diag/attn/attnsvc.C b/src/usr/diag/attn/attnsvc.C
index 85d399819..715121408 100644
--- a/src/usr/diag/attn/attnsvc.C
+++ b/src/usr/diag/attn/attnsvc.C
@@ -32,8 +32,9 @@
#include "attnsvc.H"
#include "attntrace.H"
#include "attnlistutil.H"
-#include "attnresolv.H"
#include "attnprd.H"
+#include "attnproc.H"
+#include "attnmem.H"
using namespace std;
using namespace PRDF;
@@ -115,8 +116,37 @@ errlHndl_t Service::processIntrQMsgPreAck(const msg_t & i_msg,
do {
// determine what has an attention
+ // determine what attentions are unmasked
+ // in the ipoll mask register and query the proc & mem
+ // resolvers for active attentions
- err = getResolverWrapper().resolve(proc, o_attentions);
+ static ProcOps procOps;
+ static MemOps memOps;
+
+ uint64_t ipollMaskScomData = 0;
+
+ // get ipoll mask register content and decode
+ // unmasked attention types
+
+ err = getScom(proc, IPOLL::address, ipollMaskScomData);
+
+ if(err)
+ {
+ break;
+ }
+
+ // query the proc resolver for active attentions
+
+ err = procOps.resolve(proc, ipollMaskScomData, o_attentions);
+
+ if(err)
+ {
+ break;
+ }
+
+ // query the mem resolver for active attentions
+
+ err = memOps.resolve(proc, ipollMaskScomData, o_attentions);
if(err)
{
@@ -132,6 +162,8 @@ errlHndl_t Service::processIntrQMsgPreAck(const msg_t & i_msg,
break;
}
+ ATTN_DBG("resolved %d", o_attentions.size());
+
} while(0);
return err;
diff --git a/src/usr/diag/attn/test/attnfakesys.C b/src/usr/diag/attn/test/attnfakesys.C
index ae3697f9a..6e0d22f51 100644
--- a/src/usr/diag/attn/test/attnfakesys.C
+++ b/src/usr/diag/attn/test/attnfakesys.C
@@ -93,282 +93,6 @@ errlHndl_t FakeSystem::modifyScom(
return err;
}
-errlHndl_t FakeSystem::mask(const PRDF::AttnData & i_data)
-{
- mutex_lock(&iv_mutex);
-
- // mark the attention as masked and
- // indicate that mask was called in the
- // event history
-
- iv_map[i_data].mask = true;
- iv_map[i_data].history.push_back(MASK_EVENT);
-
- mutex_unlock(&iv_mutex);
-
- return 0;
-}
-
-errlHndl_t FakeSystem::unmask(const PRDF::AttnData & i_data)
-{
- mutex_lock(&iv_mutex);
-
- // mark the attention as unmasked and
- // indicate that unmask was called in the
- // event history
-
- iv_map[i_data].mask = false;
- iv_map[i_data].history.push_back(UNMASK_EVENT);
-
- mutex_unlock(&iv_mutex);
-
- return 0;
-}
-
-errlHndl_t FakeSystem::query(const PRDF::AttnData & i_data, bool & o_active)
-{
- mutex_lock(&iv_mutex);
-
- // provide the status of the attention and
- // indicate that query was called in the
- // event history
-
- o_active = iv_map[i_data].active;
- iv_map[i_data].history.push_back(QUERY_EVENT);
-
- mutex_unlock(&iv_mutex);
-
- return 0;
-}
-
-errlHndl_t FakeSystem::resolve(
- TargetHandle_t i_proc,
- AttentionList & o_attentions)
-{
- mutex_lock(&iv_mutex);
-
- // check each attention in the map
- // and add any marked active
- // to the output list
-
- map<AttnData, FakeSystemProperties>::iterator it = iv_map.begin();
-
- while(it != iv_map.end())
- {
- if(it->first.targetHndl == i_proc
- && it->second.active && !it->second.mask)
- {
- o_attentions.add(Attention(it->first, this));
- }
-
- ++it;
- }
-
- mutex_unlock(&iv_mutex);
-
- return 0;
-}
-
-errlHndl_t FakeSystem::callPrd(const AttentionList & i_attentions)
-{
- AttnList l;
-
- i_attentions.getAttnList(l);
-
- AttnList::iterator it = l.begin();
-
- mutex_lock(&iv_mutex);
-
- // simulate prd by clearing any attentions passed in and
- // indicate that prd was called in the
- // event history
-
- while(it != l.end())
- {
- iv_map[*it].active = false;
- iv_map[*it].history.push_back(CALLPRD_EVENT);
-
- ++it;
- }
-
- mutex_unlock(&iv_mutex);
-
- return 0;
-}
-
-uint64_t FakeSystem::raiseAttentions(msg_q_t i_q, uint64_t i_count)
-{
- AttnList list;
-
- mutex_lock(&iv_mutex);
-
- uint64_t count = generateAttentions(i_count, list);
-
- AttnList::iterator it = list.begin();
-
- while(it != list.end())
- {
- iv_map[*it].active = true;
- iv_map[*it].count++;
-
- ++it;
- }
-
- mutex_unlock(&iv_mutex);
-
- it = list.begin();
-
- while(it != list.end())
- {
- msg_t * m = msg_allocate();
-
- m->type = ATTENTION;
- m->data[0] = reinterpret_cast<uint64_t>(it->targetHndl);
-
- msg_sendrecv(i_q, m);
- ++it;
- }
-
- return count;
-}
-
-void FakeSystem::install()
-{
- // register this objects
- // functions as the
- // resolver and prd implementations
-
- getResolverWrapper().setImpl(*this);
- getPrdWrapper().setImpl(*this);
-}
-
-uint64_t FakeSystem::generateAttentions(uint64_t i_count, AttnList & io_list)
-{
- static const TargetHandle_t nullTarget = 0;
- static const uint64_t numTypes = 3;
- static const uint64_t maxTargets = 64;
-
- uint64_t count = 0;
-
- uint64_t remaining = maxTargets * numTypes;
-
- while(i_count != 0 && remaining > 0)
- {
- AttnData d;
-
- // generate a "random" attention on one of maxTargets possible targets
-
- d.targetHndl = nullTarget + randint(1, maxTargets);
- d.attnType = getRandomAttentionType();
-
- map<AttnData, FakeSystemProperties>::iterator it
- = iv_map.lower_bound(d);
-
- if(it != iv_map.end() && !compare(it->first, d)
- && (it->second.active || it->second.mask))
- {
- // the random attention algorithm might
- // generate an attention
- // that is already active or masked...
- // since this class simulates
- // behaving hardware, don't use those
-
- --remaining;
- }
- else
- {
- // check for a duplicate attention
- // already in the list
-
- AttnList::iterator lit = io_list.begin();
-
- while(lit != io_list.end())
- {
- if(!compare(*lit, d))
- {
- break;
- }
-
- ++lit;
- }
-
- if(lit == io_list.end())
- {
- io_list.push_back(d);
-
- ++count;
- --remaining;
- }
- }
-
- --i_count;
- }
-
- return count;
-}
-
-bool FakeSystem::validate()
-{
- static const uint64_t seq[] = {
- MASK_EVENT,
- CALLPRD_EVENT,
- QUERY_EVENT,
- UNMASK_EVENT,
- };
- static const uint64_t * seqEnd = seq
- +sizeof(seq)/sizeof(*seq);
-
- // this class simulates behaving hardware,
- // and PRD code that will clear every error.
- // using those assumptions, validate
- // the correct sequence occurred for each attention
-
- bool valid = true;
-
- mutex_lock(&iv_mutex);
-
- map<AttnData, FakeSystemProperties>::const_iterator it = iv_map.begin();
-
- while(it != iv_map.end())
- {
- vector<uint64_t> & history = it->second.history;
-
- vector<uint64_t>::const_iterator hit = history.begin();
- const uint64_t * sit = seq;
-
- uint64_t count = it->second.count;
-
- while(count > 0 && hit != history.end())
- {
- if(*sit != *hit)
- {
- break;
- }
-
- ++sit;
- ++hit;
-
- if(sit == seqEnd)
- {
- sit = seq;
- --count;
- }
- }
-
- if(count)
- {
- valid = false;
- break;
- }
-
- ++it;
- }
-
- mutex_unlock(&iv_mutex);
-
- return valid;
-}
-
bool FakeSystem::wait(uint64_t i_maxWaitNs)
{
uint64_t count = 0;
diff --git a/src/usr/diag/attn/test/attnfakesys.H b/src/usr/diag/attn/test/attnfakesys.H
index 50b7a57e0..188bba348 100644
--- a/src/usr/diag/attn/test/attnfakesys.H
+++ b/src/usr/diag/attn/test/attnfakesys.H
@@ -30,9 +30,6 @@
* @brief HBATTN fake system class definition.
*/
-#include "../attnops.H"
-#include "../attnprd.H"
-#include "../attnresolv.H"
#include "../attnscom.H"
#include "attntest.H"
#include "attncomp.H"
@@ -42,73 +39,12 @@ namespace ATTN
{
/**
- * @brief Event fake system event trace types.
- */
-enum Event
-{
- /**
- * @brief MASK_EVENT A simulated attention was masked.
- */
- MASK_EVENT,
-
- /**
- * @brief UNMASK_EVENT A simulated attention was unmasked.
- */
- UNMASK_EVENT,
-
- /**
- * @brief QUERY_EVENT A simulated attention was queried.
- */
- QUERY_EVENT,
-
- /**
- * @brief CALLPRD_EVENT A simulated attention was forwarded to PRD.
- */
- CALLPRD_EVENT,
-};
-
-/**
- * @brief FakeSystemProperties data associated with a simulated attention.
- */
-struct FakeSystemProperties
-{
- /**
- * @brief mask The mask state of the simulated attention.
- */
- bool mask;
-
- /**
- * @brief active The state of the simulated attention.
- */
- bool active;
-
- /**
- * @brief count The number of times the simulated attention has occurred.
- */
- uint64_t count;
-
- /**
- * @brief history Simlated aattention trace.
- */
- std::vector<uint64_t> history;
-
- /**
- * @brief ctor
- */
- FakeSystemProperties() : mask(false), active(false), count(0) {}
-};
-
-/**
* @brief FakeSystem
*
* Container that presents an interface to fake hardware
* implementations.
*/
-class FakeSystem :
- public AttentionOps,
- public Resolver,
- public PrdImpl,
- public ScomImpl
+class FakeSystem : public ScomImpl
{
public:
@@ -314,99 +250,6 @@ class FakeSystem :
ScomOp i_op);
/**
- * @brief mask Mask this attention.
- *
- * @param[in] i_data the attention to be masked.
- *
- * @return errlHndl_t Error log.
- *
- * @retval[0] No error.
- * @retval[!0] Unexpected error occurred.
- */
- virtual errlHndl_t mask(const PRDF::AttnData & i_data);
-
- /**
- * @brief unmask Unmask this attention.
- *
- * @param[in] i_data the attention to be unmasked.
- *
- * @return errlHndl_t Error log.
- *
- * @retval[0] No error.
- * @retval[!0] Unexpected error occurred.
- */
- virtual errlHndl_t unmask(const PRDF::AttnData & i_data);
-
- /**
- * @brief query Test to see if this attention is active.
- *
- * @param[in] i_data the attention to be queried.
- * @param[out] o_active true if attention is active.
- *
- * @return errlHndl_t Error log.
- *
- * @retval[0] No error.
- * @retval[!0] Unexpected error occurred.
- */
- virtual errlHndl_t query(const PRDF::AttnData & i_data,
- bool & o_active);
-
- /**
- * @brief resolve Find attentions of the supplied type on the
- * supplied target.
- *
- * @param[in] i_proc The proc on which to look for attentions.
- * @param[out] o_attentions Where to put attentions when found.
- *
- * @return errlHndl_t Error log.
- *
- * @retval[0] No error.
- * @retval[!0] Unexpected error occurred.
- */
- virtual errlHndl_t resolve(
- TARGETING::TargetHandle_t i_proc,
- AttentionList & o_attentions);
-
- /**
- * @brief callPrd Simulate a call to PRD.
- *
- * @param[in] i_attentions List of attentions for PRD to analyze.
- *
- * @return errlHndl_t Error log.
- *
- * @retval[0] No error occurred.
- * @retval[!0] Unexpected error occurred.
- */
- virtual errlHndl_t callPrd(const AttentionList & i_attentions);
-
- /**
- * @brief install install this class as the prd and resolver
- * implementation.
- */
- void install();
-
- /**
- * @brief raiseAttentions Attempt to raise random attentions.
- *
- * @param[in] i_q The message Q where simulated attention
- * messages should be sent.
- * @param[i_count] The number of attentions to generate.
- *
- * @return The actual number of attentions raised.
- */
- uint64_t raiseAttentions(msg_q_t i_q, uint64_t i_count);
-
- /**
- * @brief validate Perform validation of the simulated system.
- *
- * @return The result of the validation.
- *
- * @retval[true] Result is valid.
- * @retval[false] Result is invalid.
- */
- virtual bool validate();
-
- /**
* @brief dump Dump active attentions to trace.
*/
void dump();
@@ -424,21 +267,6 @@ class FakeSystem :
private:
/**
- * @brief generateAttentions Generate random attentions.
- *
- * @param[in] i_count The number of attentions to generate.
- * @param[in/out] io_list Where generated attentions are placed.
- *
- * @return uint64_t The actual number of attentions generated.
- */
- uint64_t generateAttentions(uint64_t i_count, PRDF::AttnList & io_list);
-
- /**
- * @brief iv_map Attention <-> state association.
- */
- AttnDataMap<FakeSystemProperties> iv_map;
-
- /**
* @brief Reg Register/address association alias.
*/
typedef std::map<uint64_t, uint64_t> RegAddrDataAssoc;
diff --git a/src/usr/diag/attn/test/attntestsvc.H b/src/usr/diag/attn/test/attntestsvc.H
index baac17321..452a6f91a 100644
--- a/src/usr/diag/attn/test/attntestsvc.H
+++ b/src/usr/diag/attn/test/attntestsvc.H
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/diag/attn/test/attntestsvc.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/attn/test/attntestsvc.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_TAG
+ */
#ifndef __TEST_ATTNTESTSVC_H
#define __TEST_ATTNTESTSVC_H
@@ -29,7 +30,6 @@
* @brief Unit test for the attnsvc module.
*/
-#include "../attnfwd.H"
#include "../attnsvc.H"
#include "attnfakesys.H"
#include "attntest.H"
@@ -185,14 +185,76 @@ class AttnSvcTest: public CxxTest::TestSuite
*/
void testAttentions()
{
+ static const uint64_t targetPoolSize = 8;
+ static const uint64_t iterations = 5;
+ static const uint64_t maxAttnsPerIteration = 5;
+
TS_TRACE(ENTER_MRK "testAttentions");
errlHndl_t err = 0;
- FakeSystem hooks;
Service svc;
- hooks.install();
+ FakePresenter presenter;
+ FakeSystem system;
+
+ FakeGfir xstpGfir(CHECK_STOP),
+ spclGfir(SPECIAL),
+ recGfir(RECOVERABLE);
+
+ xstpGfir.install(system);
+ spclGfir.install(system);
+ recGfir.install(system);
+
+ FakeMcs rec(RECOVERABLE), xstp(CHECK_STOP), special(SPECIAL);
+ FakeGp1 gp1;
+
+ xstp.install(system);
+ special.install(system);
+ rec.install(system);
+ gp1.install(system);
+
+ FakeIpoll xstpIpoll(CHECK_STOP, presenter),
+ spclIpoll(SPECIAL, presenter),
+ recIpoll(RECOVERABLE, presenter),
+ hostIpoll(HOST, presenter);
+
+ xstpIpoll.install(system);
+ spclIpoll.install(system);
+ recIpoll.install(system);
+ hostIpoll.install(system);
+
+ Validator v;
+
+ v.install(system);
+
+ system.installScomImpl();
+
+ FakeMemTargetService targetSvc(targetPoolSize);
+
+ TargetHandleList membufs, procs;
+
+ targetSvc.getAllChips(procs, TYPE_PROC);
+ targetSvc.getAllChips(membufs, TYPE_MEMBUF);
+
+ RandSource procSource(iterations,
+ maxAttnsPerIteration,
+ system,
+ &procs[0],
+ &procs[0] + procs.size());
+
+ RandSource memSource(
+ iterations,
+ maxAttnsPerIteration,
+ system,
+ &membufs[0],
+ &membufs[0] + membufs.size());
+
+ targetSvc.installTargetService();
+
+ FakePrd prd(system);
+
+ prd.installPrd();
do
{
@@ -204,33 +266,68 @@ class AttnSvcTest: public CxxTest::TestSuite
break;
}
- static const int64_t iterations = 20;
-
- for(int64_t it = 0; it < iterations; ++it)
+ if(!presenter.start(svc.iv_intrTaskQ))
{
- int64_t count = randint(1, 10);
+ TS_FAIL("unexpected error starting fake presenter");
+ break;
+ }
- TS_TRACE("raising %d attentions", count);
+ if(!memSource.start())
+ {
+ TS_FAIL("unexpected error starting source");
+ break;
+ }
- hooks.raiseAttentions(svc.iv_intrTaskQ, count);
+ if(!procSource.start())
+ {
+ TS_FAIL("unexpected error starting source");
+ break;
}
- err = svc.stop();
+ // wait for the testcase to finish injecting attentions
- if(err)
+ if(!memSource.wait())
{
- TS_FAIL("unexpected error stopping service");
+ TS_FAIL("unexpected error waiting for source");
break;
}
- if(!hooks.validate())
+ if(!procSource.wait())
{
- TS_FAIL("unexpected result after injecting attentions");
+ TS_FAIL("unexpected error waiting for source");
+ break;
+ }
+
+ // wait for the the service to handle all the attentions
+ TS_TRACE("Waiting for attentions to be cleared.");
+
+ if(!system.wait(TEN_CTX_SWITCHES_NS * iterations * 100))
+ {
+ TS_FAIL("Attentions still present on system.");
+
+ system.dump();
break;
}
} while(0);
+ err = svc.stop();
+
+ if(err)
+ {
+ TS_FAIL("unexpected error stopping service");
+ delete err;
+ }
+
+ presenter.stop();
+
+ if(!v.empty())
+ {
+ TS_FAIL("unexpected result after injecting attentions");
+
+ v.dump();
+ }
+
TS_TRACE(EXIT_MRK "testAttentions");
}
};
OpenPOWER on IntegriCloud