From: j-h.choi Date: Tue, 5 Jan 2021 04:50:42 +0000 (+0900) Subject: [TC Fixed] Exclude TC not supported by specific platform X-Git-Tag: submit/tizen/20210125.003944~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=806813186bf55dc185dd525f762052677920be90;p=platform%2Fcore%2Fdotnet%2Flauncher.git [TC Fixed] Exclude TC not supported by specific platform Change-Id: I845ebe415eec352e899732751e43012149ad1e26 --- diff --git a/tests/TCs/1_AOT/AOT.py b/tests/TCs/1_AOT/AOT.py index 8be7e01..f2bcccf 100755 --- a/tests/TCs/1_AOT/AOT.py +++ b/tests/TCs/1_AOT/AOT.py @@ -118,10 +118,14 @@ def run(): global tpk_list tpk_list = search_tpk(f"{module_name}") - p = run_tc_array(module_name, tc_array) - f = len(tc_array) - p - r = round(((p / len(tc_array)) * 100), 2) - print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n") + pn = run_tc_array(module_name, tc_array) + p = int(pn.split(":")[0]) + n = int(pn.split(":")[1]) + r = 0.0 + f = len(tc_array) - p - n + if (len(tc_array) - n) != 0: + r = round(((p / (len(tc_array) - n)) * 100), 2) + print(f"--- {module_name} TCT Result ---\nNONE : [{n}] / FAIL : [{f}] / PASS : [{p}] - [{r}%]\n") # Uninstall the application and restore to original state def clean(): diff --git a/tests/TCs/2_PLUGIN/PLUGIN.py b/tests/TCs/2_PLUGIN/PLUGIN.py index e8cced4..4ffb43c 100755 --- a/tests/TCs/2_PLUGIN/PLUGIN.py +++ b/tests/TCs/2_PLUGIN/PLUGIN.py @@ -33,6 +33,9 @@ def TC_01(): # The `Launcher_TC_PLUGIN_02` application must have a library of Tizen OS. def TC_02(): + if not check_tc_support(): + return "NONE - TC_02 is not supported on this platform" + sln_name = "Launcher_TC_PLUGIN_02.Tizen" tpk_path = get_tpk_path(tpk_list, f"{sln_name}") @@ -187,6 +190,9 @@ def TC_06(): # The `Launcher_TC_PLUGIN_07` application must not have TLC applied. def TC_07(): + if not check_tc_support(): + return "NONE - TC_07 is not supported on this platform" + sln_name = "Launcher_TC_PLUGIN_07.Tizen" tpk_path = get_tpk_path(tpk_list, f"{sln_name}") @@ -216,6 +222,9 @@ def TC_07(): # The `Launcher_TC_PLUGIN_08` application must have TLC applied. def TC_08(): + if not check_tc_support(): + return "NONE - TC_08 is not supported on this platform" + sln_name = "Launcher_TC_PLUGIN_08.Tizen" tpk_path = get_tpk_path(tpk_list, f"{sln_name}") @@ -258,10 +267,14 @@ def run(): global tpk_list tpk_list = search_tpk(f"{module_name}") - p = run_tc_array(module_name, tc_array) - f = len(tc_array) - p - r = round(((p / len(tc_array)) * 100), 2) - print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n") + pn = run_tc_array(module_name, tc_array) + p = int(pn.split(":")[0]) + n = int(pn.split(":")[1]) + r = 0.0 + f = len(tc_array) - p - n + if (len(tc_array) - n) != 0: + r = round(((p / (len(tc_array) - n)) * 100), 2) + print(f"--- {module_name} TCT Result ---\nNONE : [{n}] / FAIL : [{f}] / PASS : [{p}] - [{r}%]\n") # Uninstall the application and restore to original state def clean(): diff --git a/tests/TCs/3_PRELOAD/PRELOAD.py b/tests/TCs/3_PRELOAD/PRELOAD.py index 611c866..34fefc2 100755 --- a/tests/TCs/3_PRELOAD/PRELOAD.py +++ b/tests/TCs/3_PRELOAD/PRELOAD.py @@ -98,10 +98,14 @@ def run(): global tpk_list tpk_list = search_tpk(f"{module_name}") - p = run_tc_array(module_name, tc_array) - f = len(tc_array) - p - r = round(((p / len(tc_array)) * 100), 2) - print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n") + pn = run_tc_array(module_name, tc_array) + p = int(pn.split(":")[0]) + n = int(pn.split(":")[1]) + r = 0.0 + f = len(tc_array) - p - n + if (len(tc_array) - n) != 0: + r = round(((p / (len(tc_array) - n)) * 100), 2) + print(f"--- {module_name} TCT Result ---\nNONE : [{n}] / FAIL : [{f}] / PASS : [{p}] - [{r}%]\n") # Uninstall the application and restore to original state def clean(): diff --git a/tests/TCs/4_TAC/TAC.py b/tests/TCs/4_TAC/TAC.py index ef165d2..287ac21 100755 --- a/tests/TCs/4_TAC/TAC.py +++ b/tests/TCs/4_TAC/TAC.py @@ -506,10 +506,14 @@ def run(): global tpk_list tpk_list = search_tpk(f"{module_name}") - p = run_tc_array(module_name, tc_array) - f = len(tc_array) - p - r = round(((p / len(tc_array)) * 100), 2) - print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n") + pn = run_tc_array(module_name, tc_array) + p = int(pn.split(":")[0]) + n = int(pn.split(":")[1]) + r = 0.0 + f = len(tc_array) - p - n + if (len(tc_array) - n) != 0: + r = round(((p / (len(tc_array) - n)) * 100), 2) + print(f"--- {module_name} TCT Result ---\nNONE : [{n}] / FAIL : [{f}] / PASS : [{p}] - [{r}%]\n") # Uninstall the application and restore to original state def clean(): diff --git a/tests/TCs/5_TLC/TLC.py b/tests/TCs/5_TLC/TLC.py index 2da7cf6..974ede7 100755 --- a/tests/TCs/5_TLC/TLC.py +++ b/tests/TCs/5_TLC/TLC.py @@ -11,6 +11,9 @@ module_name = "TLC" # The `Launcher_TC_TLC_01` application must have TLC applied. def TC_01(): + if not check_tc_support(): + return "NONE - TC_01 is not supported on this platform" + sln_name = "Launcher_TC_TLC_01.Tizen" tpk_path = get_tpk_path(tpk_list, f"{sln_name}") @@ -57,6 +60,9 @@ def TC_01(): # The `Launcher_TC_TLC_02` application must have TLC applied. def TC_02(): + if not check_tc_support(): + return "NONE - TC_02 is not supported on this platform" + sln_name = "Launcher_TC_TLC_02.Tizen" tpk_path = get_tpk_path(tpk_list, f"{sln_name}") @@ -103,6 +109,9 @@ def TC_02(): # The `Launcher_TC_TLC_03` application should not apply TLC when updating. def TC_03(): + if not check_tc_support(): + return "NONE - TC_03 is not supported on this platform" + pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen" root_path = get_root_path(f"{pkg_id}") @@ -165,6 +174,9 @@ def TC_02_03(): # The `Launcher_TC_TLC_04` application is normally TLC applied when updating. def TC_04(): + if not check_tc_support(): + return "NONE - TC_04 is not supported on this platform" + sln_name = "Launcher_TC_TLC_04.Tizen" tpk_path = get_tpk_path(tpk_list, f"{sln_name}") @@ -211,6 +223,9 @@ def TC_04(): # The `Launcher_TC_TLC_05` application is normally TLC applied when updating. def TC_05(): + if not check_tc_support(): + return "NONE - TC_05 is not supported on this platform" + pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen" root_path = get_root_path(f"{pkg_id}") @@ -287,6 +302,9 @@ def TC_04_05(): # The `Launcher_TC_TLC_06` application should not apply TLC when updating. def TC_06(): + if not check_tc_support(): + return "NONE - TC_06 is not supported on this platform" + pkg_id = f"org.tizen.example.Launcher_TC_TLC_00.Tizen" root_path = get_root_path(f"{pkg_id}") @@ -361,6 +379,9 @@ def TC_04_05_06(): # The `Launcher_TC_TLC_07`, `Launcher_TC_TLC_08` applications using the same nuget are normally TLC applied. def TC_07(): + if not check_tc_support(): + return "NONE - TC_07 is not supported on this platform" + sln_name = "Launcher_TC_TLC_07.Tizen" tpk_path = get_tpk_path(tpk_list, f"{sln_name}") @@ -443,6 +464,9 @@ def TC_07(): # The `Launcher_TC_TLC_09` application is normally TLC applied when uninstall. def TC_08(): + if not check_tc_support(): + return "NONE - TC_08 is not supported on this platform" + sln_name = "Launcher_TC_TLC_09.Tizen" tpk_path = get_tpk_path(tpk_list, f"{sln_name}") @@ -459,7 +483,7 @@ def TC_08(): return f"FAIL : Get the root path for {pkg_id}" if not exist(f"{root_path}/bin/libSkiaSharp.so"): - return "FAIL : The libSkiaSharp.so library should exist" + return "FAIL : The libSkiaSharp.so library should exist in the application" raw = cmd(f"shell ls -alZ {root_path}/bin/libSkiaSharp.so") if (f"{root_path}/bin/libSkiaSharp.so" not in raw) or \ @@ -487,6 +511,9 @@ def TC_08(): # The `Launcher_TC_TLC_10` application should match the information of nuget with the value of TLC database. def TC_09(): + if not check_tc_support(): + return "NONE - TC_09 is not supported on this platform" + sln_name = "Launcher_TC_TLC_10.Tizen" tpk_path = get_tpk_path(tpk_list, f"{sln_name}") @@ -505,7 +532,7 @@ def TC_09(): raw = cmd(f"shell find {root_path}/bin/ -name lib*.so*") lines1 = [l for l in raw.splitlines()] if len(lines1) == 0: - return "FAIL : The library should exist in the application" + return "FAIL : The libraries should exist in the application" raw = subprocess.run((f"sdb -s {serial} shell sqlite3 {DOTNET_DIR}.TLC.App.list.db").split(), stdout=subprocess.PIPE, input=f"select * from TLC;\n.q\n", encoding="utf-8").stdout lines2 = [l for l in raw.splitlines() if f"{pkg_id}" in l] @@ -546,10 +573,14 @@ def run(): global tpk_list tpk_list = search_tpk(f"{module_name}") - p = run_tc_array(module_name, tc_array) - f = len(tc_array) - p - r = round(((p / len(tc_array)) * 100), 2) - print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n") + pn = run_tc_array(module_name, tc_array) + p = int(pn.split(":")[0]) + n = int(pn.split(":")[1]) + r = 0.0 + f = len(tc_array) - p - n + if (len(tc_array) - n) != 0: + r = round(((p / (len(tc_array) - n)) * 100), 2) + print(f"--- {module_name} TCT Result ---\nNONE : [{n}] / FAIL : [{f}] / PASS : [{p}] - [{r}%]\n") # Uninstall the application and restore to original state def clean(): diff --git a/tests/TCs/6_TOOL/TOOL.py b/tests/TCs/6_TOOL/TOOL.py index 241464b..73a6c9b 100755 --- a/tests/TCs/6_TOOL/TOOL.py +++ b/tests/TCs/6_TOOL/TOOL.py @@ -503,10 +503,14 @@ def run(): global tpk_list tpk_list = search_tpk(f"{module_name}") - p = run_tc_array(module_name, tc_array) - f = len(tc_array) - p - r = round(((p / len(tc_array)) * 100), 2) - print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n") + pn = run_tc_array(module_name, tc_array) + p = int(pn.split(":")[0]) + n = int(pn.split(":")[1]) + r = 0.0 + f = len(tc_array) - p - n + if (len(tc_array) - n) != 0: + r = round(((p / (len(tc_array) - n)) * 100), 2) + print(f"--- {module_name} TCT Result ---\nNONE : [{n}] / FAIL : [{f}] / PASS : [{p}] - [{r}%]\n") # Uninstall the application and restore to original state def clean(): diff --git a/tests/TCs/7_LAUNCH/LAUNCH.py b/tests/TCs/7_LAUNCH/LAUNCH.py index 062e118..a343674 100755 --- a/tests/TCs/7_LAUNCH/LAUNCH.py +++ b/tests/TCs/7_LAUNCH/LAUNCH.py @@ -145,7 +145,7 @@ def TC_04(): cmd(f"shell chmod 644 /usr/share/aul/dotnet.loader") cmd(f"shell reboot -f") - sleep(30) + sleep(60) if "." in serial: subprocess.run((f"sdb connect {serial}").split(), encoding="utf-8", stdout=subprocess.PIPE).stdout @@ -180,10 +180,14 @@ def run(): global tpk_list tpk_list = search_tpk(f"{module_name}") - p = run_tc_array(module_name, tc_array) - f = len(tc_array) - p - r = round(((p / len(tc_array)) * 100), 2) - print(f"--- {module_name} TCT Result ---\nFAIL : [{f}] / PASS : [{p}] - [{r}%]\n") + pn = run_tc_array(module_name, tc_array) + p = int(pn.split(":")[0]) + n = int(pn.split(":")[1]) + r = 0.0 + f = len(tc_array) - p - n + if (len(tc_array) - n) != 0: + r = round(((p / (len(tc_array) - n)) * 100), 2) + print(f"--- {module_name} TCT Result ---\nNONE : [{n}] / FAIL : [{f}] / PASS : [{p}] - [{r}%]\n") # Uninstall the application and restore to original state def clean(): diff --git a/tests/TCs/Utils.py b/tests/TCs/Utils.py index e4b8390..f6a3572 100755 --- a/tests/TCs/Utils.py +++ b/tests/TCs/Utils.py @@ -145,26 +145,31 @@ def prepare_candidate_process(loader, pkg_id): pid = raw.split()[1] return f"OK : {pid}" +# Get the device arch +def get_device_arch(): + raw = cmd("capability") + line = [l for l in raw.splitlines() if "cpu_arch" in l] + return line[0].split(":")[1] + # Check the library type def check_library_arch(rootpath, library): raw = cmd(f"pull {rootpath}/bin/{library} {library}") if "1 file(s) pulled. 0 file(s) skipped." not in raw: return "FAIL" - raw = cmd("capability") - line = [l for l in raw.splitlines() if "cpu_arch" in l] - target_arch = line[0].split(":")[1] raw = subprocess.run((f"file ./{library}").split(), encoding="utf-8", stdout=subprocess.PIPE).stdout - if "armv7" == target_arch: + subprocess.run((f"rm ./{library}").split(), encoding="utf-8", stdout=subprocess.PIPE).stdout + + device_arch = get_device_arch() + if "armv7" == device_arch: if "ARM" not in raw: return "FAIL" - elif "x86" == target_arch: + elif "x86" == device_arch: if "Intel 80386" not in raw: return "FAIL" else: return "FAIL" - subprocess.run((f"rm ./{library}").split(), encoding="utf-8", stdout=subprocess.PIPE).stdout return "OK" # Check if the file or directory exists @@ -178,10 +183,18 @@ def exist(path): # Run the test array def run_tc_array(module_name, tc_array): p = 0 + n = 0 for tc in tc_array: print(f">{module_name}_{tc.__name__}...", end="\r") ret = tc() print(f">{module_name}_{tc.__name__} : {ret}") if "PASS" == ret: p += 1 + if "NONE" in ret: n += 1 sleep(3) - return p + return str(p) + ":" + str(n) + +def check_tc_support(): + if "armv8" == get_device_arch(): + return False + else: + return True