5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
30 EXIT_STATUS_TESTCASE_SUCCEEDED, // 0
31 EXIT_STATUS_TESTCASE_FAILED, // 1
32 EXIT_STATUS_TESTCASE_ABORTED, // 2
33 EXIT_STATUS_FORK_FAILED, // 3
34 EXIT_STATUS_WAITPID_FAILED, // 4
35 EXIT_STATUS_BAD_ARGUMENT, // 5
36 EXIT_STATUS_TESTCASE_NOT_FOUND // 6
39 const int32_t MAX_NUM_CHILDREN(16);
45 std::chrono::steady_clock::time_point startTime;
46 std::chrono::system_clock::time_point startSystemTime;
51 TestCase(int32_t index, testcase* testCase)
72 TestCase(int32_t tc, const char* name)
82 TestCase(const TestCase& rhs)
83 : testCase(rhs.testCase),
85 startTime(rhs.startTime),
86 startSystemTime(rhs.startSystemTime),
88 childPid(rhs.childPid),
92 TestCase& operator=(const TestCase& rhs)
94 testCase = rhs.testCase;
96 startTime = rhs.startTime;
97 startSystemTime = rhs.startSystemTime;
99 childPid = rhs.childPid;
107 * @param[in] testCase The Testkit-lite test case to run
109 int32_t RunTestCase(struct testcase_s& testCase);
112 * Run all test cases in parallel
113 * @param[in] processName The name of this process
114 * @param[in] tc_array The array of auto-generated testkit-lite test cases
115 * @param[in] reRunFailed True if failed test cases should be re-run
116 * @return 0 on success
118 int32_t RunAllInParallel(const char* processName, testcase tc_array[], bool reRunFailed);
121 * Run all test cases in serial
122 * @param[in] processName The name of this process
123 * @param[in] tc_array The array of auto-generated testkit-lite test cases
124 * @return 0 on success
126 int32_t RunAll(const char* processName, testcase tc_array[]);
129 * Find the named test case in the given array, and run it
130 * @param[in] tc_array The array of auto-generated testkit-lite test cases
131 * @param[in] testCaseName the name of the test case to run
132 * @return 0 on success
134 int32_t FindAndRunTestCase(::testcase tc_array[], const char* testCaseName);
137 * Display usage instructions for this program
138 * @param[in] program The name of this program
140 void Usage(const char* program);
144 * @param[in] argc Argument count
145 * @param[in] argv Argument vector
146 * @param[in] tc_array Array of test cases
148 int RunTests(int argc, char* const argv[], ::testcase tc_array[]);
150 } // namespace TestHarness