7#include "tests/userprog/sample.inc"
18 CHECK ((handle =
open (
"sample.txt")) > 1,
"open \"sample.txt\"");
23 fail (
"read() returned %d instead of %zu",
byte_cnt,
sizeof sample - 1);
26 msg (
"expected text:\n%s", sample);
28 fail (
"expected text differs from actual");
static size_t byte_cnt(size_t bit_cnt)
Returns the number of bytes required for BIT_CNT bits.
void * get_boundary_area(void)
Returns the beginning of a page.
int open(const char *file)
int read(int fd, void *buffer, unsigned size)
void fail(const char *format,...)
void msg(const char *format,...)
#define CHECK(SUCCESS,...)
Takes an expression to test for SUCCESS and a message, which may include printf-style arguments.
void test_main(void)
Reads data spanning two pages in virtual address space, which must succeed.
int strcmp(const char *a_, const char *b_)
Finds the first differing characters in strings A and B.