pintos/src/tests/lib.c File Reference

#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)

Variables

const char * test_name
bool quiet = false


Function Documentation

void check_file ( const char *  file_name,
const void *  buf,
size_t  size 
)

Definition at line 152 of file lib.c.

References CHECK, check_file_handle(), close(), 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 109 of file lib.c.

References block_size(), buf, compare_bytes(), fail(), 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 
)

Definition at line 164 of file lib.c.

References fail(), hex_dump(), memcmp(), msg(), and quiet.

Referenced by check_file_handle(), main(), and test_main().

void exec_children ( const char *  child_name,
pid_t  pids[],
size_t  child_cnt 
)

Definition at line 81 of file lib.c.

References CHECK, exec(), PID_ERROR, and snprintf().

Referenced by test_main().

void fail ( const char *  format,
  ... 
)

void msg ( const char *  format,
  ... 
)

void shuffle ( void *  buf_,
size_t  cnt,
size_t  size 
)

Definition at line 68 of file lib.c.

References buf, random_ulong(), and swap().

static void swap ( void *  a_,
void *  b_,
size_t  size 
) [static]

Definition at line 53 of file lib.c.

static void vmsg ( const char *  format,
va_list  args,
const char *  suffix 
) [static]

Definition at line 13 of file lib.c.

References buf, snprintf(), STDOUT_FILENO, strlcpy(), strlen(), test_name, vsnprintf(), and write().

Referenced by fail(), and msg().

void wait_children ( pid_t  pids[],
size_t  child_cnt 
)

Definition at line 95 of file lib.c.

References CHECK, and wait().

Referenced by test_main().


Variable Documentation

bool quiet = false

Definition at line 10 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

Definition at line 9 of file lib.c.


Generated on Mon Jan 10 16:43:58 2011 for Pintos by  doxygen 1.5.6