From: j-h.choi Date: Wed, 6 Jan 2021 06:56:47 +0000 (+0900) Subject: [TC Added] dotnettool option(--ni-ro-pkg) test in TOOL X-Git-Tag: accepted/tizen/unified/20210125.073655~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a9dc393a6f284bc68110d5150265d277db0d3272;p=platform%2Fcore%2Fdotnet%2Flauncher.git [TC Added] dotnettool option(--ni-ro-pkg) test in TOOL Change-Id: Id0f2dfe654e54c5d8f726d0485db594ecc1b3af3 --- 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 index 0000000..1772433 --- /dev/null +++ b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29613.14 +MinimumVisualStudioVersion = 10.0.40219.1 +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}" +EndProject +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}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B27E2BEF-15AE-474C-AF4F-D693ECEB4044}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B27E2BEF-15AE-474C-AF4F-D693ECEB4044}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B27E2BEF-15AE-474C-AF4F-D693ECEB4044}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B27E2BEF-15AE-474C-AF4F-D693ECEB4044}.Release|Any CPU.Build.0 = Release|Any CPU + {B924E435-937E-4C43-8E7D-A81138D91C1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B924E435-937E-4C43-8E7D-A81138D91C1B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B924E435-937E-4C43-8E7D-A81138D91C1B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B924E435-937E-4C43-8E7D-A81138D91C1B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E3C6E5D0-17F2-4BBD-A824-34CE92D118E4} + EndGlobalSection +EndGlobal 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 index 0000000..30f25f8 --- /dev/null +++ b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.cs @@ -0,0 +1,22 @@ +using System; +using Xamarin.Forms; + +namespace Launcher_TC_TOOL_09 +{ + class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication + { + protected override void OnCreate() + { + base.OnCreate(); + + LoadApplication(new App()); + } + + static void Main(string[] args) + { + var app = new Program(); + Forms.Init(app); + app.Run(args); + } + } +} 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 index 0000000..9b6c797 --- /dev/null +++ b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.csproj @@ -0,0 +1,26 @@ + + + + Exe + tizen70 + + + + portable + + + None + + + + + + + + + + + + + + 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 index 0000000..008c77e --- /dev/null +++ b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/Launcher_TC_TOOL_09.Tizen.csproj.user @@ -0,0 +1,6 @@ + + + + Launcher_TC_TOOL_09.Tizen + + \ 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 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 index 0000000..6619be2 --- /dev/null +++ b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.Tizen/tizen-manifest.xml @@ -0,0 +1,15 @@ + + + + + + Launcher_TC_TOOL_09.Tizen.png + + 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 index 0000000..7e92927 --- /dev/null +++ b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Xamarin.Forms; + +namespace Launcher_TC_TOOL_09 +{ + public class App : Application + { + public App() + { + // The root page of your application + MainPage = new ContentPage + { + Content = new StackLayout + { + VerticalOptions = LayoutOptions.Center, + Children = { + new Label { + HorizontalTextAlignment = TextAlignment.Center, + Text = "Welcome to Xamarin Forms!" + } + } + } + }; + } + + protected override void OnStart() + { + // Handle when your app starts + } + + protected override void OnSleep() + { + // Handle when your app sleeps + } + + protected override void OnResume() + { + // Handle when your app resumes + } + } +} 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 index 0000000..be3d00f --- /dev/null +++ b/tests/Apps/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09/Launcher_TC_TOOL_09.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.0 + + + + + + + diff --git a/tests/Apps/README.md b/tests/Apps/README.md index 0fa4ae0..cea7e95 100644 --- a/tests/Apps/README.md +++ b/tests/Apps/README.md @@ -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 diff --git a/tests/TCs/6_TOOL/README.md b/tests/TCs/6_TOOL/README.md index 5fb6790..ac1d6d0 100644 --- a/tests/TCs/6_TOOL/README.md +++ b/tests/TCs/6_TOOL/README.md @@ -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 diff --git a/tests/TCs/6_TOOL/TOOL.py b/tests/TCs/6_TOOL/TOOL.py index 73a6c9b..ce1b034 100755 --- a/tests/TCs/6_TOOL/TOOL.py +++ b/tests/TCs/6_TOOL/TOOL.py @@ -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 }