提交 4a5c9411 编写于 作者: W wangshi

增加xts测试入口

Signed-off-by: Nwangshi <wangshi@kaihongdigi.com>
上级 50efcbd9
...@@ -12,207 +12,130 @@ ...@@ -12,207 +12,130 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include <iostream>
#include "ActsApp.h"
#include "tcuPlatform.hpp" #include "tcuPlatform.hpp"
#include "tcuTestContext.hpp" #include "tcuTestContext.hpp"
#include "tcuTestSessionExecutor.hpp" #include "tcuTestSessionExecutor.hpp"
#include "tcuTestHierarchyUtil.hpp" #include "tcuTestHierarchyUtil.hpp"
#include "tcuCommandLine.hpp" #include "tcuCommandLine.hpp"
#include "tcuTestLog.hpp" #include "tcuTestLog.hpp"
#include "qpInfo.h" #include "qpInfo.h"
#include "qpDebugOut.h" #include "qpDebugOut.h"
#include "deMath.h" #include "deMath.h"
#include "ActsApp.h"
namespace tcu { namespace tcu {
using std::string; using std::string;
/*--------------------------------------------------------------------****!
* Writes all packages found stdout without any /*
* separations. Recommended to be used with a single package * \brief Construct test application
* only. It's possible to use test selectors for limiting the export *
* to one package in a multipackage binary. * If a fatal error occurs during initialization constructor will call
*--------------------------------------------------------------------*/ * die() with debug information.
static void writeCaselistsToStdout (TestPackageRoot& root, TestContext& testCtx) *
{ * \param platform Reference to platform implementation.
DefaultHierarchyInflater inflater(testCtx); */
de::MovePtr<const CaseListFilter> caseListFilter( ActsApp::ActsApp (Platform& platform, Archive& archive, TestLog& log, const CommandLine& cmdLine)
testCtx.getCommandLine().createCaseListFilter(testCtx.getArchive())); : m_platform(platform),
TestHierarchyIterator iter(root, inflater, *caseListFilter); m_watchDog(DE_NULL),
m_crashHandler(DE_NULL),
while (iter.getState() != TestHierarchyIterator::STATE_FINISHED) { m_crashed(false),
iter.next(); m_testCtx(DE_NULL),
tcu::TestNode* testNode = iter.getNode(); m_testRoot(DE_NULL),
while (testNode->getNodeType() != NODETYPE_PACKAGE) { m_testExecutor(DE_NULL)
if (iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE) {
std::cout << (isTestNodeTypeExecutable(testNode->getNodeType()) ? "TEST" : "GROUP") print("dEQP Core %s (0x%08x) starting..\n", qpGetReleaseName(), qpGetReleaseId());
<< ": " << iter.getNodePath() << "\n"; print(" target implementation = '%s'\n", qpGetTargetName());
iter.next();
} if (!deSetRoundingMode(DE_ROUNDINGMODE_TO_NEAREST_EVEN)) {
qpPrintf("WARNING: Failed to set floating-point rounding mode!\n");
DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_LEAVE_NODE && }
testNode->getNodeType() == NODETYPE_PACKAGE); try {
iter.next(); const RunMode runMode = cmdLine.getRunMode();
};
// Create test context
m_testCtx = new TestContext(m_platform, archive, log, cmdLine, m_watchDog);
// Create root from registry
m_testRoot = new TestPackageRoot(*m_testCtx, TestPackageRegistry::getSingleton());
// \note No executor is created if runmode is not EXECUTE
if (runMode == RUNMODE_EXECUTE) {
m_testExecutor = new TestSessionExecutor(*m_testRoot, *m_testCtx);
} else {
DE_ASSERT(false);
}
} catch (const std::exception& e) {
cleanup();
die("Failed to initialize dEQP: %s", e.what());
} }
}
ActsApp::~ActsApp (void)
{
cleanup();
}
/*--------------------------------------------------------------------****! void ActsApp::cleanup (void)
* Verifies that amber capability requirements in the .amber files {
* match with capabilities defined on the CTS C code. delete m_testExecutor;
****--------------------------------------------------------------------*/ delete m_testRoot;
static void verifyAmberCapabilityCoherency (TestPackageRoot& root, TestContext& testCtx) delete m_testCtx;
{
DefaultHierarchyInflater inflater(testCtx);
de::MovePtr<const CaseListFilter> caseListFilter(
testCtx.getCommandLine().createCaseListFilter(testCtx.getArchive()));
TestHierarchyIterator iter(root, inflater, *caseListFilter);
int count = 0;
int errorCount = 0;
bool ok = true;
while (iter.getState() != TestHierarchyIterator::STATE_FINISHED) {
iter.next();
tcu::TestNode* testNode = iter.getNode();
while (testNode->getNodeType() != NODETYPE_PACKAGE) {
if (iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE &&
isTestNodeTypeExecutable(testNode->getNodeType())) {
std::cout << iter.getNodePath() << "\n";
testCtx.getLog() << tcu::TestLog::Message << iter.getNodePath() << tcu::TestLog::EndMessage;
count++;
};
iter.next();
};
DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_LEAVE_NODE &&
testNode->getNodeType() == NODETYPE_PACKAGE);
iter.next();
};
std::cout << count << " amber tests, " << errorCount << " errors.\n";
if (!ok) {
TCU_THROW(InternalError, "One or more CTS&Amber test requirements do not match; check log for details");
};
}
/*--------------------------------------------------------------------****! m_testExecutor = DE_NULL;
* \brief Construct test application m_testRoot = DE_NULL;
* m_testCtx = DE_NULL;
* If a fatal error occurs during initialization constructor will call
* die() with debug information.
*
* \param platform Reference to platform implementation.
*--------------------------------------------------------------------*/
ActsApp::ActsApp (Platform& platform, Archive& archive, TestLog& log, const CommandLine& cmdLine)
: m_platform(platform),
m_watchDog(DE_NULL),
m_crashHandler(DE_NULL),
m_crashed(false),
m_testCtx(DE_NULL),
m_testRoot(DE_NULL),
m_testExecutor(DE_NULL)
{
print("dEQP Core %s (0x%08x) starting..\n", qpGetReleaseName(), qpGetReleaseId());
print(" target implementation = '%s'\n", qpGetTargetName());
if (!deSetRoundingMode(DE_ROUNDINGMODE_TO_NEAREST_EVEN)) {
qpPrintf("WARNING: Failed to set floating-point rounding mode!\n");
};
try { if (m_crashHandler) {
const RunMode runMode = cmdLine.getRunMode(); qpCrashHandler_destroy(m_crashHandler);
// Initialize watchdog
if (cmdLine.isWatchDogEnabled()) {
TCU_CHECK_INTERNAL(m_watchDog = qpWatchDog_create(onWatchdogTimeout, this,
WATCHDOG_TOTAL_TIME_LIMIT_SECS, WATCHDOG_INTERVAL_TIME_LIMIT_SECS));
};
// Initialize crash handler.
if (cmdLine.isCrashHandlingEnabled()) {
TCU_CHECK_INTERNAL(m_crashHandler = qpCrashHandler_create(onCrash, this));
};
// Create test context
m_testCtx = new TestContext(m_platform, archive, log, cmdLine, m_watchDog);
// Create root from registry
m_testRoot = new TestPackageRoot(*m_testCtx, TestPackageRegistry::getSingleton());
// \note No executor is created if runmode is not EXECUTE
if (runMode == RUNMODE_EXECUTE) {
m_testExecutor = new TestSessionExecutor(*m_testRoot, *m_testCtx);
} else if (runMode == RUNMODE_DUMP_STDOUT_CASELIST) {
writeCaselistsToStdout(*m_testRoot, *m_testCtx);
} else if (runMode == RUNMODE_DUMP_XML_CASELIST) {
writeXmlCaselistsToFiles(*m_testRoot, *m_testCtx, cmdLine);
} else if (runMode == RUNMODE_DUMP_TEXT_CASELIST) {
writeTxtCaselistsToFiles(*m_testRoot, *m_testCtx, cmdLine);
} else if (runMode == RUNMODE_VERIFY_AMBER_COHERENCY) {
verifyAmberCapabilityCoherency(*m_testRoot, *m_testCtx);
} else {
DE_ASSERT(false);
};
} catch (const std::exception& e) {
cleanup();
die("Failed to initialize dEQP: %s", e.what());
};
} }
ActsApp::~ActsApp (void) if (m_watchDog) {
{ qpWatchDog_destroy(m_watchDog);
cleanup();
} }
}
void ActsApp::cleanup (void) /*
{ * \brief Step forward test execution
delete m_testExecutor; * \return true if application should call iterate() again and false
delete m_testRoot; * if test execution session is complete.
delete m_testCtx; */
bool ActsApp::iterate (void)
m_testExecutor = DE_NULL {
m_testRoot = DE_NULL if (!m_testExecutor) {
m_testCtx = DE_NULL DE_ASSERT(m_testCtx->getCommandLine().getRunMode() != RUNMODE_EXECUTE);
return false;
if (m_crashHandler) {
qpCrashHandler_destroy(m_crashHandler);
};
if (m_watchDog) {
qpWatchDog_destroy(m_watchDog);
};
} }
/*--------------------------------------------------------------------****! // Poll platform events
* \brief Step forward test execution const bool platformOk = m_platform.processEvents();
* \return true if application should call iterate() again and false
* if test execution session is complete. // Iterate a step.
****--------------------------------------------------------------------*/ bool testExecOk = false;
bool ActsApp::iterate (void) if (platformOk) {
{ try {
if (!m_testExecutor) { testExecOk = m_testExecutor->iterate();
DE_ASSERT(m_testCtx->getCommandLine().getRunMode() != RUNMODE_EXECUTE); } catch (const std::exception& e) {
return false; die("%s", e.what());
}; }
// Poll platform events
const bool platformOk = m_platform.processEvents();
// Iterate a step.
bool testExecOk = false;
if (platformOk) {
try {
testExecOk = m_testExecutor->iterate();
} catch (const std::exception& e) {
die("%s", e.what());
};
};
return platformOk && testExecOk;
} }
const TestRunStatus& ActsApp::getResult (void) const return platformOk && testExecOk;
{ }
return m_testExecutor->getStatus();
const TestRunStatus& ActsApp::getResult (void) const
{
return m_testExecutor->getStatus();
}
void ActsApp::onWatchdogTimeout (qpTimeoutReason reason)
{
if (!m_crashLock.tryLock() || m_crashed) {
return; // In crash handler already.
} }
} // tcu
\ No newline at end of file m_crashed = true;
m_testCtx->getLog().terminateCase(QP_TEST_RESULT_TIMEOUT);
die("Watchdog timer timeout for %s",
(reason == QP_TIMEOUT_REASON_INTERVAL_LIMIT ? "touch interval" : "total time"));
}
} // tcu
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
...@@ -13,49 +13,44 @@ ...@@ -13,49 +13,44 @@
* limitations under the License. * limitations under the License.
*/ */
#ifndef _ActsApp_HPP #ifndef _ACTSAPP_HPP
#define _ActsApp_HPP #define _ACTSAPP_HPP
#include "tcuDefs.hpp" #include "tcuDefs.hpp"
#include "qpWatchDog.h" #include "qpWatchDog.h"
#include "qpCrashHandler.h" #include "qpCrashHandler.h"
#include "deMutex.hpp" #include "deMutex.hpp"
#include "tcuResource.hpp"
#include "tcuPlatform.hpp"
#include "tcuTestContext.hpp"
#include "tcuTestSessionExecutor.hpp"
#include "tcuTestSessionExecutor.hpp"
#include "tcuCommandLine.hpp"
#include "tcuTestLog.hpp"
#include "tcuTestPackageRoot.hpp"
#include "tcuTestSessionExecutor.hpp" #include "tcuTestSessionExecutor.hpp"
#include "tcuTestPackage.hpp"
namespace tcu { namespace tcu {
enum class EWATCHDOG { enum class EWATCHDOG {
WATCHDOG_TOTAL_TIME_LIMIT_SECS = 300, WATCHDOG_TOTAL_TIME_LIMIT_SECS = 300,
WATCHDOG_INTERVAL_TIME_LIMIT_SECS = 30 WATCHDOG_INTERVAL_TIME_LIMIT_SECS = 30
}; };
class ActsApp { class ActsApp {
public: public:
ActsApp(Platform& platform, Archive& archive, TestLog& log, const CommandLine& cmdLine); ActsApp (Platform& platform, Archive& archive, TestLog& log, const CommandLine& cmdLine);
virtual ~ActsApp(void); virtual ~ActsApp (void);
bool iterate(void); bool iterate (void);
const TestRunStatus& getResult (void) const; const TestRunStatus& getResult (void) const;
protected:
void cleanup (void); protected:
void cleanup (void);
Platform& m_platform;
qpWatchDog* m_watchDog; void onWatchdogTimeout (qpTimeoutReason reason);
qpCrashHandler* m_crashHandler;
de::Mutex m_crashLock; Platform& m_platform;
bool m_crashed; qpWatchDog* m_watchDog;
qpCrashHandler* m_crashHandler;
TestContext* m_testCtx; de::Mutex m_crashLock;
TestPackageRoot* m_testRoot; bool m_crashed;
TestSessionExecutor* m_testExecutor;
}; TestContext* m_testCtx;
TestPackageRoot* m_testRoot;
TestSessionExecutor* m_testExecutor;
};
} // tcu } // tcu
#endif // _ACTSAPP_HPP
#endif // _ActsApp_HPP \ No newline at end of file
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册