Esempio n. 1
0
void
terminate_thread
(
   int sig
)
{
   unredirect_stderr();

   // If test was not failed so far, update display.
   if (!TEST_CASE_FAILED) {
      update_display_failed();
   }

   fprintf(stderr, "caught SIGTERM (interrupting)\n");

   // Label the test case as failed. //
   TEST_CASE_FAILED = 1;

   // Clean it all. //
   test_case_clean();

   // Return to main thread.
   pthread_exit(NULL);

}
Esempio n. 2
0
void *
run_test
(
   void * data
)
{

   // Unpack argument. //
   const test_case_t test_case = *(test_case_t *) data;

   // -- Initialize -- //

   // Register signal handlers. This will allow execution
   // to return to main thread in case of crash.
   signal(SIGSEGV, terminate_thread);
   
   // Get test name and fixture (test function). //
   fixture_t fixture = test_case.fixture;

   // Initialize variable, empty buffers... //
   test_case_init();
   unredirect_stderr();
   unredirect_stdout();

   //  -- Run the test -- //
   (*fixture)();
   
   // -- Clean -- //
   unredirect_stderr();
   unredirect_stdout();
   test_case_clean();

   return NULL;

}
Esempio n. 3
0
void
terminate_thread
(
   int sig
)
{

   fprintf(stderr, "caught SIGTERM (interrupting)\n");

   // Label the test case as failed. //
   TEST_CASE_FAILED = 1;

   // Clean it all. //
   unredirect_stderr();
   test_case_clean();

   // Return to main thread.
   pthread_exit(NULL);

}