[PATCH v3 4/4] perf test: Add a simple test for term 'percore'

Jin Yao
2019-03-19T01:06:39Z

It's a simple test which just checks if parser works.

v3:
---
No change

v2:
---
Change 'coresum' to 'percore'

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
tools/perf/tests/parse-events.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 4a69c07..e59a7bb 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -605,6 +605,14 @@ static int test__checkterms_simple(struct list_head *terms)
TEST_ASSERT_VAL("wrong val", term->val.num == 1);
TEST_ASSERT_VAL("wrong config", !strcmp(term->config, "umask"));

+ /* percore=1*/
+ term = list_entry(term->list.next, struct parse_events_term, list);
+ TEST_ASSERT_VAL("wrong type term",
+ term->type_term == PARSE_EVENTS__TERM_TYPE_PERCORE);
+ TEST_ASSERT_VAL("wrong type val",
+ term->type_val == PARSE_EVENTS__TERM_TYPE_NUM);
+ TEST_ASSERT_VAL("wrong val", term->val.num == 1);
+
return 0;
}

@@ -1734,7 +1742,7 @@ struct terms_test {

static struct terms_test test__terms[] = {
[0] = {
- .str = "config=10,config1,config2=3,umask=1",
+ .str = "config=10,config1,config2=3,umask=1,percore=1",
.check = test__checkterms_simple,
},
};
--
2.7.4