1 /* Creates a 128 kB file and repeatedly shuffles data in it
2 through a memory mapping. */
7 #include "tests/arc4.h"
8 #include "tests/cksum.h"
10 #include "tests/main.h"
12 #define SIZE (128 * 1024)
14 static char *buf = (char *) 0x10000000;
22 /* Create file, mmap. */
23 CHECK (create ("buffer", SIZE), "create \"buffer\"");
24 CHECK ((handle = open ("buffer")) > 1, "open \"buffer\"");
25 CHECK (mmap (handle, buf) != MAP_FAILED, "mmap \"buffer\"");
28 for (i = 0; i < SIZE; i++)
30 msg ("init: cksum=%lu", cksum (buf, SIZE));
32 /* Shuffle repeatedly. */
33 for (i = 0; i < 10; i++)
35 shuffle (buf, SIZE, 1);
36 msg ("shuffle %zu: cksum=%lu", i, cksum (buf, SIZE));