[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-server-cvs
Subject: [Server-cvs] tools/unittest/framework ut_configmanager.cpp, 1.1,
From: srao () helixcommunity ! org
Date: 2008-09-28 4:32:42
Message-ID: 200809280438.m8S4c8Dr029683 () mailer ! progressive-comp ! com
[Download RAW message or body]
Update of /cvsroot/server/tools/unittest/framework
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv26305
Modified Files:
ut_configmanager.cpp ut_configmanager.h ut_xmllog.cpp
ut_xmllog.h
Log Message:
Synopsis
==============
This CR fixes following issues:
1. On UNIX, by default Unit test module is searching for UnitTestConfig.xml instead \
of ut_<module_name>.xml and writing test result in file TestResult_UnitTestConfig.xml \
instead of TestResult_<module_name>.xml.
2. On Linux even though shared libraries of xalan and xerces are available in the \
debug directory, executable is reporting that libraries are not found. (I will send \
separate CR for Solaris as it needs more changes).
Branches: SERVER_12_1_RN, SERVER_CURRENT_RN
Suggested Reviewer: JJ, Dean, Atin
Description
===========
1. Modified ut_main.cpp to populate g_moduleName.
2. Modified CUTConfigManager and UTXmlLog to extract module name from g_moduleName.
3. Modified linux cf files to generate compiler option rpath as ./, so that \
executable can search and find shared objects in the specified path. (Note: If any \
body feels this solution is risky, I will replace this with script which will set \
shared library path using LD_LIBRARY_PATH. But I was verified this solution on other \
builds and found that its safe).
Files Affected
==============
/server-restricted/datatype/playlist/unittest/ut_main.cpp
/server/tools/unittest/framework/ut_configmanager.cpp
/server/tools/unittest/framework/ut_configmanager.h
/server/tools/unittest/framework/ut_xmllog.cpp
/server/tools/unittest/framework/ut_xmllog.h
/build/umakecf/linux-2.2-libc6-i586-server.cf
/build/umakecf/linux-2.4-glibc23.cf
Testing Performed
=================
Verified on Linux and found that unit test module is picking up ut_<module_name>.xml \
and results are written in to TestResult_<module_name>.xml. Also with out setting \
LD_LIBRARY_PATH, executable is picking up shared objects and running fine on Linux.
Build verified: win32-i386-vc7, linux-rhel4-i686
Platforms tested: win32-i386-vc7, linux-rhel4-i686
QA Hints
===============
None
Index: ut_xmllog.h
===================================================================
RCS file: /cvsroot/server/tools/unittest/framework/ut_xmllog.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ut_xmllog.h 29 May 2007 09:16:06 -0000 1.2
+++ ut_xmllog.h 28 Sep 2008 04:32:39 -0000 1.3
@@ -43,6 +43,7 @@
#define CONST_BUFFSIZE 512
#define FAIL -1
+extern CHAR g_moduleName[CONST_BUFFSIZE];
/*! \class UTXmlLog
\brief Class logging Exceptions, Failures and Test Summary.
Index: ut_configmanager.cpp
===================================================================
RCS file: /cvsroot/server/tools/unittest/framework/ut_configmanager.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ut_configmanager.cpp 24 May 2007 12:31:43 -0000 1.1
+++ ut_configmanager.cpp 28 Sep 2008 04:32:39 -0000 1.2
@@ -84,34 +84,35 @@
char szFileName[CONST_BUFFSIZE], szXmlName[CONST_BUFFSIZE];
char *token, *prev_token;
char szExtSeperator[] = ".";
-#ifdef _WIN32
- char szPathSeperator[] = "\\";
- GetModuleFileName(NULL, szFileName, CONST_BUFFSIZE);
- token = strtok(szFileName, szPathSeperator);
- while (token != NULL)
- {
- prev_token = token;
- token = strtok(NULL, szPathSeperator);
- }
- if (token = strtok(prev_token, szExtSeperator))
+ #ifdef _WIN32
+ char szPathSeperator[] = "\\";
+ #else
+ char szPathSeperator[] = "/";
+ #endif
+
+ if (g_moduleName[0])
{
- strcpy(szXmlName, token);
+ strcpy(szFileName, g_moduleName);
+ token = strtok(szFileName, szPathSeperator);
+ while (token != NULL)
+ {
+ prev_token = token;
+ token = strtok(NULL, szPathSeperator);
+ }
+ if (token = strtok(prev_token, szExtSeperator))
+ {
+ strcpy(szXmlName, token);
+ }
+ else
+ {
+ strcpy(szXmlName, prev_token);
+ }
}
else
{
- strcpy(szXmlName, prev_token);
+ strcpy(szXmlName, "UnitTestConfig");
}
-#else /* Unix based OS */
- //TODO:
- //Get Current Module name and set it to the m_szXmlName
- //This could be handled specific to OS.
- //Currently hardcoding the name.
- char szPathSeperator[] = "/";
-
- strcpy(szXmlName, "UnitTestConfig");
- //End TODO
-#endif /* _WIN32 */
sprintf(m_szXmlName, "%s%s%s.xml", szExtSeperator, szPathSeperator, szXmlName);
}
Index: ut_xmllog.cpp
===================================================================
RCS file: /cvsroot/server/tools/unittest/framework/ut_xmllog.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ut_xmllog.cpp 29 May 2007 09:16:06 -0000 1.2
+++ ut_xmllog.cpp 28 Sep 2008 04:32:39 -0000 1.3
@@ -85,40 +85,41 @@
char szFileName[CONST_BUFFSIZE], szXmlName[CONST_BUFFSIZE];
char *token, *prev_token;
char szExtSeperator[] = ".";
- #ifdef _WIN32
- char szPathSeperator[] = "\\";
- GetModuleFileName(NULL, szFileName, CONST_BUFFSIZE);
- token = strtok(szFileName, szPathSeperator);
- while (token != NULL)
- {
- prev_token = token;
- token = strtok(NULL, szPathSeperator);
- }
- if (token = strtok(prev_token, szExtSeperator))
+ #ifdef _WIN32
+ char szPathSeperator[] = "\\";
+ #else
+ char szPathSeperator[] = "/";
+ #endif
+
+ if (g_moduleName[0])
{
- strcpy(szXmlName, token);
+ strcpy(szFileName, g_moduleName);
+ token = strtok(szFileName, szPathSeperator);
+ while (token != NULL)
+ {
+ prev_token = token;
+ token = strtok(NULL, szPathSeperator);
+ }
+ if (token = strtok(prev_token, szExtSeperator))
+ {
+ strcpy(szXmlName, token);
+ }
+ else
+ {
+ strcpy(szXmlName, prev_token);
+ }
}
- else
+ else
{
- strcpy(szXmlName, prev_token);
+ strcpy(szXmlName, "UnitTestResult");
}
- #else /* Unix based OS */
- //TODO:
- //Get Current Module name and set it to the m_szXmlName
- //This could be handled specific to OS.
- //Currently hardcoding the name.
- char szPathSeperator[] = "/";
-
- strcpy(szXmlName, "UnitTestConfig");
- //End TODO
- #endif /* _WIN32 */
sprintf(m_pszFileNameWithPath, "%s%sTestResult_%s.xml", szExtSeperator, \
szPathSeperator, szXmlName); }
else
{
//copy file path to member variable.
- strcpy(m_pszFileNameWithPath, pchFileNameWithPath);
+ strcpy(m_pszFileNameWithPath, "UnitTestResult.xml");
}
}
Index: ut_configmanager.h
===================================================================
RCS file: /cvsroot/server/tools/unittest/framework/ut_configmanager.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ut_configmanager.h 24 May 2007 12:31:43 -0000 1.1
+++ ut_configmanager.h 28 Sep 2008 04:32:39 -0000 1.2
@@ -46,7 +46,7 @@
\brief A macro that defines return value as FALSE.
*/
#define RES_EXCLUDED false
-
+extern CHAR g_moduleName[CONST_BUFFSIZE];
/*! \def RES_OK
\brief A macro that defines return value as TRUE.
*/
_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic