Added test-harness timeout check
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-harness.h
index e40492c..b210918 100644 (file)
@@ -2,7 +2,7 @@
 #define TEST_HARNESS_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include <stdio.h>
 #include <testcase.h>
+
+#include <chrono>
 #include <cstdint>
 
 namespace TestHarness
 {
-
 enum ExitStatus
 {
-  EXIT_STATUS_TESTCASE_SUCCEEDED,   // 0
-  EXIT_STATUS_TESTCASE_FAILED,      // 1
-  EXIT_STATUS_TESTCASE_ABORTED,     // 2
-  EXIT_STATUS_FORK_FAILED,          // 3
-  EXIT_STATUS_WAITPID_FAILED,       // 4
-  EXIT_STATUS_BAD_ARGUMENT,         // 5
-  EXIT_STATUS_TESTCASE_NOT_FOUND    // 6
+  EXIT_STATUS_TESTCASE_SUCCEEDED, // 0
+  EXIT_STATUS_TESTCASE_FAILED,    // 1
+  EXIT_STATUS_TESTCASE_ABORTED,   // 2
+  EXIT_STATUS_FORK_FAILED,        // 3
+  EXIT_STATUS_WAITPID_FAILED,     // 4
+  EXIT_STATUS_BAD_ARGUMENT,       // 5
+  EXIT_STATUS_TESTCASE_NOT_FOUND  // 6
 };
 
 const int32_t MAX_NUM_CHILDREN(16);
 
 struct TestCase
 {
-  int32_t testCase;
-  const char* testCaseName;
+  int32_t                               testCase;
+  const char*                           testCaseName;
+  std::chrono::steady_clock::time_point startTime;
 
   TestCase()
   : testCase(0),
-    testCaseName(NULL)
+    testCaseName(NULL),
+    startTime()
   {
   }
 
   TestCase(int32_t tc, const char* name)
   : testCase(tc),
-    testCaseName(name)
+    testCaseName(name),
+    startTime()
   {
   }
   TestCase(const TestCase& rhs)
   : testCase(rhs.testCase),
-    testCaseName(rhs.testCaseName)
+    testCaseName(rhs.testCaseName),
+    startTime(rhs.startTime)
   {
   }
   TestCase& operator=(const TestCase& rhs)
   {
-    testCase = rhs.testCase;
+    testCase     = rhs.testCase;
     testCaseName = rhs.testCaseName;
+    startTime    = rhs.startTime;
     return *this;
-
   }
 };
 
@@ -71,7 +76,7 @@ struct TestCase
  * Run a test case
  * @param[in] testCase The Testkit-lite test case to run
  */
-int32_t RunTestCase( struct testcase_s& testCase );
+int32_t RunTestCase(struct testcase_s& testCase);
 
 /**
  * Run all test cases in parallel
@@ -88,7 +93,7 @@ int32_t RunAllInParallel(const char* processName, testcase tc_array[], bool reRu
  * @param[in] tc_array The array of auto-generated testkit-lite test cases
  * @return 0 on success
  */
-int32_t RunAll( const char* processName, testcase tc_array[] );
+int32_t RunAll(const char* processName, testcase tc_array[]);
 
 /**
  * Find the named test case in the given array, and run it