[TC Added] dotnettool option(--ni-ro-pkg) test in TOOL
authorj-h.choi <j-h.choi@samsung.com>
Wed, 6 Jan 2021 06:56:47 +0000 (15:56 +0900)
committer조웅석/Common Platform Lab(SR)/Principal Engineer/삼성전자 <ws77.cho@samsung.com>
Thu, 7 Jan 2021 04:41:22 +0000 (13:41 +0900)
Change-Id: Id0f2dfe654e54c5d8f726d0485db594ecc1b3af3

tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.sln [new file with mode: 0644]
tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.cs [new file with mode: 0644]
tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.csproj [new file with mode: 0644]
tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.csproj.user [new file with mode: 0644]
tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/shared/res/Launcher_TC_TOOL_09.Tizen.png [new file with mode: 0644]
tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/tizen-manifest.xml [new file with mode: 0644]
tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.cs [new file with mode: 0644]
tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.csproj [new file with mode: 0644]
tests/Apps/README.md
tests/TCs/6_TOOL/README.md
tests/TCs/6_TOOL/TOOL.py

diff --git a/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.sln b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.sln
new file mode 100644 (file)
index 0000000..1772433
--- /dev/null
@@ -0,0 +1,31 @@
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio Version 16\r
+VisualStudioVersion = 16.0.29613.14\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher_TC_TOOL_09", "Launcher_TC_TOOL_09\Launcher_TC_TOOL_09\Launcher_TC_TOOL_09.csproj", "{B27E2BEF-15AE-474C-AF4F-D693ECEB4044}"\r
+EndProject\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher_TC_TOOL_09.Tizen", "Launcher_TC_TOOL_09\Launcher_TC_TOOL_09.Tizen\Launcher_TC_TOOL_09.Tizen.csproj", "{B924E435-937E-4C43-8E7D-A81138D91C1B}"\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+               Debug|Any CPU = Debug|Any CPU\r
+               Release|Any CPU = Release|Any CPU\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+               {B27E2BEF-15AE-474C-AF4F-D693ECEB4044}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+               {B27E2BEF-15AE-474C-AF4F-D693ECEB4044}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+               {B27E2BEF-15AE-474C-AF4F-D693ECEB4044}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+               {B27E2BEF-15AE-474C-AF4F-D693ECEB4044}.Release|Any CPU.Build.0 = Release|Any CPU\r
+               {B924E435-937E-4C43-8E7D-A81138D91C1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+               {B924E435-937E-4C43-8E7D-A81138D91C1B}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+               {B924E435-937E-4C43-8E7D-A81138D91C1B}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+               {B924E435-937E-4C43-8E7D-A81138D91C1B}.Release|Any CPU.Build.0 = Release|Any CPU\r
+       EndGlobalSection\r
+       GlobalSection(SolutionProperties) = preSolution\r
+               HideSolutionNode = FALSE\r
+       EndGlobalSection\r
+       GlobalSection(ExtensibilityGlobals) = postSolution\r
+               SolutionGuid = {E3C6E5D0-17F2-4BBD-A824-34CE92D118E4}\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.cs b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.cs
new file mode 100644 (file)
index 0000000..30f25f8
--- /dev/null
@@ -0,0 +1,22 @@
+using System;\r
+using Xamarin.Forms;\r
+\r
+namespace Launcher_TC_TOOL_09\r
+{\r
+    class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication\r
+    {\r
+        protected override void OnCreate()\r
+        {\r
+            base.OnCreate();\r
+\r
+            LoadApplication(new App());\r
+        }\r
+\r
+        static void Main(string[] args)\r
+        {\r
+            var app = new Program();\r
+            Forms.Init(app);\r
+            app.Run(args);\r
+        }\r
+    }\r
+}\r
diff --git a/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.csproj b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.csproj
new file mode 100644 (file)
index 0000000..9b6c797
--- /dev/null
@@ -0,0 +1,26 @@
+<Project Sdk="Tizen.NET.Sdk/1.1.5">\r
+\r
+  <PropertyGroup>\r
+    <OutputType>Exe</OutputType>\r
+    <TargetFramework>tizen70</TargetFramework>\r
+  </PropertyGroup>\r
+\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugType>portable</DebugType>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>None</DebugType>\r
+  </PropertyGroup>\r
+\r
+  <ItemGroup>\r
+    <Folder Include="lib\" />\r
+    <Folder Include="res\" />\r
+  </ItemGroup>\r
+\r
+  \r
+  <ItemGroup>\r
+    <ProjectReference Include="..\Launcher_TC_TOOL_09\Launcher_TC_TOOL_09.csproj" />\r
+  </ItemGroup>\r
+  \r
+\r
+</Project>\r
diff --git a/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.csproj.user b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.csproj.user
new file mode 100644 (file)
index 0000000..008c77e
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <PropertyGroup>\r
+    <ActiveDebugProfile>Launcher_TC_TOOL_09.Tizen</ActiveDebugProfile>\r
+  </PropertyGroup>\r
+</Project>
\ No newline at end of file
diff --git a/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/shared/res/Launcher_TC_TOOL_09.Tizen.png b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/shared/res/Launcher_TC_TOOL_09.Tizen.png
new file mode 100644 (file)
index 0000000..9f3cb98
Binary files /dev/null and b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/shared/res/Launcher_TC_TOOL_09.Tizen.png differ
diff --git a/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/tizen-manifest.xml b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..6619be2
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<manifest xmlns="http://tizen.org/ns/packages" api-version="5.5" package="org.tizen.example.Launcher_TC_TOOL_09.Tizen" version="1.0.0">\r
+       <profile name="common" />\r
+       <ui-application appid="org.tizen.example.Launcher_TC_TOOL_09.Tizen"\r
+                                       exec="Launcher_TC_TOOL_09.Tizen.dll"\r
+                                       type="dotnet"\r
+                                       multiple="false"\r
+                                       taskmanage="true"\r
+                                       nodisplay="false"\r
+                                       launch_mode="single"\r
+                                       api-version="6">\r
+  <label>Launcher_TC_TOOL_09.Tizen</label>\r
+       <icon>Launcher_TC_TOOL_09.Tizen.png</icon>\r
+       </ui-application>\r
+</manifest>\r
diff --git a/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.cs b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.cs
new file mode 100644 (file)
index 0000000..7e92927
--- /dev/null
@@ -0,0 +1,45 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+using System.Text;\r
+\r
+using Xamarin.Forms;\r
+\r
+namespace Launcher_TC_TOOL_09\r
+{\r
+    public class App : Application\r
+    {\r
+        public App()\r
+        {\r
+            // The root page of your application\r
+            MainPage = new ContentPage\r
+            {\r
+                Content = new StackLayout\r
+                {\r
+                    VerticalOptions = LayoutOptions.Center,\r
+                    Children = {\r
+                        new Label {\r
+                            HorizontalTextAlignment = TextAlignment.Center,\r
+                            Text = "Welcome to Xamarin Forms!"\r
+                        }\r
+                    }\r
+                }\r
+            };\r
+        }\r
+\r
+        protected override void OnStart()\r
+        {\r
+            // Handle when your app starts\r
+        }\r
+\r
+        protected override void OnSleep()\r
+        {\r
+            // Handle when your app sleeps\r
+        }\r
+\r
+        protected override void OnResume()\r
+        {\r
+            // Handle when your app resumes\r
+        }\r
+    }\r
+}\r
diff --git a/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.csproj b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.csproj
new file mode 100644 (file)
index 0000000..be3d00f
--- /dev/null
@@ -0,0 +1,11 @@
+<Project Sdk="Tizen.NET.Sdk/1.1.5">\r
+\r
+  <PropertyGroup>\r
+    <TargetFramework>netstandard2.0</TargetFramework>\r
+  </PropertyGroup>\r
+\r
+  <ItemGroup>\r
+    <PackageReference Include="Xamarin.Forms" Version="4.6.0.967" />\r
+  </ItemGroup>\r
+\r
+</Project>\r
index 0fa4ae0..cea7e95 100644 (file)
@@ -117,6 +117,7 @@ Build complete : org.tizen.example.Launcher_TC_TAC_01.Tizen-1.0.0.tpk
  Launcher_TC_TOOL_06 | org.tizen.example.Launcher_TC_TOOL_06.Tizen | X                 | True               | Xamarin.Forms(4.6.0.967)
  Launcher_TC_TOOL_07 | org.tizen.example.Launcher_TC_TOOL_07.Tizen | True              | True               | Xamarin.Forms(4.6.0.967), SkiaSharp(2.80.2)
  Launcher_TC_TOOL_08 | org.tizen.example.Launcher_TC_TOOL_08.Tizen | True              | X                  | Xamarin.Forms(4.6.0.967)
+ Launcher_TC_TOOL_09 | org.tizen.example.Launcher_TC_TOOL_09.Tizen | X                 | X                  | Xamarin.Forms(4.6.0.967)
 
 ----
 ### Note
index 5fb6790..ac1d6d0 100644 (file)
@@ -122,6 +122,11 @@ launcher/tests/TCs/6_TOOL$ ./TOOL.py TC_01
  1. Regenerated NI files of read-only application is stored at "/opt/usr/dotnet/apps/[PkgID]/bin/.native_image/".
  2. The assembly in the "/opt/usr/dotnet/apps/[PkgId]/bin/.native/image/" should be loaded when running the application.
 ----
+* TC_19
+```
+  PASS : The `Launcher_TC_TOOL_09` application of read-only type generates native image.
+```
+  1. sh-3.2# dotnettool --ni-ro-pkg org.tizen.example.Launcher_TC_TOOL_09.Tizen
 
 ### Note
 
index 73a6c9b..ce1b034 100755 (executable)
@@ -491,7 +491,51 @@ def TC_17_18():
 
     return "PASS"
 
-#def TC_19():
+# The `Launcher_TC_TOOL_09` application of read-only type generates native image.
+def TC_19():
+    sln_name = "Launcher_TC_TOOL_09.Tizen"
+
+    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")
+
+    pkg_id = f"org.tizen.example.Launcher_TC_TOOL_09.Tizen"
+
+    root_path = get_root_path(f"{pkg_id}")
+    if root_path == "None":
+        return f"FAIL : Get the root path for {pkg_id}"
+
+    if exist(f"{root_path}/bin/.native_image"):
+        return "FAIL : The .native_image folder not should exist"
+
+    cmd(f"shell dotnettool --ni-ro-pkg {pkg_id}")
+
+    if not exist(f"{DOTNET_DIR}apps/{pkg_id}/bin/.native_image"):
+        return "FAIL : The .native_image folder should exist"
+
+    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_20():
 #dotnettool --resolve-all-app
 
 
@@ -529,6 +573,7 @@ def clean():
     cmd(f"shell rm -rf {IBCDATA_DIR}")
 
     cmd(f"shell rm -rf {DOTNET_DIR}apps/org.tizen.example.Launcher_TC_TOOL_08.Tizen")
+    cmd(f"shell rm -rf {DOTNET_DIR}apps/org.tizen.example.Launcher_TC_TOOL_09.Tizen")
 
 # Main entry point
 def main():
@@ -546,7 +591,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_16, TC_17, TC_18]
+        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, TC_19]
 
     global serial
     if len(sys.argv) >= 2 and "TC_" not in sys.argv[1]:
@@ -568,10 +613,10 @@ 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, 'TC_16': TC_16, 'TC_17': TC_17, 'TC_18': TC_17_18,
+'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, 'TC_19': TC_19,
 '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
+'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, 'TOOL_TC_19': TC_19
 }