diff options
| author | manuel <manuel@mausz.at> | 2012-03-27 11:51:08 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2012-03-27 11:51:08 +0200 |
| commit | 4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b (patch) | |
| tree | 868c52e06f207b5ec8a3cc141f4b8b2bdfcc165c /pintos-progos/tests/lib.h | |
| parent | eae0bd57f0a26314a94785061888d193d186944a (diff) | |
| download | progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.gz progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.bz2 progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.zip | |
reorganize file structure to match the upstream requirements
Diffstat (limited to 'pintos-progos/tests/lib.h')
| -rw-r--r-- | pintos-progos/tests/lib.h | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/pintos-progos/tests/lib.h b/pintos-progos/tests/lib.h deleted file mode 100644 index 648327b..0000000 --- a/pintos-progos/tests/lib.h +++ /dev/null | |||
| @@ -1,50 +0,0 @@ | |||
| 1 | #ifndef TESTS_LIB_H | ||
| 2 | #define TESTS_LIB_H | ||
| 3 | |||
| 4 | #include <debug.h> | ||
| 5 | #include <stdbool.h> | ||
| 6 | #include <stddef.h> | ||
| 7 | #include <syscall.h> | ||
| 8 | |||
| 9 | extern const char *test_name; | ||
| 10 | extern bool quiet; | ||
| 11 | |||
| 12 | void msg (const char *, ...) PRINTF_FORMAT (1, 2); | ||
| 13 | void fail (const char *, ...) PRINTF_FORMAT (1, 2) NO_RETURN; | ||
| 14 | |||
| 15 | /* Takes an expression to test for SUCCESS and a message, which | ||
| 16 | may include printf-style arguments. Logs the message, then | ||
| 17 | tests the expression. If it is zero, indicating failure, | ||
| 18 | emits the message as a failure. | ||
| 19 | |||
| 20 | Somewhat tricky to use: | ||
| 21 | |||
| 22 | - SUCCESS must not have side effects that affect the | ||
| 23 | message, because that will cause the original message and | ||
| 24 | the failure message to differ. | ||
| 25 | |||
| 26 | - The message must not have side effects of its own, because | ||
| 27 | it will be printed twice on failure, or zero times on | ||
| 28 | success if quiet is set. */ | ||
| 29 | #define CHECK(SUCCESS, ...) \ | ||
| 30 | do \ | ||
| 31 | { \ | ||
| 32 | msg (__VA_ARGS__); \ | ||
| 33 | if (!(SUCCESS)) \ | ||
| 34 | fail (__VA_ARGS__); \ | ||
| 35 | } \ | ||
| 36 | while (0) | ||
| 37 | |||
| 38 | void shuffle (void *, size_t cnt, size_t size); | ||
| 39 | |||
| 40 | void exec_children (const char *child_name, pid_t pids[], size_t child_cnt); | ||
| 41 | void wait_children (pid_t pids[], size_t child_cnt); | ||
| 42 | |||
| 43 | void check_file_handle (int fd, const char *file_name, | ||
| 44 | const void *buf_, size_t filesize); | ||
| 45 | void check_file (const char *file_name, const void *buf, size_t filesize); | ||
| 46 | |||
| 47 | void compare_bytes (const void *read_data, const void *expected_data, | ||
| 48 | size_t size, size_t ofs, const char *file_name); | ||
| 49 | |||
| 50 | #endif /* test/lib.h */ | ||
