2 import os, subprocess, sys, argparse
3 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
6 from pathlib import Path
12 # The `Launcher_TC_TLC_01` application must have TLC applied.
14 sln_name = "Launcher_TC_TLC_01.Tizen"
16 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
18 return f"FAIL : Get the tpk path for {sln_name}"
20 if "OK" not in app_install(f"{tpk_path}"):
21 return f"FAIL : Install the application for {tpk_path}"
23 pkg_id = f"org.tizen.example.Launcher_TC_TLC_01.Tizen"
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}"
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"
34 sha = raw.split("..")[1].rstrip()
36 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
38 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
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"
43 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
45 return f"FAIL : Get the pid for {pkg_id}"
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"
51 cmd(f"shell app_launcher -t {pkg_id}")
55 # The `Launcher_TC_TLC_02` application must have TLC applied.
57 sln_name = "Launcher_TC_TLC_02.Tizen"
59 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
61 return f"FAIL : Get the tpk path for {sln_name}"
63 if "OK" not in app_install(f"{tpk_path}"):
64 return f"FAIL : Install the application for {tpk_path}"
66 pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
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}"
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"
77 sha = raw.split("..")[1].rstrip()
79 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
81 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
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"
86 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
88 return f"FAIL : Get the pid for {pkg_id}"
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"
94 cmd(f"shell app_launcher -t {pkg_id}")
98 # The `Launcher_TC_TLC_03` application should not apply TLC when updating.
100 pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
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}"
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"
111 sha = raw.split("..")[1].rstrip()
113 sln_name = "Launcher_TC_TLC_03.Tizen"
115 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
117 return f"FAIL : Get the tpk path for {sln_name}"
119 if "OK" not in app_install(f"{tpk_path}"):
120 return f"FAIL : Install the application for {tpk_path}"
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}"
126 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
128 return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
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"
134 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
136 return f"FAIL : Get the pid for {pkg_id}"
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"
142 cmd(f"shell app_launcher -t {pkg_id}")
146 # It should be done together for update test.
158 # The `Launcher_TC_TLC_04` application is normally TLC applied when updating.
160 sln_name = "Launcher_TC_TLC_04.Tizen"
162 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
164 return f"FAIL : Get the tpk path for {sln_name}"
166 if "OK" not in app_install(f"{tpk_path}"):
167 return f"FAIL : Install the application for {tpk_path}"
169 pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
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}"
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"
180 sha = raw.split("..")[1].rstrip()
182 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
184 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
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"
189 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
191 return f"FAIL : Get the pid for {pkg_id}"
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"
197 cmd(f"shell app_launcher -t {pkg_id}")
201 # The `Launcher_TC_TLC_05` application is normally TLC applied when updating.
203 pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
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}"
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"
214 sha = raw.split("..")[1].rstrip()
216 sln_name = "Launcher_TC_TLC_05.Tizen"
218 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
220 return f"FAIL : Get the tpk path for {sln_name}"
222 if "OK" not in app_install(f"{tpk_path}"):
223 return f"FAIL : Install the application for {tpk_path}"
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}"
229 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
231 return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
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"
238 sha = raw.split("..")[1].rstrip()
240 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
242 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
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"
247 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
249 return f"FAIL : Get the pid for {pkg_id}"
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"
255 cmd(f"shell app_launcher -t {pkg_id}")
259 # It should be done together for update test.
271 # The `Launcher_TC_TLC_06` application should not apply TLC when updating.
273 pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
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}"
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"
284 sha = raw.split("..")[1].rstrip()
286 sln_name = "Launcher_TC_TLC_06.Tizen"
288 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
290 return f"FAIL : Get the tpk path for {sln_name}"
292 if "OK" not in app_install(f"{tpk_path}"):
293 return f"FAIL : Install the application for {tpk_path}"
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}"
299 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
301 return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
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"
307 return "FAIL : The libSkiaSharp.so library should not be a symbolic link"
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"
312 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
314 return f"FAIL : Get the pid for {pkg_id}"
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"
321 cmd(f"shell app_launcher -t {pkg_id}")
325 # It should be done together for update test.
341 # The `Launcher_TC_TLC_07`, `Launcher_TC_TLC_08` applications using the same nuget are normally TLC applied.
343 sln_name = "Launcher_TC_TLC_07.Tizen"
345 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
347 return f"FAIL : Get the tpk path for {sln_name}"
349 if "OK" not in app_install(f"{tpk_path}"):
350 return f"FAIL : Install the application for {tpk_path}"
352 pkg_id1 = f"org.tizen.example.Launcher_TC_TLC_07.Tizen"
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}"
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"
363 sha = raw.split("..")[1].rstrip()
365 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libHarfBuzzSharp.so*")
367 return f"FAIL : The libHarfBuzzSharp.so library should exist in {DOTNET_DIR}"
369 sln_name = "Launcher_TC_TLC_08.Tizen"
371 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
373 return f"FAIL : Get the tpk path for {sln_name}"
375 if "OK" not in app_install(f"{tpk_path}"):
376 return f"FAIL : Install the application for {tpk_path}"
378 pkg_id2 = f"org.tizen.example.Launcher_TC_TLC_08.Tizen"
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}"
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"
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"
391 sha = raw.split("..")[1].rstrip()
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}"
397 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libHarfBuzzSharp.so*")
399 return f"FAIL : The libHarfBuzzSharp.so library should exist in {DOTNET_DIR}"
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"
404 pid = launch_and_get_pid(f"-e", f"{pkg_id2}")
406 return f"FAIL : Get the pid for {pkg_id2}"
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"
412 cmd(f"shell app_launcher -t {pkg_id2}")
416 # The `Launcher_TC_TLC_09` application is normally TLC applied when uninstall.
418 sln_name = "Launcher_TC_TLC_09.Tizen"
420 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
422 return f"FAIL : Get the tpk path for {sln_name}"
424 if "OK" not in app_install(f"{tpk_path}"):
425 return f"FAIL : Install the application for {tpk_path}"
427 pkg_id = f"org.tizen.example.Launcher_TC_TLC_09.Tizen"
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}"
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"
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"
441 sha = raw.split("..")[1].rstrip()
443 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
445 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
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}"
451 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
453 return f"FAIL : The libSkiaSharp.so library should not exist in {DONTET_DIR}"
457 # The `Launcher_TC_TLC_10` application should match the information of nuget with the value of TLC database.
459 sln_name = "Launcher_TC_TLC_10.Tizen"
461 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
463 return f"FAIL : Get the tpk path for {sln_name}"
465 if "OK" not in app_install(f"{tpk_path}"):
466 return f"FAIL : Install the application for {tpk_path}"
468 pkg_id = f"org.tizen.example.Launcher_TC_TLC_10.Tizen"
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}"
474 raw = cmd(f"shell find {root_path}/bin/ -name lib*.so*")
475 lines1 = [l for l in raw.splitlines()]
477 return "FAIL : The library should exist in the application"
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]
482 return "FAIL : TLC database must have a valid value"
485 raw = cmd(f"shell ls -alZ {lib}")
487 return f"FAIL : The {name} library should be a symbolic link"
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"
493 sha = raw.split("..")[1].rstrip()
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}"
501 if f"{name}..{sha}" in raw:
506 return "FAIL : TLC database must have a valid value"
513 cmd(f"shell mount -o remount,rw /")
516 tpk_list = search_tpk(f"{module_name}")
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")
523 # Uninstall the application and restore to original state
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")
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()
539 if "TC_" in args.TC_NUMBER[0]:
541 for tc_num in args.TC_NUMBER:
542 if tc_num not in funcMap:
543 print(f"There is no {tc_num} test.")
546 tc_array.append(funcMap[tc_num])
548 tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_07, TC_08, TC_09]
551 if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
552 serial = read_serial(sys.argv[1])
554 serial = read_serial(None)
557 print("No connected device(s).")
560 device = get_device_type()
561 print(f"=== Dotnet-Launcher [{device}] Test Case - ({module_name}) ===")
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
574 if __name__ == "__main__":
577 except KeyboardInterrupt:
578 print("\nExit (Pressed Ctrl+C)")