diff options
Diffstat (limited to 'tools/perf/tests/expr.c')
-rw-r--r-- | tools/perf/tests/expr.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c index f1d8411fce12..3c16f3df1980 100644 --- a/tools/perf/tests/expr.c +++ b/tools/perf/tests/expr.c @@ -56,7 +56,7 @@ static int test(struct expr_parse_ctx *ctx, const char *e, double val2) { double val; - if (expr__parse(&val, ctx, e, 1)) + if (expr__parse(&val, ctx, e)) TEST_ASSERT_VAL("parse test failed", 0); TEST_ASSERT_VAL("unexpected value", val == val2); return 0; @@ -104,17 +104,17 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused) } p = "FOO/0"; - ret = expr__parse(&val, ctx, p, 1); + ret = expr__parse(&val, ctx, p); TEST_ASSERT_VAL("division by zero", ret == -1); p = "BAR/"; - ret = expr__parse(&val, ctx, p, 1); + ret = expr__parse(&val, ctx, p); TEST_ASSERT_VAL("missing operand", ret == -1); expr__ctx_clear(ctx); TEST_ASSERT_VAL("find ids", expr__find_ids("FOO + BAR + BAZ + BOZO", "FOO", - ctx, 1) == 0); + ctx) == 0); TEST_ASSERT_VAL("find ids", hashmap__size(ctx->ids) == 3); TEST_ASSERT_VAL("find ids", hashmap__find(ctx->ids, "BAR", (void **)&val_ptr)); @@ -124,9 +124,10 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused) (void **)&val_ptr)); expr__ctx_clear(ctx); + ctx->runtime = 3; TEST_ASSERT_VAL("find ids", expr__find_ids("EVENT1\\,param\\=?@ + EVENT2\\,param\\=?@", - NULL, ctx, 3) == 0); + NULL, ctx) == 0); TEST_ASSERT_VAL("find ids", hashmap__size(ctx->ids) == 2); TEST_ASSERT_VAL("find ids", hashmap__find(ctx->ids, "EVENT1,param=3/", (void **)&val_ptr)); @@ -137,7 +138,7 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused) expr__ctx_clear(ctx); TEST_ASSERT_VAL("find ids", expr__find_ids("EVENT1 if #smt_on else EVENT2", - NULL, ctx, 0) == 0); + NULL, ctx) == 0); TEST_ASSERT_VAL("find ids", hashmap__size(ctx->ids) == 1); TEST_ASSERT_VAL("find ids", hashmap__find(ctx->ids, smt_on() ? "EVENT1" : "EVENT2", @@ -147,7 +148,7 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused) expr__ctx_clear(ctx); TEST_ASSERT_VAL("find ids", expr__find_ids("1.0 if EVENT1 > 100.0 else 1.0", - NULL, ctx, 0) == 0); + NULL, ctx) == 0); TEST_ASSERT_VAL("find ids", hashmap__size(ctx->ids) == 0); expr__ctx_free(ctx); |