Move tcu::ResultCollector to a separate file.
authorJarkko Pöyry <jpoyry@google.com>
Thu, 12 Feb 2015 23:22:19 +0000 (15:22 -0800)
committerJarkko Pöyry <jpoyry@google.com>
Fri, 13 Feb 2015 19:03:15 +0000 (11:03 -0800)
- Move tcu::ResultCollector to a separate file.
- Fix includes in tests.

Change-Id: I688d84e5de7bfa4c80b0034cdac4ea0e4fd2faa7

17 files changed:
Android.mk
framework/common/CMakeLists.txt
framework/common/tcuResultCollector.cpp [new file with mode: 0644]
framework/common/tcuResultCollector.hpp [new file with mode: 0644]
framework/common/tcuTestContext.cpp
framework/common/tcuTestContext.hpp
modules/egl/teglResizeTests.cpp
modules/gles3/performance/es3pDepthTests.cpp
modules/gles31/functional/es31fDebugTests.cpp
modules/gles31/functional/es31fFboNoAttachmentTests.cpp
modules/gles31/functional/es31fNegativeTestShared.cpp
modules/gles31/functional/es31fNegativeTestShared.hpp
modules/gles31/functional/es31fSeparateShaderTests.cpp
modules/glshared/glsBuiltinPrecisionTests.cpp
modules/glshared/glsDrawTest.hpp
modules/glshared/glsStateQueryUtil.hpp
modules/glshared/glsTextureBufferCase.cpp

index 21aefcc..10e56b0 100644 (file)
@@ -51,6 +51,7 @@ LOCAL_SRC_FILES := \
        framework/common/tcuRandomValueIterator.cpp \
        framework/common/tcuRenderTarget.cpp \
        framework/common/tcuResource.cpp \
+       framework/common/tcuResultCollector.cpp \
        framework/common/tcuRGBA.cpp \
        framework/common/tcuEither.cpp \
        framework/common/tcuStringTemplate.cpp \
index 4861de6..20ad1dc 100644 (file)
@@ -40,6 +40,8 @@ set(TCUTIL_SRCS
        tcuRenderTarget.hpp
        tcuResource.cpp
        tcuResource.hpp
+       tcuResultCollector.cpp
+       tcuResultCollector.hpp
        tcuSurface.cpp
        tcuSurface.hpp
        tcuTestCase.cpp
diff --git a/framework/common/tcuResultCollector.cpp b/framework/common/tcuResultCollector.cpp
new file mode 100644 (file)
index 0000000..e760466
--- /dev/null
@@ -0,0 +1,104 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Tester Core
+ * ----------------------------------------
+ *
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Test result collector
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuResultCollector.hpp"
+#include "tcuTestContext.hpp"
+#include "tcuTestLog.hpp"
+
+namespace tcu
+{
+
+static int testResultSeverity (qpTestResult testResult)
+{
+       switch (testResult)
+       {
+               case QP_TEST_RESULT_LAST:                                       return -1;
+               case QP_TEST_RESULT_PASS:                                       return 0;
+               case QP_TEST_RESULT_PENDING:                            return 10;
+               case QP_TEST_RESULT_NOT_SUPPORTED:                      return 20;
+               case QP_TEST_RESULT_QUALITY_WARNING:            return 30;
+               case QP_TEST_RESULT_COMPATIBILITY_WARNING:      return 40;
+               case QP_TEST_RESULT_TIMEOUT:                            return 50;
+               case QP_TEST_RESULT_FAIL:                                       return 100;
+               case QP_TEST_RESULT_RESOURCE_ERROR:                     return 110;
+               case QP_TEST_RESULT_INTERNAL_ERROR:                     return 120;
+               case QP_TEST_RESULT_CRASH:                                      return 150;
+               default:                                                                        DE_ASSERT(!"Impossible case");
+       }
+       return 0;
+}
+
+ResultCollector::ResultCollector (void)
+       : m_log         (DE_NULL)
+       , m_prefix      ("")
+       , m_result      (QP_TEST_RESULT_LAST)
+       , m_message ("Pass")
+{
+}
+
+ResultCollector::ResultCollector (TestLog& log, const std::string& prefix)
+       : m_log         (&log)
+       , m_prefix      (prefix)
+       , m_result      (QP_TEST_RESULT_LAST)
+       , m_message ("Pass")
+{
+}
+
+void ResultCollector::addResult (qpTestResult result, const std::string& msg)
+{
+       if (m_log != DE_NULL)
+               (*m_log) << TestLog::Message << m_prefix << msg << TestLog::EndMessage;
+
+       if (testResultSeverity(result) > testResultSeverity(m_result))
+       {
+               m_result = result;
+               m_message = msg;
+       }
+}
+
+bool ResultCollector::checkResult (bool condition, qpTestResult result, const std::string& msg)
+{
+       if (!condition)
+               addResult(result, msg);
+       return condition;
+}
+
+void ResultCollector::fail (const std::string& msg)
+{
+       addResult(QP_TEST_RESULT_FAIL, msg);
+}
+
+bool ResultCollector::check (bool condition, const std::string& msg)
+{
+       return checkResult(condition, QP_TEST_RESULT_FAIL, msg);
+}
+
+void ResultCollector::setTestContextResult (TestContext& testCtx)
+{
+       if (m_result == QP_TEST_RESULT_LAST)
+               testCtx.setTestResult(QP_TEST_RESULT_PASS, m_message.c_str());
+       else
+               testCtx.setTestResult(m_result, m_message.c_str());
+}
+
+} // tcu
diff --git a/framework/common/tcuResultCollector.hpp b/framework/common/tcuResultCollector.hpp
new file mode 100644 (file)
index 0000000..7860147
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef _TCURESULTCOLLECTOR_HPP
+#define _TCURESULTCOLLECTOR_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Tester Core
+ * ----------------------------------------
+ *
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Test result collector
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "qpTestLog.h"
+
+#include <string>
+
+namespace tcu
+{
+
+class TestLog;
+class TestContext;
+
+/*--------------------------------------------------------------------*//*!
+ * This utility class collects test results with associated messages,
+ * optionally logs them, and finally sets the test result of a TestContext to
+ * the most severe collected result. This allows multiple problems to be
+ * easily reported from a single test run.
+ *//*--------------------------------------------------------------------*/
+class ResultCollector
+{
+public:
+                                       ResultCollector                 (void);
+                                       ResultCollector                 (TestLog& log, const std::string& prefix = "");
+
+       qpTestResult    getResult                               (void) const  { return m_result; }
+
+       void                    fail                                    (const std::string& msg);
+       bool                    check                                   (bool condition, const std::string& msg);
+
+       void                    addResult                               (qpTestResult result, const std::string& msg);
+       bool                    checkResult                             (bool condition, qpTestResult result, const std::string& msg);
+
+       void                    setTestContextResult    (TestContext& testCtx);
+
+private:
+       TestLog*                m_log;
+       std::string             m_prefix;
+       qpTestResult    m_result;
+       std::string             m_message;
+};
+
+
+} // tcu
+
+#endif // _TCURESULTCOLLECTOR_HPP
\ No newline at end of file
index bfa6d88..965d918 100644 (file)
@@ -58,77 +58,4 @@ void TestContext::setTestResult (qpTestResult testResult, const char* descriptio
        m_testResultDesc        = description;
 }
 
-static int testResultSeverity (qpTestResult testResult)
-{
-       switch (testResult)
-       {
-               case QP_TEST_RESULT_LAST:                                       return -1;
-               case QP_TEST_RESULT_PASS:                                       return 0;
-               case QP_TEST_RESULT_PENDING:                            return 10;
-               case QP_TEST_RESULT_NOT_SUPPORTED:                      return 20;
-               case QP_TEST_RESULT_QUALITY_WARNING:            return 30;
-               case QP_TEST_RESULT_COMPATIBILITY_WARNING:      return 40;
-               case QP_TEST_RESULT_TIMEOUT:                            return 50;
-               case QP_TEST_RESULT_FAIL:                                       return 100;
-               case QP_TEST_RESULT_RESOURCE_ERROR:                     return 110;
-               case QP_TEST_RESULT_INTERNAL_ERROR:                     return 120;
-               case QP_TEST_RESULT_CRASH:                                      return 150;
-               default:                                                                        DE_ASSERT(!"Impossible case");
-       }
-       return 0;
-}
-
-ResultCollector::ResultCollector (void)
-       : m_log         (DE_NULL)
-       , m_prefix      ("")
-       , m_result      (QP_TEST_RESULT_LAST)
-       , m_message ("Pass")
-{
-}
-
-ResultCollector::ResultCollector (TestLog& log, const std::string& prefix)
-       : m_log         (&log)
-       , m_prefix      (prefix)
-       , m_result      (QP_TEST_RESULT_LAST)
-       , m_message ("Pass")
-{
-}
-
-void ResultCollector::addResult (qpTestResult result, const std::string& msg)
-{
-       if (m_log != DE_NULL)
-               (*m_log) << TestLog::Message << m_prefix << msg << TestLog::EndMessage;
-
-       if (testResultSeverity(result) > testResultSeverity(m_result))
-       {
-               m_result = result;
-               m_message = msg;
-       }
-}
-
-bool ResultCollector::checkResult (bool condition, qpTestResult result, const std::string& msg)
-{
-       if (!condition)
-               addResult(result, msg);
-       return condition;
-}
-
-void ResultCollector::fail (const std::string& msg)
-{
-       addResult(QP_TEST_RESULT_FAIL, msg);
-}
-
-bool ResultCollector::check (bool condition, const std::string& msg)
-{
-       return checkResult(condition, QP_TEST_RESULT_FAIL, msg);
-}
-
-void ResultCollector::setTestContextResult (TestContext& testCtx)
-{
-       if (m_result == QP_TEST_RESULT_LAST)
-               testCtx.setTestResult(QP_TEST_RESULT_PASS, m_message.c_str());
-       else
-               testCtx.setTestResult(m_result, m_message.c_str());
-}
-
 } // tcu
index 3196154..3aa474d 100644 (file)
@@ -82,36 +82,6 @@ protected:
        bool                                    m_terminateAfter;       //!< Should tester terminate after execution of the current test
 };
 
-/*--------------------------------------------------------------------*//*!
- * \brief Test result collector
- *
- * This utility class collects test results with associated messages,
- * optionally logs them, and finally sets the test result of a TestContext to
- * the most severe collected result. This allows multiple problems to be
- * easily reported from a single test run.
- *//*--------------------------------------------------------------------*/
-class ResultCollector
-{
-public:
-                                       ResultCollector                 (void);
-                                       ResultCollector                 (TestLog& log, const std::string& prefix = "");
-
-       qpTestResult    getResult                               (void) const  { return m_result; }
-
-       void                    fail                                    (const std::string& msg);
-       bool                    check                                   (bool condition, const std::string& msg);
-
-       void                    addResult                               (qpTestResult result, const std::string& msg);
-       bool                    checkResult                             (bool condition, qpTestResult result, const std::string& msg);
-
-       void                    setTestContextResult    (TestContext& testCtx);
-
-private:
-       TestLog*                m_log;
-       std::string             m_prefix;
-       qpTestResult    m_result;
-       std::string             m_message;
-};
 
 } // tcu
 
index b79ba73..81ba71b 100644 (file)
@@ -31,6 +31,7 @@
 #include "tcuTestLog.hpp"
 #include "tcuInterval.hpp"
 #include "tcuTextureUtil.hpp"
+#include "tcuResultCollector.hpp"
 
 #include "egluNativeDisplay.hpp"
 #include "egluNativeWindow.hpp"
index 2638a1e..b1a715c 100644 (file)
@@ -36,6 +36,7 @@
 #include "tcuStringTemplate.hpp"
 #include "tcuCPUWarmup.hpp"
 #include "tcuCommandLine.hpp"
+#include "tcuResultCollector.hpp"
 
 #include "deClock.h"
 #include "deString.h"
index c58e181..b7edfdc 100644 (file)
@@ -50,6 +50,7 @@
 #include "tes31Context.hpp"
 #include "tcuTestContext.hpp"
 #include "tcuCommandLine.hpp"
+#include "tcuResultCollector.hpp"
 
 namespace deqp
 {
index 17c4514..4d18459 100644 (file)
@@ -36,6 +36,7 @@
 #include "tcuVectorUtil.hpp"
 #include "tcuTestLog.hpp"
 #include "tcuCommandLine.hpp"
+#include "tcuResultCollector.hpp"
 
 #include "deMemory.h"
 #include "deRandom.hpp"
index 93f3998..98a895a 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "es31fNegativeTestShared.hpp"
 
+#include "tcuResultCollector.hpp"
+
 #include "gluRenderContext.hpp"
 #include "glwFunctions.hpp"
 
index c646fb6..96940cd 100644 (file)
 #include "gluCallLogWrapper.hpp"
 #include "tes31TestCase.hpp"
 
+namespace tcu
+{
+
+class ResultCollector;
+
+} // tcu
+
 namespace deqp
 {
 namespace gles31
index 90d7161..a387e97 100644 (file)
@@ -32,6 +32,7 @@
 #include "tcuCommandLine.hpp"
 #include "tcuImageCompare.hpp"
 #include "tcuRenderTarget.hpp"
+#include "tcuResultCollector.hpp"
 #include "tcuRGBA.hpp"
 #include "tcuSurface.hpp"
 #include "tcuStringTemplate.hpp"
index 2a2ecc3..cb11004 100644 (file)
@@ -40,6 +40,7 @@
 #include "tcuTestLog.hpp"
 #include "tcuVector.hpp"
 #include "tcuMatrix.hpp"
+#include "tcuResultCollector.hpp"
 
 #include "gluContextInfo.hpp"
 #include "gluVarType.hpp"
index a129a6b..a373558 100644 (file)
@@ -24,6 +24,7 @@
  *//*--------------------------------------------------------------------*/
 
 #include "tcuTestCase.hpp"
+#include "tcuResultCollector.hpp"
 #include "gluRenderContext.hpp"
 
 namespace sglr
index 98be0b3..00d1cd1 100644 (file)
@@ -26,6 +26,7 @@
 #include "tcuDefs.hpp"
 #include "tcuTestLog.hpp"
 #include "tcuTestContext.hpp"
+#include "tcuResultCollector.hpp"
 #include "glwDefs.hpp"
 #include "deMath.h"
 
index a58357a..fe76eac 100644 (file)
@@ -30,6 +30,7 @@
 #include "tcuSurface.hpp"
 #include "tcuTestLog.hpp"
 #include "tcuTextureUtil.hpp"
+#include "tcuResultCollector.hpp"
 
 #include "rrRenderer.hpp"
 #include "rrShaders.hpp"