From: Jens Axboe Date: Wed, 23 Jan 2013 18:02:07 +0000 (-0700) Subject: t/axmap: update to catch recent bugs X-Git-Tag: fio-2.0.14~98 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=32bbd3ab7846a8c140fda5c83d95c21c447c844c t/axmap: update to catch recent bugs Also properly include axmap.h and don't declare our own prototypes. Signed-off-by: Jens Axboe --- diff --git a/t/axmap.c b/t/axmap.c index 3f6043db..27fdaa73 100644 --- a/t/axmap.c +++ b/t/axmap.c @@ -6,10 +6,7 @@ #include #include "../lib/lfsr.h" - -struct axmap; -void axmap_set(struct axmap *, uint64_t); -struct axmap *axmap_new(uint64_t size); +#include "../lib/axmap.h" void *smalloc(size_t size) { @@ -24,8 +21,9 @@ void sfree(void *ptr) int main(int argc, char *argv[]) { struct fio_lfsr lfsr; - size_t size = (1UL << 28) - 200; + size_t osize, size = (1UL << 28) - 200; struct axmap *map; + uint64_t ff; int seed = 1; if (argc > 1) { @@ -38,13 +36,23 @@ int main(int argc, char *argv[]) lfsr_init(&lfsr, size, seed); map = axmap_new(size); + osize = size; while (size--) { uint64_t val; - lfsr_next(&lfsr, &val); + if (lfsr_next(&lfsr, &val, osize)) { + printf("lfsr: short loop\n"); + break; + } axmap_set(map, val); } + ff = axmap_next_free(map, osize); + if (ff != (uint64_t) -1ULL) { + printf("axmap_next_free broken: got %llu\n", (unsigned long long) ff); + return 1; + } + return 0; }