Fix test/unit/prof_log

Compiler optimizations may produce traces more than expected.  Instead verify
the lower bound only.
This commit is contained in:
Qi Wang 2019-04-03 16:19:00 -07:00 committed by Qi Wang
parent 93084cdc89
commit c2a3a7cd3f

View File

@ -125,12 +125,14 @@ TEST_BEGIN(test_prof_log_many_traces) {
assert_rep(); assert_rep();
} }
/* /*
* There should be 8 total backtraces: two for malloc/free in f1(), * There should be 8 total backtraces: two for malloc/free in f1(), two
* two for malloc/free in f2(), two for malloc/free in f3(), and then * for malloc/free in f2(), two for malloc/free in f3(), and then two
* two for malloc/free in f1()'s call to f3(). * for malloc/free in f1()'s call to f3(). However compiler
* optimizations such as loop unrolling might generate more call sites.
* So >= 8 traces are expected.
*/ */
assert_zu_eq(prof_log_bt_count(), 8, assert_zu_ge(prof_log_bt_count(), 8,
"Wrong number of backtraces given sample workload"); "Expect at least 8 backtraces given sample workload");
assert_d_eq(mallctl("prof.log_stop", NULL, NULL, NULL, 0), 0, assert_d_eq(mallctl("prof.log_stop", NULL, NULL, NULL, 0), 0,
"Unexpected mallctl failure when stopping logging"); "Unexpected mallctl failure when stopping logging");
} }