• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "tooling/test/client_utils/test_list.h"
17 
18 #include "tooling/test/client_utils/test_util.h"
19 
20 // testcase list
21 #include "tooling/test/testcases/js_accelerate_launch_test.h"
22 #include "tooling/test/testcases/js_allocationtrack_loop_test.h"
23 #include "tooling/test/testcases/js_allocationtrack_recursion_test.h"
24 #include "tooling/test/testcases/js_allocationtrack_test.h"
25 #include "tooling/test/testcases/js_breakpoint_arrow_test.h"
26 #include "tooling/test/testcases/js_breakpoint_async_test.h"
27 #include "tooling/test/testcases/js_breakpoint_cannot_hit_test.h"
28 #include "tooling/test/testcases/js_breakpoint_in_different_branch.h"
29 #include "tooling/test/testcases/js_breakpoint_loop_test.h"
30 #include "tooling/test/testcases/js_breakpoint_recursion_test.h"
31 #include "tooling/test/testcases/js_breakpoint_switch_test.h"
32 #include "tooling/test/testcases/js_breakpoint_test.h"
33 #include "tooling/test/testcases/js_closure_scope_test.h"
34 #include "tooling/test/testcases/js_container_test.h"
35 #include "tooling/test/testcases/js_exception_test.h"
36 #include "tooling/test/testcases/js_heapdump_loop_test.h"
37 #include "tooling/test/testcases/js_heapdump_test.h"
38 #include "tooling/test/testcases/js_heapusage_async_test.h"
39 #include "tooling/test/testcases/js_heapusage_loop_test.h"
40 #include "tooling/test/testcases/js_heapusage_recursion_test.h"
41 #include "tooling/test/testcases/js_heapusage_step_test.h"
42 #include "tooling/test/testcases/js_heapusage_test.h"
43 #include "tooling/test/testcases/js_local_variable_scope_test.h"
44 #include "tooling/test/testcases/js_module_variable_test.h"
45 #include "tooling/test/testcases/js_multiple_breakpoint_in_function_test.h"
46 #include "tooling/test/testcases/js_multiple_common_breakpoint_test.h"
47 #include "tooling/test/testcases/js_smart_stepInto_test.h"
48 #include "tooling/test/testcases/js_source_test.h"
49 #include "tooling/test/testcases/js_special_location_breakpoint_test.h"
50 #include "tooling/test/testcases/js_stepinto_and_stepout_test.h"
51 #include "tooling/test/testcases/js_stepinto_arrow_test.h"
52 #include "tooling/test/testcases/js_stepinto_async_test.h"
53 #include "tooling/test/testcases/js_stepinto_loop_test.h"
54 #include "tooling/test/testcases/js_stepinto_recursion_test.h"
55 #include "tooling/test/testcases/js_stepinto_switch_test.h"
56 #include "tooling/test/testcases/js_stepinto_test.h"
57 #include "tooling/test/testcases/js_stepout_arrow_test.h"
58 #include "tooling/test/testcases/js_stepout_async_test.h"
59 #include "tooling/test/testcases/js_stepout_before_function_test.h"
60 #include "tooling/test/testcases/js_stepout_loop_test.h"
61 #include "tooling/test/testcases/js_stepout_recursion_test.h"
62 #include "tooling/test/testcases/js_stepout_switch_test.h"
63 #include "tooling/test/testcases/js_stepout_test.h"
64 #include "tooling/test/testcases/js_stepover_loop_test.h"
65 #include "tooling/test/testcases/js_stepover_recursion_test.h"
66 #include "tooling/test/testcases/js_stepover_switch_test.h"
67 #include "tooling/test/testcases/js_stepover_test.h"
68 #include "tooling/test/testcases/js_tracing_test.h"
69 #include "tooling/test/testcases/js_watch_basic_type_test.h"
70 #include "tooling/test/testcases/js_watch_closure_variable_test.h"
71 #include "tooling/test/testcases/js_watch_other_type_test.h"
72 #include "tooling/test/testcases/js_watch_set_type_test.h"
73 #include "tooling/test/testcases/js_watch_test.h"
74 #include "tooling/test/testcases/js_watch_variable_test.h"
75 
76 namespace panda::ecmascript::tooling::test {
77 static std::string g_currentTestName = "";
78 
RegisterTests()79 static void RegisterTests()
80 {
81     // Register testcases
82     TestUtil::RegisterTest("JsBreakpointTest", GetJsBreakpointTest());
83     TestUtil::RegisterTest("JsBreakpointArrowTest", GetJsBreakpointArrowTest());
84     TestUtil::RegisterTest("JsBreakpointAsyncTest", GetJsBreakpointAsyncTest());
85     TestUtil::RegisterTest("JsClosureScopeTest", GetJsClosureScopeTest());
86     TestUtil::RegisterTest("JsLocalVariableScopeTest", GetJsLocalVariableScopeTest());
87     TestUtil::RegisterTest("JsExceptionTest", GetJsExceptionTest());
88     TestUtil::RegisterTest("JsContainerTest", GetJsContainerTest());
89     TestUtil::RegisterTest("JsModuleVariableTest", GetJsModuleVariableTest());
90     TestUtil::RegisterTest("JsSourceTest", GetJsSourceTest());
91     TestUtil::RegisterTest("JsTracingTest", GetJsTracingTest());
92     TestUtil::RegisterTest("JsWatchTest", GetJsWatchTest());
93     TestUtil::RegisterTest("JsHeapdumpTest", GetJsHeapdumpTest());
94     TestUtil::RegisterTest("JsAllocationtrackTest", GetJsAllocationtrackTest());
95     TestUtil::RegisterTest("JsStepintoTest", GetJsStepintoTest());
96     TestUtil::RegisterTest("JsStepoutTest", GetJsStepoutTest());
97     TestUtil::RegisterTest("JsStepoverTest", GetJsStepoverTest());
98     TestUtil::RegisterTest("JsStepintoAndStepoutTest", GetJsStepintoAndStepoutTest());
99     TestUtil::RegisterTest("JsStepoutBeforeFunctiontTest", GetJsStepoutBeforeFunctionTest());
100     TestUtil::RegisterTest("JsSpecialLocationBreakpointTest", GetJsSpecialLocationBreakpointTest());
101     TestUtil::RegisterTest("JsMultipleCommonBreakpointTest", GetJsMultipleCommonBreakpointTest());
102     TestUtil::RegisterTest("JsMultipleBreakpointInFunctionTest", GetJsMultipleBreakpointInFunctionTest());
103     TestUtil::RegisterTest("JsBreakpointCannotHitTest", GetJsBreakpointCannotHitTest());
104     TestUtil::RegisterTest("JsBreakpointInDifferentBranchTest", GetJsBreakpointInDifferentBranchTest());
105     TestUtil::RegisterTest("JsWatchVariableTest", GetJsWatchVariableTest());
106     TestUtil::RegisterTest("JsStepintoArrowTest", GetJsStepintoArrowTest());
107     TestUtil::RegisterTest("JsStepintoAsyncTest", GetJsStepintoAsyncTest());
108     TestUtil::RegisterTest("JsStepoutArrowTest", GetJsStepoutArrowTest());
109     TestUtil::RegisterTest("JsStepoutAsyncTest", GetJsStepoutAsyncTest());
110     TestUtil::RegisterTest("JsHeapusageTest", GetJsHeapusageTest());
111     TestUtil::RegisterTest("JsHeapusageAsyncTest", GetJsHeapusageAsyncTest());
112     TestUtil::RegisterTest("JsHeapusageStepTest", GetJsHeapusageStepTest());
113     TestUtil::RegisterTest("JsHeapdumpLoopTest", GetJsHeapdumpLoopTest());
114     TestUtil::RegisterTest("JsAllocationTrackLoopTest", GetJsAllocationTrackLoopTest());
115     TestUtil::RegisterTest("JsAllocationTrackRecursionTest", GetJsAllocationTrackRecursionTest());
116     TestUtil::RegisterTest("JsJsWatchBasicTypeTest", GetJsWatchBasicTypeTest());
117     TestUtil::RegisterTest("JsJsWatchSetTypeTest", GetJsWatchSetTypeTest());
118     TestUtil::RegisterTest("JsJsWatchOtherTypeTest", GetJsWatchOtherTypeTest());
119     TestUtil::RegisterTest("JsWatchClosureVariableTest", GetJsWatchClosureVariableTest());
120     TestUtil::RegisterTest("JsStepintoLoopTest", GetJsStepintoLoopTest());
121     TestUtil::RegisterTest("JsStepintoRecursionTest", GetJsStepintoRecursionTest());
122     TestUtil::RegisterTest("JsStepintoSwitchTest", GetJsStepintoSwitchTest());
123     TestUtil::RegisterTest("JsStepoverLoopTest", GetJsStepoverLoopTest());
124     TestUtil::RegisterTest("JsStepoverRecursionTest", GetJsStepoverRecursionTest());
125     TestUtil::RegisterTest("JsStepoverSwitchTest", GetJsStepoverSwitchTest());
126     TestUtil::RegisterTest("JsStepoutLoopTest", GetJsStepoutLoopTest());
127     TestUtil::RegisterTest("JsStepoutRecursionTest", GetJsStepoutRecursionTest());
128     TestUtil::RegisterTest("JsStepoutSwitchTest", GetJsStepoutSwitchTest());
129     TestUtil::RegisterTest("JsBreakpointLoopTest", GetJsBreakpointLoopTest());
130     TestUtil::RegisterTest("JsBreakpointRecursionTest", GetJsBreakpointRecursionTest());
131     TestUtil::RegisterTest("JsBreakpointSwitchTest", GetJsBreakpointSwitchTest());
132     TestUtil::RegisterTest("JsHeapusageLoopTest", GetJsHeapusageLoopTest());
133     TestUtil::RegisterTest("JsHeapusageRecursionTest", GetJsHeapusageRecursionTest());
134     TestUtil::RegisterTest("JsSmartStepoutTest", GetJsSmartStepoutTest());
135     TestUtil::RegisterTest("JsAccelerateLaunchTest", GetJsAccelerateLaunchTest());
136 }
137 
GetTestList()138 std::vector<const char *> GetTestList()
139 {
140     RegisterTests();
141     std::vector<const char *> res;
142 
143     auto &tests = TestUtil::GetTests();
144     for (const auto &entry : tests) {
145         res.push_back(entry.first.c_str());
146     }
147     return res;
148 }
149 
SetCurrentTestName(const std::string & testName)150 void SetCurrentTestName(const std::string &testName)
151 {
152     g_currentTestName = testName;
153 }
154 
GetCurrentTestName()155 std::string GetCurrentTestName()
156 {
157     return g_currentTestName;
158 }
159 
GetTestEntryPoint(const std::string & testName)160 std::pair<std::string, std::string> GetTestEntryPoint(const std::string &testName)
161 {
162     return TestUtil::GetTest(testName)->GetEntryPoint();
163 }
164 }  // namespace panda::ecmascript::tooling::test
165