Add --deqp-log-shader-sources= command line option
authorPyry Haulos <phaulos@google.com>
Thu, 21 Jan 2016 18:06:20 +0000 (10:06 -0800)
committerPyry Haulos <phaulos@google.com>
Thu, 21 Jan 2016 18:25:24 +0000 (10:25 -0800)
Change-Id: If113a0f7a56109104a7d074e2730003a312c3023

framework/common/tcuCommandLine.cpp
framework/qphelper/qpTestLog.c
framework/qphelper/qpTestLog.h

index c660e63..ec85266 100644 (file)
@@ -81,6 +81,7 @@ DE_DECLARE_COMMAND_LINE_OPT(EGLDisplayType,                           std::string);
 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 @@ void registerOptions (de::cmdline::Parser& parser)
                << 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 @@ bool CommandLine::parse (int argc, const char* const* argv)
        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) +
index 5bd6301..77e182a 100644 (file)
@@ -1024,6 +1024,7 @@ deBool qpTestLog_endShaderProgram (qpTestLog* log)
 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 @@ deBool qpTestLog_writeShader (qpTestLog* log, qpShaderType type, const char* sou
        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_endSection (qpTestLog* log)
  *//*--------------------------------------------------------------------*/
 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);
index 38cad23..d03dfdd 100644 (file)
@@ -132,7 +132,8 @@ typedef enum qpImageFormat_e
 /* 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. */