4#include "tests/userprog/sample.inc"
13 CHECK (
create (
"test.txt",
sizeof sample - 1),
"create \"test.txt\"");
14 CHECK ((handle =
open (
"test.txt")) > 1,
"open \"test.txt\"");
18 fail (
"write() returned %d instead of %zu",
byte_cnt,
sizeof sample - 1);
static size_t byte_cnt(size_t bit_cnt)
Returns the number of bytes required for BIT_CNT bits.
bool create(const char *file, unsigned initial_size)
int open(const char *file)
int write(int fd, const void *buffer, unsigned size)
void fail(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)
Try writing a file in the most normal way.