From 95e8b1be902cce3b5a394066a62e0c32d0688261 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 15 Sep 2022 12:17:07 -0500 Subject: Add more burn E2E tests. Fix bug where first splash screen wasn't closed. Fix bug where billboard only started the first time. Fix bug where the restart status was lost when the exit code was an error. Fix bug where the hash byte array length was compared to the hash string length (string is twice as long). Fix bug where Burn didn't give update hash if the first byte was 0. --- .../CustomExitCodeExePackage.wixproj | 17 +++++++ .../CustomExitCodeExePackage.wxs | 34 ++++++++++++++ .../theme/BafThmUtilTestingTheme.xml | 2 +- .../theme/BafThmUtilTestingThemeLoose.xml | 2 +- .../burn/TestData/Manual/BundleA/ManualTests.txt | 10 ++++ .../BundleBv1/FeedBv2.0_wronghash.xml | 54 ++++++++++++++++++++++ src/test/burn/WixTestTools/MSIExec.cs | 8 +++- .../burn/WixToolsetTest.BurnE2E/ExePackageTests.cs | 26 +++++++++++ .../WixToolsetTest.BurnE2E/UpdateBundleTests.cs | 36 +++++++++++++++ 9 files changed, 186 insertions(+), 3 deletions(-) create mode 100644 src/test/burn/TestData/ExePackageTests/CustomExitCodeExePackage/CustomExitCodeExePackage.wixproj create mode 100644 src/test/burn/TestData/ExePackageTests/CustomExitCodeExePackage/CustomExitCodeExePackage.wxs create mode 100644 src/test/burn/TestData/UpdateBundleTests/BundleBv1/FeedBv2.0_wronghash.xml (limited to 'src/test') diff --git a/src/test/burn/TestData/ExePackageTests/CustomExitCodeExePackage/CustomExitCodeExePackage.wixproj b/src/test/burn/TestData/ExePackageTests/CustomExitCodeExePackage/CustomExitCodeExePackage.wixproj new file mode 100644 index 00000000..403f3320 --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/CustomExitCodeExePackage/CustomExitCodeExePackage.wixproj @@ -0,0 +1,17 @@ + + + + Bundle + {9BB4F6D3-4EE3-40BF-879F-90E78440EAE8} + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/burn/TestData/ExePackageTests/CustomExitCodeExePackage/CustomExitCodeExePackage.wxs b/src/test/burn/TestData/ExePackageTests/CustomExitCodeExePackage/CustomExitCodeExePackage.wxs new file mode 100644 index 00000000..a02e48d1 --- /dev/null +++ b/src/test/burn/TestData/ExePackageTests/CustomExitCodeExePackage/CustomExitCodeExePackage.wxs @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/burn/TestData/Manual/BafThmutilTesting/theme/BafThmUtilTestingTheme.xml b/src/test/burn/TestData/Manual/BafThmutilTesting/theme/BafThmUtilTestingTheme.xml index 4c117506..c890d7df 100644 --- a/src/test/burn/TestData/Manual/BafThmutilTesting/theme/BafThmUtilTestingTheme.xml +++ b/src/test/burn/TestData/Manual/BafThmutilTesting/theme/BafThmUtilTestingTheme.xml @@ -132,7 +132,7 @@ There are currently four states for a button: default, focus, hover, and selecte diff --git a/src/test/burn/TestData/Manual/BafThmutilTesting/theme/BafThmUtilTestingThemeLoose.xml b/src/test/burn/TestData/Manual/BafThmutilTesting/theme/BafThmUtilTestingThemeLoose.xml index b2b0dcb3..37757e64 100644 --- a/src/test/burn/TestData/Manual/BafThmutilTesting/theme/BafThmUtilTestingThemeLoose.xml +++ b/src/test/burn/TestData/Manual/BafThmutilTesting/theme/BafThmUtilTestingThemeLoose.xml @@ -132,7 +132,7 @@ There are currently four states for a button: default, focus, hover, and selecte diff --git a/src/test/burn/TestData/Manual/BundleA/ManualTests.txt b/src/test/burn/TestData/Manual/BundleA/ManualTests.txt index b8c6e74d..351f2c1f 100644 --- a/src/test/burn/TestData/Manual/BundleA/ManualTests.txt +++ b/src/test/burn/TestData/Manual/BundleA/ManualTests.txt @@ -152,3 +152,13 @@ CanRestartFromUnelevatedPerUserBundleWithShutdownPrivilege ======================================= (10. Uninstall the bundle) + +CanShowSplashScreenQuicklyAndCacheThousandsOfFilesInLinearTime + +1. Run BundleB.exe. +2. The splash screen should come up immediately (less than 1 second). +3. After the wixstdba UI comes up, make sure the splash screen was closed (it might be hiding underneath windows). +4. Click Install (accept elevation). +5. This bundle contains 10000 loose files which needs to be cached, which used to take over 30 minutes. The exact timing can be different on different machines, but it should be closer to 30 seconds. +6. Click Close. +(7. Uninstall the bundle) diff --git a/src/test/burn/TestData/UpdateBundleTests/BundleBv1/FeedBv2.0_wronghash.xml b/src/test/burn/TestData/UpdateBundleTests/BundleBv1/FeedBv2.0_wronghash.xml new file mode 100644 index 00000000..82ce6837 --- /dev/null +++ b/src/test/burn/TestData/UpdateBundleTests/BundleBv1/FeedBv2.0_wronghash.xml @@ -0,0 +1,54 @@ + + + + + + BundleB v2.0 + Bundle Subtitle. + 1116353B-7C6E-4C29-BFA1-D4A972CD421D + 2014-07-14T12:39:00.000Z + http://localhost:9999/e2e/BundleB/feed + + manual build + + Bundle v2.0 + v2.0 + + Bundle_Author + http://mycompany.com/software + Bundle_Author@mycompany.com + + + + this hash is supposed to be wrong but has a tiny chance of actually being right + 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + + + <p>Change list:</p><ul> + <li>Updated release.</li> + </ul> + + + 2.0.0.0 + 2014-11-10T12:39:00.000Z + + + Bundle v1.0 + v1.0 + + Bundle_Author + http://mycompany.com/software + Bundle_Author@mycompany.com + + + + + <p>Change list:</p><ul> + <li>Initial release.</li> + </ul> + + + 1.0.0.0 + 2014-11-09T12:39:00.000Z + + diff --git a/src/test/burn/WixTestTools/MSIExec.cs b/src/test/burn/WixTestTools/MSIExec.cs index 5f57da7b..a905ec5a 100644 --- a/src/test/burn/WixTestTools/MSIExec.cs +++ b/src/test/burn/WixTestTools/MSIExec.cs @@ -666,7 +666,13 @@ namespace WixTestTools /// A restart is required to complete the install. This message is indicative of a success. /// This does not include installs where the ForceReboot action is run. /// - ERROR_SUCCESS_REBOOT_REQUIRED = 3010 + ERROR_SUCCESS_REBOOT_REQUIRED = 3010, + + /// + /// ERROR_SUCCESS_REBOOT_REQUIRED 3017 + /// The requested operation failed. A system reboot is required to roll back changes made. + /// + ERROR_FAIL_REBOOT_REQUIRED = 3017, } /// diff --git a/src/test/burn/WixToolsetTest.BurnE2E/ExePackageTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/ExePackageTests.cs index e76461f3..42301f30 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/ExePackageTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/ExePackageTests.cs @@ -142,6 +142,32 @@ namespace WixToolsetTest.BurnE2E Assert.True(LogVerifier.MessageInLogFile(installLogPath, $"testexe.exe\" /regd HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{arpId}")); } + [RuntimeFact] + public void CanUseLargeCustomExitCode() + { + var customExitCodeExePackageBundle = this.CreateBundleInstaller(@"CustomExitCodeExePackage"); + + var installLogPath = customExitCodeExePackageBundle.Install(5, "EXEEXITCODE=-2147024891"); + customExitCodeExePackageBundle.VerifyUnregisteredAndRemovedFromPackageCache(); + + Assert.True(LogVerifier.MessageInLogFile(installLogPath, "TestExe.exe\" /ec -2147024891")); + Assert.True(LogVerifier.MessageInLogFile(installLogPath, "The process for package: TestExe exited with code: 0x80070005. The exit code has been translated to type: ErrorScheduleReboot and restart: Required.")); + Assert.True(LogVerifier.MessageInLogFile(installLogPath, "Applied execute package: TestExe, result: 0x80070005, restart: Required")); + Assert.True(LogVerifier.MessageInLogFile(installLogPath, "Apply complete, result: 0x80070005, restart: Required, ba requested restart: No")); + } + + [RuntimeFact] + public void CanUseWildcardCustomExitCode() + { + var customExitCodeExePackageBundle = this.CreateBundleInstaller(@"CustomExitCodeExePackage"); + + var installLogPath = customExitCodeExePackageBundle.Install((int)MSIExec.MSIExecReturnCode.SUCCESS, "EXEEXITCODE=1"); + customExitCodeExePackageBundle.VerifyUnregisteredAndRemovedFromPackageCache(); + + Assert.True(LogVerifier.MessageInLogFile(installLogPath, "TestExe.exe\" /ec 1")); + Assert.True(LogVerifier.MessageInLogFile(installLogPath, "The process for package: TestExe exited with code: 0x1. The exit code has been translated to type: Success and restart: None.")); + } + [RuntimeFact] public void CanInstallAndUninstallPerUserArpEntryExePackage() { diff --git a/src/test/burn/WixToolsetTest.BurnE2E/UpdateBundleTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/UpdateBundleTests.cs index df666833..f7ec8647 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/UpdateBundleTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/UpdateBundleTests.cs @@ -242,5 +242,41 @@ namespace WixToolsetTest.BurnE2E packageBv1.VerifyInstalled(false); packageBv2.VerifyInstalled(false); } + + // Installs bundle Bv1.0 then attempts an update to bundle Bv2.0 during modify (server exists, v2.0 feed with wrong hash). + [RuntimeFact] + public void CanBlockWrongUpdateBundleFromDownloadInsteadOfModify() + { + var packageBv1 = this.CreatePackageInstaller("PackageBv1"); + var packageBv2 = this.CreatePackageInstaller("PackageBv2"); + var bundleBv1 = this.CreateBundleInstaller("BundleBv1"); + var bundleBv2 = this.CreateBundleInstaller("BundleBv2"); + var webServer = this.CreateWebServer(); + + webServer.AddFiles(new Dictionary + { + { "/BundleB/feed", Path.Combine(this.TestContext.TestDataFolder, "FeedBv2.0_wronghash.xml") }, + { "/BundleB/2.0/BundleB.exe", bundleBv2.Bundle }, + }); + webServer.Start(); + + packageBv1.VerifyInstalled(false); + packageBv2.VerifyInstalled(false); + + bundleBv1.Install(); + bundleBv1.VerifyRegisteredAndInPackageCache(); + + packageBv1.VerifyInstalled(true); + packageBv2.VerifyInstalled(false); + + // Run the v1 bundle requesting an update bundle. + bundleBv1.Modify(unchecked((int)0x80091007), arguments: "-checkupdate"); + + bundleBv1.VerifyRegisteredAndInPackageCache(); + bundleBv2.VerifyUnregisteredAndRemovedFromPackageCache(); + + packageBv1.VerifyInstalled(true); + packageBv2.VerifyInstalled(false); + } } } -- cgit v1.2.3-55-g6feb