From 93995d56dca800318ff7be67e1df1a1a3e3282a2 Mon Sep 17 00:00:00 2001 From: "j-h.choi" Date: Mon, 4 Jan 2021 10:35:24 +0900 Subject: [PATCH] [TC Fixed] Change the logical operator of the if statement Change-Id: Ibfea439c2c72e9783ef4bb6ebb46aed2adbad557 --- tests/TCs/4_TAC/TAC.py | 32 ++++++++++++++++++-------------- tests/TCs/6_TOOL/TOOL.py | 22 +++++++++++++--------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/tests/TCs/4_TAC/TAC.py b/tests/TCs/4_TAC/TAC.py index 4966987..ef165d2 100755 --- a/tests/TCs/4_TAC/TAC.py +++ b/tests/TCs/4_TAC/TAC.py @@ -47,8 +47,8 @@ def TC_01(): 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}Xamarin.Forms/4.6.0.967/Xamarin.Forms.Platform.Tizen.dll" not in raw) and \ - (f"{DOTNET_DIR}Xamarin.Forms/4.6.0.967/Xamarin.Forms.Core.dll" not in raw) and \ + if (f"{DOTNET_DIR}Xamarin.Forms/4.6.0.967/Xamarin.Forms.Platform.Tizen.dll" not in raw) or \ + (f"{DOTNET_DIR}Xamarin.Forms/4.6.0.967/Xamarin.Forms.Core.dll" not in raw) or \ (f"{DOTNET_DIR}Xamarin.Forms/4.6.0.967/Xamarin.Forms.Platform.dll" not in raw): return "FAIL : The Xamarin.Forms in the TAC should be loaded when running the application" @@ -97,8 +97,8 @@ def TC_02(): 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}Xamarin.Forms/4.8.0.1364/Xamarin.Forms.Platform.Tizen.dll" not in raw) and \ - (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1364/Xamarin.Forms.Core.dll" not in raw) and \ + if (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1364/Xamarin.Forms.Platform.Tizen.dll" not in raw) or \ + (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1364/Xamarin.Forms.Core.dll" not in raw) or \ (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1364/Xamarin.Forms.Platform.dll" not in raw): return "FAIL : The Xamarin.Forms in the TAC should be loaded when running the application" @@ -159,8 +159,8 @@ def TC_03(): 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}Xamarin.Forms/4.8.0.1687/Xamarin.Forms.Platform.Tizen.dll" not in raw) and \ - (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1687/Xamarin.Forms.Core.dll" not in raw) and \ + if (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1687/Xamarin.Forms.Platform.Tizen.dll" not in raw) or \ + (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1687/Xamarin.Forms.Core.dll" not in raw) or \ (f"{DOTNET_DIR}Xamarin.Forms/4.8.0.1687/Xamarin.Forms.Platform.dll" not in raw): return "FAIL : The Xamarin.Forms in the TAC should be loaded when running the application" @@ -213,8 +213,8 @@ def TC_04(): return f"FAIL : Get the pid for {pkg_id}" raw = cmd(f"shell cat /proc/{pid}/smaps | grep Xamarin.Forms.*.dll") - if (f"{root_path}/bin/Xamarin.Forms.Platform.Tizen.dll" not in raw) and \ - (f"{root_path}/bin/Xamarin.Forms.Core.dll" not in raw) and \ + if (f"{root_path}/bin/Xamarin.Forms.Platform.Tizen.dll" not in raw) or \ + (f"{root_path}/bin/Xamarin.Forms.Core.dll" not in raw) or \ (f"{root_path}/bin/Xamarin.Forms.Platform.dll" not in raw): return "FAIL : The Xamarin.Forms in the application should be loaded when running the application" @@ -311,8 +311,8 @@ def TC_05(): return f"FAIL : Get the pid for {pkg_id2}" raw = cmd(f"shell cat /proc/{pid}/smaps | grep Xamarin.Forms.*.dll") - if (f"{DOTNET_DIR}Xamarin.Forms/5.0.0.1558-pre3/Xamarin.Forms.Platform.Tizen.dll" not in raw) and \ - (f"{DOTNET_DIR}Xamarin.Forms/5.0.0.1558-pre3/Xamarin.Forms.Core.dll" not in raw) and \ + if (f"{DOTNET_DIR}Xamarin.Forms/5.0.0.1558-pre3/Xamarin.Forms.Platform.Tizen.dll" not in raw) or \ + (f"{DOTNET_DIR}Xamarin.Forms/5.0.0.1558-pre3/Xamarin.Forms.Core.dll" not in raw) or \ (f"{DOTNET_DIR}Xamarin.Forms/5.0.0.1558-pre3/Xamarin.Forms.Platform.dll" not in raw): return "FAIL : The Xamarin.Forms in the TAC should be loaded when running the application" @@ -458,10 +458,14 @@ def TC_08(): raw = subprocess.run((f"sdb -s {serial} shell sqlite3 {DOTNET_DIR}.TAC.App.list.db").split(), stdout=subprocess.PIPE, input=f"select * from TAC;\n.q\n", encoding="utf-8").stdout lines = [l for l in raw.splitlines() if f"{pkg_id}" in l] for rcd in lines: - if ("Xamarin.Forms/4.8.0.1560" not in rcd) and \ - ("Google.Apis.Core/1.49.0" not in rcd) and \ - ("Google.Apis/1.49.0" not in rcd) and \ - ("Newtonsoft.Json/12.0.3" not in rcd): + is_exist = False + if ("Xamarin.Forms/4.8.0.1560" in rcd) or \ + ("Google.Apis.Core/1.49.0" in rcd) or \ + ("Google.Apis/1.49.0" in rcd) or \ + ("Newtonsoft.Json/12.0.3" in rcd): + is_exist = True + continue + if not is_exist: return "FAIL : TAC database must have a valid value" return "PASS" diff --git a/tests/TCs/6_TOOL/TOOL.py b/tests/TCs/6_TOOL/TOOL.py index e2ed2f8..241464b 100755 --- a/tests/TCs/6_TOOL/TOOL.py +++ b/tests/TCs/6_TOOL/TOOL.py @@ -11,7 +11,7 @@ module_name = "TOOL" # The `dotnettool` works normally. def TC_01(): - if not exist("/usr/bin/dotnettool") + if not exist("/usr/bin/dotnettool"): return "FAIL : The dotnettool works normally" raw = cmd(f"shell dotnettool") @@ -68,8 +68,8 @@ def TC_04(): cmd(f"shell mv {RUNTIME_DIR}{SPC_DLL}.Backup {RUNTIME_DIR}{SPC_DLL}") raw = cmd(f"shell dotnettool --ni-dll {RUNTIME_DIR}{SPC_DLL}") - if f"{SPC_DLL} (FNV)" not in raw and \ - "System.Private.CoreLib.ni.dll generated successfully." not in raw: + if (f"{SPC_DLL} (FNV)" not in raw) or \ + ("System.Private.CoreLib.ni.dll generated successfully." not in raw): return f"FAIL : Create native image for {SPC_DLL}" if not exist(f"{RUNTIME_DIR}{SPC_DLL}.Backup"): @@ -111,8 +111,8 @@ def TC_06(): # Create native image for Tizen.dll in `R2R` mode. def TC_07(): raw = cmd(f"shell dotnettool --r2r --ni-dll {FRAMEWORK_DIR}Tizen.dll") - if "Tizen.dll (R2R)" not in raw and \ - "Tizen.ni.dll generated successfully." not in raw: + if ("Tizen.dll (R2R)" not in raw) or \ + ("Tizen.ni.dll generated successfully." not in raw): return "FAIL : Create native image for Tizen.dll in R2R mode" return "PASS" @@ -283,8 +283,8 @@ def TC_13(): return f"FAIL : Install the application for {tpk_path}" raw = cmd(f"shell dotnettool --tac-regen-all") - if ".dll (FNV)" not in raw and \ - ".ni.dll generated successfully." not in raw: + if (".dll (FNV)" not in raw) or \ + (".ni.dll generated successfully." not in raw): return "FAIL : Create native image for TAC" return "PASS" @@ -404,8 +404,12 @@ def TC_16(): raw = subprocess.run((f"sdb -s {serial} shell sqlite3 {DOTNET_DIR}.TAC.App.list.db").split(), stdout=subprocess.PIPE, input=f"select * from TAC;\n.q\n", encoding="utf-8").stdout lines = [l for l in raw.splitlines() if f"{pkg_id}" in l] for rcd in lines: - if ("SkiaSharp/2.80.2" not in rcd) and \ - ("Xamarin.Forms/4.6.0.967" not in rcd): + is_exist = False + if ("SkiaSharp/2.80.2" in rcd) or \ + ("Xamarin.Forms/4.6.0.967" in rcd): + is_exist = True + continue + if not is_exist: return "FAIL : TAC database must have a valid value" 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 -- 2.7.4