cmd(f"shell dotnettool --ni-regen-all-app")
raw = subprocess.run((f"sdb -s {serial} shell pkginfo --metadata-flt").split(), stdout=subprocess.PIPE, input=f"http://tizen.org/metadata/prefer_dotnet_aot\ntrue\n", encoding="utf-8").stdout
- lines1 = [l for l in raw.splitlines() if "appid" in l]
- lines2 = []
- for app in lines1:
+ lines = [l for l in raw.splitlines() if "appid" in l]
+ for app in lines:
pkg_id = app.split(": ")[1]
raw = subprocess.run((f"sdb -s {serial} shell pkginfo --pkg {pkg_id}").split(), stdout=subprocess.PIPE, encoding="utf-8").stdout
- lines2 = [l for l in raw.splitlines() if "root_path" in l]
-
- for path in lines2:
- root_path = path.split(": ")[1]
- raw = cmd(f"shell find {root_path}/bin/.native_image/ -name *.ni.dll")
- lines3 = [l for l in raw.splitlines()]
- raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
- lines4 = [l for l in raw.splitlines()]
- if len(lines3) != len(lines4):
- return "FAIL : The number of .dll and .ni.dll must match in the application"
-
- for ni in lines3:
- is_same = False
- for dll in lines4:
- if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
- is_same = True
- break
- if not is_same:
- return "FAIL : The file name of .dll and .ni.dll must match in the application"
+ readonly = [l for l in raw.splitlines() if "Readonly" in l]
+ if "0" == readonly[0].split(": ")[1]:
+ path = [l for l in raw.splitlines() if "root_path" in l]
+ root_path = path[0].split(": ")[1]
+ raw = cmd(f"shell find {root_path}/bin/.native_image/ -name *.ni.dll")
+ lines1 = [l for l in raw.splitlines()]
+ raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
+ lines2 = [l for l in raw.splitlines()]
+ if len(lines1) != len(lines2):
+ return "FAIL : The number of .dll and .ni.dll must match in the application"
+
+ for ni in lines1:
+ is_same = False
+ for dll in lines2:
+ if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
+ is_same = True
+ break
+ if not is_same:
+ return "FAIL : The file name of .dll and .ni.dll must match in the application"
return "PASS"
return "PASS"
+# The prefer_dotnet_aot metadata value of true will regenerates the native image in all .NET applications of read-only type.
+def TC_17():
+ sln_name = "Launcher_TC_TOOL_08.Tizen"
-#def TC_17():
-#dotnettool --resolve-all-app
+ tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
+ if tpk_path == None:
+ return f"FAIL : Get the tpk path for {sln_name}"
+
+ raw = cmd(f"push {tpk_path} /usr/apps/.preload-tpk/")
+ if "1 file(s) pushed. 0 file(s) skipped." in raw:
+ cmd(f"shell install_preload_pkg")
+
+ cmd(f"shell dotnettool --ni-regen-all-ro-app")
+
+ raw = subprocess.run((f"sdb -s {serial} shell pkginfo --metadata-flt").split(), stdout=subprocess.PIPE, input=f"http://tizen.org/metadata/prefer_dotnet_aot\ntrue\n", encoding="utf-8").stdout
+ lines = [l for l in raw.splitlines() if "appid" in l]
+ for app in lines:
+ pkg_id = app.split(": ")[1]
+ raw = subprocess.run((f"sdb -s {serial} shell pkginfo --pkg {pkg_id}").split(), stdout=subprocess.PIPE, encoding="utf-8").stdout
+ readonly = [l for l in raw.splitlines() if "Readonly" in l]
+ if "1" == readonly[0].split(": ")[1]:
+ path = [l for l in raw.splitlines() if "root_path" in l]
+ root_path = path[0].split(": ")[1]
+ raw = cmd(f"shell find {DOTNET_DIR}apps/{pkg_id}/bin/.native_image/ -name *.ni.dll")
+ lines1 = [l for l in raw.splitlines()]
+ raw = cmd(f"shell find {root_path}/bin/ -maxdepth 1 -name *.dll -not -name *.ni.dll")
+ lines2 = [l for l in raw.splitlines()]
+ if len(lines1) != len(lines2):
+ return "FAIL : The number of .dll and .ni.dll must match in the application"
+
+ for ni in lines1:
+ is_same = False
+ for dll in lines2:
+ if Path(ni).name.replace(".ni.dll", "") == Path(dll).name.replace(".dll", ""):
+ is_same = True
+ break
+ if not is_same:
+ return "FAIL : The file name of .dll and .ni.dll must match in the application"
+
+ return "PASS"
-#def TC_18():
-#dotnettool --instrument
+# The `Launcher_TC_TOOL_08` application should load the newly generated native image.
+def TC_18():
+ pkg_id = f"org.tizen.example.Launcher_TC_TOOL_08.Tizen"
+
+ pid = launch_and_get_pid(f"-e", f"{pkg_id}")
+ if 0 == pid:
+ return f"FAIL : Get the pid for {pkg_id}"
+
+ raw = cmd(f"shell cat /proc/{pid}/smaps | grep Xamarin.Forms.*.dll")
+ if (f"{DOTNET_DIR}apps/{pkg_id}/bin/.native_image/Xamarin.Forms.Platform.Tizen.ni.dll" not in raw) or \
+ (f"{DOTNET_DIR}apps/{pkg_id}/bin/.native_image/Xamarin.Forms.Core.ni.dll" not in raw) or \
+ (f"{DOTNET_DIR}apps/{pkg_id}/bin/.native_image/Xamarin.Forms.Platform.ni.dll" not in raw):
+ return "FAIL : The Xamarin.Forms in the application should be loaded when running the application"
+
+ cmd(f"shell app_launcher -t {pkg_id}")
+
+ return "PASS"
+
+# It should be done together for update test.
+def TC_17_18():
+ ret = TC_17()
+ if "PASS" != ret:
+ return f"{ret}"
+
+ ret = TC_18()
+ if "PASS" != ret:
+ return f"{ret}"
+
+ return "PASS"
#def TC_19():
-#dotnettool --compatibility
+#dotnettool --resolve-all-app
# Run the test
cmd(f"shell rm -rf {IBCDATA_DIR}")
+ cmd(f"shell rm -rf {DOTNET_DIR}apps/org.tizen.example.Launcher_TC_TOOL_08.Tizen")
+
# Main entry point
def main():
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter)
else:
tc_array.append(funcMap[tc_num])
else:
- tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_07, TC_08, TC_09, TC_10, TC_11, TC_12, TC_13, TC_14, TC_15, TC_16]
+ tc_array = [TC_01, TC_02, TC_03, TC_04, TC_05, TC_06, TC_07, TC_08, TC_09, TC_10, TC_11, TC_12, TC_13, TC_14, TC_15, TC_16, TC_17, TC_18]
global serial
if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
funcMap = {
-'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,
-'TC_11': TC_11, 'TC_12': TC_12, 'TC_13': TC_13, 'TC_14': TC_14, 'TC_15': TC_15, 'TC_16': TC_16,
-'TOOL_TC_01': TC_01, 'TOOL_TC_02': TC_02, 'TOOL_TC_03': TC_03, 'TOOL_TC_04': TC_04, 'TOOL_TC_05': TC_05,
-'TOOL_TC_06': TC_06, 'TOOL_TC_07': TC_07, 'TOOL_TC_08': TC_08, 'TOOL_TC_09': TC_09, 'TOOL_TC_10': TC_10,
-'TOOL_TC_11': TC_11, 'TOOL_TC_12': TC_12, 'TOOL_TC_13': TC_13, 'TOOL_TC_14': TC_14, 'TOOL_TC_15': TC_15, 'TOOL_TC_16': TC_16
+'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, 'TC_11': TC_11, 'TC_12': TC_12,
+'TC_13': TC_13, 'TC_14': TC_14, 'TC_15': TC_15, 'TC_16': TC_16, 'TC_17': TC_17, 'TC_18': TC_17_18,
+'TOOL_TC_01': TC_01, 'TOOL_TC_02': TC_02, 'TOOL_TC_03': TC_03, 'TOOL_TC_04': TC_04, 'TOOL_TC_05': TC_05, 'TOOL_TC_06': TC_06,
+'TOOL_TC_07': TC_07, 'TOOL_TC_08': TC_08, 'TOOL_TC_09': TC_09, 'TOOL_TC_10': TC_10, 'TOOL_TC_11': TC_11, 'TOOL_TC_12': TC_12,
+'TOOL_TC_13': TC_13, 'TOOL_TC_14': TC_14, 'TOOL_TC_15': TC_15, 'TOOL_TC_16': TC_16, 'TOOL_TC_17': TC_17, 'TOOL_TC_18': TC_17_18
}