66cb913d3af16eaa1649e0a5c7f27fb60b57a590
[platform/core/dotnet/launcher.git] / tests / TCs / 5_TLC / TLC.py
1 #!/usr/bin/env python3
2 import os, subprocess, sys, argparse
3 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
4
5 from time import sleep
6 from pathlib import Path
7 from Utils import *
8
9
10 module_name = "TLC"
11
12 # The `Launcher_TC_TLC_01` application must have TLC applied.
13 def TC_01():
14     sln_name = "Launcher_TC_TLC_01.Tizen"
15
16     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
17     if tpk_path == None:
18         return f"FAIL : Get the tpk path for {sln_name}"
19
20     if "OK" not in app_install(f"{tpk_path}"):
21         return f"FAIL : Install the application for {tpk_path}"
22
23     pkg_id = f"org.tizen.example.Launcher_TC_TLC_01.Tizen"
24
25     root_path = get_root_path(f"{pkg_id}")
26     if root_path == "None":
27         return f"FAIL : Get the root path for {pkg_id}"
28
29     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
30     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
31        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
32         return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
33
34     sha = raw.split("..")[1].rstrip()
35
36     raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
37     if sha not in raw:
38         return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
39
40     if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
41         return "FAIL : The arch of the target and the arch of the library must match"
42
43     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
44     if 0 == pid:
45         return f"FAIL : Get the pid for {pkg_id}"
46
47     raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
48     if (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." + sha) not in raw:
49         return "FAIL : TThe libSkiaSharp.so library in the TLC should be loaded when running the application"
50
51     cmd(f"shell app_launcher -t {pkg_id}")
52
53     return "PASS"
54
55 # The `Launcher_TC_TLC_02` application must have TLC applied.
56 def TC_02():
57     sln_name = "Launcher_TC_TLC_02.Tizen"
58
59     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
60     if tpk_path == None:
61         return f"FAIL : Get the tpk path for {sln_name}"
62
63     if "OK" not in app_install(f"{tpk_path}"):
64         return f"FAIL : Install the application for {tpk_path}"
65
66     pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
67
68     root_path = get_root_path(f"{pkg_id}")
69     if root_path == "None":
70         return f"FAIL : Get the root path for {pkg_id}"
71
72     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
73     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
74        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
75         return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
76
77     sha = raw.split("..")[1].rstrip()
78
79     raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
80     if sha not in raw:
81         return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
82
83     if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
84         return "FAIL : The arch of the target and the arch of the library must match"
85
86     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
87     if 0 == pid:
88         return f"FAIL : Get the pid for {pkg_id}"
89
90     raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
91     if (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." + sha) not in raw:
92         return "FAIL : The libSkiaSharp.so library in the TLC should be loaded when running the application"
93
94     cmd(f"shell app_launcher -t {pkg_id}")
95
96     return "PASS"
97
98 # The `Launcher_TC_TLC_03` application should not apply TLC when updating.
99 def TC_03():
100     pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
101
102     root_path = get_root_path(f"{pkg_id}")
103     if root_path == "None":
104         return f"FAIL : Get the root path for {pkg_id}"
105
106     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
107     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
108        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
109         return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
110
111     sha = raw.split("..")[1].rstrip()
112
113     sln_name = "Launcher_TC_TLC_03.Tizen"
114
115     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
116     if tpk_path == None:
117         return f"FAIL : Get the tpk path for {sln_name}"
118
119     if "OK" not in app_install(f"{tpk_path}"):
120         return f"FAIL : Install the application for {tpk_path}"
121
122     root_path = get_root_path(f"{pkg_id}")
123     if root_path == "None":
124         return f"FAIL : Get the root path for {pkg_id}"
125
126     raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
127     if sha in raw:
128         return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
129
130     raw = cmd(f"shell find {root_path}/bin/ -name libSkiaSharp.so")
131     if f"{root_path}/bin/libSkiaSharp.so" in raw:
132         return "FAIL : The libSkiaSharp.so library should not exist in the application"
133
134     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
135     if 0 == pid:
136         return f"FAIL : Get the pid for {pkg_id}"
137
138     raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
139     if f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." in raw:
140         return "FAIL : The libSkiaSharp.so library should not be loaded when running the application"
141
142     cmd(f"shell app_launcher -t {pkg_id}")
143
144     return "PASS"
145
146 # It should be done together for update test.
147 def TC_02_03():
148     ret = TC_02()
149     if "PASS" != ret:
150         return f"{ret}"
151
152     ret = TC_03()
153     if  "PASS" != ret:
154         return f"{ret}"
155
156     return "PASS"
157
158 # The `Launcher_TC_TLC_04` application is normally TLC applied when updating.
159 def TC_04():
160     sln_name = "Launcher_TC_TLC_04.Tizen"
161
162     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
163     if tpk_path == None:
164         return f"FAIL : Get the tpk path for {sln_name}"
165
166     if "OK" not in app_install(f"{tpk_path}"):
167         return f"FAIL : Install the application for {tpk_path}"
168
169     pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
170
171     root_path = get_root_path(f"{pkg_id}")
172     if root_path == "None":
173         return f"FAIL : Get the root path for {pkg_id}"
174
175     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
176     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
177        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
178         return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
179
180     sha = raw.split("..")[1].rstrip()
181
182     raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
183     if sha not in raw:
184         return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
185
186     if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
187         return "FAIL : The arch of the target and the arch of the library must match"
188
189     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
190     if 0 == pid:
191         return f"FAIL : Get the pid for {pkg_id}"
192
193     raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
194     if (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." + sha) not in raw:
195         return "FAIL : The libSkiaSharp.so library in the TLC should be loaded when running the application"
196
197     cmd(f"shell app_launcher -t {pkg_id}")
198
199     return "PASS"
200
201 # The `Launcher_TC_TLC_05` application is normally TLC applied when updating.
202 def TC_05():
203     pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
204
205     root_path = get_root_path(f"{pkg_id}")
206     if root_path == "None":
207         return f"FAIL : Get the root path for {pkg_id}"
208
209     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
210     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
211        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
212         return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
213
214     sha = raw.split("..")[1].rstrip()
215
216     sln_name = "Launcher_TC_TLC_05.Tizen"
217
218     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
219     if tpk_path == None:
220         return f"FAIL : Get the tpk path for {sln_name}"
221
222     if "OK" not in app_install(f"{tpk_path}"):
223         return f"FAIL : Install the application for {tpk_path}"
224
225     root_path = get_root_path(f"{pkg_id}")
226     if root_path == "None":
227         return f"FAIL : Get the root path for {pkg_id}"
228
229     raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
230     if sha in raw:
231         return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
232
233     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
234     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
235        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
236         return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
237
238     sha = raw.split("..")[1].rstrip()
239
240     raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
241     if sha not in raw:
242         return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
243
244     if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
245         return "FAIL : The arch of the target and the arch of the library must match"
246
247     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
248     if 0 == pid:
249         return f"FAIL : Get the pid for {pkg_id}"
250
251     raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
252     if (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." + sha) not in raw:
253         return "FAIL : The libSkiaSharp.so library in the TLC should be loaded when running the application"
254
255     cmd(f"shell app_launcher -t {pkg_id}")
256
257     return "PASS"
258
259 # It should be done together for update test.
260 def TC_04_05():
261     ret = TC_04()
262     if "PASS" != ret:
263         return f"{ret}"
264
265     ret = TC_05()
266     if  "PASS" != ret:
267         return f"{ret}"
268
269     return "PASS"
270
271 # The `Launcher_TC_TLC_06` application should not apply TLC when updating.
272 def TC_06():
273     pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
274
275     root_path = get_root_path(f"{pkg_id}")
276     if root_path == "None":
277         return f"FAIL : Get the root path for {pkg_id}"
278
279     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
280     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
281        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
282         return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
283
284     sha = raw.split("..")[1].rstrip()
285
286     sln_name = "Launcher_TC_TLC_06.Tizen"
287
288     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
289     if tpk_path == None:
290         return f"FAIL : Get the tpk path for {sln_name}"
291
292     if "OK" not in app_install(f"{tpk_path}"):
293         return f"FAIL : Install the application for {tpk_path}"
294
295     root_path = get_root_path(f"{pkg_id}")
296     if root_path == "None":
297         return f"FAIL : Get the root path for {pkg_id}"
298
299     raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
300     if sha in raw:
301         return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
302
303     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
304     if f"{root_path}/bin/libSkiaSharp.so" not in raw:
305         return "FAIL : The libSkiaSharp.so library should exist only"
306     if "->" in raw:
307         return "FAIL : The libSkiaSharp.so library should not be a symbolic link"
308
309     if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
310         return "FAIL : The arch of the target and the arch of the library must match"
311
312     pid = launch_and_get_pid(f"-e", f"{pkg_id}")
313     if 0 == pid:
314         return f"FAIL : Get the pid for {pkg_id}"
315
316     raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
317     if (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." in raw) or \
318        (f"{root_path}/bin/libSkiaSharp.so" not in raw):
319         return "FAIL : The libSkiaSharp.so library in the application should be loaded when running the application"
320
321     cmd(f"shell app_launcher -t {pkg_id}")
322
323     return "PASS"
324
325 # It should be done together for update test.
326 def TC_04_05_06():
327     ret = TC_04()
328     if "PASS" != ret:
329         return f"{ret}"
330
331     ret = TC_05()
332     if  "PASS" != ret:
333         return f"{ret}"
334
335     ret = TC_06()
336     if "PASS" != ret:
337         return f"{ret}"
338
339     return "PASS"
340
341 # The `Launcher_TC_TLC_07`, `Launcher_TC_TLC_08` applications using the same nuget are normally TLC applied.
342 def TC_07():
343     sln_name = "Launcher_TC_TLC_07.Tizen"
344
345     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
346     if tpk_path == None:
347         return f"FAIL : Get the tpk path for {sln_name}"
348
349     if "OK" not in app_install(f"{tpk_path}"):
350         return f"FAIL : Install the application for {tpk_path}"
351
352     pkg_id1 = f"org.tizen.example.Launcher_TC_TLC_07.Tizen"
353
354     root_path = get_root_path(f"{pkg_id1}")
355     if root_path == "None":
356         return f"FAIL : Get the root path for {pkg_id1}"
357
358     raw = cmd(f"shell ls -alZ {root_path}/bin/libHarfBuzzSharp.so")
359     if (f"{root_path}/bin/libHarfBuzzSharp.so" not in raw) or \
360        (f"{DOTNET_DIR}Libraries/libHarfBuzzSharp.so.." not in raw):
361         return "FAIL : The libHarfBuzzSharp.so library should exist or be a symbolic link"
362
363     sha = raw.split("..")[1].rstrip()
364
365     raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libHarfBuzzSharp.so*")
366     if sha not in raw:
367         return f"FAIL : The libHarfBuzzSharp.so library should exist in {DOTNET_DIR}"
368
369     sln_name = "Launcher_TC_TLC_08.Tizen"
370
371     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
372     if tpk_path == None:
373         return f"FAIL : Get the tpk path for {sln_name}"
374
375     if "OK" not in app_install(f"{tpk_path}"):
376         return f"FAIL : Install the application for {tpk_path}"
377
378     pkg_id2 = f"org.tizen.example.Launcher_TC_TLC_08.Tizen"
379
380     root_path = get_root_path(f"{pkg_id2}")
381     if root_path == "None":
382         return f"FAIL : Get the root path for {pkg_id2}"
383
384     raw = cmd(f"shell ls -alZ {root_path}/bin/libHarfBuzzSharp.so")
385     if f"{root_path}/bin/libHarfBuzzSharp.so" not in raw:
386         return "FAIL : The libHarfBuzzSharp.so library should exist"
387
388     if "OK" not in check_library_arch(f"{root_path}", "libHarfBuzzSharp.so"):
389         return "FAIL : The arch of the target and the arch of the library must match"
390
391     sha = raw.split("..")[1].rstrip()
392
393     raw = cmd(f"uninstall {pkg_id1}")
394     if "key[end] val[ok]" not in raw:
395         return f"FAIL : Uninstall the application for {pkg_id1}"
396
397     raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libHarfBuzzSharp.so*")
398     if sha not in raw:
399         return f"FAIL : The libHarfBuzzSharp.so library should exist in {DOTNET_DIR}"
400
401     if "OK" not in check_library_arch(f"{root_path}", "libHarfBuzzSharp.so"):
402         return "FAIL : The arch of the target and the arch of the library must match"
403
404     pid = launch_and_get_pid(f"-e", f"{pkg_id2}")
405     if 0 == pid:
406         return f"FAIL : Get the pid for {pkg_id2}"
407
408     raw = cmd(f"shell cat /proc/{pid}/smaps | grep libHarfBuzzSharp.so")
409     if (f"{DOTNET_DIR}Libraries/libHarfBuzzSharp.so.." + sha) not in raw:
410         return "FAIL : The libHarfBuzzSharp.so library in the TLC should be loaded when running the application"
411
412     cmd(f"shell app_launcher -t {pkg_id2}")
413
414     return "PASS"
415
416 # The `Launcher_TC_TLC_09` application is normally TLC applied when uninstall.
417 def TC_08():
418     sln_name = "Launcher_TC_TLC_09.Tizen"
419
420     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
421     if tpk_path == None:
422         return f"FAIL : Get the tpk path for {sln_name}"
423
424     if "OK" not in app_install(f"{tpk_path}"):
425         return f"FAIL : Install the application for {tpk_path}"
426
427     pkg_id = f"org.tizen.example.Launcher_TC_TLC_09.Tizen"
428
429     root_path = get_root_path(f"{pkg_id}")
430     if root_path == "None":
431         return f"FAIL : Get the root path for {pkg_id}"
432
433     raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
434     if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
435        (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
436         return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
437
438     if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
439         return "FAIL : The arch of the target and the arch of the library must match"
440
441     sha = raw.split("..")[1].rstrip()
442
443     raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
444     if sha not in raw:
445         return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
446
447     raw = cmd(f"uninstall {pkg_id}")
448     if "key[end] val[ok]" not in raw:
449         return f"FAIL : Uninstall the application for {pkg_id}"
450
451     raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
452     if sha in raw:
453        return f"FAIL : The libSkiaSharp.so library should not exist in {DONTET_DIR}"
454
455     return "PASS"
456
457 # The `Launcher_TC_TLC_10` application should match the information of nuget with the value of TLC database.
458 def TC_09():
459     sln_name = "Launcher_TC_TLC_10.Tizen"
460
461     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
462     if tpk_path == None:
463         return f"FAIL : Get the tpk path for {sln_name}"
464
465     if "OK" not in app_install(f"{tpk_path}"):
466         return f"FAIL : Install the application for {tpk_path}"
467
468     pkg_id = f"org.tizen.example.Launcher_TC_TLC_10.Tizen"
469
470     root_path = get_root_path(f"{pkg_id}")
471     if root_path == "None":
472         return f"FAIL : Get the root path for {pkg_id}"
473
474     raw = cmd(f"shell find {root_path}/bin/ -name lib*.so*")
475     lines1 = [l for l in raw.splitlines()]
476     if len(lines1) == 0:
477         return "FAIL : The library should exist in the application"
478
479     raw = subprocess.run((f"sdb -s {serial} shell sqlite3 {DOTNET_DIR}.TLC.App.list.db").split(), stdout=subprocess.PIPE, input=f"select * from TLC;\n.q\n", encoding="utf-8").stdout
480     lines2 = [l for l in raw.splitlines() if f"{pkg_id}" in l]
481     if len(lines2) == 0:
482         return "FAIL : TLC database must have a valid value"
483
484     for lib in lines1:
485         raw = cmd(f"shell ls -alZ {lib}")
486         if "->" not in raw:
487             return f"FAIL : The {name} library should be a symbolic link"
488
489         name = Path(lib).name
490         if "OK" not in check_library_arch(f"{root_path}", f"{name}"):
491             return "FAIL : The arch of the target and the arch of the library must match"
492
493         sha = raw.split("..")[1].rstrip()
494
495         raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name {name}..{sha}")
496         if f"{DOTNET_DIR}Libraries/{name}..{sha}" not in raw:
497             return f"FAIL : The {name} library should exist in {DOTNET_DIR}"
498
499         is_exist = False
500         for rcd in lines2:
501             if f"{name}..{sha}" in raw:
502                 is_exist = True
503                 break
504
505         if not is_exist:
506             return "FAIL : TLC database must have a valid value"
507
508     return "PASS"
509
510 # Run the test
511 def run():
512     cmd(f"root on")
513     cmd(f"shell mount -o remount,rw /")
514
515     global tpk_list
516     tpk_list = search_tpk(f"{module_name}")
517
518     p = run_tc_array(module_name, tc_array)
519     f = len(tc_array) - p
520     r = round(((p / len(tc_array)) * 100), 2)
521     print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n")
522
523 # Uninstall the application and restore to original state
524 def clean():
525     cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_01.Tizen")
526     cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_00.Tizen")
527     cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_07.Tizen")
528     cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_08.Tizen")
529     cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_09.Tizen")
530     cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_10.Tizen")
531
532 # Main entry point
533 def main():
534     parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
535     parser.add_argument("TC_NUMBER", type=str, nargs="*", help="Individual excution")
536     args = parser.parse_args()
537
538     global tc_array
539     if "TC_" in args.TC_NUMBER[0]:
540         tc_array = []
541         for tc_num in args.TC_NUMBER:
542             if tc_num not in funcMap:
543                 print(f"There is no {tc_num} test.")
544                 exit(1)
545             else:
546                 tc_array.append(funcMap[tc_num])
547     else:
548         tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_07, TC_08, TC_09]
549
550     global serial
551     if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
552         serial = read_serial(sys.argv[1])
553     else:
554         serial = read_serial(None)
555
556     if serial is None:
557         print("No connected device(s).")
558         exit(1)
559
560     device = get_device_type()
561     print(f"=== Dotnet-Launcher [{device}] Test Case - ({module_name}) ===")
562
563     run()
564     clean()
565
566
567 funcMap = {
568 'TC_01': TC_01, 'TC_02': TC_02, 'TC_03': TC_02_03, 'TC_04': TC_04, 'TC_05': TC_04_05, 'TC_06': TC_04_05_06, 'TC_07': TC_07, 'TC_08': TC_08, 'TC_09': TC_09,
569 'TLC_TC_01': TC_01, 'TLC_TC_02': TC_02, 'TLC_TC_03': TC_02_03, 'TLC_TC_04': TC_04, 'TLC_TC_05': TC_04_05,
570 'TLC_TC_06': TC_04_05_06, 'TLC_TC_07': TC_07, 'TLC_TC_08': TC_08, 'TLC_TC_09': TC_09
571 }
572
573
574 if __name__ == "__main__":
575     try:
576         main()
577     except KeyboardInterrupt:
578         print("\nExit (Pressed Ctrl+C)")
579         exit(1)