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 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
30 return "FAIL : The libSkiaSharp.so library should exist in the application"
32 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
33 if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
34 (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
35 return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
37 sha = raw.split("..")[1].rstrip()
39 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
41 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
43 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
44 return "FAIL : The arch of the target and the arch of the library must match"
46 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
48 return f"FAIL : Get the pid for {pkg_id}"
50 raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
51 if (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." + sha) not in raw:
52 return "FAIL : TThe libSkiaSharp.so library in the TLC should be loaded when running the application"
54 cmd(f"shell app_launcher -t {pkg_id}")
58 # The `Launcher_TC_TLC_02` application must have TLC applied.
60 sln_name = "Launcher_TC_TLC_02.Tizen"
62 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
64 return f"FAIL : Get the tpk path for {sln_name}"
66 if "OK" not in app_install(f"{tpk_path}"):
67 return f"FAIL : Install the application for {tpk_path}"
69 pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
71 root_path = get_root_path(f"{pkg_id}")
72 if root_path == "None":
73 return f"FAIL : Get the root path for {pkg_id}"
75 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
76 return "FAIL : The libSkiaSharp.so library should exist in the application"
78 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
79 if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
80 (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
81 return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
83 sha = raw.split("..")[1].rstrip()
85 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
87 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
89 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
90 return "FAIL : The arch of the target and the arch of the library must match"
92 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
94 return f"FAIL : Get the pid for {pkg_id}"
96 raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
97 if (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." + sha) not in raw:
98 return "FAIL : The libSkiaSharp.so library in the TLC should be loaded when running the application"
100 cmd(f"shell app_launcher -t {pkg_id}")
104 # The `Launcher_TC_TLC_03` application should not apply TLC when updating.
106 pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
108 root_path = get_root_path(f"{pkg_id}")
109 if root_path == "None":
110 return f"FAIL : Get the root path for {pkg_id}"
112 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
113 return "FAIL : The libSkiaSharp.so library should exist in the application"
115 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
116 if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
117 (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
118 return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
120 sha = raw.split("..")[1].rstrip()
122 sln_name = "Launcher_TC_TLC_03.Tizen"
124 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
126 return f"FAIL : Get the tpk path for {sln_name}"
128 if "OK" not in app_install(f"{tpk_path}"):
129 return f"FAIL : Install the application for {tpk_path}"
131 root_path = get_root_path(f"{pkg_id}")
132 if root_path == "None":
133 return f"FAIL : Get the root path for {pkg_id}"
135 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
137 return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
139 if exist(f"{root_path}/bin/libSkiaSharp.so"):
140 return "FAIL : The libSkiaSharp.so library should not exist in the application"
142 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
144 return f"FAIL : Get the pid for {pkg_id}"
146 raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
147 if f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." in raw:
148 return "FAIL : The libSkiaSharp.so library should not be loaded when running the application"
150 cmd(f"shell app_launcher -t {pkg_id}")
154 # It should be done together for update test.
166 # The `Launcher_TC_TLC_04` application is normally TLC applied when updating.
168 sln_name = "Launcher_TC_TLC_04.Tizen"
170 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
172 return f"FAIL : Get the tpk path for {sln_name}"
174 if "OK" not in app_install(f"{tpk_path}"):
175 return f"FAIL : Install the application for {tpk_path}"
177 pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
179 root_path = get_root_path(f"{pkg_id}")
180 if root_path == "None":
181 return f"FAIL : Get the root path for {pkg_id}"
183 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
184 return "FAIL : The libSkiaSharp.so library should exist in the application"
186 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
187 if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
188 (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
189 return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
191 sha = raw.split("..")[1].rstrip()
193 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
195 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
197 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
198 return "FAIL : The arch of the target and the arch of the library must match"
200 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
202 return f"FAIL : Get the pid for {pkg_id}"
204 raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
205 if (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." + sha) not in raw:
206 return "FAIL : The libSkiaSharp.so library in the TLC should be loaded when running the application"
208 cmd(f"shell app_launcher -t {pkg_id}")
212 # The `Launcher_TC_TLC_05` application is normally TLC applied when updating.
214 pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
216 root_path = get_root_path(f"{pkg_id}")
217 if root_path == "None":
218 return f"FAIL : Get the root path for {pkg_id}"
220 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
221 return "FAIL : The libSkiaSharp.so library should exist in the application"
223 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
224 if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
225 (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
226 return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
228 sha = raw.split("..")[1].rstrip()
230 sln_name = "Launcher_TC_TLC_05.Tizen"
232 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
234 return f"FAIL : Get the tpk path for {sln_name}"
236 if "OK" not in app_install(f"{tpk_path}"):
237 return f"FAIL : Install the application for {tpk_path}"
239 root_path = get_root_path(f"{pkg_id}")
240 if root_path == "None":
241 return f"FAIL : Get the root path for {pkg_id}"
243 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
245 return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
247 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
248 return "FAIL : The libSkiaSharp.so library should exist in the application"
250 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
251 if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
252 (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
253 return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
255 sha = raw.split("..")[1].rstrip()
257 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
259 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
261 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
262 return "FAIL : The arch of the target and the arch of the library must match"
264 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
266 return f"FAIL : Get the pid for {pkg_id}"
268 raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
269 if (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." + sha) not in raw:
270 return "FAIL : The libSkiaSharp.so library in the TLC should be loaded when running the application"
272 cmd(f"shell app_launcher -t {pkg_id}")
276 # It should be done together for update test.
288 # The `Launcher_TC_TLC_06` application should not apply TLC when updating.
290 pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen"
292 root_path = get_root_path(f"{pkg_id}")
293 if root_path == "None":
294 return f"FAIL : Get the root path for {pkg_id}"
296 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
297 return "FAIL : The libSkiaSharp.so library should exist in the application"
299 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
300 if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
301 (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
302 return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
304 sha = raw.split("..")[1].rstrip()
306 sln_name = "Launcher_TC_TLC_06.Tizen"
308 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
310 return f"FAIL : Get the tpk path for {sln_name}"
312 if "OK" not in app_install(f"{tpk_path}"):
313 return f"FAIL : Install the application for {tpk_path}"
315 root_path = get_root_path(f"{pkg_id}")
316 if root_path == "None":
317 return f"FAIL : Get the root path for {pkg_id}"
319 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
321 return f"FAIL : The libSkiaSharp.so library should not exist in {DOTNET_DIR}"
323 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
324 return "FAIL : The libSkiaSharp.so library should exist only in the application"
326 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
328 return "FAIL : The libSkiaSharp.so library should not be a symbolic link"
330 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
331 return "FAIL : The arch of the target and the arch of the library must match"
333 pid = launch_and_get_pid(f"-e", f"{pkg_id}")
335 return f"FAIL : Get the pid for {pkg_id}"
337 raw = cmd(f"shell cat /proc/{pid}/smaps | grep libSkiaSharp.so")
338 if (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." in raw) or \
339 (f"{root_path}/bin/libSkiaSharp.so" not in raw):
340 return "FAIL : The libSkiaSharp.so library in the application should be loaded when running the application"
342 cmd(f"shell app_launcher -t {pkg_id}")
346 # It should be done together for update test.
362 # The `Launcher_TC_TLC_07`, `Launcher_TC_TLC_08` applications using the same nuget are normally TLC applied.
364 sln_name = "Launcher_TC_TLC_07.Tizen"
366 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
368 return f"FAIL : Get the tpk path for {sln_name}"
370 if "OK" not in app_install(f"{tpk_path}"):
371 return f"FAIL : Install the application for {tpk_path}"
373 pkg_id1 = f"org.tizen.example.Launcher_TC_TLC_07.Tizen"
375 root_path = get_root_path(f"{pkg_id1}")
376 if root_path == "None":
377 return f"FAIL : Get the root path for {pkg_id1}"
379 if not exist(f"{root_path}/bin/libHarfBuzzSharp.so"):
380 return "FAIL : The libHarfBuzzSharp.so library should exist in the application"
382 raw = cmd(f"shell ls -alZ {root_path}/bin/libHarfBuzzSharp.so")
383 if (f"{root_path}/bin/libHarfBuzzSharp.so" not in raw) or \
384 (f"{DOTNET_DIR}Libraries/libHarfBuzzSharp.so.." not in raw):
385 return "FAIL : The libHarfBuzzSharp.so library should exist or be a symbolic link"
387 sha = raw.split("..")[1].rstrip()
389 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libHarfBuzzSharp.so*")
391 return f"FAIL : The libHarfBuzzSharp.so library should exist in {DOTNET_DIR}"
393 sln_name = "Launcher_TC_TLC_08.Tizen"
395 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
397 return f"FAIL : Get the tpk path for {sln_name}"
399 if "OK" not in app_install(f"{tpk_path}"):
400 return f"FAIL : Install the application for {tpk_path}"
402 pkg_id2 = f"org.tizen.example.Launcher_TC_TLC_08.Tizen"
404 root_path = get_root_path(f"{pkg_id2}")
405 if root_path == "None":
406 return f"FAIL : Get the root path for {pkg_id2}"
408 if not exist(f"{root_path}/bin/libHarfBuzzSharp.so"):
409 return "FAIL : The libHarfBuzzSharp.so library should exist"
411 raw = cmd(f"shell ls -alZ {root_path}/bin/libHarfBuzzSharp.so")
412 if (f"{root_path}/bin/libHarfBuzzSharp.so" not in raw) or \
413 (f"{DOTNET_DIR}Libraries/libHarfBuzzSharp.so.." not in raw):
414 return "FAIL : The libHarfBuzzSharp.so library should exist or be a symbolic link"
416 if "OK" not in check_library_arch(f"{root_path}", "libHarfBuzzSharp.so"):
417 return "FAIL : The arch of the target and the arch of the library must match"
419 sha = raw.split("..")[1].rstrip()
421 raw = cmd(f"uninstall {pkg_id1}")
422 if "key[end] val[ok]" not in raw:
423 return f"FAIL : Uninstall the application for {pkg_id1}"
425 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libHarfBuzzSharp.so*")
427 return f"FAIL : The libHarfBuzzSharp.so library should exist in {DOTNET_DIR}"
429 if "OK" not in check_library_arch(f"{root_path}", "libHarfBuzzSharp.so"):
430 return "FAIL : The arch of the target and the arch of the library must match"
432 pid = launch_and_get_pid(f"-e", f"{pkg_id2}")
434 return f"FAIL : Get the pid for {pkg_id2}"
436 raw = cmd(f"shell cat /proc/{pid}/smaps | grep libHarfBuzzSharp.so")
437 if (f"{DOTNET_DIR}Libraries/libHarfBuzzSharp.so.." + sha) not in raw:
438 return "FAIL : The libHarfBuzzSharp.so library in the TLC should be loaded when running the application"
440 cmd(f"shell app_launcher -t {pkg_id2}")
444 # The `Launcher_TC_TLC_09` application is normally TLC applied when uninstall.
446 sln_name = "Launcher_TC_TLC_09.Tizen"
448 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
450 return f"FAIL : Get the tpk path for {sln_name}"
452 if "OK" not in app_install(f"{tpk_path}"):
453 return f"FAIL : Install the application for {tpk_path}"
455 pkg_id = f"org.tizen.example.Launcher_TC_TLC_09.Tizen"
457 root_path = get_root_path(f"{pkg_id}")
458 if root_path == "None":
459 return f"FAIL : Get the root path for {pkg_id}"
461 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
462 return "FAIL : The libSkiaSharp.so library should exist"
464 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
465 if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
466 (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
467 return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
469 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
470 return "FAIL : The arch of the target and the arch of the library must match"
472 sha = raw.split("..")[1].rstrip()
474 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
476 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
478 raw = cmd(f"uninstall {pkg_id}")
479 if "key[end] val[ok]" not in raw:
480 return f"FAIL : Uninstall the application for {pkg_id}"
482 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
484 return f"FAIL : The libSkiaSharp.so library should not exist in {DONTET_DIR}"
488 # The `Launcher_TC_TLC_10` application should match the information of nuget with the value of TLC database.
490 sln_name = "Launcher_TC_TLC_10.Tizen"
492 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
494 return f"FAIL : Get the tpk path for {sln_name}"
496 if "OK" not in app_install(f"{tpk_path}"):
497 return f"FAIL : Install the application for {tpk_path}"
499 pkg_id = f"org.tizen.example.Launcher_TC_TLC_10.Tizen"
501 root_path = get_root_path(f"{pkg_id}")
502 if root_path == "None":
503 return f"FAIL : Get the root path for {pkg_id}"
505 raw = cmd(f"shell find {root_path}/bin/ -name lib*.so*")
506 lines1 = [l for l in raw.splitlines()]
508 return "FAIL : The library should exist in the application"
510 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
511 lines2 = [l for l in raw.splitlines() if f"{pkg_id}" in l]
513 return "FAIL : TLC database must have a valid value"
516 raw = cmd(f"shell ls -alZ {lib}")
518 return f"FAIL : The {name} library should be a symbolic link"
520 name = Path(lib).name
521 if "OK" not in check_library_arch(f"{root_path}", f"{name}"):
522 return "FAIL : The arch of the target and the arch of the library must match"
524 sha = raw.split("..")[1].rstrip()
526 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name {name}..{sha}")
527 if f"{DOTNET_DIR}Libraries/{name}..{sha}" not in raw:
528 return f"FAIL : The {name} library should exist in {DOTNET_DIR}"
532 if f"{name}..{sha}" in raw:
537 return "FAIL : TLC database must have a valid value"
544 cmd(f"shell mount -o remount,rw /")
547 tpk_list = search_tpk(f"{module_name}")
549 p = run_tc_array(module_name, tc_array)
550 f = len(tc_array) - p
551 r = round(((p / len(tc_array)) * 100), 2)
552 print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n")
554 # Uninstall the application and restore to original state
556 cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_01.Tizen")
557 cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_00.Tizen")
558 cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_07.Tizen")
559 cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_08.Tizen")
560 cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_09.Tizen")
561 cmd(f"uninstall org.tizen.example.Launcher_TC_TLC_10.Tizen")
565 parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
566 parser.add_argument("TC_NUMBER", type=str, nargs="*", help="Individual excution")
567 args = parser.parse_args()
570 if args.TC_NUMBER and "TC_" in args.TC_NUMBER[0]:
572 for tc_num in args.TC_NUMBER:
573 if tc_num not in funcMap:
574 print(f"There is no {tc_num} test.")
577 tc_array.append(funcMap[tc_num])
579 tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_07, TC_08, TC_09]
582 if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
583 serial = read_serial(sys.argv[1])
585 serial = read_serial(None)
588 print("No connected device(s).")
591 device = get_device_type()
592 print(f"=== Dotnet-Launcher [{device}] Test Case - ({module_name}) ===")
599 '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,
600 '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,
601 'TLC_TC_06': TC_04_05_06, 'TLC_TC_07': TC_07, 'TLC_TC_08': TC_08, 'TLC_TC_09': TC_09
605 if __name__ == "__main__":
608 except KeyboardInterrupt:
609 print("\nExit (Pressed Ctrl+C)")