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