Automated.c: add test duration in XML report and fix JUnit generation and bump v3.0-1

parent 19f5ddb3
......@@ -26,8 +26,8 @@ project(CUNIT C)
set(PACKAGE "CUnit")
set(PACKAGE_NAME "${PACKAGE}")
set(VERSION "2.1")
set(RELEASE "2")
set(VERSION "3.0")
set(RELEASE "1")
set(PACKAGE_VERSION "${VERSION}-${RELEASE}")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "")
......
......@@ -80,6 +80,8 @@ static CU_BOOL f_bWriting_CUNIT_RUN_SUITE = CU_FALSE; /**< Flag for keepin
static CU_BOOL bJUnitXmlOutput = CU_FALSE; /**< Flag for toggling the xml junit output or keeping the original. Off is the default */
static char _gPackageName[50] = "";
static time_t f_testStartTime = 0; /**< Start time of current running test suite. */
/*=================================================================
* Static function forward declarations
*=================================================================*/
......@@ -265,6 +267,8 @@ static void automated_test_start_message_handler(const CU_pTest pTest, const CU_
char *szTempName = NULL;
size_t szTempName_len = 0;
f_testStartTime = time(NULL);
if( test_start_handler ){
(*test_start_handler)(pTest, pSuite);
}
......@@ -354,16 +358,18 @@ static void automated_test_complete_message_handler(const CU_pTest pTest,
assert((NULL != pTempFailure->pTest) && (pTempFailure->pTest == pTest));
if (NULL != pTempFailure->strCondition) {
szTemp = (char *)CU_MALLOC(CU_translated_strlen(pTempFailure->strCondition));
CU_translate_special_characters(pTempFailure->strCondition, szTemp, sizeof(szTemp));
}
else {
szTemp[0] = '\0';
}
fprintf(f_pTestResultFile, " <testcase classname=\"%s.%s\" name=\"%s\" time=\"0\">\n",
fprintf(f_pTestResultFile, " <testcase classname=\"%s.%s\" name=\"%s\" time=\"%ld\">\n",
pPackageName,
pSuite->pName,
(NULL != pTest->pName) ? pTest->pName : "");
(NULL != pTest->pName) ? pTest->pName : "",
(long)(time(NULL) - f_testStartTime));
fprintf(f_pTestResultFile, " <failure message=\"%s\" type=\"Failure\">\n", szTemp);
} /* if */
}
......@@ -425,10 +431,11 @@ static void automated_test_complete_message_handler(const CU_pTest pTest,
}
else {
if (bJUnitXmlOutput == CU_TRUE) {
fprintf(f_pTestResultFile, " <testcase classname=\"%s.%s\" name=\"%s\" time=\"0\"/>\n",
fprintf(f_pTestResultFile, " <testcase classname=\"%s.%s\" name=\"%s\" time=\"%ld\"/>\n",
pPackageName,
pSuite->pName,
(NULL != pTest->pName) ? pTest->pName : "");
(NULL != pTest->pName) ? pTest->pName : "",
(long)(time(NULL) - f_testStartTime));
} else {
fprintf(f_pTestResultFile,
" <CUNIT_RUN_TEST_RECORD> \n"
......@@ -637,11 +644,18 @@ static CU_ErrorCode uninitialize_result_file(void)
time(&tTime);
szTime = ctime(&tTime);
if (szTime) szTime[24] = '\0';
if (bJUnitXmlOutput == CU_TRUE) {
fprintf(f_pTestResultFile,
" </testsuite>\n</testsuites>\n");
}
else {
fprintf(f_pTestResultFile,
" <CUNIT_FOOTER> %s" CU_VERSION " - %s </CUNIT_FOOTER> \n"
"</CUNIT_TEST_RUN_REPORT>",
"</CUNIT_TEST_RUN_REPORT>\n",
_("File Generated By CUnit v"),
(NULL != szTime) ? szTime : "");
}
if (0 != fclose(f_pTestResultFile)) {
CU_set_error(CUE_FCLOSE_FAILED);
......@@ -754,9 +768,10 @@ static CU_ErrorCode automated_list_all_tests(CU_pTestRegistry pRegistry, const c
time(&tTime);
szTime = ctime(&tTime);
if (szTime) szTime[24] = '\0';
fprintf(pTestListFile,
" <CUNIT_FOOTER> %s" CU_VERSION " - %s </CUNIT_FOOTER> \n"
"</CUNIT_TEST_LIST_REPORT>",
"</CUNIT_TEST_LIST_REPORT>\n",
_("File Generated By CUnit v"),
(NULL != szTime) ? szTime : "");
......
dnl Applied patch to handle AC_ARG_ENABLE targets (Patch 1250604) - Provided by Andrew Kephart <andrew.kephart@alereon.com
AC_INIT(CUnit, 2.1-2)
AM_INIT_AUTOMAKE(CUnit, 2.1-2)
AC_INIT(CUnit, 3.0-1)
AM_INIT_AUTOMAKE(CUnit, 3.0-1)
dnl Package version information
PACKAGE=CUnit
VERSION_MAJOR=2
VERSION_MINOR=1
VERSION_MAJOR=3
VERSION_MINOR=0
VERSION=${VERSION_MAJOR}.${VERSION_MINOR}
RELEASE=2
RELEASE=1
dnl Shared library version information
dnl
......
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