]> granicus.if.org Git - check/commitdiff
Added name of test to result.
authorhugo303 <hugo303@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Fri, 14 May 2004 13:54:49 +0000 (13:54 +0000)
committerhugo303 <hugo303@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Fri, 14 May 2004 13:54:49 +0000 (13:54 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@160 64e312b2-a51f-0410-8e61-82d0ca0eb02a

check/src/check_run.c
check/src/check_str.c

index ee29efe1dce5bfb4c3c287cd7e1956bb603b330b..2dddd5fca03c46c527c00da93f99cf0f9a4a1b04 100644 (file)
@@ -63,8 +63,10 @@ static void srunner_iterate_tcase_tfuns (SRunner *sr, TCase *tc);
 static void srunner_add_failure (SRunner *sr, TestResult *tf);
 static TestResult *tcase_run_tfun_fork (TCase *tc, TF *tf);
 static TestResult *tcase_run_tfun_nofork (TCase *tc, TF *tf);
-static TestResult *receive_result_info_fork (const char *tcname, int status);
-static TestResult *receive_result_info_nofork (const char *tcname);
+static TestResult *receive_result_info_fork (const char *tcname,
+                                             const char *tname, int status);
+static TestResult *receive_result_info_nofork (const char *tcname,
+                                               const char *tname);
 static void set_fork_info (TestResult *tr, int status);
 static void set_nofork_info (TestResult *tr);
 static char *signal_msg (int sig);
@@ -181,13 +183,19 @@ static int srunner_run_unchecked_setup (SRunner *sr, TCase *tc)
     send_ctx_info(get_send_key(),CK_CTX_SETUP);
     f->fun();
 
-    tr = receive_result_info_nofork (tc->name);
+    tr = receive_result_info_nofork (tc->name, "unchecked_setup");
 
     if (tr->rtype != CK_PASS) {
       srunner_add_failure(sr, tr);
       rval = 0;
       break;
     }
+    else
+    {
+      free(tr->file);
+      free(tr->msg);
+      free(tr);
+    }
   } 
 
   set_fork_status(srunner_fork_status(sr));
@@ -252,7 +260,8 @@ static void srunner_run_tcase (SRunner *sr, TCase *tc)
   }
 }
 
-static TestResult *receive_result_info_fork (const char *tcname, int status)
+static TestResult *receive_result_info_fork (const char *tcname,
+                                             const char *tname, int status)
 {
   TestResult *tr;
 
@@ -260,12 +269,14 @@ static TestResult *receive_result_info_fork (const char *tcname, int status)
   if (tr == NULL)
     eprintf("Failed to receive test result", __FILE__, __LINE__);
   tr->tcname = tcname;
+  tr->tname = tname;
   set_fork_info(tr, status);
 
   return tr;
 }
 
-static TestResult *receive_result_info_nofork (const char *tcname)
+static TestResult *receive_result_info_nofork (const char *tcname,
+                                               const char *tname)
 {
   TestResult *tr;
 
@@ -273,6 +284,7 @@ static TestResult *receive_result_info_nofork (const char *tcname)
   if (tr == NULL)
     eprintf("Failed to receive test result", __FILE__, __LINE__);
   tr->tcname = tcname;
+  tr->tname = tname;
   set_nofork_info(tr);
 
   return tr;
@@ -315,7 +327,7 @@ static TestResult *tcase_run_tfun_nofork (TCase *tc, TF *tfun)
   tcase_run_checked_setup(tc);
   tfun->fn();
   tcase_run_checked_teardown(tc);
-  return receive_result_info_nofork (tc->name);
+  return receive_result_info_nofork (tc->name, tfun->name);
 }
 
   
@@ -334,7 +346,7 @@ static TestResult *tcase_run_tfun_fork (TCase *tc, TF *tfun)
     _exit (EXIT_SUCCESS);
   }
   (void) wait(&status);
-  return receive_result_info_fork (tc->name, status);
+  return receive_result_info_fork (tc->name, tfun->name, status);
 }
 
 static char *signal_msg (int signal)
index f7a481e548b2b537352c454506e08f782c20a582..0fc60f22a2f664b327fac0f8e2b149c10fdbcf92 100644 (file)
@@ -39,9 +39,9 @@ char *tr_str (TestResult *tr)
   
   exact_msg = (tr->rtype == CK_ERROR) ? "(after this point) ": "";
   
-  rstr = ck_strdup_printf ("%s:%d:%s:%s: %s%s",
+  rstr = ck_strdup_printf ("%s:%d:%s:%s:%s: %s%s",
                            tr->file, tr->line,
-                           tr_type_str(tr),  tr->tcname,
+                           tr_type_str(tr), tr->tcname, tr->tname,
                            exact_msg, tr->msg);
 
   return rstr;