27void no_handler(
int) { }
 
   38    struct sigaction ignored, original;
 
   39    memset(&ignored, 0, 
sizeof ignored);
 
   40    ignored.sa_handler = no_handler;
 
   41    if (sigaction(SIGALRM, &ignored, &original)) {
 
   47    int result(waitpid(
process, &status, 0) == -1);
 
   50    if (sigaction(SIGALRM, &original, NULL)) {
 
   59    return WIFEXITED(status) && WEXITSTATUS(status) == 0;
 
 
   73    *read_pipe = pipes[0];
 
 
   95check_output(
int *write_pipe, 
const void* 
const output, 
const size_t length)
 
  101    *write_pipe = pipes[1];
 
  108        unsigned char* buffer = 
new unsigned char[length + 1];
 
  110        size_t got_length(
read_data(pipes[0], buffer, length + 1));
 
  112        if (got_length != length) {
 
  113            fprintf(stderr, 
"Different length (expected %u, got %u)\n",
 
  114                static_cast<unsigned>(length),
 
  115                static_cast<unsigned>(got_length));
 
  118        if(!ok || memcmp(buffer, output, length)) {
 
  119            const unsigned char *output_c(
static_cast<const unsigned char *
>(
 
  122            for(
size_t i(0); i != got_length; ++ i) {
 
  123                fprintf(stderr, 
"%02hhx", buffer[i]);
 
  125            fprintf(stderr, 
"\n");
 
  126            for(
size_t i(0); i != length; ++ i) {
 
  127                fprintf(stderr, 
"%02hhx", output_c[i]);
 
  129            fprintf(stderr, 
"\n");
 
 
Wrappers around common unix fd manipulation functions.
Help functions to fork the test case process.
ssize_t read_data(const int fd, void *buffer_v, const size_t length)
bool write_data(const int fd, const void *buffer_v, const size_t length)
pid_t provide_input(int *read_pipe, const void *input, const size_t length)
bool process_ok(pid_t process)
Checks that a process terminates correctly.
pid_t check_output(int *write_pipe, const void *const output, const size_t length)
Defines the logger used by the top-level component of kea-lfc.