static int do_rand_allocs(void)
{
- unsigned int size, nr, rounds = 0;
+ unsigned int size, nr, rounds = 0, ret = 0;
unsigned long total;
struct elem *e;
bool error;
e = smalloc(size);
if (!e) {
printf("fail at %lu, size %u\n", total, size);
+ ret++;
break;
}
e->magic1 = MAGIC1;
e = smalloc(LARGESMALLOC);
if (!e) {
error = true;
+ ret++;
printf("failure allocating %u bytes at %lu allocated during sfree phase\n",
LARGESMALLOC, total);
}
}
}
- return 0;
+ return ret;
}
int main(int argc, char *argv[])
{
+ int ret;
+
arch_init(argv);
sinit();
debug_init();
- do_rand_allocs();
- smalloc_debug(0); /* free and total blocks should match */
+ ret = do_rand_allocs();
+ smalloc_debug(0); /* TODO: check that free and total blocks
+ ** match */
scleanup();
- return 0;
+ return ret;
}