PKUOS - Pintos
Pintos source browser for PKU Operating System course
|
#include "tests/lib.h"
#include <random.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <syscall.h>
Go to the source code of this file.
Functions | |
static void | vmsg (const char *format, va_list args, const char *suffix) |
void | msg (const char *format,...) |
void | fail (const char *format,...) |
static void | swap (void *a_, void *b_, size_t size) |
void | shuffle (void *buf_, 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 size) |
void | check_file (const char *file_name, const void *buf, size_t size) |
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 = false |
void check_file | ( | const char * | file_name, |
const void * | buf, | ||
size_t | size | ||
) |
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 | size | ||
) |
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().
void fail | ( | const char * | format, |
... | |||
) |
Definition at line 40 of file lib.c.
References exit(), va_end, va_start, and vmsg().
Referenced by check_file_handle(), check_file_size(), check_tell(), compare_bytes(), main(), seq_test(), test_main(), test_sleep(), verify(), wrap_open(), and write_some_bytes().
void msg | ( | const char * | format, |
... | |||
) |
Definition at line 28 of file lib.c.
References quiet, va_start, and vmsg().
Referenced by a_thread_func(), acquire1_thread_func(), acquire2_thread_func(), acquire_thread_func(), alarm_priority_thread(), b_thread_func(), block_thread(), c_thread_func(), changing_thread(), check_file(), check_file_handle(), compare_bytes(), donor_thread_func(), fail_io(), h_thread_func(), high_thread_func(), init(), interloper_thread_func(), l_thread_func(), m_thread_func(), main(), make_tree(), medium_thread_func(), merge(), priority_condvar_thread(), priority_sema_thread(), remove_tree(), seq_test(), simple_thread_func(), sort_chunks(), test_main(), test_mlfqs_fair(), test_sleep(), and verify().
Definition at line 67 of file lib.c.
References buf, random_ulong(), and swap().
|
static |
|
static |
Definition at line 12 of file lib.c.
References buf, snprintf(), STDOUT_FILENO, strlcpy(), strlen(), test_name, vsnprintf(), and write().
Referenced by fail(), and msg().
Definition at line 94 of file lib.c.
Referenced by test_main().
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().
const char* test_name |
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.)
Definition at line 8 of file lib.c.
Referenced by vmsg().