Update contrib.
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #ifndef _STD_LOG_FILE_H__
21 #define _STD_LOG_FILE_H__
28 //#define LOG_FILE "c:\\logs\\std_test_log.txt"
29 #define LOG_DIR "c:\\logs\\"
30 #define LOG_FILE_EXT "xml"
31 int assert_failed = 0;
34 #define LOG_FILE_EXT "xml"
35 #define LOG_FILE "std_test_log.txt"
36 int assert_failed = 0;
42 # define VERIFY(fn) gnutest &= (fn)
45 void std_log(const char *filename,const int lineno,const char* aformat,...)
50 fp = fopen(LOG_FILE,"a");
55 fprintf(fp,"%s - [%d] : ",filename,lineno);
56 vfprintf(fp,aformat,va);
68 fp = fopen(LOG_FILE, "a");
77 // This function is used to generate the xml file used bt ATS
78 void testResultXml(char *filename)
84 char xmlfilename[256];
86 time_t t = time(NULL);
88 struct tm *tm1 = localtime(&t);
90 char *atsinitmsg = "<test-report>\n\t<test-batch>";
92 char *atsbatchinit1 = \
94 \n\t\t\t<description></description>\
96 char *atsbatchinit2 = "</date>\
97 \n\t\t\t<factory>NA</factory>\
99 \n\t\t\t\t<name>NA</name>\
100 \n\t\t\t\t<version>NA</version>\
101 \n\t\t\t</component>\
102 \n\t\t</batch-init>";
104 char *atsbatchresult= \
105 "\n\t\t<batch-result>\
106 \n\t\t\t<run-time>00:00:00</run-time>\
107 \n\t\t</batch-result>";
109 char *atsclosemsg = \
111 \n</test-report>\n ";
113 char *atstestinit = "\n\t\t<test-case time-stamp=\"00:00:00\">";
116 char *atscaseinit1 = \
117 "\n\t\t\t<case-init>\
118 \n\t\t\t\t<version></version>\
121 char *atscaseinit2 = "</id>\
122 \n\t\t\t\t<expected-result description=\"\">0</expected-result>\
123 \n\t\t\t</case-init>";
125 char *atscaseresult1= \
126 "\n\t\t\t<case-result status=\"";
128 char *atscaseresult2= "\">\
129 \n\t\t\t\t<actual-result>0</actual-result>\
130 \n\t\t\t\t<run-time>00:00:00</run-time>\
131 \n\t\t\t</case-result>";
133 char *atstestclose = "\n\t\t</test-case>";
135 // create the xml file name
137 sprintf(xmlfilename, "%s%s.%s", LOG_DIR, filename, LOG_FILE_EXT);
138 strftime(time_buf,50,"%c",tm1);
141 strcpy(result,"FAILED");
143 strcpy(result,"PASSED");
145 fp_result = fopen(xmlfilename,"w");
149 fprintf(fp_result,"%s%s%s%s%s%s%s%s%s%s%s%s%s%s",atsinitmsg,atsbatchinit1,time_buf,atsbatchinit2,atstestinit,
150 atscaseinit1,filename,atscaseinit2,atscaseresult1,result,atscaseresult2,
151 atstestclose,atsbatchresult,atsclosemsg);