Merge commit '9bd0272d004aabece70774113d1ff6d9dbf1301c' into HEAD
Test: check_build_sanity.py
Change-Id: I83a7e6b3626bcf5a51af5a4bfe49f727bd2c4da1
diff --git a/framework/common/tcuApp.cpp b/framework/common/tcuApp.cpp
index 075d505..d99617f 100644
--- a/framework/common/tcuApp.cpp
+++ b/framework/common/tcuApp.cpp
@@ -209,10 +209,10 @@
return m_testExecutor->getStatus();
}
-void App::onWatchdogTimeout (qpWatchDog* watchDog, void* userPtr)
+void App::onWatchdogTimeout (qpWatchDog* watchDog, void* userPtr, qpTimeoutReason reason)
{
DE_UNREF(watchDog);
- static_cast<App*>(userPtr)->onWatchdogTimeout();
+ static_cast<App*>(userPtr)->onWatchdogTimeout(reason);
}
void App::onCrash (qpCrashHandler* crashHandler, void* userPtr)
@@ -221,7 +221,7 @@
static_cast<App*>(userPtr)->onCrash();
}
-void App::onWatchdogTimeout (void)
+void App::onWatchdogTimeout (qpTimeoutReason reason)
{
if (!m_crashLock.tryLock() || m_crashed)
return; // In crash handler already.
@@ -229,7 +229,7 @@
m_crashed = true;
m_testCtx->getLog().terminateCase(QP_TEST_RESULT_TIMEOUT);
- die("Watchdog timer timeout");
+ die("Watchdog timer timeout for %s", (reason == QP_TIMEOUT_REASON_INTERVAL_LIMIT ? "touch interval" : "total time"));
}
static void writeCrashToLog (void* userPtr, const char* infoString)
diff --git a/framework/common/tcuApp.hpp b/framework/common/tcuApp.hpp
index b6e0db1..7ee007d 100644
--- a/framework/common/tcuApp.hpp
+++ b/framework/common/tcuApp.hpp
@@ -71,10 +71,10 @@
protected:
void cleanup (void);
- void onWatchdogTimeout (void);
+ void onWatchdogTimeout (qpTimeoutReason reason);
void onCrash (void);
- static void onWatchdogTimeout (qpWatchDog* watchDog, void* userPtr);
+ static void onWatchdogTimeout (qpWatchDog* watchDog, void* userPtr, qpTimeoutReason reason);
static void onCrash (qpCrashHandler* crashHandler, void* userPtr);
Platform& m_platform;
diff --git a/framework/qphelper/qpWatchDog.c b/framework/qphelper/qpWatchDog.c
index 84957b8..c691aa2 100644
--- a/framework/qphelper/qpWatchDog.c
+++ b/framework/qphelper/qpWatchDog.c
@@ -69,11 +69,14 @@
deUint64 curTime = deGetMicroseconds();
int totalSecondsPassed = (int)((curTime - dog->resetTime) / 1000000ull);
int secondsSinceLastTouch = (int)((curTime - dog->lastTouchTime) / 1000000ull);
+ deBool overIntervalLimit = secondsSinceLastTouch > dog->intervalTimeLimit;
+ deBool overTotalLimit = totalSecondsPassed > dog->totalTimeLimit;
- if ((secondsSinceLastTouch > dog->intervalTimeLimit) || (totalSecondsPassed > dog->totalTimeLimit))
+ if (overIntervalLimit || overTotalLimit)
{
+ qpTimeoutReason reason = overTotalLimit ? QP_TIMEOUT_REASON_TOTAL_LIMIT : QP_TIMEOUT_REASON_INTERVAL_LIMIT;
DBGPRINT(("watchDogThreadFunc(): call timeout func\n"));
- dog->timeOutFunc(dog, dog->timeOutUserPtr);
+ dog->timeOutFunc(dog, dog->timeOutUserPtr, reason);
break;
}
diff --git a/framework/qphelper/qpWatchDog.h b/framework/qphelper/qpWatchDog.h
index 6ac8f6a..6247e66 100644
--- a/framework/qphelper/qpWatchDog.h
+++ b/framework/qphelper/qpWatchDog.h
@@ -27,7 +27,15 @@
typedef struct qpWatchDog_s qpWatchDog;
-typedef void (*qpWatchDogFunc) (qpWatchDog* dog, void* userPtr);
+typedef enum qpTimeoutReason_e
+{
+ QP_TIMEOUT_REASON_INTERVAL_LIMIT = 0,
+ QP_TIMEOUT_REASON_TOTAL_LIMIT,
+
+ QP_TIMEOUT_REASON_LAST
+} qpTimeoutReason;
+
+typedef void (*qpWatchDogFunc) (qpWatchDog* dog, void* userPtr, qpTimeoutReason reason);
DE_BEGIN_EXTERN_C