bc_tester: add bc_tester_current_test_name and bc_tester_current_suite_name

parent d6c10705
...@@ -55,6 +55,9 @@ static char *bc_tester_resource_dir_prefix = NULL; ...@@ -55,6 +55,9 @@ static char *bc_tester_resource_dir_prefix = NULL;
// by default writable will always write near the executable // by default writable will always write near the executable
static char *bc_tester_writable_dir_prefix = NULL; static char *bc_tester_writable_dir_prefix = NULL;
static char *bc_current_suite_name = NULL;
static char *bc_current_test_name = NULL;
int bc_printf_verbosity_info; int bc_printf_verbosity_info;
int bc_printf_verbosity_error; int bc_printf_verbosity_error;
...@@ -165,6 +168,7 @@ static time_t suite_start_time = 0; ...@@ -165,6 +168,7 @@ static time_t suite_start_time = 0;
static void suite_start_message_handler(const CU_pSuite pSuite) { static void suite_start_message_handler(const CU_pSuite pSuite) {
bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] started\n", pSuite->pName); bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] started\n", pSuite->pName);
suite_start_time = time(NULL); suite_start_time = time(NULL);
bc_current_suite_name = pSuite->pName;
} }
static void suite_complete_message_handler(const CU_pSuite pSuite, const CU_pFailureRecord pFailure) { static void suite_complete_message_handler(const CU_pSuite pSuite, const CU_pFailureRecord pFailure) {
bc_tester_printf(bc_printf_verbosity_info, "Suite [%s] ended in %lu sec\n", pSuite->pName, bc_tester_printf(bc_printf_verbosity_info, "Suite [%s] ended in %lu sec\n", pSuite->pName,
...@@ -179,6 +183,7 @@ static void test_start_message_handler(const CU_pTest pTest, const CU_pSuite pSu ...@@ -179,6 +183,7 @@ static void test_start_message_handler(const CU_pTest pTest, const CU_pSuite pSu
} }
bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] Test [%s] started", pSuite->pName,pTest->pName); bc_tester_printf(bc_printf_verbosity_info,"Suite [%s] Test [%s] started", pSuite->pName,pTest->pName);
test_start_time = time(NULL); test_start_time = time(NULL);
bc_current_test_name = pTest->pName;
} }
/*derivated from cunit*/ /*derivated from cunit*/
...@@ -641,3 +646,11 @@ char* bc_sprintf(const char* format, ...) { ...@@ -641,3 +646,11 @@ char* bc_sprintf(const char* format, ...) {
va_end (args); va_end (args);
return res; return res;
} }
const char * bc_tester_current_suite_name() {
return bc_current_suite_name;
}
const char * bc_tester_current_test_name() {
return bc_current_test_name;
}
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef TESTER_UTILS_H #ifndef TESTER_UTILS_H
#define TESTER_UTILS_H #define TESTER_UTILS_H
...@@ -93,6 +92,8 @@ const char * bc_tester_test_name(const char *suite_name, int test_index); ...@@ -93,6 +92,8 @@ const char * bc_tester_test_name(const char *suite_name, int test_index);
int bc_tester_run_suite(test_suite_t *suite); int bc_tester_run_suite(test_suite_t *suite);
int bc_tester_run_tests(const char *suite_name, const char *test_name); int bc_tester_run_tests(const char *suite_name, const char *test_name);
int bc_tester_suite_index(const char *suite_name); int bc_tester_suite_index(const char *suite_name);
const char * bc_tester_current_suite_name();
const char * bc_tester_current_test_name();
char* bc_sprintfva(const char* format, va_list args); char* bc_sprintfva(const char* format, va_list args);
char* bc_sprintf(const char* format, ...); char* bc_sprintf(const char* format, ...);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment