!2947 测试用例执行异常问题修复

Merge pull request !2947 from dy/fix_testrunner_error
This commit is contained in:
openharmony_ci 2022-09-06 11:53:05 +00:00 committed by Gitee
commit 7258e1ebee
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -50,14 +50,17 @@ JsTestRunner::JsTestRunner(
bool isFaJsModel)
: jsRuntime_(jsRuntime), isFaJsModel_(isFaJsModel)
{
std::string moduleName;
if (args) {
std::string srcPath;
if (bundleInfo.hapModuleInfos.back().isModuleJson) {
srcPath.append(args->GetTestModuleName());
srcPath.append("/ets/TestRunner/");
moduleName = args->GetTestModuleName();
} else {
srcPath.append(args->GetTestPackageName());
srcPath.append("/assets/js/TestRunner/");
moduleName = args->GetTestPackageName();
}
srcPath.append(args->GetTestRunnerClassName());
srcPath.append(".abc");
@ -65,9 +68,9 @@ JsTestRunner::JsTestRunner(
}
HILOG_DEBUG("JsTestRunner srcPath is %{public}s", srcPath_.c_str());
if (!isFaJsModel) {
if (!args->GetTestModuleName().empty()) {
if (!moduleName.empty()) {
for (auto hapModuleInfo : bundleInfo.hapModuleInfos) {
if (hapModuleInfo.name == args->GetTestModuleName()) {
if (hapModuleInfo.name == moduleName) {
hapPath_ = hapModuleInfo.hapPath;
}
}