(Automated Tests) Clean up linking
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-harness.h
1 #ifndef TEST_HARNESS_H
2 #define TEST_HARNESS_H
3
4 /*
5  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #include <stdio.h>
21 #include <testcase.h>
22 #include <cstdint>
23
24 namespace TestHarness
25 {
26
27 enum ExitStatus
28 {
29   EXIT_STATUS_TESTCASE_SUCCEEDED,   // 0
30   EXIT_STATUS_TESTCASE_FAILED,      // 1
31   EXIT_STATUS_TESTCASE_ABORTED,     // 2
32   EXIT_STATUS_FORK_FAILED,          // 3
33   EXIT_STATUS_WAITPID_FAILED,       // 4
34   EXIT_STATUS_BAD_ARGUMENT,         // 5
35   EXIT_STATUS_TESTCASE_NOT_FOUND    // 6
36 };
37
38 const int32_t MAX_NUM_CHILDREN(16);
39
40 struct TestCase
41 {
42   int32_t testCase;
43   const char* testCaseName;
44
45   TestCase()
46   : testCase(0),
47     testCaseName(NULL)
48   {
49   }
50
51   TestCase(int32_t tc, const char* name)
52   : testCase(tc),
53     testCaseName(name)
54   {
55   }
56   TestCase(const TestCase& rhs)
57   : testCase(rhs.testCase),
58     testCaseName(rhs.testCaseName)
59   {
60   }
61   TestCase& operator=(const TestCase& rhs)
62   {
63     testCase = rhs.testCase;
64     testCaseName = rhs.testCaseName;
65     return *this;
66
67   }
68 };
69
70 /**
71  * Run a test case
72  * @param[in] testCase The Testkit-lite test case to run
73  */
74 int32_t RunTestCase( struct testcase_s& testCase );
75
76 /**
77  * Run all test cases in parallel
78  * @param[in] processName The name of this process
79  * @param[in] tc_array The array of auto-generated testkit-lite test cases
80  * @param[in] reRunFailed True if failed test cases should be re-run
81  * @return 0 on success
82  */
83 int32_t RunAllInParallel(const char* processName, testcase tc_array[], bool reRunFailed);
84
85 /**
86  * Run all test cases in serial
87  * @param[in] processName The name of this process
88  * @param[in] tc_array The array of auto-generated testkit-lite test cases
89  * @return 0 on success
90  */
91 int32_t RunAll( const char* processName, testcase tc_array[] );
92
93 /**
94  * Find the named test case in the given array, and run it
95  * @param[in] tc_array The array of auto-generated testkit-lite test cases
96  * @param[in] testCaseName the name of the test case to run
97  * @return 0 on success
98  */
99 int32_t FindAndRunTestCase(::testcase tc_array[], const char* testCaseName);
100
101 /**
102  * Display usage instructions for this program
103  * @param[in] program The name of this program
104  */
105 void Usage(const char* program);
106
107 } // namespace TestHarness
108
109 #endif