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:
Yinan Zhang
2020-02-18 14:39:06 -08:00
parent 162c2bcf31
commit 21dfa4300d
85 changed files with 1854 additions and 1854 deletions

View File

@@ -8,15 +8,15 @@ test_switch_background_thread_ctl(bool new_val) {
size_t sz = sizeof(bool);
e1 = new_val;
assert_d_eq(mallctl("background_thread", (void *)&e0, &sz,
expect_d_eq(mallctl("background_thread", (void *)&e0, &sz,
&e1, sz), 0, "Unexpected mallctl() failure");
assert_b_eq(e0, !e1,
expect_b_eq(e0, !e1,
"background_thread should be %d before.\n", !e1);
if (e1) {
assert_zu_gt(n_background_threads, 0,
expect_zu_gt(n_background_threads, 0,
"Number of background threads should be non zero.\n");
} else {
assert_zu_eq(n_background_threads, 0,
expect_zu_eq(n_background_threads, 0,
"Number of background threads should be zero.\n");
}
}
@@ -27,15 +27,15 @@ test_repeat_background_thread_ctl(bool before) {
size_t sz = sizeof(bool);
e1 = before;
assert_d_eq(mallctl("background_thread", (void *)&e0, &sz,
expect_d_eq(mallctl("background_thread", (void *)&e0, &sz,
&e1, sz), 0, "Unexpected mallctl() failure");
assert_b_eq(e0, before,
expect_b_eq(e0, before,
"background_thread should be %d.\n", before);
if (e1) {
assert_zu_gt(n_background_threads, 0,
expect_zu_gt(n_background_threads, 0,
"Number of background threads should be non zero.\n");
} else {
assert_zu_eq(n_background_threads, 0,
expect_zu_eq(n_background_threads, 0,
"Number of background threads should be zero.\n");
}
}
@@ -46,16 +46,16 @@ TEST_BEGIN(test_background_thread_ctl) {
bool e0, e1;
size_t sz = sizeof(bool);
assert_d_eq(mallctl("opt.background_thread", (void *)&e0, &sz,
expect_d_eq(mallctl("opt.background_thread", (void *)&e0, &sz,
NULL, 0), 0, "Unexpected mallctl() failure");
assert_d_eq(mallctl("background_thread", (void *)&e1, &sz,
expect_d_eq(mallctl("background_thread", (void *)&e1, &sz,
NULL, 0), 0, "Unexpected mallctl() failure");
assert_b_eq(e0, e1,
expect_b_eq(e0, e1,
"Default and opt.background_thread does not match.\n");
if (e0) {
test_switch_background_thread_ctl(false);
}
assert_zu_eq(n_background_threads, 0,
expect_zu_eq(n_background_threads, 0,
"Number of background threads should be 0.\n");
for (unsigned i = 0; i < 4; i++) {
@@ -80,7 +80,7 @@ TEST_BEGIN(test_background_thread_running) {
test_repeat_background_thread_ctl(false);
test_switch_background_thread_ctl(true);
assert_b_eq(info->state, background_thread_started,
expect_b_eq(info->state, background_thread_started,
"Background_thread did not start.\n");
nstime_t start;
@@ -100,7 +100,7 @@ TEST_BEGIN(test_background_thread_running) {
nstime_t now;
nstime_init_update(&now);
nstime_subtract(&now, &start);
assert_u64_lt(nstime_sec(&now), 1000,
expect_u64_lt(nstime_sec(&now), 1000,
"Background threads did not run for 1000 seconds.");
sleep(1);
}