mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 21:23:06 +00:00
Change assert_* to expect_* in tests
```
grep -Irl assert_ test/ | xargs sed -i \
's/witness_assert/witness_do_not_replace/g';
grep -Irl assert_ test/ | xargs sed -i \
's/malloc_mutex_assert_owner/malloc_mutex_do_not_replace_owner/g';
grep -Ir assert_ test/ | grep -o "[_a-zA-Z]*assert_[_a-zA-Z]*" | \
grep -v "^assert_"; # confirm no output
grep -Irl assert_ test/ | xargs sed -i 's/assert_/expect_/g';
grep -Irl witness_do_not_replace test/ | xargs sed -i \
's/witness_do_not_replace/witness_assert/g';
grep -Irl malloc_mutex_do_not_replace_owner test/ | xargs sed -i \
's/malloc_mutex_do_not_replace_owner/malloc_mutex_assert_owner/g';
```
This commit is contained in:
@@ -4,16 +4,16 @@
|
||||
#define N_PARAM 100
|
||||
#define N_THREADS 10
|
||||
|
||||
static void assert_rep() {
|
||||
assert_b_eq(prof_log_rep_check(), false, "Rep check failed");
|
||||
static void expect_rep() {
|
||||
expect_b_eq(prof_log_rep_check(), false, "Rep check failed");
|
||||
}
|
||||
|
||||
static void assert_log_empty() {
|
||||
assert_zu_eq(prof_log_bt_count(), 0,
|
||||
static void expect_log_empty() {
|
||||
expect_zu_eq(prof_log_bt_count(), 0,
|
||||
"The log has backtraces; it isn't empty");
|
||||
assert_zu_eq(prof_log_thr_count(), 0,
|
||||
expect_zu_eq(prof_log_thr_count(), 0,
|
||||
"The log has threads; it isn't empty");
|
||||
assert_zu_eq(prof_log_alloc_count(), 0,
|
||||
expect_zu_eq(prof_log_alloc_count(), 0,
|
||||
"The log has allocations; it isn't empty");
|
||||
}
|
||||
|
||||
@@ -35,22 +35,22 @@ TEST_BEGIN(test_prof_log_many_logs) {
|
||||
test_skip_if(!config_prof);
|
||||
|
||||
for (i = 0; i < N_PARAM; i++) {
|
||||
assert_b_eq(prof_log_is_logging(), false,
|
||||
expect_b_eq(prof_log_is_logging(), false,
|
||||
"Logging shouldn't have started yet");
|
||||
assert_d_eq(mallctl("prof.log_start", NULL, NULL, NULL, 0), 0,
|
||||
expect_d_eq(mallctl("prof.log_start", NULL, NULL, NULL, 0), 0,
|
||||
"Unexpected mallctl failure when starting logging");
|
||||
assert_b_eq(prof_log_is_logging(), true,
|
||||
expect_b_eq(prof_log_is_logging(), true,
|
||||
"Logging should be started by now");
|
||||
assert_log_empty();
|
||||
assert_rep();
|
||||
expect_log_empty();
|
||||
expect_rep();
|
||||
f();
|
||||
assert_zu_eq(prof_log_thr_count(), 1, "Wrong thread count");
|
||||
assert_rep();
|
||||
assert_b_eq(prof_log_is_logging(), true,
|
||||
expect_zu_eq(prof_log_thr_count(), 1, "Wrong thread count");
|
||||
expect_rep();
|
||||
expect_b_eq(prof_log_is_logging(), true,
|
||||
"Logging should still be on");
|
||||
assert_d_eq(mallctl("prof.log_stop", NULL, NULL, NULL, 0), 0,
|
||||
expect_d_eq(mallctl("prof.log_stop", NULL, NULL, NULL, 0), 0,
|
||||
"Unexpected mallctl failure when stopping logging");
|
||||
assert_b_eq(prof_log_is_logging(), false,
|
||||
expect_b_eq(prof_log_is_logging(), false,
|
||||
"Logging should have turned off");
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ TEST_BEGIN(test_prof_log_many_threads) {
|
||||
test_skip_if(!config_prof);
|
||||
|
||||
int i;
|
||||
assert_d_eq(mallctl("prof.log_start", NULL, NULL, NULL, 0), 0,
|
||||
expect_d_eq(mallctl("prof.log_start", NULL, NULL, NULL, 0), 0,
|
||||
"Unexpected mallctl failure when starting logging");
|
||||
for (i = 0; i < N_THREADS; i++) {
|
||||
thd_create(&thr_buf[i], &f_thread, NULL);
|
||||
@@ -83,10 +83,10 @@ TEST_BEGIN(test_prof_log_many_threads) {
|
||||
for (i = 0; i < N_THREADS; i++) {
|
||||
thd_join(thr_buf[i], NULL);
|
||||
}
|
||||
assert_zu_eq(prof_log_thr_count(), N_THREADS,
|
||||
expect_zu_eq(prof_log_thr_count(), N_THREADS,
|
||||
"Wrong number of thread entries");
|
||||
assert_rep();
|
||||
assert_d_eq(mallctl("prof.log_stop", NULL, NULL, NULL, 0), 0,
|
||||
expect_rep();
|
||||
expect_d_eq(mallctl("prof.log_stop", NULL, NULL, NULL, 0), 0,
|
||||
"Unexpected mallctl failure when stopping logging");
|
||||
}
|
||||
TEST_END
|
||||
@@ -111,19 +111,19 @@ TEST_BEGIN(test_prof_log_many_traces) {
|
||||
|
||||
test_skip_if(!config_prof);
|
||||
|
||||
assert_d_eq(mallctl("prof.log_start", NULL, NULL, NULL, 0), 0,
|
||||
expect_d_eq(mallctl("prof.log_start", NULL, NULL, NULL, 0), 0,
|
||||
"Unexpected mallctl failure when starting logging");
|
||||
int i;
|
||||
assert_rep();
|
||||
assert_log_empty();
|
||||
expect_rep();
|
||||
expect_log_empty();
|
||||
for (i = 0; i < N_PARAM; i++) {
|
||||
assert_rep();
|
||||
expect_rep();
|
||||
f1();
|
||||
assert_rep();
|
||||
expect_rep();
|
||||
f2();
|
||||
assert_rep();
|
||||
expect_rep();
|
||||
f3();
|
||||
assert_rep();
|
||||
expect_rep();
|
||||
}
|
||||
/*
|
||||
* There should be 8 total backtraces: two for malloc/free in f1(), two
|
||||
@@ -132,9 +132,9 @@ TEST_BEGIN(test_prof_log_many_traces) {
|
||||
* optimizations such as loop unrolling might generate more call sites.
|
||||
* So >= 8 traces are expected.
|
||||
*/
|
||||
assert_zu_ge(prof_log_bt_count(), 8,
|
||||
expect_zu_ge(prof_log_bt_count(), 8,
|
||||
"Expect at least 8 backtraces given sample workload");
|
||||
assert_d_eq(mallctl("prof.log_stop", NULL, NULL, NULL, 0), 0,
|
||||
expect_d_eq(mallctl("prof.log_stop", NULL, NULL, NULL, 0), 0,
|
||||
"Unexpected mallctl failure when stopping logging");
|
||||
}
|
||||
TEST_END
|
||||
|
||||
Reference in New Issue
Block a user