Skip to content

Commit e43c6ce

Browse files
committed
[tests/MSBuildDeviceIntegration] Add test for dll's which have the same size.
Context xamarin/monodroid#1123 There seems to be a bug in the new fast deployment system where if the dll was modified BUT had exactly the same size as the existing dll on the device it would not be uploade. This commit adds a test to make sure this does work as expected.
1 parent 91498d5 commit e43c6ce

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

tests/MSBuildDeviceIntegration/Tests/InstallTests.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,14 +478,15 @@ public void IncrementalFastDeployment ()
478478
}
479479
};
480480

481+
var class2src = new BuildItem.Source ("Class2.cs") {
482+
TextContent = () => "namespace Library2 { public class Class2 { public static int foo = 0; } }"
483+
};
481484
var lib2 = new DotNetStandard {
482485
ProjectName = "Library2",
483486
Sdk = "Microsoft.NET.Sdk",
484487
TargetFramework = "netstandard2.0",
485488
Sources = {
486-
new BuildItem.Source ("Class2.cs") {
487-
TextContent = () => "namespace Library2 { public class Class2 { } }"
488-
},
489+
class2src,
489490
}
490491
};
491492

@@ -507,21 +508,29 @@ public void IncrementalFastDeployment ()
507508
using (var builder = CreateApkBuilder (Path.Combine (rootPath, app.ProjectName))) {
508509
builder.ThrowOnBuildFailure = false;
509510
Assert.IsTrue (builder.Install (app), "First install should have succeeded.");
511+
var logLines = builder.LastBuildOutput;
512+
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("Library2.dll")), "Library2.dll should have been uploaded");
510513
var firstInstallTime = builder.LastBuildTime;
511514
Assert.IsTrue (builder.Install (app, doNotCleanupOnUpdate: true, saveProject: false), "Second install should have succeeded.");
512515
var secondInstallTime = builder.LastBuildTime;
513516

514517
var filesToTouch = new [] {
515518
Path.Combine (rootPath, lib1.ProjectName, "Class1.cs"),
516-
Path.Combine (rootPath, lib2.ProjectName, "Class2.cs"),
517519
Path.Combine (rootPath, app.ProjectName, "MainPage.xaml"),
518520
};
519521
foreach (var file in filesToTouch) {
520522
FileAssert.Exists (file);
521523
File.SetLastWriteTimeUtc (file, DateTime.UtcNow);
522524
}
523525

526+
class2src.TextContent = () => "namespace Library2 { public class Class2 { public static int foo = 100; } }";
527+
using (var lb2 = CreateDllBuilder (Path.Combine (rootPath, lib2.ProjectName)))
528+
Assert.IsTrue (lb2.Build (lib2), "Second library build should have succeeded.");
529+
524530
Assert.IsTrue (builder.Install (app, doNotCleanupOnUpdate: true, saveProject: false), "Third install should have succeeded.");
531+
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("UnnamedProject.dll")), "UnnamedProject.dll should have been uploaded");
532+
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("Library2.dll")), "Library2.dll should have been uploaded");
533+
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync SkipCopyFile") && l.Contains ("Library1.dll")), "Library1.dll should not have been uploaded");
525534
var thirdInstallTime = builder.LastBuildTime;
526535
Assert.IsTrue (builder.Install (app, doNotCleanupOnUpdate: true, saveProject: false), "Fourth install should have succeeded.");
527536
var fourthInstalTime = builder.LastBuildTime;

0 commit comments

Comments
 (0)