Lines Matching refs:log
251 static void qpTestLog_flushFile (qpTestLog* log)
253 DE_ASSERT(log && log->outputFile);
254 fflush(log->outputFile);
257 FlushFileBuffers((HANDLE)_get_osfhandle(_fileno(log->outputFile)));
292 static deBool beginSession (qpTestLog* log)
294 DE_ASSERT(log && !log->isSessionOpen);
297 fprintf(log->outputFile, "#sessionInfo releaseName %s\n", qpGetReleaseName());
298 fprintf(log->outputFile, "#sessionInfo releaseId 0x%08x\n", qpGetReleaseId());
299 fprintf(log->outputFile, "#sessionInfo targetName \"%s\"\n", qpGetTargetName());
302 fprintf(log->outputFile, "#beginSession\n");
303 qpTestLog_flushFile(log);
305 log->isSessionOpen = DE_TRUE;
310 static deBool endSession (qpTestLog* log)
312 DE_ASSERT(log && log->isSessionOpen);
315 qpXmlWriter_flush(log->writer);
318 fprintf(log->outputFile, "\n#endSession\n");
319 qpTestLog_flushFile(log);
321 log->isSessionOpen = DE_FALSE;
333 qpTestLog* log = (qpTestLog*)deCalloc(sizeof(qpTestLog));
334 if (!log)
340 ContainerStack_reset(&log->containerStack);
344 log->outputFile = fopen(fileName, "wb");
345 if (!log->outputFile)
347 qpPrintf("ERROR: Unable to open test log output file '%s'.\n", fileName);
348 qpTestLog_destroy(log);
352 log->flags = flags;
353 log->writer = qpXmlWriter_createFileWriter(log->outputFile, 0);
354 log->lock = deMutex_create(DE_NULL);
355 log->isSessionOpen = DE_FALSE;
356 log->isCaseOpen = DE_FALSE;
358 if (!log->writer)
361 qpTestLog_destroy(log);
365 if (!log->lock)
368 qpTestLog_destroy(log);
372 beginSession(log);
374 return log;
381 void qpTestLog_destroy (qpTestLog* log)
383 DE_ASSERT(log);
385 if (log->isSessionOpen)
386 endSession(log);
388 if (log->writer)
389 qpXmlWriter_destroy(log->writer);
391 if (log->outputFile)
392 fclose(log->outputFile);
394 if (log->lock)
395 deMutex_destroy(log->lock);
397 deFree(log);
401 * \brief Log start of test case
402 * \param log qpTestLog instance
407 deBool qpTestLog_startCase (qpTestLog* log, const char* testCasePath, qpTestCaseType testCaseType)
413 DE_ASSERT(log && testCasePath && (testCasePath[0] != 0));
414 deMutex_lock(log->lock);
416 DE_ASSERT(!log->isCaseOpen);
417 DE_ASSERT(ContainerStack_isEmpty(&log->containerStack));
420 qpXmlWriter_flush(log->writer);
421 fprintf(log->outputFile, "\n#beginTestCaseResult %s\n", testCasePath);
422 qpTestLog_flushFile(log);
424 log->isCaseOpen = DE_TRUE;
431 if (!qpXmlWriter_startDocument(log->writer) ||
432 !qpXmlWriter_startElement(log->writer, "TestCaseResult", numResultAttribs, resultAttribs))
435 deMutex_unlock(log->lock);
439 deMutex_unlock(log->lock);
444 * \brief Log end of test case
445 * \param log qpTestLog instance
450 deBool qpTestLog_endCase (qpTestLog* log, qpTestResult result, const char* resultDetails)
455 DE_ASSERT(log && log->isCaseOpen);
456 DE_ASSERT(ContainerStack_isEmpty(&log->containerStack));
457 deMutex_lock(log->lock);
462 if (!qpXmlWriter_startElement(log->writer, "Result", 1, &statusAttrib) ||
463 (resultDetails && !qpXmlWriter_writeString(log->writer, resultDetails)) ||
464 !qpXmlWriter_endElement(log->writer, "Result") ||
465 !qpXmlWriter_endElement(log->writer, "TestCaseResult") ||
466 !qpXmlWriter_endDocument(log->writer)) /* Close any XML elements still open */
469 deMutex_unlock(log->lock);
474 qpXmlWriter_flush(log->writer);
475 fprintf(log->outputFile, "\n#endTestCaseResult\n");
476 qpTestLog_flushFile(log);
478 log->isCaseOpen = DE_FALSE;
480 deMutex_unlock(log->lock);
486 * \param log qpTestLog instance
490 deBool qpTestLog_terminateCase (qpTestLog* log, qpTestResult result)
494 DE_ASSERT(log);
497 deMutex_lock(log->lock);
499 if (!log->isCaseOpen)
501 deMutex_unlock(log->lock);
506 qpXmlWriter_flush(log->writer);
507 fprintf(log->outputFile, "\n#terminateTestCaseResult %s\n", resultStr);
508 qpTestLog_flushFile(log);
510 log->isCaseOpen = DE_FALSE;
513 ContainerStack_reset(&log->containerStack);
516 deMutex_unlock(log->lock);
520 static deBool qpTestLog_writeKeyValuePair (qpTestLog* log, const char* elementName, const char* name, const char* description, const char* unit, qpKeyValueTag tag, const char* text)
526 DE_ASSERT(log && elementName && text);
527 deMutex_lock(log->lock);
535 if (!qpXmlWriter_startElement(log->writer, elementName, numAttribs, attribs) ||
536 !qpXmlWriter_writeString(log->writer, text) ||
537 !qpXmlWriter_endElement(log->writer, elementName))
540 deMutex_unlock(log->lock);
544 deMutex_unlock(log->lock);
549 * \brief Write a message to output log
550 * \param log qpTestLog instance
555 deBool qpTestLog_writeMessage (qpTestLog* log, const char* format, ...)
570 log, "Text", DE_NULL, DE_NULL, DE_NULL, QP_KEY_TAG_LAST, buffer);
574 * \brief Write key-value-pair into log
575 * \param log qpTestLog instance
582 deBool qpTestLog_writeText (qpTestLog* log, const char* name, const char* description, qpKeyValueTag tag, const char* text)
585 return qpTestLog_writeKeyValuePair(log, "Text", name, description, DE_NULL, tag, text);
589 * \brief Write key-value-pair into log
590 * \param log qpTestLog instance
597 deBool qpTestLog_writeInteger (qpTestLog* log, const char* name, const char* description, const char* unit, qpKeyValueTag tag, deInt64 value)
605 return qpTestLog_writeKeyValuePair(log, "Number", name, description, unit, tag, tmpString);
609 * \brief Write key-value-pair into log
610 * \param log qpTestLog instance
617 deBool qpTestLog_writeFloat (qpTestLog* log, const char* name, const char* description, const char* unit, qpKeyValueTag tag, float value)
625 return qpTestLog_writeKeyValuePair(log, "Number", name, description, unit, tag, tmpString);
763 * \param log qpTestLog instance
768 deBool qpTestLog_startImageSet (qpTestLog* log, const char* name, const char* description)
773 DE_ASSERT(log && name);
774 deMutex_lock(log->lock);
781 if (!qpXmlWriter_startElement(log->writer, "ImageSet", numAttribs, attribs))
784 deMutex_unlock(log->lock);
788 DE_ASSERT(ContainerStack_push(&log->containerStack, CONTAINERTYPE_IMAGESET));
790 deMutex_unlock(log->lock);
796 * \param log qpTestLog instance
799 deBool qpTestLog_endImageSet (qpTestLog* log)
801 DE_ASSERT(log);
802 deMutex_lock(log->lock);
805 if (!qpXmlWriter_endElement(log->writer, "ImageSet"))
808 deMutex_unlock(log->lock);
812 DE_ASSERT(ContainerStack_pop(&log->containerStack) == CONTAINERTYPE_IMAGESET);
814 deMutex_unlock(log->lock);
819 * \brief Write base64 encoded raw image data into log
820 * \param log qpTestLog instance
832 qpTestLog* log,
850 DE_ASSERT(log && name);
855 if (log->flags & QP_TEST_LOG_EXCLUDE_IMAGES)
942 /* \note Log lock is acquired after compression! */
943 deMutex_lock(log->lock);
946 if (!qpXmlWriter_startElement(log->writer, "Image", numAttribs, attribs) ||
947 !qpXmlWriter_writeBase64(log->writer, (const deUint8*)writeDataPtr, writeDataBytes) ||
948 !qpXmlWriter_endElement(log->writer, "Image"))
951 deMutex_unlock(log->lock);
956 deMutex_unlock(log->lock);
965 * \brief Write a OpenGL ES shader program into the log.
967 * \param linkInfoLog Implementation provided linkage log
969 deBool qpTestLog_startShaderProgram (qpTestLog* log, deBool linkOk, const char* linkInfoLog)
974 DE_ASSERT(log);
975 deMutex_lock(log->lock);
979 if (!qpXmlWriter_startElement(log->writer, "ShaderProgram", numProgramAttribs, programAttribs) ||
980 !qpXmlWriter_writeStringElement(log->writer, "InfoLog", linkInfoLog))
983 deMutex_unlock(log->lock);
987 DE_ASSERT(ContainerStack_push(&log->containerStack, CONTAINERTYPE_SHADERPROGRAM));
989 deMutex_unlock(log->lock);
995 * \param log qpTestLog instance
998 deBool qpTestLog_endShaderProgram (qpTestLog* log)
1000 DE_ASSERT(log);
1001 deMutex_lock(log->lock);
1004 if (!qpXmlWriter_endElement(log->writer, "ShaderProgram"))
1007 deMutex_unlock(log->lock);
1011 DE_ASSERT(ContainerStack_pop(&log->containerStack) == CONTAINERTYPE_SHADERPROGRAM);
1013 deMutex_unlock(log->lock);
1018 * \brief Write a OpenGL ES shader into the log.
1022 * \param infoLog Implementation provided shader compilation log
1024 deBool qpTestLog_writeShader (qpTestLog* log, qpShaderType type, const char* source, deBool compileOk, const char* infoLog)
1030 DE_ASSERT(log && source);
1031 DE_ASSERT(ContainerStack_getTop(&log->containerStack) == CONTAINERTYPE_SHADERPROGRAM);
1032 deMutex_lock(log->lock);
1036 if (!qpXmlWriter_startElement(log->writer, tagName, numShaderAttribs, shaderAttribs) ||
1037 !qpXmlWriter_writeStringElement(log->writer, "ShaderSource", source) ||
1038 !qpXmlWriter_writeStringElement(log->writer, "InfoLog", infoLog) ||
1039 !qpXmlWriter_endElement(log->writer, tagName))
1042 deMutex_unlock(log->lock);
1046 deMutex_unlock(log->lock);
1051 * \brief Start writing a set of EGL configurations into the log.
1053 deBool qpTestLog_startEglConfigSet (qpTestLog* log, const char* name, const char* description)
1058 DE_ASSERT(log && name);
1059 deMutex_lock(log->lock);
1066 if (!qpXmlWriter_startElement(log->writer, "EglConfigSet", numAttribs, attribs))
1069 deMutex_unlock(log->lock);
1073 DE_ASSERT(ContainerStack_push(&log->containerStack, CONTAINERTYPE_EGLCONFIGSET));
1075 deMutex_unlock(log->lock);
1082 deBool qpTestLog_endEglConfigSet (qpTestLog* log)
1084 log);
1085 deMutex_lock(log->lock);
1088 if (!qpXmlWriter_endElement(log->writer, "EglConfigSet"))
1091 deMutex_unlock(log->lock);
1095 DE_ASSERT(ContainerStack_pop(&log->containerStack) == CONTAINERTYPE_EGLCONFIGSET);
1097 deMutex_unlock(log->lock);
1105 deBool qpTestLog_writeEglConfig (qpTestLog* log, const qpEglConfigInfo* config)
1110 DE_ASSERT(log && config);
1111 deMutex_lock(log->lock);
1145 if (!qpXmlWriter_startElement(log->writer, "EglConfig", numAttribs, attribs) ||
1146 !qpXmlWriter_endElement(log->writer, "EglConfig"))
1149 deMutex_unlock(log->lock);
1153 deMutex_unlock(log->lock);
1158 * \brief Start section in log.
1159 * \param log qpTestLog instance
1164 deBool qpTestLog_startSection (qpTestLog* log, const char* name, const char* description)
1169 DE_ASSERT(log && name);
1170 deMutex_lock(log->lock);
1177 if (!qpXmlWriter_startElement(log->writer, "Section", numAttribs, attribs))
1180 deMutex_unlock(log->lock);
1184 DE_ASSERT(ContainerStack_push(&log->containerStack, CONTAINERTYPE_SECTION));
1186 deMutex_unlock(log->lock);
1191 * \brief End section in log.
1192 * \param log qpTestLog instance
1195 deBool qpTestLog_endSection (qpTestLog* log)
1197 DE_ASSERT(log);
1198 deMutex_lock(log->lock);
1201 if (!qpXmlWriter_endElement(log->writer, "Section"))
1204 deMutex_unlock(log->lock);
1208 DE_ASSERT(ContainerStack_pop(&log->containerStack) == CONTAINERTYPE_SECTION);
1210 deMutex_unlock(log->lock);
1215 * \brief Write OpenCL compute kernel source into the log.
1217 deBool qpTestLog_writeKernelSource (qpTestLog* log, const char* source)
1219 DE_ASSERT(log);
1220 deMutex_lock(log->lock);
1222 if (!qpXmlWriter_writeStringElement(log->writer, "KernelSource", source))
1225 deMutex_unlock(log->lock);
1229 deMutex_unlock(log->lock);
1234 * \brief Write OpenCL kernel compilation results into the log
1236 deBool qpTestLog_writeCompileInfo (qpTestLog* log, const char* name, const char* description, deBool compileOk, const char* infoLog)
1241 DE_ASSERT(log && name && description && infoLog);
1242 deMutex_lock(log->lock);
1248 if (!qpXmlWriter_startElement(log->writer, "CompileInfo", numAttribs, attribs) ||
1249 !qpXmlWriter_writeStringElement(log->writer, "InfoLog", infoLog) ||
1250 !qpXmlWriter_endElement(log->writer, "CompileInfo"))
1253 deMutex_unlock(log->lock);
1257 deMutex_unlock(log->lock);
1261 deBool qpTestLog_startSampleList (qpTestLog* log, const char* name, const char* description)
1266 DE_ASSERT(log && name && description);
1267 deMutex_lock(log->lock);
1272 if (!qpXmlWriter_startElement(log->writer, "SampleList", numAttribs, attribs))
1275 deMutex_unlock(log->lock);
1279 DE_ASSERT(ContainerStack_push(&log->containerStack, CONTAINERTYPE_SAMPLELIST));
1281 deMutex_unlock(log->lock);
1285 deBool qpTestLog_startSampleInfo (qpTestLog* log)
1287 DE_ASSERT(log);
1288 deMutex_lock(log->lock);
1290 if (!qpXmlWriter_startElement(log->writer, "SampleInfo", 0, DE_NULL))
1293 deMutex_unlock(log->lock);
1297 DE_ASSERT(ContainerStack_push(&log->containerStack, CONTAINERTYPE_SAMPLEINFO));
1299 deMutex_unlock(log->lock);
1303 deBool qpTestLog_writeValueInfo (qpTestLog* log, const char* name, const char* description, const char* unit, qpSampleValueTag tag)
1309 DE_ASSERT(log && name && description && tagName);
1310 deMutex_lock(log->lock);
1312 DE_ASSERT(ContainerStack_getTop(&log->containerStack) == CONTAINERTYPE_SAMPLEINFO);
1321 if (!qpXmlWriter_startElement(log->writer, "ValueInfo", numAttribs, attribs) ||
1322 !qpXmlWriter_endElement(log->writer, "ValueInfo"))
1325 deMutex_unlock(log->lock);
1329 deMutex_unlock(log->lock);
1333 deBool qpTestLog_endSampleInfo (qpTestLog* log)
1335 DE_ASSERT(log);
1336 deMutex_lock(log->lock);
1338 if (!qpXmlWriter_endElement(log->writer, "SampleInfo"))
1341 deMutex_unlock(log->lock);
1345 DE_ASSERT(ContainerStack_pop(&log->containerStack) == CONTAINERTYPE_SAMPLEINFO);
1347 deMutex_unlock(log->lock);
1351 deBool qpTestLog_startSample (qpTestLog* log)
1353 DE_ASSERT(log);
1354 deMutex_lock(log->lock);
1356 DE_ASSERT(ContainerStack_getTop(&log->containerStack) == CONTAINERTYPE_SAMPLELIST);
1358 if (!qpXmlWriter_startElement(log->writer, "Sample", 0, DE_NULL))
1361 deMutex_unlock(log->lock);
1365 DE_ASSERT(ContainerStack_push(&log->containerStack, CONTAINERTYPE_SAMPLE));
1367 deMutex_unlock(log->lock);
1371 deBool qpTestLog_writeValueFloat (qpTestLog* log, double value)
1376 deMutex_lock(log->lock);
1378 DE_ASSERT(ContainerStack_getTop(&log->containerStack) == CONTAINERTYPE_SAMPLE);
1380 if (!qpXmlWriter_writeStringElement(log->writer, "Value", &tmpString[0]))
1383 deMutex_unlock(log->lock);
1387 deMutex_unlock(log->lock);
1391 deBool qpTestLog_writeValueInteger (qpTestLog* log, deInt64 value)
1396 deMutex_lock(log->lock);
1398 DE_ASSERT(ContainerStack_getTop(&log->containerStack) == CONTAINERTYPE_SAMPLE);
1400 if (!qpXmlWriter_writeStringElement(log->writer, "Value", &tmpString[0]))
1403 deMutex_unlock(log->lock);
1407 deMutex_unlock(log->lock);
1411 deBool qpTestLog_endSample (qpTestLog* log)
1413 DE_ASSERT(log);
1414 deMutex_lock(log->lock);
1416 if (!qpXmlWriter_endElement(log->writer, "Sample"))
1419 deMutex_unlock(log->lock);
1423 DE_ASSERT(ContainerStack_pop(&log->containerStack) == CONTAINERTYPE_SAMPLE);
1425 deMutex_unlock(log->lock);
1429 deBool qpTestLog_endSampleList (qpTestLog* log)
1431 DE_ASSERT(log);
1432 deMutex_lock(log->lock);
1434 if (!qpXmlWriter_endElement(log->writer, "SampleList"))
1437 deMutex_unlock(log->lock);
1441 DE_ASSERT(ContainerStack_pop(&log->containerStack) == CONTAINERTYPE_SAMPLELIST);
1443 deMutex_unlock(log->lock);