perf test: Reset err after using it hold errcode in hist testcases
authorWang Nan <wangnan0@huawei.com>
Mon, 11 Jan 2016 13:48:03 +0000 (13:48 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 11 Jan 2016 22:22:22 +0000 (19:22 -0300)
All hists test cases forget to reset err after using it to hold an
error code. If error occure in setup_fake_machine() it incorrectly
return TEST_OK.

This patch fixes it.

Suggested-and-Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1452520124-2073-13-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/hists_cumulate.c
tools/perf/tests/hists_filter.c
tools/perf/tests/hists_link.c
tools/perf/tests/hists_output.c

index e360892120618a46eea78dd5b1c59f6e87cfc9ca..5e6a86e50fb97aae648c16ce627157e8377ebb02 100644 (file)
@@ -706,6 +706,7 @@ int test__hists_cumulate(int subtest __maybe_unused)
        err = parse_events(evlist, "cpu-clock", NULL);
        if (err)
                goto out;
+       err = TEST_FAIL;
 
        machines__init(&machines);
 
index 2a784befd9ce56df84f0c3362c3ec7fcc05475c8..351a42463444a3df9f80daea3848499b8d39659a 100644 (file)
@@ -120,6 +120,7 @@ int test__hists_filter(int subtest __maybe_unused)
        err = parse_events(evlist, "task-clock", NULL);
        if (err)
                goto out;
+       err = TEST_FAIL;
 
        /* default sort order (comm,dso,sym) will be used */
        if (setup_sorting(NULL) < 0)
index c764d69ac6ef37e4e59e6335f9013de9f3baaef5..64b257d8d557679f71a56458067f5324e6a6f62c 100644 (file)
@@ -293,6 +293,7 @@ int test__hists_link(int subtest __maybe_unused)
        if (err)
                goto out;
 
+       err = TEST_FAIL;
        /* default sort order (comm,dso,sym) will be used */
        if (setup_sorting(NULL) < 0)
                goto out;
index ebe6cd485b5d8c4deeada43b89061f8905f4f554..b231265148d89a28e39387d423711c643351eb70 100644 (file)
@@ -597,6 +597,7 @@ int test__hists_output(int subtest __maybe_unused)
        err = parse_events(evlist, "cpu-clock", NULL);
        if (err)
                goto out;
+       err = TEST_FAIL;
 
        machines__init(&machines);