From: j-h.choi Date: Mon, 21 Feb 2022 05:19:17 +0000 (+0900) Subject: Check the SPC before creating a native image for the app X-Git-Tag: accepted/tizen/unified/20220222.034344^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f041806ddcd915a48be94b658533da10aadf5f5b;p=platform%2Fcore%2Fdotnet%2Flauncher.git Check the SPC before creating a native image for the app Change-Id: I14ac5775cb5b58df00fec96134d6c3f75474d3fc --- diff --git a/NativeLauncher/tool/ni_common.cc b/NativeLauncher/tool/ni_common.cc index 402e34a..2ed4b32 100644 --- a/NativeLauncher/tool/ni_common.cc +++ b/NativeLauncher/tool/ni_common.cc @@ -861,6 +861,13 @@ ni_error_e createNIUnderDirs(const std::string& rootPaths, NIOption* opt) ni_error_e createNIUnderPkgRoot(const std::string& pkgId, NIOption* opt) { + if (!isR2RImage(concatPath(__pm->getRuntimePath(), "System.Private.CoreLib.dll"))) { + _SERR("The native image of System.Private.CoreLib does not exist.\n" + "Run the command to create the native image\n" + "# dotnettool --ni-dll /usr/share/dotnet.tizen/netcoreapp/System.Private.CoreLib.dll"); + return NI_ERROR_CORE_NI_FILE; + } + std::string rootPath = getRootPath(pkgId); if (rootPath.empty()) { _SERR("Failed to get root path from [%s]", pkgId.c_str()); diff --git a/tests/TCs/1_AOT/AOT.py b/tests/TCs/1_AOT/AOT.py index af7873a..8463227 100755 --- a/tests/TCs/1_AOT/AOT.py +++ b/tests/TCs/1_AOT/AOT.py @@ -80,7 +80,7 @@ def TC_02(): return "PASS" -# The `Launcher_TC_AOT_03` application generates native image when the SPC.ni.dll doesn't exist. +# The `Launcher_TC_AOT_03` application does not generate native image when the SPC.ni.dll doesn't exist. def TC_03(): if "OK" not in remove_system_ni(): return "FAIL : Remove the platform native image" @@ -100,24 +100,13 @@ def TC_03(): if root_path == "None": return f"FAIL : Get the root path for {pkg_id}" - if not exist(f"{root_path}/bin/.native_image"): - return "FAIL : The .native_image folder should exist" - - raw = cmd(f"shell find {root_path}/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" + if exist(f"{root_path}/bin/.native_image"): + return "FAIL : The .native_image folder should not exist" - 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" + raw = cmd(f"shell find {root_path}/bin/ -name *.ni.dll") + lines = [l for l in raw.splitlines()] + if len(lines) != 0: + return "FAIL : The .ni.dll files should not exist" return "PASS" diff --git a/tests/TCs/1_AOT/README.md b/tests/TCs/1_AOT/README.md index 6a6e06c..55178a6 100644 --- a/tests/TCs/1_AOT/README.md +++ b/tests/TCs/1_AOT/README.md @@ -45,13 +45,11 @@ launcher/tests/TCs/1_AOT$ ./AOT.py TC_01 5. The file names of `.dll` and `.ni.dll` must match in the application. * TC_03 ``` - PASS : The Launcher_TC_AOT_03 application generates native image when the SPC.ni.dll doesn't exist. + PASS : The Launcher_TC_AOT_03 application does not generate native image when the SPC.ni.dll doesn't exist. ``` 1. The `System.Private.CoreLib.ni.dll`(SPC.dll.Backup) file does not exist. 2. The `prefer_dotnet_aot` metadata value is `true` in the manifest. - 3. The `.native_image` folder and `.ni.dll` files exist. - 4. The number of `.dll` files and the number of `.ni.dll` files in the application are the same. - 5. The file names of `.dll` and `.ni.dll` must match in the application. + 3. The `.native_image` folder and `.ni.dll` files do exist. ---- ### Note