- Move tcu::ResultCollector to a separate file.
- Fix includes in tests.
Change-Id: I688d84e5de7bfa4c80b0034cdac4ea0e4fd2faa7
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 \
tcuRenderTarget.hpp
tcuResource.cpp
tcuResource.hpp
+ tcuResultCollector.cpp
+ tcuResultCollector.hpp
tcuSurface.cpp
tcuSurface.hpp
tcuTestCase.cpp
--- /dev/null
+/*-------------------------------------------------------------------------
+ * 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
--- /dev/null
+#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
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
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
#include "tcuTestLog.hpp"
#include "tcuInterval.hpp"
#include "tcuTextureUtil.hpp"
+#include "tcuResultCollector.hpp"
#include "egluNativeDisplay.hpp"
#include "egluNativeWindow.hpp"
#include "tcuStringTemplate.hpp"
#include "tcuCPUWarmup.hpp"
#include "tcuCommandLine.hpp"
+#include "tcuResultCollector.hpp"
#include "deClock.h"
#include "deString.h"
#include "tes31Context.hpp"
#include "tcuTestContext.hpp"
#include "tcuCommandLine.hpp"
+#include "tcuResultCollector.hpp"
namespace deqp
{
#include "tcuVectorUtil.hpp"
#include "tcuTestLog.hpp"
#include "tcuCommandLine.hpp"
+#include "tcuResultCollector.hpp"
#include "deMemory.h"
#include "deRandom.hpp"
#include "es31fNegativeTestShared.hpp"
+#include "tcuResultCollector.hpp"
+
#include "gluRenderContext.hpp"
#include "glwFunctions.hpp"
#include "gluCallLogWrapper.hpp"
#include "tes31TestCase.hpp"
+namespace tcu
+{
+
+class ResultCollector;
+
+} // tcu
+
namespace deqp
{
namespace gles31
#include "tcuCommandLine.hpp"
#include "tcuImageCompare.hpp"
#include "tcuRenderTarget.hpp"
+#include "tcuResultCollector.hpp"
#include "tcuRGBA.hpp"
#include "tcuSurface.hpp"
#include "tcuStringTemplate.hpp"
#include "tcuTestLog.hpp"
#include "tcuVector.hpp"
#include "tcuMatrix.hpp"
+#include "tcuResultCollector.hpp"
#include "gluContextInfo.hpp"
#include "gluVarType.hpp"
*//*--------------------------------------------------------------------*/
#include "tcuTestCase.hpp"
+#include "tcuResultCollector.hpp"
#include "gluRenderContext.hpp"
namespace sglr
#include "tcuDefs.hpp"
#include "tcuTestLog.hpp"
#include "tcuTestContext.hpp"
+#include "tcuResultCollector.hpp"
#include "glwDefs.hpp"
#include "deMath.h"
#include "tcuSurface.hpp"
#include "tcuTestLog.hpp"
#include "tcuTextureUtil.hpp"
+#include "tcuResultCollector.hpp"
#include "rrRenderer.hpp"
#include "rrShaders.hpp"