On Thu, Jun 30, 2016 at 01:41:57PM -0600, David Ahern wrote:
> On 6/30/16 10:18 AM, Jiri Olsa wrote:
> > it was the setup in my .perfconfig:
> > 
> > [call-graph]
> > threshold=10
> > 
> > caused some of the callchains to disappear and screw the test,
> 
> Did you find out why it caused a segfault?

yep, the code of tests/hists_cumulate.c::do_test
expects each hist_entry to carry callchain,
and the option above cause only some of the
had it:

  do_test
  {

       root = &he->callchain->node.rb_root;
       cnode = rb_entry(rb_first(root), struct callchain_node, rb_node);

       c = 0;
       list_for_each_entry(clist, &cnode->val, list) {
       ^
       - root is empty, cnode is trash and this itaration segfaults

maybe we could also add check below

jirka


---
diff --git a/tools/perf/tests/hists_cumulate.c 
b/tools/perf/tests/hists_cumulate.c
index 1208284a7338..9fd54b79a788 100644
--- a/tools/perf/tests/hists_cumulate.c
+++ b/tools/perf/tests/hists_cumulate.c
@@ -216,6 +216,8 @@ static int do_test(struct hists *hists, struct result 
*expected, size_t nr_expec
 
                /* check callchain entries */
                root = &he->callchain->node.rb_root;
+
+               TEST_ASSERT_VAL("callchains expected", !RB_EMPTY_ROOT(root));
                cnode = rb_entry(rb_first(root), struct callchain_node, 
rb_node);
 
                c = 0;

Reply via email to