1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <string> 17 #include <fstream> 18 #include <filesystem> 19 #include "FileSystem.h" 20 #include "gtest/gtest.h" 21 #define private public 22 #include "StageContext.h" 23 #include "MockFile.h" 24 using namespace testmock; 25 26 namespace { 27 class StageContextTest : public ::testing::Test { 28 public: StageContextTest()29 StageContextTest() {} ~StageContextTest()30 ~StageContextTest() {} 31 protected: WriteFile(const std::string & filePath,const std::string & content)32 static void WriteFile(const std::string& filePath, const std::string& content) 33 { 34 std::ofstream file(filePath, std::ios_base::trunc); 35 if (file.is_open()) { 36 file << content; 37 file.close(); 38 } else { 39 printf("Error open file!\n"); 40 } 41 } 42 SetUpTestCase()43 static void SetUpTestCase() 44 { 45 char buffer[FILENAME_MAX]; 46 if (getcwd(buffer, FILENAME_MAX) != nullptr) { 47 testDir = std::string(buffer); 48 testFile = testDir + "/testfile"; 49 WriteFile(testFile, testLoadJsonContent); 50 51 testFileError = testDir + "/testfileError"; 52 WriteFile(testFileError, R"({"anBuildOutPut","anBuildMode":"type"})"); 53 54 testfileErrorMember = testDir + "/testfileErrorMember"; 55 WriteFile(testfileErrorMember, R"({"modulePathMap":{"entry":"entry","lib1":"lib1"}, 56 "harNameOhmMap1":{"lib1":"lib1"}, "packageManagerType":"ohpm", "compileEntry":[], 57 "dynamicImportLibInfo":{}, "routerMap":[], "anBuildOutPut":"arm64-v8a", "anBuildMode":"type"})"); 58 std::string hspDir = testDir + "/MyApplication32/oh_modules/.hsp"; 59 if (!FileSystem::IsDirectoryExists(hspDir)) { 60 FileSystem::MakeDir(testDir + "/MyApplication32"); 61 FileSystem::MakeDir(testDir + "/MyApplication32/oh_modules"); 62 FileSystem::MakeDir(testDir + "/MyApplication32/oh_modules/.hsp"); 63 FileSystem::MakeDir(testDir + "/MyApplication32/oh_modules/.hsp/example@1.0.0"); 64 65 testFileHsp = hspDir + "/example.hsp"; 66 WriteFile(testFileHsp, "example.hsp"); 67 } 68 69 if (!FileSystem::IsDirectoryExists("ets")) { 70 FileSystem::MakeDir(testDir + "/ets"); 71 } 72 WriteFile(testDir + "/ets/buildConfig.json", "{\"aceModuleBuild\":\"" + testDir + "/ets" + "\"}"); 73 } else { 74 printf("error: getcwd failed\n"); 75 } 76 } 77 TearDownTestCase()78 static void TearDownTestCase() 79 { 80 if (std::remove(testFile.c_str()) != 0) { 81 printf("Error deleting file!\n"); 82 } 83 84 // 最后删除ets文件夹 85 char buffer[FILENAME_MAX]; 86 if (getcwd(buffer, FILENAME_MAX) != nullptr) { 87 testDir = std::string(buffer); 88 std::string etsDir = testDir + "/ets"; 89 if (FileSystem::IsDirectoryExists(etsDir)) { 90 std::filesystem::remove_all(etsDir); 91 } 92 } 93 } 94 static std::string testDir; 95 static std::string testFile; 96 static std::string testFileError; 97 static std::string testfileErrorMember; 98 static std::string testFileHsp; 99 static std::string testLoadJsonContent; 100 }; 101 std::string StageContextTest::testDir = ""; 102 std::string StageContextTest::testFile = ""; 103 std::string StageContextTest::testFileError = ""; 104 std::string StageContextTest::testFileHsp = ""; 105 std::string StageContextTest::testfileErrorMember = ""; 106 std::string StageContextTest::testLoadJsonContent = 107 R"({"modulePathMap":{"entry":"entry","lib1":"lib1"}, "compileMode":"esmodule", 108 "projectRootPath":"./MyApplication32", "nodeModulesPath":"node_modules", "moduleName":"entry", 109 "harNameOhmMap":{"lib1":"lib1"}, "hspNameOhmMap":{"lib1":"lib1"}, "buildConfigPath":"buildConfig.json", 110 "packageManagerType":"ohpm", "compileEntry":[], "dynamicImportLibInfo":{}, "routerMap":[], 111 "anBuildOutPut":"arm64-v8a", "anBuildMode":"type"})"; 112 TEST_F(StageContextTest,ReadFileContentsTest)113 TEST_F(StageContextTest, ReadFileContentsTest) 114 { 115 std::optional<std::vector<uint8_t>> buf1 = 116 OHOS::Ide::StageContext::GetInstance().ReadFileContents("abc"); 117 EXPECT_TRUE(std::nullopt == buf1); 118 std::optional<std::vector<uint8_t>> buf2 = 119 OHOS::Ide::StageContext::GetInstance().ReadFileContents(testFile); 120 EXPECT_TRUE(std::nullopt != buf2); 121 if (buf2) { 122 std::string str(buf2->begin(), buf2->end()); 123 EXPECT_EQ(str, testLoadJsonContent); 124 } else { 125 EXPECT_TRUE(false); 126 } 127 } 128 TEST_F(StageContextTest,SetLoaderJsonPathTest)129 TEST_F(StageContextTest, SetLoaderJsonPathTest) 130 { 131 OHOS::Ide::StageContext::GetInstance().SetLoaderJsonPath("aa"); 132 EXPECT_EQ(OHOS::Ide::StageContext::GetInstance().loaderJsonPath, "aa"); 133 OHOS::Ide::StageContext::GetInstance().SetLoaderJsonPath(testFile); 134 EXPECT_EQ(OHOS::Ide::StageContext::GetInstance().loaderJsonPath, testFile); 135 } 136 TEST_F(StageContextTest,GetModulePathMapFromLoaderJsonTest)137 TEST_F(StageContextTest, GetModulePathMapFromLoaderJsonTest) 138 { 139 OHOS::Ide::StageContext::GetInstance().SetLoaderJsonPath(testFileError); 140 OHOS::Ide::StageContext::GetInstance().GetModulePathMapFromLoaderJson(); 141 OHOS::Ide::StageContext::GetInstance().SetLoaderJsonPath(testfileErrorMember); 142 OHOS::Ide::StageContext::GetInstance().GetModulePathMapFromLoaderJson(); 143 OHOS::Ide::StageContext::GetInstance().SetLoaderJsonPath(testFile); 144 OHOS::Ide::StageContext::GetInstance().GetModulePathMapFromLoaderJson(); 145 EXPECT_EQ(OHOS::Ide::StageContext::GetInstance().modulePathMap.size(), 2); 146 EXPECT_EQ(OHOS::Ide::StageContext::GetInstance().hspNameOhmMap.size(), 1); 147 EXPECT_EQ(OHOS::Ide::StageContext::GetInstance().projectRootPath, "./MyApplication32"); 148 } 149 TEST_F(StageContextTest,GetHspAceModuleBuildTest)150 TEST_F(StageContextTest, GetHspAceModuleBuildTest) 151 { 152 std::string fileContent = R"({"aceModuleBuild":"abc"})"; 153 WriteFile(testFile, fileContent); 154 std::string ret = OHOS::Ide::StageContext::GetInstance().GetHspAceModuleBuild(testFile); 155 EXPECT_EQ(ret, "abc"); 156 157 ret = OHOS::Ide::StageContext::GetInstance().GetHspAceModuleBuild("aaa"); 158 EXPECT_EQ(ret, ""); 159 160 fileContent = ""; 161 WriteFile(testFile, fileContent); 162 ret = OHOS::Ide::StageContext::GetInstance().GetHspAceModuleBuild(testFile); 163 EXPECT_EQ(ret, ""); 164 165 fileContent = R"({"aceModuleBuild11":"abc"})"; 166 WriteFile(testFile, fileContent); 167 ret = OHOS::Ide::StageContext::GetInstance().GetHspAceModuleBuild(testFile); 168 EXPECT_EQ(ret, ""); 169 } 170 TEST_F(StageContextTest,ReleaseHspBuffersTest)171 TEST_F(StageContextTest, ReleaseHspBuffersTest) 172 { 173 std::vector<uint8_t> *buf = new std::vector<uint8_t>(); 174 OHOS::Ide::StageContext::GetInstance().hspBufferPtrsVec.push_back(buf); 175 EXPECT_TRUE(OHOS::Ide::StageContext::GetInstance().hspBufferPtrsVec.size() > 0); 176 OHOS::Ide::StageContext::GetInstance().ReleaseHspBuffers(); 177 EXPECT_TRUE(OHOS::Ide::StageContext::GetInstance().hspBufferPtrsVec.size() == 0); 178 } 179 TEST_F(StageContextTest,ParseMockJsonFileTest)180 TEST_F(StageContextTest, ParseMockJsonFileTest) 181 { 182 std::map<std::string, std::string> retMap = 183 OHOS::Ide::StageContext::GetInstance().ParseMockJsonFile("aaa"); 184 EXPECT_EQ(retMap.size(), 0); 185 186 std::string fileContent = ""; 187 WriteFile(testFile, fileContent); 188 retMap = OHOS::Ide::StageContext::GetInstance().ParseMockJsonFile(testFile); 189 EXPECT_EQ(retMap.size(), 0); 190 191 fileContent = R"({ 192 "libentry.so": { 193 "source": 123 194 } 195 })"; 196 WriteFile(testFile, fileContent); 197 retMap = OHOS::Ide::StageContext::GetInstance().ParseMockJsonFile(testFile); 198 EXPECT_EQ(retMap.size(), 0); 199 200 fileContent = R"({ 201 "libentry.so": { 202 "source": "src/mock/Libentry.mock.ets" 203 } 204 })"; 205 WriteFile(testFile, fileContent); 206 retMap = OHOS::Ide::StageContext::GetInstance().ParseMockJsonFile(testFile); 207 EXPECT_EQ(retMap["libentry.so"], "src/mock/Libentry.mock.ets"); 208 } 209 TEST_F(StageContextTest,GetModuleBufferTest)210 TEST_F(StageContextTest, GetModuleBufferTest) 211 { 212 std::vector<uint8_t>* ret = 213 OHOS::Ide::StageContext::GetInstance().GetModuleBuffer("bundleTestlibrary"); 214 EXPECT_TRUE(ret == nullptr); 215 216 ret = OHOS::Ide::StageContext::GetInstance().GetModuleBuffer("/Testlibrary"); 217 EXPECT_TRUE(ret == nullptr); 218 219 OHOS::Ide::StageContext::GetInstance().modulePathMap.clear(); 220 ret = OHOS::Ide::StageContext::GetInstance().GetModuleBuffer("bundle1/Testlibrary"); 221 EXPECT_TRUE(ret == nullptr); 222 223 OHOS::Ide::StageContext::GetInstance().modulePathMap["Testlibrary"] = "TestlibraryPathX"; 224 ret = OHOS::Ide::StageContext::GetInstance().GetModuleBuffer("bundle/TestlibraryX"); 225 EXPECT_TRUE(ret == nullptr); 226 227 OHOS::Ide::StageContext::GetInstance().modulePathMap["Testlibrary"] = "TestlibraryPath"; 228 ret = OHOS::Ide::StageContext::GetInstance().GetModuleBuffer("bundle/Testlibrary"); 229 EXPECT_TRUE(ret == nullptr); 230 231 OHOS::Ide::StageContext::GetInstance().modulePathMap["Testlibrary"] = "/tmp/../"; 232 ret = OHOS::Ide::StageContext::GetInstance().GetModuleBuffer("bundle/Testlibrary"); 233 EXPECT_TRUE(ret == nullptr); 234 235 OHOS::Ide::StageContext::GetInstance().modulePathMap["Testlibrary"] = "/tmp/../"; 236 OHOS::Ide::StageContext::GetInstance().hspNameOhmMap["TestlibraryM"] ="@bundle:aaa.bbb.ccc/TestlibraryM/Index"; 237 ret = OHOS::Ide::StageContext::GetInstance().GetModuleBuffer("bundle/TestlibraryM"); 238 EXPECT_TRUE(ret == nullptr); 239 240 char buffer[FILENAME_MAX]; 241 if (getcwd(buffer, FILENAME_MAX) != nullptr) { 242 testDir = std::string(buffer); 243 std::string testlibrary = testDir + "/ets"; 244 OHOS::Ide::StageContext::GetInstance().modulePathMap["Testlibrary"] = testlibrary; 245 ret = OHOS::Ide::StageContext::GetInstance().GetModuleBuffer("bundle/Testlibrary"); 246 EXPECT_TRUE(ret == nullptr); 247 if (FileSystem::IsDirectoryExists(testlibrary)) { 248 std::filesystem::remove(testlibrary + "/modules.abc"); 249 ret = OHOS::Ide::StageContext::GetInstance().GetModuleBuffer("bundle/Testlibrary"); 250 EXPECT_TRUE(ret == nullptr); 251 252 const int defaultLength = 1000; 253 const std::string defaultString = "aaaa"; 254 std::string strVal = "bbb"; 255 MockFile::CreateHspFile("testHspFile", strVal); 256 257 std::vector<uint8_t>* ret2 = 258 OHOS::Ide::StageContext::GetInstance().GetModuleBuffer("bundle/Testlibrary"); 259 OHOS::Ide::StageContext::GetInstance().ReleaseHspBuffers(); 260 EXPECT_FALSE(ret2 == nullptr); 261 } 262 } 263 } 264 TEST_F(StageContextTest,GetLocalModuleBufferTest)265 TEST_F(StageContextTest, GetLocalModuleBufferTest) 266 { 267 OHOS::Ide::StageContext::GetInstance().modulePathMap["Testlibrary"] = ""; 268 std::vector<uint8_t>* ret = 269 OHOS::Ide::StageContext::GetInstance().GetLocalModuleBuffer("Testlibrary"); 270 EXPECT_TRUE(ret == nullptr); 271 272 OHOS::Ide::StageContext::GetInstance().modulePathMap["Testlibrary"] = "."; 273 ret = OHOS::Ide::StageContext::GetInstance().GetLocalModuleBuffer("Testlibrary"); 274 EXPECT_TRUE(ret == nullptr); 275 276 OHOS::Ide::StageContext::GetInstance().modulePathMap["Testlibrary"] = testDir; 277 ret = OHOS::Ide::StageContext::GetInstance().GetLocalModuleBuffer("Testlibrary"); 278 EXPECT_TRUE(ret == nullptr); 279 } 280 TEST_F(StageContextTest,ContainsRelativePathTest)281 TEST_F(StageContextTest, ContainsRelativePathTest) 282 { 283 bool ret = OHOS::Ide::StageContext::GetInstance().ContainsRelativePath("../../aaa"); 284 EXPECT_TRUE(ret); 285 ret = OHOS::Ide::StageContext::GetInstance().ContainsRelativePath("bbb/aaa"); 286 EXPECT_FALSE(ret); 287 } 288 TEST_F(StageContextTest,GetModulePathMapTest)289 TEST_F(StageContextTest, GetModulePathMapTest) 290 { 291 OHOS::Ide::StageContext::GetInstance().modulePathMap["Testlibrary1"] = "aaa"; 292 EXPECT_EQ(OHOS::Ide::StageContext::GetInstance().GetModulePathMap()["Testlibrary1"], "aaa"); 293 } 294 TEST_F(StageContextTest,GetCloudHspPathTest)295 TEST_F(StageContextTest, GetCloudHspPathTest) 296 { 297 std::string ret = OHOS::Ide::StageContext::GetInstance().GetCloudHspPath("/aaa/bbb", "ccc"); 298 EXPECT_EQ(ret, ""); 299 } 300 TEST_F(StageContextTest,ReplaceLastStrTest)301 TEST_F(StageContextTest, ReplaceLastStrTest) 302 { 303 std::string ret = OHOS::Ide::StageContext::GetInstance().ReplaceLastStr("abcabcabc", "abc", "123"); 304 EXPECT_EQ(ret, "abcabc123"); 305 } 306 TEST_F(StageContextTest,GetHspActualNameTest)307 TEST_F(StageContextTest, GetHspActualNameTest) 308 { 309 OHOS::Ide::StageContext::GetInstance().hspNameOhmMap["testlibrary1"] = 310 "@bundle:aaa.bbb.ccc/Testlibrary/Index"; 311 std::string input = "Testlibrary"; 312 std::string ret; 313 int num = OHOS::Ide::StageContext::GetInstance().GetHspActualName(input, ret); 314 EXPECT_EQ(num, 1); 315 EXPECT_EQ(ret, "testlibrary1"); 316 } 317 TEST_F(StageContextTest,GetCloudHspVersionTest)318 TEST_F(StageContextTest, GetCloudHspVersionTest) 319 { 320 std::string ret = OHOS::Ide::StageContext::GetInstance().GetCloudHspVersion("/aaa/bbb@/ccc", "ddd"); 321 EXPECT_EQ(ret, ""); 322 323 ret = OHOS::Ide::StageContext::GetInstance().GetCloudHspVersion("/aaa/bbb@/ccc", "bbb"); 324 EXPECT_EQ(ret, "/ccc"); 325 } 326 TEST_F(StageContextTest,GetActualCloudHspDirTest)327 TEST_F(StageContextTest, GetActualCloudHspDirTest) 328 { 329 std::string ret = OHOS::Ide::StageContext::GetInstance().GetActualCloudHspDir("ddd"); 330 EXPECT_TRUE(ret == ""); 331 } 332 TEST_F(StageContextTest,SplitHspVersionTest)333 TEST_F(StageContextTest, SplitHspVersionTest) 334 { 335 std::vector<int> vec = OHOS::Ide::StageContext::GetInstance().StageContext::SplitHspVersion("10.1.2"); 336 EXPECT_EQ(vec[0], 10); 337 EXPECT_EQ(vec[1], 1); 338 EXPECT_EQ(vec[2], 2); 339 } 340 TEST_F(StageContextTest,CompareHspVersionTest)341 TEST_F(StageContextTest, CompareHspVersionTest) 342 { 343 int ret = OHOS::Ide::StageContext::GetInstance().CompareHspVersion("10.1.2", "10.1.1"); 344 EXPECT_EQ(ret, 1); 345 346 ret = OHOS::Ide::StageContext::GetInstance().CompareHspVersion("10.1.2", "10.1.3"); 347 EXPECT_EQ(ret, -1); 348 349 ret = OHOS::Ide::StageContext::GetInstance().CompareHspVersion("10.1.2", "10.1.2"); 350 EXPECT_EQ(ret, 0); 351 352 ret = OHOS::Ide::StageContext::GetInstance().CompareHspVersion("10.1", "10.1.2"); 353 EXPECT_EQ(ret, -1); 354 355 ret = OHOS::Ide::StageContext::GetInstance().CompareHspVersion("10.1.2.3", "10.1.2"); 356 EXPECT_EQ(ret, 1); 357 } 358 TEST_F(StageContextTest,GetUpwardDirIndexTest)359 TEST_F(StageContextTest, GetUpwardDirIndexTest) 360 { 361 std::string path = "/aaa/bbb/ccc/ddd/eee/fff.json"; 362 int pos = OHOS::Ide::StageContext::GetInstance().GetUpwardDirIndex(path, 3); 363 EXPECT_EQ(pos, 8); // 8 is expect pos value 364 365 std::string path0 = "fff.json"; 366 int pos0 = OHOS::Ide::StageContext::GetInstance().GetUpwardDirIndex(path0, 3); 367 EXPECT_EQ(pos0, -1); 368 } 369 TEST_F(StageContextTest,GetCloudModuleBufferTest)370 TEST_F(StageContextTest, GetCloudModuleBufferTest) 371 { 372 std::vector<uint8_t>* ret = OHOS::Ide::StageContext::GetInstance().GetCloudModuleBuffer("aa"); 373 EXPECT_TRUE(ret == nullptr); 374 375 char buffer[FILENAME_MAX]; 376 if (getcwd(buffer, FILENAME_MAX) != nullptr) { 377 testDir = std::string(buffer); 378 std::string hspDir = testDir + "/cloudHspDir"; 379 if (!FileSystem::IsDirectoryExists(hspDir)) { 380 FileSystem::MakeDir(testDir + "/cloudHspDir"); 381 FileSystem::MakeDir(testDir + "/cloudHspDir/a"); 382 FileSystem::MakeDir(testDir + "/cloudHspDir/a/b"); 383 FileSystem::MakeDir(testDir + "/cloudHspDir/a/b/c"); 384 FileSystem::MakeDir(testDir + "/cloudHspDir/a/b/c/d"); 385 FileSystem::MakeDir(testDir + "/cloudHspDir/a/b/c/d/e"); 386 FileSystem::MakeDir(testDir + "/cloudHspDir/oh_modules"); 387 FileSystem::MakeDir(testDir + "/cloudHspDir/oh_modules/.hsp"); 388 FileSystem::MakeDir(testDir + "/cloudHspDir/oh_modules/.hsp/example@1.0.0"); 389 } 390 std::string loderJsonPath = testDir + "/cloudHspDir/a/b/c/d/e/f.json"; 391 WriteFile(loderJsonPath, "test"); 392 std::string cloudHspPath = testDir + "/cloudHspDir/oh_modules/.hsp/example@1.0.0/example.hsp"; 393 WriteFile(cloudHspPath, "cloudHsp"); 394 OHOS::Ide::StageContext::GetInstance().SetLoaderJsonPath(loderJsonPath); 395 396 OHOS::Ide::StageContext::GetInstance().hspNameOhmMap["example"] ="@bundle:aaa.bbb.ccc/example/Index"; 397 std::vector<uint8_t>* ret1 = OHOS::Ide::StageContext::GetInstance().GetCloudModuleBuffer("example"); 398 EXPECT_TRUE(ret1 == nullptr); 399 } 400 } 401 TEST_F(StageContextTest,GetModuleBufferFromHspTest)402 TEST_F(StageContextTest, GetModuleBufferFromHspTest) 403 { 404 std::string path = "/aaa/bbb/ccc/ddd/eee/fff.json"; 405 std::vector<uint8_t>* ret = OHOS::Ide::StageContext::GetInstance().GetModuleBufferFromHsp(path, "aa"); 406 EXPECT_TRUE(ret == nullptr); 407 std::string newFileName = MockFile::CreateHspFile("testHspFile", "abc"); 408 char buffer[FILENAME_MAX]; 409 if (getcwd(buffer, FILENAME_MAX) != nullptr) { 410 testDir = std::string(buffer); 411 std::string hspDir = testDir + "/testHspFile.hsp"; 412 std::vector<uint8_t>* buf1 = 413 OHOS::Ide::StageContext::GetInstance().GetModuleBufferFromHsp(hspDir, "ets/modules.abc"); 414 OHOS::Ide::StageContext::GetInstance().ReleaseHspBuffers(); 415 EXPECT_FALSE(buf1 == nullptr); 416 } 417 } 418 TEST_F(StageContextTest,GetSystemModuleBufferTest)419 TEST_F(StageContextTest, GetSystemModuleBufferTest) 420 { 421 std::string path = "/aaa/bbb/ccc/ddd/eee/fff.json"; 422 std::vector<uint8_t>* ret = OHOS::Ide::StageContext::GetInstance().GetSystemModuleBuffer(path, "aa"); 423 EXPECT_TRUE(ret == nullptr); 424 425 char buffer[FILENAME_MAX]; 426 if (getcwd(buffer, FILENAME_MAX) != nullptr) { 427 testDir = std::string(buffer); 428 std::string packageName = "com.huawei.example"; 429 std::string path1 = "bundle/" + packageName + "/moduleName"; 430 if (!FileSystem::IsDirectoryExists("/systemHsp")) { 431 FileSystem::MakeDir(testDir + "/systemHsp"); 432 FileSystem::MakeDir(testDir + "/systemHsp/" + packageName); 433 FileSystem::MakeDir(testDir + "/systemHsp/" + packageName + "/files"); 434 } 435 std::string loderHspPath = testDir + "/systemHsp/example.hsp"; 436 WriteFile(loderHspPath, "test"); 437 438 OHOS::Ide::StageContext::GetInstance().SetHosSdkPath(testDir); 439 std::vector<uint8_t>* ret1 = OHOS::Ide::StageContext::GetInstance().GetSystemModuleBuffer(path1, "example"); 440 EXPECT_TRUE(ret1 == nullptr); 441 } 442 } 443 } 444