Remove building with NOCRYPTO option
[minix.git] / minix / tests / test71.c
blob954b972c8227fbb53976c6d9ef5aaea3839696d5
1 /* Test 71 - full hierachy storage test.
3 * Black box test of storage: test consistent file contents
4 * under various working sets and access patterns.
6 * Using varying working set sizes, exercise various cache
7 * layers separately.
9 * There is a 'smoke test' mode, suitable for running interactively,
10 * and a 'regression test' (big) mode, meant for batch invocation only
11 * as it takes very long.
14 #include <sys/types.h>
15 #include <sys/ioc_memory.h>
16 #include <stdio.h>
17 #include <assert.h>
18 #include <string.h>
19 #include <stdlib.h>
20 #include <unistd.h>
21 #include <fcntl.h>
23 #include "common.h"
24 #include "testcache.h"
26 int
27 dowriteblock(int b, int blocksize, u32_t seed, char *data)
29 u64_t offset;
30 int fd;
32 get_fd_offset(b, blocksize, &offset, &fd);
34 if(pwrite(fd, data, blocksize, offset) < blocksize) {
35 perror("pwrite");
36 return -1;
39 return blocksize;
42 int
43 readblock(int b, int blocksize, u32_t seed, char *data)
45 u64_t offset;
46 int fd;
48 get_fd_offset(b, blocksize, &offset, &fd);
50 if(pread(fd, data, blocksize, offset) < blocksize) {
51 perror("pread");
52 return -1;
55 return blocksize;
58 void testend(void) { }
60 int
61 main(int argc, char *argv[])
63 int iter = 2;
65 start(71);
67 cachequiet(!bigflag);
68 if(bigflag) iter = 3;
70 makefiles(MAXFILES);
72 /* Try various combinations working set sizes
73 * and block sizes in order to specifically
74 * target the primary cache, then primary+secondary
75 * cache, then primary+secondary cache+secondary
76 * cache eviction.
79 if(dotest(PAGE_SIZE, 100, iter)) e(5);
80 if(dotest(PAGE_SIZE*2, 100, iter)) e(2);
81 if(dotest(PAGE_SIZE*3, 100, iter)) e(3);
82 if(dotest(PAGE_SIZE, 20000, iter)) e(5);
84 if(bigflag) {
85 u32_t totalmem, freemem, cachedmem;
86 if(dotest(PAGE_SIZE, 150000, iter)) e(5);
87 getmem(&totalmem, &freemem, &cachedmem);
88 if(dotest(PAGE_SIZE, totalmem*1.5, iter)) e(6);
91 quit();
93 return 0;