2 import os, subprocess, sys, argparse
3 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
11 # The `Launcher_TC_PLUGIN_01` application should not have a library of other OS.
13 sln_name = "Launcher_TC_PLUGIN_01.Tizen"
15 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
17 return f"FAIL : Get the tpk path for {sln_name}"
19 if "OK" not in app_install(f"{tpk_path}"):
20 return f"FAIL : Install the application for {tpk_path}"
22 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_01.Tizen"
24 root_path = get_root_path(f"{pkg_id}")
25 if root_path == "None":
26 return f"FAIL : Get the root path for {pkg_id}"
28 raw = cmd(f"shell ls {root_path}/bin/")
29 if ("libHarfBuzzSharp.dylib" in raw) or ("libHarfBuzzSharp.dll" in raw):
30 return "FAIL : Library of other OS should not exist"
34 # The `Launcher_TC_PLUGIN_02` application must have a library of Tizen OS.
36 sln_name = "Launcher_TC_PLUGIN_02.Tizen"
38 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
40 return f"FAIL : Get the tpk path for {sln_name}"
42 if "OK" not in app_install(f"{tpk_path}"):
43 return f"FAIL : Install the application for {tpk_path}"
45 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_02.Tizen"
47 root_path = get_root_path(f"{pkg_id}")
48 if root_path == "None":
49 return f"FAIL : Get the root path for {pkg_id}"
51 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
52 return "FAIL : The libSkiaSharp.so library should exist in the application"
54 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
55 return "FAIL : The arch of the target and the arch of the library must match"
59 # The `Launcher_TC_PLUGIN_03` application does not generate native image.
61 if "OK" not in create_spc_ni():
62 return f"FAIL : Create native image for {SPC_DLL}"
64 sln_name = "Launcher_TC_PLUGIN_03.Tizen"
66 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
68 return f"FAIL : Get the tpk path for {sln_name}"
70 if "OK" not in app_install(f"{tpk_path}"):
71 return f"FAIL : Install the application for {tpk_path}"
73 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_03.Tizen"
75 root_path = get_root_path(f"{pkg_id}")
76 if root_path == "None":
77 return f"FAIL : Get the root path for {pkg_id}"
79 if exist(f"{root_path}/bin/.native_image"):
80 return "FAIL : The .native_image folder should not exist"
82 raw = cmd(f"shell find {root_path}/bin/ -name *.ni.dll")
83 lines = [l for l in raw.splitlines()]
85 return "FAIL : The .ni.dll files should not exist"
89 # The `Launcher_TC_PLUGIN_04` application generates native image.
91 if "OK" not in create_spc_ni():
92 return f"FAIL : Create native image for {SPC_DLL}"
94 sln_name = "Launcher_TC_PLUGIN_04.Tizen"
96 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
98 return f"FAIL : Get the tpk path for {sln_name}"
100 if "OK" not in app_install(f"{tpk_path}"):
101 return f"FAIL : Install the application for {tpk_path}"
103 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_04.Tizen"
105 root_path = get_root_path(f"{pkg_id}")
106 if root_path == "None":
107 return f"FAIL : Get the root path for {pkg_id}"
109 if not exist(f"{root_path}/bin/.native_image"):
110 return "FAIL : The .native_image folder should exist"
112 raw = cmd(f"shell find {root_path}/bin/.native_image/ -name *.ni.dll")
113 lines1 = [l for l in raw.splitlines()]
114 raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
115 lines2 = [l for l in raw.splitlines()]
116 if len(lines1) != len(lines2):
117 return "FAIL : The number of .dll and .ni.dll must match in the application"
122 if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
126 return "FAIL : The file name of .dll and .ni.dll must match in the application"
130 # The `Launcher_TC_PLUGIN_05` application must not have TAC applied.
132 sln_name = "Launcher_TC_PLUGIN_05.Tizen"
134 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
136 return f"FAIL : Get the tpk path for {sln_name}"
138 if "OK" not in app_install(f"{tpk_path}"):
139 return f"FAIL : Install the application for {tpk_path}"
141 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_05.Tizen"
143 root_path = get_root_path(f"{pkg_id}")
144 if root_path == "None":
145 return f"FAIL : Get the root path for {pkg_id}"
147 if exist(f"{root_path}/bin/.tac_symlink"):
148 return "FAIL : The .tac_symlink folder should not exist"
152 # The `Launcher_TC_PLUGIN_06` application must have TAC applied.
154 sln_name = "Launcher_TC_PLUGIN_06.Tizen"
156 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
158 return f"FAIL : Get the tpk path for {sln_name}"
160 if "OK" not in app_install(f"{tpk_path}"):
161 return f"FAIL : Install the application for {tpk_path}"
163 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_06.Tizen"
165 root_path = get_root_path(f"{pkg_id}")
166 if root_path == "None":
167 return f"FAIL : Get the root path for {pkg_id}"
169 if not exist(f"{root_path}/bin/.tac_symlink"):
170 return "FAIL : The .tac_symlink folder should exist"
172 raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
173 lines1 = [l for l in raw.splitlines()]
174 raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.6.0.967/ -name *.dll -not -name *.ni.dll")
175 lines2 = [l for l in raw.splitlines()]
176 if len(lines1) != len(lines2):
177 return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
179 raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
180 lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
182 origin_path = dll.split("->")[1].strip()
183 if not exist(f"{origin_path}"):
184 return "FAIL : The original file of the symbolic link must exist"
188 # The `Launcher_TC_PLUGIN_07` application must not have TLC applied.
190 sln_name = "Launcher_TC_PLUGIN_07.Tizen"
192 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
194 return f"FAIL : Get the tpk path for {sln_name}"
196 if "OK" not in app_install(f"{tpk_path}"):
197 return f"FAIL : Install the application for {tpk_path}"
199 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_07.Tizen"
201 root_path = get_root_path(f"{pkg_id}")
202 if root_path == "None":
203 return f"FAIL : Get the root path for {pkg_id}"
205 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
206 return "FAIL : The libSkiaSharp.so library should exist only in the application"
208 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
210 return "FAIL : The libSkiaSharp.so library should not be a symbolic link"
212 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
213 return "FAIL : The arch of the target and the arch of the library must match"
217 # The `Launcher_TC_PLUGIN_08` application must have TLC applied.
219 sln_name = "Launcher_TC_PLUGIN_08.Tizen"
221 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
223 return f"FAIL : Get the tpk path for {sln_name}"
225 if "OK" not in app_install(f"{tpk_path}"):
226 return f"FAIL : Install the application for {tpk_path}"
228 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_08.Tizen"
230 root_path = get_root_path(f"{pkg_id}")
231 if root_path == "None":
232 return f"FAIL : Get the root path for {pkg_id}"
234 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
235 return "FAIL : The libSkiaSharp.so library should exist in the application"
237 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
238 if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
239 (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
240 return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
242 sha = raw.split("..")[1].rstrip()
244 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
246 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
248 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
249 return "FAIL : The arch of the target and the arch of the library must match"
256 cmd(f"shell mount -o remount,rw /")
259 tpk_list = search_tpk(f"{module_name}")
261 p = run_tc_array(module_name, tc_array)
262 f = len(tc_array) - p
263 r = round(((p / len(tc_array)) * 100), 2)
264 print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n")
266 # Uninstall the application and restore to original state
268 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_01.Tizen")
269 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_02.Tizen")
270 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_03.Tizen")
271 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_04.Tizen")
272 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_05.Tizen")
273 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_06.Tizen")
274 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_07.Tizen")
275 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_08.Tizen")
279 parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
280 parser.add_argument("TC_NUMBER", type=str, nargs="*", help="Individual excution")
281 args = parser.parse_args()
284 if args.TC_NUMBER and "TC_" in args.TC_NUMBER[0]:
286 for tc_num in args.TC_NUMBER:
287 if tc_num not in funcMap:
288 print(f"There is no {tc_num} test.")
291 tc_array.append(funcMap[tc_num])
293 tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_07, TC_08]
296 if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
297 serial = read_serial(sys.argv[1])
299 serial = read_serial(None)
302 print("No connected device(s).")
305 device = get_device_type()
306 print(f"=== Dotnet-Launcher [{device}] Test Case - ({module_name}) ===")
313 'TC_01': TC_01, 'TC_02': TC_02, 'TC_03': TC_03, 'TC_04': TC_04, 'TC_05': TC_05, 'TC_06': TC_06, 'TC_07': TC_07, 'TC_08': TC_08,
314 'PLUGIN_TC_01': TC_01, 'PLUGIN_TC_02': TC_02, 'PLUGIN_TC_03': TC_03, 'PLUGIN_TC_04': TC_04,
315 'PLUGIN_TC_05': TC_05, 'PLUGIN_TC_06': TC_06, 'PLUGIN_TC_07': TC_07, 'PLUGIN_TC_08': TC_08
319 if __name__ == "__main__":
322 except KeyboardInterrupt:
323 print("\nExit (Pressed Ctrl+C)")