[msbuild] Don't leave changes behind if a test fails. (#7636)

This commit is contained in:
Rolf Bjarne Kvinge 2019-12-23 19:30:12 +01:00 коммит произвёл Manuel de la Pena
Родитель b107841f13
Коммит 5c7b669b5b
2 изменённых файлов: 21 добавлений и 10 удалений

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

@ -504,20 +504,24 @@ namespace Xamarin.iOS.Tasks
plist.SetMinimumOSVersion ("7.0");
plist.Save (path, true);
var projectInstance = project.CreateProjectInstance ();
RunTargetOnInstance (projectInstance, TargetName.CompileImageAssets, 0);
ProjectInstance projectInstance = null;
try {
projectInstance = project.CreateProjectInstance ();
RunTargetOnInstance (projectInstance, TargetName.CompileImageAssets, 0);
var bundleItemsNoAppIcon = projectInstance.GetItems ("_BundleResourceWithLogicalName").ToArray ();
Assert.IsFalse (bundleItemsNoAppIcon.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons60x60@2x.png") && i.GetMetadataValue ("LogicalName") == "AppIcons60x60@2x.png"), "#1");
var bundleItemsNoAppIcon = projectInstance.GetItems ("_BundleResourceWithLogicalName").ToArray ();
Assert.IsFalse (bundleItemsNoAppIcon.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons60x60@2x.png") && i.GetMetadataValue ("LogicalName") == "AppIcons60x60@2x.png"), "#1");
project = SetupProject (Engine, MonoTouchProjectCSProjPath);
projectInstance = project.CreateProjectInstance ();
project = SetupProject (Engine, MonoTouchProjectCSProjPath);
projectInstance = project.CreateProjectInstance ();
// Put a thread.sleep so that we get noticeable timestamps.
EnsureFilestampChange ();
// Put a thread.sleep so that we get noticeable timestamps.
EnsureFilestampChange ();
// Re-save the original plist (adding app icon).
plistCopy.Save (path, true);
} finally {
// Re-save the original plist (adding app icon).
plistCopy.Save (path, true);
}
// Re-run the task with app icon set this time and no clean.
// The task should be aware the app icon is now being used.

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

@ -55,6 +55,13 @@ namespace Xamarin.iOS.Tasks
CompiledPlist = PDictionary.FromFile (Task.CompiledAppManifest.ItemSpec);
}
public override void Teardown ()
{
base.Teardown ();
Directory.Delete ("AppBundlePath", true);
}
#region General tests
[Test]
public void PlistMissing ()