[XHarness] If there are issues generating the BCL tests for mac dont crash. (#7646)

This commit is contained in:
Manuel de la Pena 2019-12-23 19:04:09 -05:00 коммит произвёл GitHub
Родитель 4c6181e904
Коммит 1c3bd7f114
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 22 добавлений и 16 удалений

Просмотреть файл

@ -711,24 +711,30 @@ namespace BCLTestImporter {
using (var file = new StreamWriter (registerTypePath, false)) { // false is do not append
await file.WriteAsync (registerCode);
}
var plistTemplate = Path.Combine (PlistTemplateRootPath, plistTemplateMatches[platform]);
var plist = await BCLTestInfoPlistGenerator.GenerateCodeAsync (plistTemplate, projectDefinition.Name);
var infoPlistPath = GetPListPath (generatedCodeDir, platform);
using (var file = new StreamWriter (infoPlistPath, false)) { // false is do not append
await file.WriteAsync (plist);
}
var projectTemplatePath = Path.Combine (ProjectTemplateRootPath, projectTemplateMatches[platform]);
var info = projectDefinition.GetAssemblyInclusionInformation (GetReleaseDownload (platform), platform, true);
var generatedProject = await GenerateMacAsync (projectDefinition.Name, registerTypePath,
info, projectTemplatePath, infoPlistPath, platform);
var projectPath = GetProjectPath (projectDefinition.Name, platform);
projectPaths.Add (new BclTestProject { Name = projectDefinition.Name, Path = projectPath, XUnit = projectDefinition.IsXUnit, ExtraArgs = projectDefinition.ExtraArgs, Failure = null, TimeoutMultiplier = def.TimeoutMultiplier });
using (var file = new StreamWriter (projectPath, false)) { // false is do not append
await file.WriteAsync (generatedProject);
string failure = null;
try {
var plistTemplate = Path.Combine (PlistTemplateRootPath, plistTemplateMatches [platform]);
var plist = await BCLTestInfoPlistGenerator.GenerateCodeAsync (plistTemplate, projectDefinition.Name);
var infoPlistPath = GetPListPath (generatedCodeDir, platform);
using (var file = new StreamWriter (infoPlistPath, false)) { // false is do not append
await file.WriteAsync (plist);
}
var projectTemplatePath = Path.Combine (ProjectTemplateRootPath, projectTemplateMatches [platform]);
var info = projectDefinition.GetAssemblyInclusionInformation (GetReleaseDownload (platform), platform, true);
var generatedProject = await GenerateMacAsync (projectDefinition.Name, registerTypePath,
info, projectTemplatePath, infoPlistPath, platform);
using (var file = new StreamWriter (projectPath, false)) { // false is do not append
await file.WriteAsync (generatedProject);
}
failure = failure ?? info.FailureMessage;
failure = failure ?? typesPerAssembly.FailureMessage;
} catch (Exception e) {
failure = e.Message;
}
projectPaths.Add (new BclTestProject { Name = projectDefinition.Name, Path = projectPath, XUnit = projectDefinition.IsXUnit, ExtraArgs = projectDefinition.ExtraArgs, Failure = failure, TimeoutMultiplier = def.TimeoutMultiplier });
}
return projectPaths;
}