PKUOS - Pintos
Pintos source browser for PKU Operating System course
|
Go to the source code of this file.
Macros | |
#define | CHECK(SUCCESS, ...) |
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments. More... | |
Functions | |
void | msg (const char *,...) PRINTF_FORMAT(1 |
void void | fail (const char *,...) PRINTF_FORMAT(1 |
void | shuffle (void *, size_t cnt, size_t size) |
void | exec_children (const char *child_name, pid_t pids[], size_t child_cnt) |
void | wait_children (pid_t pids[], size_t child_cnt) |
void | check_file_handle (int fd, const char *file_name, const void *buf_, size_t filesize) |
void | check_file (const char *file_name, const void *buf, size_t filesize) |
void | compare_bytes (const void *read_data, const void *expected_data, size_t size, size_t ofs, const char *file_name) |
test/lib.h More... | |
Variables | |
const char * | test_name |
Child process for syn-read test. More... | |
bool | quiet |
void void | NO_RETURN |
#define CHECK | ( | SUCCESS, | |
... | |||
) |
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
Logs the message, then tests the expression. If it is zero, indicating failure, emits the message as a failure.
Somewhat tricky to use:
void check_file | ( | const char * | file_name, |
const void * | buf, | ||
size_t | filesize | ||
) |
Definition at line 151 of file lib.c.
References buf, CHECK, check_file_handle(), close(), file_name, msg(), and open().
Referenced by seq_test(), and test_main().
void check_file_handle | ( | int | fd, |
const char * | file_name, | ||
const void * | buf_, | ||
size_t | filesize | ||
) |
Definition at line 108 of file lib.c.
References block_size(), buf, compare_bytes(), fail(), file_name, filesize(), msg(), and read().
Referenced by check_file(), and test_main().
void compare_bytes | ( | const void * | read_data, |
const void * | expected_data, | ||
size_t | size, | ||
size_t | ofs, | ||
const char * | file_name | ||
) |
test/lib.h
Definition at line 163 of file lib.c.
References fail(), file_name, hex_dump(), memcmp(), msg(), and quiet.
Referenced by check_file_handle(), main(), and test_main().
Definition at line 80 of file lib.c.
References CHECK, exec(), PID_ERROR, and snprintf().
Referenced by test_main().
Definition at line 67 of file lib.c.
References buf, random_ulong(), and swap().
Definition at line 94 of file lib.c.
Referenced by test_main().
|
extern |
Definition at line 9 of file lib.c.
Referenced by compare_bytes(), main(), make_tree(), msg(), remove_tree(), sort_chunks(), test_main(), and try_write().
|
extern |
Child process for syn-read test.
Reads the contents of a test file a byte at a time, in the hope that this will take long enough that we can get a significant amount of contention in the kernel file system code.
Child process for syn-read test.
Reads from a file created by our parent process, which is growing it. We loop until we've read the whole file successfully. Many iterations through the loop will return 0 bytes, because the file has not grown in the meantime. That is, we are "busy waiting" for the file to grow. (This test could be improved by adding a "yield" system call and calling yield whenever we receive a 0-byte read.)
Child process for syn-read test.
Attempts to close the file descriptor passed as the first command-line argument. This is invalid, because file descriptors are not inherited in Pintos. Two results are allowed: either the system call should return without taking any action, or the kernel should terminate the process with a -1 exit code.
Child process for syn-read test.
Opens and tries to write to its own executable, verifying that that is disallowed. Then recursively executes itself to the depth indicated by the first command-line argument.
Child process for syn-read test.
Just prints a single message and terminates.
Child process for syn-read test.
Child process for syn-read test.
Encrypts 1 MB of zeros, then decrypts it, and ensures that the zeros are back.
Child process for syn-read test.
Child process for syn-read test.
The sorted data is written back to the same file in-place.
Definition at line 14 of file child-syn-read.c.
Referenced by consume_some_resources(), main(), spawn_child(), and vmsg().