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 if not check_tc_support():
37 return "NONE - TC_02 is not supported on this platform"
39 sln_name = "Launcher_TC_PLUGIN_02.Tizen"
41 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
43 return f"FAIL : Get the tpk path for {sln_name}"
45 if "OK" not in app_install(f"{tpk_path}"):
46 return f"FAIL : Install the application for {tpk_path}"
48 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_02.Tizen"
50 root_path = get_root_path(f"{pkg_id}")
51 if root_path == "None":
52 return f"FAIL : Get the root path for {pkg_id}"
54 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
55 return "FAIL : The libSkiaSharp.so library should exist in the application"
57 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
58 return "FAIL : The arch of the target and the arch of the library must match"
62 # The `Launcher_TC_PLUGIN_03` application does not generate native image.
64 if "OK" not in create_spc_ni():
65 return f"FAIL : Create native image for {SPC_DLL}"
67 sln_name = "Launcher_TC_PLUGIN_03.Tizen"
69 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
71 return f"FAIL : Get the tpk path for {sln_name}"
73 if "OK" not in app_install(f"{tpk_path}"):
74 return f"FAIL : Install the application for {tpk_path}"
76 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_03.Tizen"
78 root_path = get_root_path(f"{pkg_id}")
79 if root_path == "None":
80 return f"FAIL : Get the root path for {pkg_id}"
82 if exist(f"{root_path}/bin/.native_image"):
83 return "FAIL : The .native_image folder should not exist"
85 raw = cmd(f"shell find {root_path}/bin/ -name *.ni.dll")
86 lines = [l for l in raw.splitlines()]
88 return "FAIL : The .ni.dll files should not exist"
92 # The `Launcher_TC_PLUGIN_04` application generates native image.
94 if "OK" not in create_spc_ni():
95 return f"FAIL : Create native image for {SPC_DLL}"
97 sln_name = "Launcher_TC_PLUGIN_04.Tizen"
99 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
101 return f"FAIL : Get the tpk path for {sln_name}"
103 if "OK" not in app_install(f"{tpk_path}"):
104 return f"FAIL : Install the application for {tpk_path}"
106 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_04.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/.native_image"):
113 return "FAIL : The .native_image folder should exist"
115 raw = cmd(f"shell find {root_path}/bin/.native_image/ -name *.ni.dll")
116 lines1 = [l for l in raw.splitlines()]
117 raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
118 lines2 = [l for l in raw.splitlines()]
119 if len(lines1) != len(lines2):
120 return "FAIL : The number of .dll and .ni.dll must match in the application"
125 if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
129 return "FAIL : The file name of .dll and .ni.dll must match in the application"
133 # The `Launcher_TC_PLUGIN_05` application must not have TAC applied.
135 sln_name = "Launcher_TC_PLUGIN_05.Tizen"
137 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
139 return f"FAIL : Get the tpk path for {sln_name}"
141 if "OK" not in app_install(f"{tpk_path}"):
142 return f"FAIL : Install the application for {tpk_path}"
144 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_05.Tizen"
146 root_path = get_root_path(f"{pkg_id}")
147 if root_path == "None":
148 return f"FAIL : Get the root path for {pkg_id}"
150 if exist(f"{root_path}/bin/.tac_symlink"):
151 return "FAIL : The .tac_symlink folder should not exist"
155 # The `Launcher_TC_PLUGIN_06` application must have TAC applied.
157 sln_name = "Launcher_TC_PLUGIN_06.Tizen"
159 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
161 return f"FAIL : Get the tpk path for {sln_name}"
163 if "OK" not in app_install(f"{tpk_path}"):
164 return f"FAIL : Install the application for {tpk_path}"
166 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_06.Tizen"
168 root_path = get_root_path(f"{pkg_id}")
169 if root_path == "None":
170 return f"FAIL : Get the root path for {pkg_id}"
172 if not exist(f"{root_path}/bin/.tac_symlink"):
173 return "FAIL : The .tac_symlink folder should exist"
175 raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
176 lines1 = [l for l in raw.splitlines()]
177 raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.6.0.967/ -name *.dll -not -name *.ni.dll")
178 lines2 = [l for l in raw.splitlines()]
179 if len(lines1) != len(lines2):
180 return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
182 raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
183 lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
185 origin_path = dll.split("->")[1].strip()
186 if not exist(f"{origin_path}"):
187 return "FAIL : The original file of the symbolic link must exist"
191 # The `Launcher_TC_PLUGIN_07` application must not have TLC applied.
193 if not check_tc_support():
194 return "NONE - TC_07 is not supported on this platform"
196 sln_name = "Launcher_TC_PLUGIN_07.Tizen"
198 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
200 return f"FAIL : Get the tpk path for {sln_name}"
202 if "OK" not in app_install(f"{tpk_path}"):
203 return f"FAIL : Install the application for {tpk_path}"
205 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_07.Tizen"
207 root_path = get_root_path(f"{pkg_id}")
208 if root_path == "None":
209 return f"FAIL : Get the root path for {pkg_id}"
211 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
212 return "FAIL : The libSkiaSharp.so library should exist only in the application"
214 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
216 return "FAIL : The libSkiaSharp.so library should not be a symbolic link"
218 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
219 return "FAIL : The arch of the target and the arch of the library must match"
223 # The `Launcher_TC_PLUGIN_08` application must have TLC applied.
225 if not check_tc_support():
226 return "NONE - TC_08 is not supported on this platform"
228 sln_name = "Launcher_TC_PLUGIN_08.Tizen"
230 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
232 return f"FAIL : Get the tpk path for {sln_name}"
234 if "OK" not in app_install(f"{tpk_path}"):
235 return f"FAIL : Install the application for {tpk_path}"
237 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_08.Tizen"
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 if not exist(f"{root_path}/bin/libSkiaSharp.so"):
244 return "FAIL : The libSkiaSharp.so library should exist in the application"
246 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
247 if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
248 (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
249 return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
251 sha = raw.split("..")[1].rstrip()
253 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
255 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
257 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
258 return "FAIL : The arch of the target and the arch of the library must match"
262 # The Launcher_TC_PLUGIN_09 application must have a ._TIZEN_DOTNET_SYSTEM_NET_DISABLEIPV6 file exist.
264 sln_name = "Launcher_TC_PLUGIN_09.Tizen"
266 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
268 return f"FAIL : Get the tpk path for {sln_name}"
270 if "OK" not in app_install(f"{tpk_path}"):
271 return f"FAIL : Install the application for {tpk_path}"
273 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_09.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 if not exist(f"{root_path}/bin/._TIZEN_DOTNET_SYSTEM_NET_DISABLEIPV6"):
280 return "FAIL : The ._TIZEN_DOTNET_SYSTEM_NET_DISABLEIPV6 file should exist"
284 # The Launcher_TC_PLUGIN_10 application must not have a ._TIZEN_DOTNET_SYSTEM_NET_DISABLEIPV6 file.
286 sln_name = "Launcher_TC_PLUGIN_10.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 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_10.Tizen"
297 root_path = get_root_path(f"{pkg_id}")
298 if root_path == "None":
299 return f"FAIL : Get the root path for {pkg_id}"
301 if exist(f"{root_path}/bin/._TIZEN_DOTNET_SYSTEM_NET_DISABLEIPV6"):
302 return "FAIL : The ._TIZEN_DOTNET_SYSTEM_NET_DISABLEIPV6 file should not exist"
309 cmd(f"shell mount -o remount,rw /")
312 tpk_list = search_tpk(f"{module_name}")
314 pn = run_tc_array(module_name, tc_array)
315 n = int(pn.split(":")[0])
316 f = int(pn.split(":")[1])
317 p = int(pn.split(":")[2])
319 if (len(tc_array) - n) != 0:
320 r = round(((p / (len(tc_array) - n)) * 100), 2)
321 print(f"--- {module_name} TCT Result ---\nNONE : [{n}] / FAIL : [{f}] / PASS : [{p}] - [{r}%]\n")
323 # Uninstall the application and restore to original state
325 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_01.Tizen")
326 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_02.Tizen")
327 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_03.Tizen")
328 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_04.Tizen")
329 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_05.Tizen")
330 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_06.Tizen")
331 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_07.Tizen")
332 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_08.Tizen")
333 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_09.Tizen")
334 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_10.Tizen")
338 parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
339 parser.add_argument("TC_NUMBER", type=str, nargs="*", help="Individual excution")
340 args = parser.parse_args()
343 if args.TC_NUMBER and "TC_" in args.TC_NUMBER[0]:
345 for tc_num in args.TC_NUMBER:
346 if tc_num not in funcMap:
347 print(f"There is no {tc_num} test.")
350 tc_array.append(funcMap[tc_num])
352 tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_07, TC_08, TC_09, TC_10]
355 if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
356 serial = read_serial(sys.argv[1])
358 serial = read_serial(None)
361 print("No connected device(s).")
364 device = get_device_type()
365 print(f"=== Dotnet-Launcher [{device}] Test Case - ({module_name}) ===")
372 '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, 'TC_09': TC_09, 'TC_10': TC_10,
373 'PLUGIN_TC_01': TC_01, 'PLUGIN_TC_02': TC_02, 'PLUGIN_TC_03': TC_03, 'PLUGIN_TC_04': TC_04, 'PLUGIN_TC_05': TC_05,
374 'PLUGIN_TC_06': TC_06, 'PLUGIN_TC_07': TC_07, 'PLUGIN_TC_08': TC_08, 'PLUGIN_TC_09': TC_09, 'PLUGIN_TC_10': TC_10
378 if __name__ == "__main__":
381 except KeyboardInterrupt:
382 print("\nExit (Pressed Ctrl+C)")