Add --deqp-log-shader-sources= command line option
Change-Id: If113a0f7a56109104a7d074e2730003a312c3023
diff --git a/framework/common/tcuCommandLine.cpp b/framework/common/tcuCommandLine.cpp
index c660e63..ec85266 100644
--- a/framework/common/tcuCommandLine.cpp
+++ b/framework/common/tcuCommandLine.cpp
@@ -81,6 +81,7 @@
DE_DECLARE_COMMAND_LINE_OPT(EGLWindowType, std::string);
DE_DECLARE_COMMAND_LINE_OPT(EGLPixmapType, std::string);
DE_DECLARE_COMMAND_LINE_OPT(LogImages, bool);
+DE_DECLARE_COMMAND_LINE_OPT(LogShaderSources, bool);
DE_DECLARE_COMMAND_LINE_OPT(TestOOM, bool);
static void parseIntList (const char* src, std::vector<int>* dst)
@@ -164,6 +165,7 @@
<< Option<EGLWindowType> (DE_NULL, "deqp-egl-window-type", "EGL native window type")
<< Option<EGLPixmapType> (DE_NULL, "deqp-egl-pixmap-type", "EGL native pixmap type")
<< Option<LogImages> (DE_NULL, "deqp-log-images", "Enable or disable logging of result images", s_enableNames, "enable")
+ << Option<LogShaderSources> (DE_NULL, "deqp-log-shader-sources", "Enable or disable logging of shader sources", s_enableNames, "enable")
<< Option<TestOOM> (DE_NULL, "deqp-test-oom", "Run tests that exhaust memory on purpose", s_enableNames, TEST_OOM_DEFAULT);
}
@@ -718,6 +720,9 @@
if (!m_cmdLine.getOption<opt::LogImages>())
m_logFlags |= QP_TEST_LOG_EXCLUDE_IMAGES;
+ if (!m_cmdLine.getOption<opt::LogShaderSources>())
+ m_logFlags |= QP_TEST_LOG_EXCLUDE_SHADER_SOURCES;
+
if ((m_cmdLine.hasOption<opt::CasePath>()?1:0) +
(m_cmdLine.hasOption<opt::CaseList>()?1:0) +
(m_cmdLine.hasOption<opt::CaseListFile>()?1:0) +
diff --git a/framework/qphelper/qpTestLog.c b/framework/qphelper/qpTestLog.c
index 5bd6301..77e182a 100644
--- a/framework/qphelper/qpTestLog.c
+++ b/framework/qphelper/qpTestLog.c
@@ -1024,6 +1024,7 @@
deBool qpTestLog_writeShader (qpTestLog* log, qpShaderType type, const char* source, deBool compileOk, const char* infoLog)
{
const char* tagName = QP_LOOKUP_STRING(s_qpShaderTypeMap, type);
+ const char* sourceStr = ((log->flags & QP_TEST_LOG_EXCLUDE_SHADER_SOURCES) == 0 || !compileOk) ? source : "";
int numShaderAttribs = 0;
qpXmlAttribute shaderAttribs[4];
@@ -1034,7 +1035,7 @@
shaderAttribs[numShaderAttribs++] = qpSetStringAttrib("CompileStatus", compileOk ? "OK" : "Fail");
if (!qpXmlWriter_startElement(log->writer, tagName, numShaderAttribs, shaderAttribs) ||
- !qpXmlWriter_writeStringElement(log->writer, "ShaderSource", source) ||
+ !qpXmlWriter_writeStringElement(log->writer, "ShaderSource", sourceStr) ||
!qpXmlWriter_writeStringElement(log->writer, "InfoLog", infoLog) ||
!qpXmlWriter_endElement(log->writer, tagName))
{
@@ -1216,10 +1217,12 @@
*//*--------------------------------------------------------------------*/
deBool qpTestLog_writeKernelSource (qpTestLog* log, const char* source)
{
+ const char* sourceStr = (log->flags & QP_TEST_LOG_EXCLUDE_SHADER_SOURCES) != 0 ? "" : source;
+
DE_ASSERT(log);
deMutex_lock(log->lock);
- if (!qpXmlWriter_writeStringElement(log->writer, "KernelSource", source))
+ if (!qpXmlWriter_writeStringElement(log->writer, "KernelSource", sourceStr))
{
qpPrintf("qpTestLog_writeKernelSource(): Writing XML failed\n");
deMutex_unlock(log->lock);
diff --git a/framework/qphelper/qpTestLog.h b/framework/qphelper/qpTestLog.h
index 38cad23..d03dfdd 100644
--- a/framework/qphelper/qpTestLog.h
+++ b/framework/qphelper/qpTestLog.h
@@ -132,7 +132,8 @@
/* Test log flags. */
typedef enum qpTestLogFlag_e
{
- QP_TEST_LOG_EXCLUDE_IMAGES = (1<<0) /*!< Do not log images. This reduces log size considerably. */
+ QP_TEST_LOG_EXCLUDE_IMAGES = (1<<0), /*!< Do not log images. This reduces log size considerably. */
+ QP_TEST_LOG_EXCLUDE_SHADER_SOURCES = (1<<1) /*!< Do not log shader sources. Helps to reduce log size further. */
} qpTestLogFlag;
/* Shader type. */