[TC Added] dotnettool option(--ibc-dir) test in TOOL
authorj-h.choi <j-h.choi@samsung.com>
Mon, 28 Dec 2020 08:33:21 +0000 (17:33 +0900)
committer조웅석/Common Platform Lab(SR)/Principal Engineer/삼성전자 <ws77.cho@samsung.com>
Mon, 4 Jan 2021 05:17:48 +0000 (14:17 +0900)
Change-Id: I0e4c4f72bc5f33492b929869109133e7cacf9492

tests/TCs/6_TOOL/README.md
tests/TCs/6_TOOL/TOOL.py
tests/TCs/Utils.py

index bfc37e1..ae1cf6a 100644 (file)
@@ -72,35 +72,40 @@ launcher/tests/TCs/6_TOOL$ ./TOOL.py TC_01
   1. sh-3.2# dotnettool --verbose --ni-dll /usr/share/dotnet.tizen/framework/Tizen.Log.dll
 * TC_09
 ```
+  PASS : Create a native image for netstandard.dll by specifying the directory containing the IBC files.
+```
+  1. sh-3.2# dotnettool --ibc-dir /usr/share/dotnet.tizen/ibcdata/ --ni-dll /usr/share/dotnet.tizen/netcoreapp/netstandard.dll
+* TC_10
+```
   PASS : The Launcher_TC_TOOL_01 application does not have native image.
 ```
   1. sh-3.2# dotnettool --ni-reset-pkg org.tizen.example.Launcher_TC_TOOL_01.Tizen
-* TC_10
+* TC_11
 ```
   PASS : The Launcher_TC_TOOL_02 application generates native image.
 ```
   1. sh-3.2# dotnettool --ni-pkg org.tizen.example.Launcher_TC_TOOL_02.Tizen
-* TC_11
+* TC_12
 ```
   PASS : The prefer_dotnet_aot metadata value of true will regenerates the native image in all .NET applications.
 ```
   1. sh-3.2# dotnettool --ni-regen-all-app
-* TC_12
+* TC_13
 ```
   PASS : The prefer_nuget_cache metadata value of true will regenerates the native image in the TAC.
 ```
   1. sh-3.2# dotnettool --tac-regen-all
-* TC_13
+* TC_14
 ```
   PASS : The Launcher_TC_TOOL_05 application must not have TAC applied.
 ```
   1. sh-3.2# dotnettool --tac-disable-pkg org.tizen.example.Launcher_TC_TOOL_05.Tizen
-* TC_14
+* TC_15
 ```
   PASS : The Launcher_TC_TOOL_06 application must have TAC applied.
 ```
   1. sh-3.2# dotnettool --tac-enable-pkg org.tizen.example.Launcher_TC_TOOL_06.Tizen
-* TC_15
+* TC_16
 ```
   PASS : The Database of the restored TAC and TLC must be a valid value.
 ```
index 915fdec..8d4e166 100755 (executable)
@@ -3,6 +3,7 @@ import os, subprocess, sys, argparse
 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
 
 from time import sleep
+from pathlib import Path
 from Utils import *
 
 
@@ -131,8 +132,38 @@ def TC_08():
 
     return "PASS"
 
-# The `Launcher_TC_TOOL_01` application does not have native image.
+# Create a native image for netstandard.dll by specifying the directory containing the IBC files.
 def TC_09():
+    current_path = os.path.abspath(__file__)
+    packaging_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../packaging"))
+    ibcdata_zip = ""
+
+    raw = cmd("capability")
+    line = [l for l in raw.splitlines() if "cpu_arch" in l]
+    target_arch = line[0].split(":")[1]
+    if ("armv7" == target_arch) or \
+       ("x86" == target_arch):
+        ibcdata_zip = "ibcdata_arm.zip"
+    else:
+        ibcdata_zip = "ibcdata_aarch64.zip"
+
+    cmd(f"push {packaging_path}/{ibcdata_zip} /tmp")
+    cmd(f"shell unzip /tmp/{ibcdata_zip} -d {IBCDATA_DIR}")
+    cmd(f"shell chsmack -a _ {IBCDATA_DIR} -r")
+
+    raw = cmd(f"shell find {IBCDATA_DIR}netstandard.ibc")
+    if f"No such file or directory" in raw:
+        return "FAIL : The netstandard.ibc file should exist"
+
+    raw = cmd(f"shell dotnettool --ibc-dir /usr/share/dotnet.tizen/ibcdata/ --ni-dll {RUNTIME_DIR}netstandard.dll")
+    if ("netstandard.dll (FNV)" not in raw) or \
+       ("netstandard.ni.dll generated successfully." not in raw):
+        return "FAIL : Create native image for netstandard.dll"
+
+    return "PASS"
+
+# The `Launcher_TC_TOOL_01` application does not have native image.
+def TC_10():
     sln_name = "Launcher_TC_TOOL_01.Tizen"
 
     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
@@ -166,7 +197,7 @@ def TC_09():
     return "PASS"
 
 # The `Launcher_TC_TOOL_02` application generates native image.
-def TC_10():
+def TC_11():
     sln_name = "Launcher_TC_TOOL_02.Tizen"
 
     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
@@ -211,7 +242,7 @@ def TC_10():
     return "PASS"
 
 # The `prefer_dotnet_aot` metadata value of `true` will regenerates the native image in all .NET applications.
-def TC_11():
+def TC_12():
     sln_name = "Launcher_TC_TOOL_03.Tizen"
 
     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
@@ -252,7 +283,7 @@ def TC_11():
     return "PASS"
 
 # The `prefer_nuget_cache` metadata value of `true` will regenerates the native image in the `TAC`.
-def TC_12():
+def TC_13():
     sln_name = "Launcher_TC_TOOL_04.Tizen"
 
     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
@@ -270,7 +301,7 @@ def TC_12():
     return "PASS"
 
 # The `Launcher_TC_TOOL_05` application must not have `TAC` applied.
-def TC_13():
+def TC_14():
     sln_name = "Launcher_TC_TOOL_05.Tizen"
 
     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
@@ -319,7 +350,7 @@ def TC_13():
     return "PASS"
 
 # The `Launcher_TC_TOOL_06` application must have `TAC` applied.
-def TC_14():
+def TC_15():
     sln_name = "Launcher_TC_TOOL_06.Tizen"
 
     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
@@ -370,7 +401,7 @@ def TC_14():
     return "PASS"
 
 # The `DB` of the restored `TAC` and `TLC` must be a valid value.
-def TC_15():
+def TC_16():
     sln_name = "Launcher_TC_TOOL_07.Tizen"
 
     tpk_path = get_tpk_path(tpk_list, f"{sln_name}")
@@ -403,11 +434,8 @@ def TC_15():
     return "PASS"
 
 
-#def TC_16():
-#dotnettool --resolve-all-app
-
 #def TC_17():
-#dotnettool --ibc-dir
+#dotnettool --resolve-all-app
 
 #def TC_18():
 #dotnettool --instrument
@@ -441,6 +469,9 @@ def clean():
 
     cmd(f"shell rm {FRAMEWORK_DIR}Tizen.ni.dll")
     cmd(f"shell rm {FRAMEWORK_DIR}Tizen.Log.ni.dll")
+    cmd(f"shell rm {RUNTIME_DIR}netstandard.ni.dll")
+
+    cmd(f"shell rm -rf {IBCDATA_DIR}")
 
 # Main entry point
 def main():
@@ -458,7 +489,7 @@ def main():
             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_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]
 
     global serial
     if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
@@ -478,10 +509,12 @@ def main():
 
 
 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,
-'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
+'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
 }
 
 
index cbd824b..23f6f02 100755 (executable)
@@ -9,6 +9,7 @@ from pathlib import Path
 RUNTIME_DIR = "/usr/share/dotnet.tizen/netcoreapp/"
 FRAMEWORK_DIR = "/usr/share/dotnet.tizen/framework/"
 PRELOAD_DIR = "/usr/share/dotnet.tizen/preload/"
+IBCDATA_DIR = "/usr/share/dotnet.tizen/ibcdata/"
 DOTNET_DIR = "/opt/usr/dotnet/"
 OWNER_DIR = "/home/owner/"
 SPC_DLL = "System.Private.CoreLib.dll"