diff -r 403e7f6ed6c5 -r 564bc7b7ad27 internal/gcce/inc/result_log.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/internal/gcce/inc/result_log.h Tue Nov 02 19:23:22 2010 +0530 @@ -0,0 +1,146 @@ +/* +Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of Nokia Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +* Description: +* +*/ + + + +#ifndef __RESULT_LOG_H__ +#define __RESULT_LOG_H__ +#include +#include + +#include +#include +#include +#include + + +#undef g_assert +#define g_assert(expr) G_STMT_START{ if (expr) { } else {g_log (G_LOG_DOMAIN,G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, "file %s: line %d: assertion failed: (%s)", __FILE__, __LINE__, #expr);assert_failed = TRUE; }}G_STMT_END + + +// This function is used to generate the xml file used bt ATS +void testResultXml(char *filename,int passed) +{ + char time_buf[50]; + + char result[10]; + + char xmlfilename[256]; + + time_t t = time(NULL); + + struct tm *tm1 = localtime(&t); + + char *atsinitmsg = "\n\t"; + + char *atsbatchinit1 = \ + "\n\t\t\ + \n\t\t\t\ + \n\t\t\t"; + + char *atsbatchinit2 = "\ + \n\t\t\tNA\ + \n\t\t\t\ + \n\t\t\t\tNA\ + \n\t\t\t\tNA\ + \n\t\t\t\ + \n\t\t"; + + char *atsbatchresult= \ + "\n\t\t\ + \n\t\t\t00:00:00\ + \n\t\t"; + + char *atsclosemsg = \ + "\n\t\ + \n\n "; + + char *atstestinit = "\n\t\t"; + + + char *atscaseinit1 = \ + "\n\t\t\t\ + \n\t\t\t\t\ + \n\t\t\t\t"; + + char *atscaseinit2 = "\ + \n\t\t\t\t0\ + \n\t\t\t"; + + char *atscaseresult1= \ + "\n\t\t\t\ + \n\t\t\t\t0\ + \n\t\t\t\t00:00:00\ + \n\t\t\t"; + + char *atstestclose = "\n\t\t"; + + /* Check and see if spd_logs/xml is existent or not. If not present create it */ + DIR *dir; + FILE *fp; + + dir = opendir("c:\\spd_logs"); + if(!dir) + mkdir("c:\\spd_logs",0777); + + dir = opendir("c:\\spd_logs\\xml"); + if(!dir) + mkdir("c:\\spd_logs\\xml",0777); + + // create the xml file name + strcpy(xmlfilename,"c:\\spd_logs\\xml\\"); + strcat(xmlfilename,filename); + strcat(xmlfilename,".xml"); + + strftime(time_buf,50,"%c",tm1); + + if(passed != 0) + strcpy(result,"FAILED"); + else + strcpy(result,"PASSED"); + + fp = fopen(xmlfilename,"w"); + + if(fp) + { + fprintf(fp,"%s%s%s%s%s%s%s%s%s%s%s%s%s%s",atsinitmsg,atsbatchinit1,time_buf,atsbatchinit2,atstestinit, + atscaseinit1,filename,atscaseinit2,atscaseresult1,result,atscaseresult2, + atstestclose,atsbatchresult,atsclosemsg); + + fclose(fp); + } + else + { + } +} + +#endif //__RESULT_LOG_H__