mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-05 11:44:18 +03:00
Replace fprintf with malloc_printf in tests.
This commit is contained in:
parent
fa08da752b
commit
45f208e112
12 changed files with 108 additions and 108 deletions
|
|
@ -15,7 +15,7 @@ main(void)
|
|||
size_t sz, tsz;
|
||||
int r;
|
||||
|
||||
fprintf(stderr, "Test begin\n");
|
||||
malloc_printf("Test begin\n");
|
||||
|
||||
/* Get page size. */
|
||||
{
|
||||
|
|
@ -26,51 +26,51 @@ main(void)
|
|||
|
||||
r = allocm(&p, &sz, 42, 0);
|
||||
if (r != ALLOCM_SUCCESS) {
|
||||
fprintf(stderr, "Unexpected allocm() error\n");
|
||||
malloc_printf("Unexpected allocm() error\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
q = p;
|
||||
r = rallocm(&q, &tsz, sz, 0, ALLOCM_NO_MOVE);
|
||||
if (r != ALLOCM_SUCCESS)
|
||||
fprintf(stderr, "Unexpected rallocm() error\n");
|
||||
malloc_printf("Unexpected rallocm() error\n");
|
||||
if (q != p)
|
||||
fprintf(stderr, "Unexpected object move\n");
|
||||
malloc_printf("Unexpected object move\n");
|
||||
if (tsz != sz) {
|
||||
fprintf(stderr, "Unexpected size change: %zu --> %zu\n",
|
||||
malloc_printf("Unexpected size change: %zu --> %zu\n",
|
||||
sz, tsz);
|
||||
}
|
||||
|
||||
q = p;
|
||||
r = rallocm(&q, &tsz, sz, 5, ALLOCM_NO_MOVE);
|
||||
if (r != ALLOCM_SUCCESS)
|
||||
fprintf(stderr, "Unexpected rallocm() error\n");
|
||||
malloc_printf("Unexpected rallocm() error\n");
|
||||
if (q != p)
|
||||
fprintf(stderr, "Unexpected object move\n");
|
||||
malloc_printf("Unexpected object move\n");
|
||||
if (tsz != sz) {
|
||||
fprintf(stderr, "Unexpected size change: %zu --> %zu\n",
|
||||
malloc_printf("Unexpected size change: %zu --> %zu\n",
|
||||
sz, tsz);
|
||||
}
|
||||
|
||||
q = p;
|
||||
r = rallocm(&q, &tsz, sz + 5, 0, ALLOCM_NO_MOVE);
|
||||
if (r != ALLOCM_ERR_NOT_MOVED)
|
||||
fprintf(stderr, "Unexpected rallocm() result\n");
|
||||
malloc_printf("Unexpected rallocm() result\n");
|
||||
if (q != p)
|
||||
fprintf(stderr, "Unexpected object move\n");
|
||||
malloc_printf("Unexpected object move\n");
|
||||
if (tsz != sz) {
|
||||
fprintf(stderr, "Unexpected size change: %zu --> %zu\n",
|
||||
malloc_printf("Unexpected size change: %zu --> %zu\n",
|
||||
sz, tsz);
|
||||
}
|
||||
|
||||
q = p;
|
||||
r = rallocm(&q, &tsz, sz + 5, 0, 0);
|
||||
if (r != ALLOCM_SUCCESS)
|
||||
fprintf(stderr, "Unexpected rallocm() error\n");
|
||||
malloc_printf("Unexpected rallocm() error\n");
|
||||
if (q == p)
|
||||
fprintf(stderr, "Expected object move\n");
|
||||
malloc_printf("Expected object move\n");
|
||||
if (tsz == sz) {
|
||||
fprintf(stderr, "Expected size change: %zu --> %zu\n",
|
||||
malloc_printf("Expected size change: %zu --> %zu\n",
|
||||
sz, tsz);
|
||||
}
|
||||
p = q;
|
||||
|
|
@ -78,11 +78,11 @@ main(void)
|
|||
|
||||
r = rallocm(&q, &tsz, pagesize*2, 0, 0);
|
||||
if (r != ALLOCM_SUCCESS)
|
||||
fprintf(stderr, "Unexpected rallocm() error\n");
|
||||
malloc_printf("Unexpected rallocm() error\n");
|
||||
if (q == p)
|
||||
fprintf(stderr, "Expected object move\n");
|
||||
malloc_printf("Expected object move\n");
|
||||
if (tsz == sz) {
|
||||
fprintf(stderr, "Expected size change: %zu --> %zu\n",
|
||||
malloc_printf("Expected size change: %zu --> %zu\n",
|
||||
sz, tsz);
|
||||
}
|
||||
p = q;
|
||||
|
|
@ -90,9 +90,9 @@ main(void)
|
|||
|
||||
r = rallocm(&q, &tsz, pagesize*4, 0, 0);
|
||||
if (r != ALLOCM_SUCCESS)
|
||||
fprintf(stderr, "Unexpected rallocm() error\n");
|
||||
malloc_printf("Unexpected rallocm() error\n");
|
||||
if (tsz == sz) {
|
||||
fprintf(stderr, "Expected size change: %zu --> %zu\n",
|
||||
malloc_printf("Expected size change: %zu --> %zu\n",
|
||||
sz, tsz);
|
||||
}
|
||||
p = q;
|
||||
|
|
@ -100,28 +100,28 @@ main(void)
|
|||
|
||||
r = rallocm(&q, &tsz, pagesize*2, 0, ALLOCM_NO_MOVE);
|
||||
if (r != ALLOCM_SUCCESS)
|
||||
fprintf(stderr, "Unexpected rallocm() error\n");
|
||||
malloc_printf("Unexpected rallocm() error\n");
|
||||
if (q != p)
|
||||
fprintf(stderr, "Unexpected object move\n");
|
||||
malloc_printf("Unexpected object move\n");
|
||||
if (tsz == sz) {
|
||||
fprintf(stderr, "Expected size change: %zu --> %zu\n",
|
||||
malloc_printf("Expected size change: %zu --> %zu\n",
|
||||
sz, tsz);
|
||||
}
|
||||
sz = tsz;
|
||||
|
||||
r = rallocm(&q, &tsz, pagesize*4, 0, ALLOCM_NO_MOVE);
|
||||
if (r != ALLOCM_SUCCESS)
|
||||
fprintf(stderr, "Unexpected rallocm() error\n");
|
||||
malloc_printf("Unexpected rallocm() error\n");
|
||||
if (q != p)
|
||||
fprintf(stderr, "Unexpected object move\n");
|
||||
malloc_printf("Unexpected object move\n");
|
||||
if (tsz == sz) {
|
||||
fprintf(stderr, "Expected size change: %zu --> %zu\n",
|
||||
malloc_printf("Expected size change: %zu --> %zu\n",
|
||||
sz, tsz);
|
||||
}
|
||||
sz = tsz;
|
||||
|
||||
dallocm(p, 0);
|
||||
|
||||
fprintf(stderr, "Test end\n");
|
||||
malloc_printf("Test end\n");
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue