X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=test%2Ftest%2Ftest_service_cores.c;h=86b4073d21dc3389072d2aaee6cc1a9dad73d578;hb=5e80364a0389f76e4c8c20cdbe40a4db36b49f58;hp=a0768c967af90c017700b4e740aabafb4bd6ff52;hpb=4d55194d76a4cf23f95e700c6911f62cc625fb45;p=dpdk.git diff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c index a0768c967a..86b4073d21 100644 --- a/test/test/test_service_cores.c +++ b/test/test/test_service_cores.c @@ -242,6 +242,9 @@ service_name(void) static int service_attr_get(void) { + /* ensure all services unregistered so cycle counts are zero */ + unregister_all(); + struct rte_service_spec service; memset(&service, 0, sizeof(struct rte_service_spec)); service.callback = dummy_cb; @@ -275,6 +278,12 @@ service_attr_get(void) "Valid attr_get() call didn't return success"); TEST_ASSERT_EQUAL(0, attr_value, "attr_get() call didn't set correct cycles (zero)"); + /* check correct call count */ + const int attr_calls = RTE_SERVICE_ATTR_CALL_COUNT; + TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_calls, &attr_value), + "Valid attr_get() call didn't return success"); + TEST_ASSERT_EQUAL(0, attr_value, + "attr_get() call didn't get call count (zero)"); /* Call service to increment cycle count */ TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id), @@ -295,6 +304,24 @@ service_attr_get(void) rte_service_lcore_stop(slcore_id); + TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_calls, &attr_value), + "Valid attr_get() call didn't return success"); + TEST_ASSERT_EQUAL(1, (attr_value > 0), + "attr_get() call didn't get call count (zero)"); + + TEST_ASSERT_EQUAL(0, rte_service_attr_reset_all(id), + "Valid attr_reset_all() return success"); + + TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_id, &attr_value), + "Valid attr_get() call didn't return success"); + TEST_ASSERT_EQUAL(0, attr_value, + "attr_get() call didn't set correct cycles (zero)"); + /* ensure call count > zero */ + TEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_calls, &attr_value), + "Valid attr_get() call didn't return success"); + TEST_ASSERT_EQUAL(0, (attr_value > 0), + "attr_get() call didn't get call count (zero)"); + return unregister_all(); }