Re: [PATCH 6/6] perf, tools: Add test cases for new data source encoding

From: Jiri Olsa
Date: Mon Jun 05 2017 - 06:33:26 EST


On Fri, Jun 02, 2017 at 01:12:33PM -0700, Andi Kleen wrote:

SNIP

> + n += perf_mem__lvl_scnprintf(out + n, sizeof out - n, &mi);
> + snprintf(failure, sizeof failure, "unexpected %s", out);
> + TEST_ASSERT_VAL(failure, !strcmp(string, out));
> + return 0;
> +}
> +
> +int test__mem(int subtest __maybe_unused)
> +{
> + int ret = 0;
> +
> + ret |= check(((union perf_mem_data_src) {
> + .mem_lvl = PERF_MEM_LVL_HIT,
> + .mem_lvlx = PERF_MEM_LVLX_L4 }), "N/AL4 hit");
> +
> + ret |= check(((union perf_mem_data_src) {
> + .mem_lvl = PERF_MEM_LVL_MISS,
> + .mem_lvlx = PERF_MEM_LVLX_PMEM }), "N/APMEM miss");
> +
> + ret |= check(((union perf_mem_data_src) {
> + .mem_snoopx = PERF_MEM_SNOOPX_FWD,
> + .mem_lvl = PERF_MEM_LVL_MISS,
> + .mem_lvlx = PERF_MEM_LVLX_RAM }), "ForwardRAM miss");

[jolsa@krava perf]$ ./perf test source -v
5: Test data source output :
--- start ---
test child forked, pid 8689
FAILED tests/mem.c:20 unexpected FwdRAM miss
test child finished with -1
---- end ----
Test data source output: FAILED!

jirka