Add more tests, results.
[pintos-anon] / grading / filesys / fslib.h
1 #ifndef FSLIB_H
2 #define FSLIB_H
3
4 #include <debug.h>
5 #include <stdbool.h>
6 #include <stddef.h>
7
8 extern const char test_name[];
9 extern bool quiet;
10
11 void msg (const char *, ...) PRINTF_FORMAT (1, 2);
12 void fail (const char *, ...) PRINTF_FORMAT (1, 2) NO_RETURN;
13
14 #define check(SUCCESS, ...)                     \
15         do                                      \
16           {                                     \
17             msg (__VA_ARGS__);                  \
18             if (!(SUCCESS))                     \
19               fail (__VA_ARGS__);               \
20           }                                     \
21         while (0)
22
23 void shuffle (void *, size_t cnt, size_t size);
24
25 void seq_test (const char *filename,
26                void *buf, size_t size, size_t initial_size,
27                size_t (*block_size_func) (void),
28                void (*check_func) (int fd, long ofs));
29
30 void check_file (const char *filename, const void *buf, size_t filesize);
31
32 void compare_bytes (const void *read_data, const void *expected_data,
33                     size_t size, size_t ofs, const char *filename);
34
35 void test_main (void);
36
37 #endif /* fslib.h */