pintos/src/tests/lib.h File Reference

#include <debug.h>
#include <stdbool.h>
#include <stddef.h>
#include <syscall.h>

Go to the source code of this file.

Defines

#define CHECK(SUCCESS,...)

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)

Variables

const char * test_name
bool quiet
void void NO_RETURN


Define Documentation

#define CHECK ( SUCCESS,
...   ) 

Value:

do                                      \
          {                                     \
            msg (__VA_ARGS__);                  \
            if (!(SUCCESS))                     \
              fail (__VA_ARGS__);               \
          }                                     \
        while (0)

Definition at line 30 of file lib.h.

Referenced by check_file(), do_mkdir(), do_remove(), do_touch(), exec_children(), main(), make_tree(), remove_tree(), seq_test(), sort_chunks(), test_main(), try_write(), wait_children(), and wrap_open().


Function Documentation

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

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

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 void fail ( const char *  ,
  ... 
)

Definition at line 41 of file lib.c.

void msg ( const char *  ,
  ... 
)

Definition at line 29 of file lib.c.

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

Definition at line 68 of file lib.c.

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

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

void void NO_RETURN

Definition at line 14 of file lib.h.

bool quiet

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 14 of file child-syn-read.c.

Referenced by consume_some_resources(), fail(), main(), msg(), pass(), run_test(), spawn_child(), and vmsg().


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