• 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/dynamic/test/client_utils/test_list.h"
17 
18 #include "tooling/dynamic/test/client_utils/test_util.h"
19 
20 // testcase list
21 #include "tooling/dynamic/test/testcases/js_accelerate_launch_test.h"
22 #include "tooling/dynamic/test/testcases/js_allocationtrack_loop_test.h"
23 #include "tooling/dynamic/test/testcases/js_allocationtrack_recursion_test.h"
24 #include "tooling/dynamic/test/testcases/js_allocationtrack_test.h"
25 #include "tooling/dynamic/test/testcases/js_breakpoint_arrow_test.h"
26 #include "tooling/dynamic/test/testcases/js_breakpoint_async_test.h"
27 #include "tooling/dynamic/test/testcases/js_breakpoint_cannot_hit_test.h"
28 #include "tooling/dynamic/test/testcases/js_breakpoint_in_different_branch.h"
29 #include "tooling/dynamic/test/testcases/js_breakpoint_loop_test.h"
30 #include "tooling/dynamic/test/testcases/js_breakpoint_recursion_test.h"
31 #include "tooling/dynamic/test/testcases/js_breakpoint_switch_test.h"
32 #include "tooling/dynamic/test/testcases/js_breakpoint_test.h"
33 #include "tooling/dynamic/test/testcases/js_closure_scope_test.h"
34 #include "tooling/dynamic/test/testcases/js_container_test.h"
35 #include "tooling/dynamic/test/testcases/js_exception_test.h"
36 #include "tooling/dynamic/test/testcases/js_heapdump_loop_test.h"
37 #include "tooling/dynamic/test/testcases/js_heapdump_test.h"
38 #include "tooling/dynamic/test/testcases/js_heapusage_async_test.h"
39 #include "tooling/dynamic/test/testcases/js_heapusage_loop_test.h"
40 #include "tooling/dynamic/test/testcases/js_heapusage_recursion_test.h"
41 #include "tooling/dynamic/test/testcases/js_heapusage_step_test.h"
42 #include "tooling/dynamic/test/testcases/js_heapusage_test.h"
43 #include "tooling/dynamic/test/testcases/js_local_variable_scope_test.h"
44 #include "tooling/dynamic/test/testcases/js_module_variable_test.h"
45 #include "tooling/dynamic/test/testcases/js_multiple_breakpoint_in_function_test.h"
46 #include "tooling/dynamic/test/testcases/js_multiple_common_breakpoint_test.h"
47 #include "tooling/dynamic/test/testcases/js_smart_stepInto_test.h"
48 #include "tooling/dynamic/test/testcases/js_source_test.h"
49 #include "tooling/dynamic/test/testcases/js_special_location_breakpoint_test.h"
50 #include "tooling/dynamic/test/testcases/js_stepinto_and_stepout_test.h"
51 #include "tooling/dynamic/test/testcases/js_stepinto_arrow_test.h"
52 #include "tooling/dynamic/test/testcases/js_stepinto_async_test.h"
53 #include "tooling/dynamic/test/testcases/js_stepinto_loop_test.h"
54 #include "tooling/dynamic/test/testcases/js_stepinto_recursion_test.h"
55 #include "tooling/dynamic/test/testcases/js_stepinto_switch_test.h"
56 #include "tooling/dynamic/test/testcases/js_stepinto_test.h"
57 #include "tooling/dynamic/test/testcases/js_stepout_arrow_test.h"
58 #include "tooling/dynamic/test/testcases/js_stepout_async_test.h"
59 #include "tooling/dynamic/test/testcases/js_stepout_before_function_test.h"
60 #include "tooling/dynamic/test/testcases/js_stepout_loop_test.h"
61 #include "tooling/dynamic/test/testcases/js_stepout_recursion_test.h"
62 #include "tooling/dynamic/test/testcases/js_stepout_switch_test.h"
63 #include "tooling/dynamic/test/testcases/js_stepout_test.h"
64 #include "tooling/dynamic/test/testcases/js_stepover_loop_test.h"
65 #include "tooling/dynamic/test/testcases/js_stepover_recursion_test.h"
66 #include "tooling/dynamic/test/testcases/js_stepover_switch_test.h"
67 #include "tooling/dynamic/test/testcases/js_stepover_test.h"
68 #include "tooling/dynamic/test/testcases/js_tracing_test.h"
69 #include "tooling/dynamic/test/testcases/js_watch_basic_type_test.h"
70 #include "tooling/dynamic/test/testcases/js_watch_closure_variable_test.h"
71 #include "tooling/dynamic/test/testcases/js_watch_other_type_test.h"
72 #include "tooling/dynamic/test/testcases/js_watch_set_type_test.h"
73 #include "tooling/dynamic/test/testcases/js_watch_test.h"
74 #include "tooling/dynamic/test/testcases/js_watch_module_test.h"
75 #include "tooling/dynamic/test/testcases/js_watch_variable_test.h"
76 #include "tooling/dynamic/test/testcases/js_symbolbreakpoint_test.h"
77 
78 namespace panda::ecmascript::tooling::test {
79 static std::string g_currentTestName = "";
80 
RegisterTests()81 static void RegisterTests()
82 {
83     // Register testcases
84     TestUtil::RegisterTest("JsBreakpointTest", GetJsBreakpointTest());
85     TestUtil::RegisterTest("JsBreakpointArrowTest", GetJsBreakpointArrowTest());
86     TestUtil::RegisterTest("JsBreakpointAsyncTest", GetJsBreakpointAsyncTest());
87     TestUtil::RegisterTest("JsClosureScopeTest", GetJsClosureScopeTest());
88     TestUtil::RegisterTest("JsLocalVariableScopeTest", GetJsLocalVariableScopeTest());
89     TestUtil::RegisterTest("JsExceptionTest", GetJsExceptionTest());
90     TestUtil::RegisterTest("JsContainerTest", GetJsContainerTest());
91     TestUtil::RegisterTest("JsModuleVariableTest", GetJsModuleVariableTest());
92     TestUtil::RegisterTest("JsWatchModuleTest", GetJsWatchModuleTest());
93     TestUtil::RegisterTest("JsSourceTest", GetJsSourceTest());
94     TestUtil::RegisterTest("JsTracingTest", GetJsTracingTest());
95     TestUtil::RegisterTest("JsWatchTest", GetJsWatchTest());
96     if (!g_isEnableCMCGC) {
97         // Need support heapdump
98         TestUtil::RegisterTest("JsHeapdumpTest", GetJsHeapdumpTest());
99         TestUtil::RegisterTest("JsHeapdumpLoopTest", GetJsHeapdumpLoopTest());
100     }
101     TestUtil::RegisterTest("JsStepintoTest", GetJsStepintoTest());
102     TestUtil::RegisterTest("JsStepoutTest", GetJsStepoutTest());
103     TestUtil::RegisterTest("JsStepoverTest", GetJsStepoverTest());
104     TestUtil::RegisterTest("JsStepintoAndStepoutTest", GetJsStepintoAndStepoutTest());
105     TestUtil::RegisterTest("JsStepoutBeforeFunctiontTest", GetJsStepoutBeforeFunctionTest());
106     TestUtil::RegisterTest("JsSpecialLocationBreakpointTest", GetJsSpecialLocationBreakpointTest());
107     TestUtil::RegisterTest("JsMultipleCommonBreakpointTest", GetJsMultipleCommonBreakpointTest());
108     TestUtil::RegisterTest("JsMultipleBreakpointInFunctionTest", GetJsMultipleBreakpointInFunctionTest());
109     TestUtil::RegisterTest("JsBreakpointCannotHitTest", GetJsBreakpointCannotHitTest());
110     TestUtil::RegisterTest("JsBreakpointInDifferentBranchTest", GetJsBreakpointInDifferentBranchTest());
111     TestUtil::RegisterTest("JsWatchVariableTest", GetJsWatchVariableTest());
112     TestUtil::RegisterTest("JsStepintoArrowTest", GetJsStepintoArrowTest());
113     TestUtil::RegisterTest("JsStepintoAsyncTest", GetJsStepintoAsyncTest());
114     TestUtil::RegisterTest("JsStepoutArrowTest", GetJsStepoutArrowTest());
115     TestUtil::RegisterTest("JsStepoutAsyncTest", GetJsStepoutAsyncTest());
116     TestUtil::RegisterTest("JsHeapusageTest", GetJsHeapusageTest());
117     TestUtil::RegisterTest("JsHeapusageAsyncTest", GetJsHeapusageAsyncTest());
118     TestUtil::RegisterTest("JsHeapusageStepTest", GetJsHeapusageStepTest());
119     if (!g_isEnableCMCGC) {
120         // Need support allocation tracker
121         TestUtil::RegisterTest("JsAllocationtrackTest", GetJsAllocationtrackTest());
122         TestUtil::RegisterTest("JsAllocationTrackLoopTest", GetJsAllocationTrackLoopTest());
123         TestUtil::RegisterTest("JsAllocationTrackRecursionTest", GetJsAllocationTrackRecursionTest());
124     }
125     TestUtil::RegisterTest("JsJsWatchBasicTypeTest", GetJsWatchBasicTypeTest());
126     TestUtil::RegisterTest("JsJsWatchSetTypeTest", GetJsWatchSetTypeTest());
127     TestUtil::RegisterTest("JsJsWatchOtherTypeTest", GetJsWatchOtherTypeTest());
128     TestUtil::RegisterTest("JsWatchClosureVariableTest", GetJsWatchClosureVariableTest());
129     TestUtil::RegisterTest("JsStepintoLoopTest", GetJsStepintoLoopTest());
130     TestUtil::RegisterTest("JsStepintoRecursionTest", GetJsStepintoRecursionTest());
131     TestUtil::RegisterTest("JsStepintoSwitchTest", GetJsStepintoSwitchTest());
132     TestUtil::RegisterTest("JsStepoverLoopTest", GetJsStepoverLoopTest());
133     TestUtil::RegisterTest("JsStepoverRecursionTest", GetJsStepoverRecursionTest());
134     TestUtil::RegisterTest("JsStepoverSwitchTest", GetJsStepoverSwitchTest());
135     TestUtil::RegisterTest("JsStepoutLoopTest", GetJsStepoutLoopTest());
136     TestUtil::RegisterTest("JsStepoutRecursionTest", GetJsStepoutRecursionTest());
137     TestUtil::RegisterTest("JsStepoutSwitchTest", GetJsStepoutSwitchTest());
138     TestUtil::RegisterTest("JsBreakpointLoopTest", GetJsBreakpointLoopTest());
139     TestUtil::RegisterTest("JsBreakpointRecursionTest", GetJsBreakpointRecursionTest());
140     TestUtil::RegisterTest("JsBreakpointSwitchTest", GetJsBreakpointSwitchTest());
141     TestUtil::RegisterTest("JsHeapusageLoopTest", GetJsHeapusageLoopTest());
142     TestUtil::RegisterTest("JsHeapusageRecursionTest", GetJsHeapusageRecursionTest());
143     TestUtil::RegisterTest("JsSmartStepoutTest", GetJsSmartStepoutTest());
144     TestUtil::RegisterTest("JsAccelerateLaunchTest", GetJsAccelerateLaunchTest());
145     TestUtil::RegisterTest("JsSymbolicBreakpointTest", GetJsSymbolicBreakpointTest());
146 }
147 
GetTestList()148 std::vector<const char *> GetTestList()
149 {
150     RegisterTests();
151     std::vector<const char *> res;
152 
153     auto &tests = TestUtil::GetTests();
154     for (const auto &entry : tests) {
155         res.push_back(entry.first.c_str());
156     }
157     return res;
158 }
159 
SetCurrentTestName(const std::string & testName)160 void SetCurrentTestName(const std::string &testName)
161 {
162     g_currentTestName = testName;
163 }
164 
GetCurrentTestName()165 std::string GetCurrentTestName()
166 {
167     return g_currentTestName;
168 }
169 
GetTestEntryPoint(const std::string & testName)170 std::pair<std::string, std::string> GetTestEntryPoint(const std::string &testName)
171 {
172     return TestUtil::GetTest(testName)->GetEntryPoint();
173 }
174 }  // namespace panda::ecmascript::tooling::test
175