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 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
52 if f"{root_path}/bin/libSkiaSharp.so" not in raw:
53 return "FAIL : The libSkiaSharp.so library should exist"
55 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
56 return "FAIL : The arch of the target and the arch of the library must match"
60 # The `Launcher_TC_PLUGIN_03` application does not generate native image.
62 if "OK" not in create_spc_ni():
63 return f"FAIL : Create native image for {SPC_DLL}"
65 sln_name = "Launcher_TC_PLUGIN_03.Tizen"
67 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
69 return f"FAIL : Get the tpk path for {sln_name}"
71 if "OK" not in app_install(f"{tpk_path}"):
72 return f"FAIL : Install the application for {tpk_path}"
74 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_03.Tizen"
76 root_path = get_root_path(f"{pkg_id}")
77 if root_path == "None":
78 return f"FAIL : Get the root path for {pkg_id}"
80 raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
81 if ".native_image" in raw:
82 return "FAIL : The .native_image folder should not exist"
84 raw = cmd(f"shell find {root_path}/bin/ -name *.ni.dll")
85 lines = [l for l in raw.splitlines()]
87 return "FAIL : The .ni.dll files should not exist"
91 # The `Launcher_TC_PLUGIN_04` application generates native image.
93 if "OK" not in create_spc_ni():
94 return f"FAIL : Create native image for {SPC_DLL}"
96 sln_name = "Launcher_TC_PLUGIN_04.Tizen"
98 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
100 return f"FAIL : Get the tpk path for {sln_name}"
102 if "OK" not in app_install(f"{tpk_path}"):
103 return f"FAIL : Install the application for {tpk_path}"
105 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_04.Tizen"
107 root_path = get_root_path(f"{pkg_id}")
108 if root_path == "None":
109 return f"FAIL : Get the root path for {pkg_id}"
111 raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
112 if ".native_image" not in raw:
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 raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
151 if ".tac_symlink" in raw:
152 return "FAIL : The .tac_symlink folder should not exist"
156 # The `Launcher_TC_PLUGIN_06` application must have TAC applied.
158 sln_name = "Launcher_TC_PLUGIN_06.Tizen"
160 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
162 return f"FAIL : Get the tpk path for {sln_name}"
164 if "OK" not in app_install(f"{tpk_path}"):
165 return f"FAIL : Install the application for {tpk_path}"
167 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_06.Tizen"
169 root_path = get_root_path(f"{pkg_id}")
170 if root_path == "None":
171 return f"FAIL : Get the root path for {pkg_id}"
173 raw = cmd(f"shell find {root_path}/bin/ -name .tac_symlink")
174 if ".tac_symlink" not in raw:
175 return "FAIL : The .tac_symlink folder should exist"
177 raw = cmd(f"shell find {root_path}/bin/.tac_symlink/ -name *.dll -not -name *.ni.dll")
178 lines1 = [l for l in raw.splitlines()]
179 raw = cmd(f"shell find {DOTNET_DIR}Xamarin.Forms/4.6.0.967/ -name *.dll -not -name *.ni.dll")
180 lines2 = [l for l in raw.splitlines()]
181 if len(lines1) != len(lines2):
182 return "FAIL : The number of .dll in the .tac_symlink and .dll in the TAC must match"
184 raw = cmd(f"shell ls -alZ {root_path}/bin/.tac_symlink/*.dll")
185 lines = [l for l in raw.splitlines() if ".ni.dll" not in l]
187 origin_path = dll.split("->")[1].strip()
188 raw = cmd(f"shell ls -alZ {origin_path}")
189 if "No such file or directory" in raw:
190 return "FAIL : The original file of the symbolic link must exist"
194 # The `Launcher_TC_PLUGIN_07` application must not have TLC applied.
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 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
212 if f"{root_path}/bin/libSkiaSharp.so" not in raw:
213 return "FAIL : The libSkiaSharp.so library should exist only"
215 return "FAIL : The libSkiaSharp.so library should not be a symbolic link"
217 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
218 return "FAIL : The arch of the target and the arch of the library must match"
222 # The `Launcher_TC_PLUGIN_08` application must have TLC applied.
224 sln_name = "Launcher_TC_PLUGIN_08.Tizen"
226 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
228 return f"FAIL : Get the tpk path for {sln_name}"
230 if "OK" not in app_install(f"{tpk_path}"):
231 return f"FAIL : Install the application for {tpk_path}"
233 pkg_id = f"org.tizen.example.Launcher_TC_PLUGIN_08.Tizen"
235 root_path = get_root_path(f"{pkg_id}")
236 if root_path == "None":
237 return f"FAIL : Get the root path for {pkg_id}"
239 raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so")
240 if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \
241 (f"{DOTNET_DIR}Libraries/libSkiaSharp.so.." not in raw):
242 return "FAIL : The libSkiaSharp.so library should exist or be a symbolic link"
244 sha = raw.split("..")[1].rstrip()
246 raw = cmd(f"shell find {DOTNET_DIR}Libraries/ -name libSkiaSharp.so*")
248 return f"FAIL : The libSkiaSharp.so library should exist in {DOTNET_DIR}"
250 if "OK" not in check_library_arch(f"{root_path}", "libSkiaSharp.so"):
251 return "FAIL : The arch of the target and the arch of the library must match"
258 cmd(f"shell mount -o remount,rw /")
261 tpk_list = search_tpk(f"{module_name}")
263 p = run_tc_array(module_name, tc_array)
264 f = len(tc_array) - p
265 r = round(((p / len(tc_array)) * 100), 2)
266 print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n")
268 # Uninstall the application and restore to original state
270 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_01.Tizen")
271 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_02.Tizen")
272 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_03.Tizen")
273 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_04.Tizen")
274 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_05.Tizen")
275 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_06.Tizen")
276 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_07.Tizen")
277 cmd(f"uninstall org.tizen.example.Launcher_TC_PLUGIN_08.Tizen")
281 parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
282 parser.add_argument("TC_NUMBER", type=str, nargs="*", help="Individual excution")
283 args = parser.parse_args()
286 if "TC_" in args.TC_NUMBER[0]:
288 for tc_num in args.TC_NUMBER:
289 if tc_num not in funcMap:
290 print(f"There is no {tc_num} test.")
293 tc_array.append(funcMap[tc_num])
295 tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_07, TC_08]
298 if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
299 serial = read_serial(sys.argv[1])
301 serial = read_serial(None)
304 print("No connected device(s).")
307 device = get_device_type()
308 print(f"=== Dotnet-Launcher [{device}] Test Case - ({module_name}) ===")
315 '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,
316 'PLUGIN_TC_01': TC_01, 'PLUGIN_TC_02': TC_02, 'PLUGIN_TC_03': TC_03, 'PLUGIN_TC_04': TC_04,
317 'PLUGIN_TC_05': TC_05, 'PLUGIN_TC_06': TC_06, 'PLUGIN_TC_07': TC_07, 'PLUGIN_TC_08': TC_08
321 if __name__ == "__main__":
324 except KeyboardInterrupt:
325 print("\nExit (Pressed Ctrl+C)")