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

@@ -13,7 +13,7 @@ thd_producer(void *varg) {
sz = sizeof(arena);
/* Remote arena. */
assert_d_eq(mallctl("arenas.create", (void *)&arena, &sz, NULL, 0), 0,
expect_d_eq(mallctl("arenas.create", (void *)&arena, &sz, NULL, 0), 0,
"Unexpected mallctl() failure");
for (i = 0; i < REMOTE_NALLOC / 2; i++) {
mem[i] = mallocx(1, MALLOCX_TCACHE_NONE | MALLOCX_ARENA(arena));
@@ -42,7 +42,7 @@ TEST_BEGIN(test_producer_consumer) {
/* Remote deallocation by the current thread. */
for (i = 0; i < NTHREADS; i++) {
for (unsigned j = 0; j < REMOTE_NALLOC; j++) {
assert_ptr_not_null(mem[i][j],
expect_ptr_not_null(mem[i][j],
"Unexpected remote allocation failure");
dallocx(mem[i][j], 0);
}
@@ -65,12 +65,12 @@ thd_start(void *varg) {
edata = emap_edata_lookup(tsdn, &emap_global, ptr);
shard1 = edata_binshard_get(edata);
dallocx(ptr, 0);
assert_u_lt(shard1, 16, "Unexpected bin shard used");
expect_u_lt(shard1, 16, "Unexpected bin shard used");
edata = emap_edata_lookup(tsdn, &emap_global, ptr2);
shard2 = edata_binshard_get(edata);
dallocx(ptr2, 0);
assert_u_lt(shard2, 4, "Unexpected bin shard used");
expect_u_lt(shard2, 4, "Unexpected bin shard used");
if (shard1 > 0 || shard2 > 0) {
/* Triggered sharded bin usage. */
@@ -98,7 +98,7 @@ TEST_BEGIN(test_bin_shard_mt) {
sharded = true;
}
}
assert_b_eq(sharded, true, "Did not find sharded bins");
expect_b_eq(sharded, true, "Did not find sharded bins");
}
TEST_END
@@ -108,14 +108,14 @@ TEST_BEGIN(test_bin_shard) {
size_t miblen, miblen2, len;
len = sizeof(nbins);
assert_d_eq(mallctl("arenas.nbins", (void *)&nbins, &len, NULL, 0), 0,
expect_d_eq(mallctl("arenas.nbins", (void *)&nbins, &len, NULL, 0), 0,
"Unexpected mallctl() failure");
miblen = 4;
assert_d_eq(mallctlnametomib("arenas.bin.0.nshards", mib, &miblen), 0,
expect_d_eq(mallctlnametomib("arenas.bin.0.nshards", mib, &miblen), 0,
"Unexpected mallctlnametomib() failure");
miblen2 = 4;
assert_d_eq(mallctlnametomib("arenas.bin.0.size", mib2, &miblen2), 0,
expect_d_eq(mallctlnametomib("arenas.bin.0.size", mib2, &miblen2), 0,
"Unexpected mallctlnametomib() failure");
for (i = 0; i < nbins; i++) {
@@ -124,22 +124,22 @@ TEST_BEGIN(test_bin_shard) {
mib[2] = i;
sz1 = sizeof(nshards);
assert_d_eq(mallctlbymib(mib, miblen, (void *)&nshards, &sz1,
expect_d_eq(mallctlbymib(mib, miblen, (void *)&nshards, &sz1,
NULL, 0), 0, "Unexpected mallctlbymib() failure");
mib2[2] = i;
sz2 = sizeof(size);
assert_d_eq(mallctlbymib(mib2, miblen2, (void *)&size, &sz2,
expect_d_eq(mallctlbymib(mib2, miblen2, (void *)&size, &sz2,
NULL, 0), 0, "Unexpected mallctlbymib() failure");
if (size >= 1 && size <= 128) {
assert_u_eq(nshards, 16, "Unexpected nshards");
expect_u_eq(nshards, 16, "Unexpected nshards");
} else if (size == 256) {
assert_u_eq(nshards, 8, "Unexpected nshards");
expect_u_eq(nshards, 8, "Unexpected nshards");
} else if (size > 128 && size <= 512) {
assert_u_eq(nshards, 4, "Unexpected nshards");
expect_u_eq(nshards, 4, "Unexpected nshards");
} else {
assert_u_eq(nshards, 1, "Unexpected nshards");
expect_u_eq(nshards, 1, "Unexpected nshards");
}
}
}