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_AOT_01` application does not generate native image.
14 if "OK" not in create_spc_ni():
15 return f"FAIL : Create native image for {SPC_DLL}"
17 sln_name = "Launcher_TC_AOT_01.Tizen"
19 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
21 return f"FAIL : Get the tpk path for {sln_name}"
23 if "OK" not in app_install(f"{tpk_path}"):
24 return f"FAIL : Install the application for {tpk_path}"
26 pkg_id = "org.tizen.example.Launcher_TC_AOT_01.Tizen"
28 root_path = get_root_path(f"{pkg_id}")
29 if root_path == "None":
30 return f"FAIL : Get the root path for {pkg_id}"
32 raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
33 if ".native_image" in raw:
34 return "FAIL : The .native_image folder should not exist"
36 raw = cmd(f"shell find {root_path}/bin/ -name *.ni.dll")
37 lines = [l for l in raw.splitlines()]
39 return "FAIL : The .ni.dll files should not exist"
43 # The `Launcher_TC_AOT_02` application generates native image.
45 if "OK" not in create_spc_ni():
46 return f"FAIL : Create native image for {SPC_DLL}"
48 sln_name = "Launcher_TC_AOT_02.Tizen"
50 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
52 return f"FAIL : Get the tpk path for {sln_name}"
54 if "OK" not in app_install(f"{tpk_path}"):
55 return f"FAIL : Install the application for {tpk_path}"
57 pkg_id = "org.tizen.example.Launcher_TC_AOT_02.Tizen"
59 root_path = get_root_path(f"{pkg_id}")
60 if root_path == "None":
61 return f"FAIL : Get the root path for {pkg_id}"
63 raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
64 if ".native_image" not in raw:
65 return "FAIL : The .native_image folder should exist"
67 raw = cmd(f"shell find {root_path}/bin/.native_image/ -name *.ni.dll")
68 lines1 = [l for l in raw.splitlines()]
69 raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
70 lines2 = [l for l in raw.splitlines()]
71 if len(lines1) != len(lines2):
72 return "FAIL : The number of .dll and .ni.dll must match in the application"
77 if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
81 return "FAIL : The file name of .dll and .ni.dll must match in the application"
85 # The `Launcher_TC_AOT_03` application does not generate native image.
87 if "OK" not in remove_system_ni():
88 return "FAIL : Remove the platform native image"
90 sln_name = "Launcher_TC_AOT_03.Tizen"
92 tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
94 return f"FAIL : Get the tpk path for {sln_name}"
96 if "OK" not in app_install(f"{tpk_path}"):
97 return f"FAIL : Install the application for {tpk_path}"
99 pkg_id = "org.tizen.example.Launcher_TC_AOT_03.Tizen"
101 root_path = get_root_path(f"{pkg_id}")
102 if root_path == "None":
103 return f"FAIL : Get the root path for {pkg_id}"
105 raw = cmd(f"shell find {root_path}/bin/ -name .native_image")
106 if ".native_image" in raw:
107 return "FAIL : The .native_image folder should not exist"
109 raw = cmd(f"shell find {root_path}/bin/ -name *.ni.dll")
110 lines = [l for l in raw.splitlines()]
112 return "FAIL : The .ni.dll files should not exist"
119 cmd(f"shell mount -o remount,rw /")
122 tpk_list = search_tpk(f"{module_name}")
124 p = run_tc_array(module_name, tc_array)
125 f = len(tc_array) - p
126 r = round(((p / len(tc_array)) * 100), 2)
127 print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n")
129 # Uninstall the application and restore to original state
131 cmd(f"uninstall org.tizen.example.Launcher_TC_AOT_01.Tizen")
132 cmd(f"uninstall org.tizen.example.Launcher_TC_AOT_02.Tizen")
133 cmd(f"uninstall org.tizen.example.Launcher_TC_AOT_03.Tizen")
139 parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
140 parser.add_argument("TC_NUMBER", type=str, nargs="*", help="Individual excution")
141 args = parser.parse_args()
144 if "TC_" in args.TC_NUMBER[0]:
146 for tc_num in args.TC_NUMBER:
147 if tc_num not in funcMap:
148 print(f"There is no {tc_num} test.")
151 tc_array.append(funcMap[tc_num])
153 tc_array = [TC_01, TC_02, TC_03]
156 if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
157 serial = read_serial(sys.argv[1])
159 serial = read_serial(None)
162 print("No connected device(s).")
165 device = get_device_type()
166 print(f"=== Dotnet-Launcher [{device}] Test Case - ({module_name}) ===")
173 'TC_01': TC_01, 'TC_02': TC_02, 'TC_03': TC_03,
174 'AOT_TC_01': TC_01, 'AOT_TC_02': TC_02, 'AOT_TC_03': TC_03
178 if __name__ == "__main__":
181 except KeyboardInterrupt:
182 print("\nExit (Pressed Ctrl+C)")