diff options
author | Dan Crowell <dcrowell@us.ibm.com> | 2012-03-29 16:03:59 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-03-30 15:50:50 -0500 |
commit | a2cf819c913c65fb9a019b8e62c8e77b8964929a (patch) | |
tree | 103843cd2c48b1a8af4f17de3da1bc23627b8836 /src/usr/devicefw/test/associatortest.H | |
parent | df3648d7cd33ee146de3041d3f0d93a713075e26 (diff) | |
download | talos-hostboot-a2cf819c913c65fb9a019b8e62c8e77b8964929a.tar.gz talos-hostboot-a2cf819c913c65fb9a019b8e62c8e77b8964929a.zip |
Prevent double registration in device framework
The device framework code will log an error if more than one
function is registered for the same operation/access/target
combination.
Change-Id: Id5136c389250ed26d7b62ff3b71116bba54ceb89
RTC: 38760
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/805
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/devicefw/test/associatortest.H')
-rw-r--r-- | src/usr/devicefw/test/associatortest.H | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/usr/devicefw/test/associatortest.H b/src/usr/devicefw/test/associatortest.H index c3ed5ab30..f54734858 100644 --- a/src/usr/devicefw/test/associatortest.H +++ b/src/usr/devicefw/test/associatortest.H @@ -113,6 +113,82 @@ public: } /** + * @test Verify we catch double registration. + */ + void testDoubleRegistration() + { + errlHndl_t l_errl = NULL; + + // Register non-sensical SCOM-READ to Nodes + Associator as; + l_errl = as.registerRoute(READ, + SCOM, + TYPE_NODE, + &performOperation); + if (l_errl) + { + TS_FAIL("testDoubleRegistration> Error received from registerRoute (1)."); + } + + // Register the exact same thing again + l_errl = as.registerRoute(READ, + SCOM, + TYPE_NODE, + &performOperation); + + if (l_errl) + { + // error log is expected case, delete it + delete l_errl; + } + else + { + TS_FAIL("testDoubleRegistration> No error from duplicate registration."); + } + + // Register a wildcard that overlaps + l_errl = as.registerRoute(WILDCARD, + SCOM, + TYPE_NODE, + &performOperation); + + if (l_errl) + { + // error log is expected case, delete it + delete l_errl; + } + else + { + TS_FAIL("testDoubleRegistration> No error from wildcard registration."); + } + + // Reverse the wildcard test + l_errl = as.registerRoute(WILDCARD, + PNOR, + TYPE_NODE, + &performOperation); + if (l_errl) + { + TS_FAIL("testDoubleRegistration> Error received from registerRoute (2)."); + } + l_errl = as.registerRoute(WRITE, + PNOR, + TYPE_NODE, + &performOperation); + if (l_errl) + { + // error log is expected case, delete it + delete l_errl; + } + else + { + TS_FAIL("testDoubleRegistration> No error from registration after wildcard."); + } + + + } + + /** * @test Verify registration with an operator as a WILDCARD. */ void testOpWildcard() |