From 040e50ec2859c1de70cd8e9f957474321774f293 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 11 Feb 2025 13:53:50 -0800 Subject: Rewrite Prereq tests after hardening and bypassing .NET GUI errors --- .../burn/TestData/PrereqBaTests/BundleA/BundleA.wxs | 11 ++++------- .../PrereqBaTests/BundleA/bad.runtimeconfig.json | 10 ---------- .../burn/TestData/PrereqBaTests/BundleB/BundleB.wxs | 12 ++++-------- .../TestData/PrereqBaTests/BundleC/BundleC.wixproj | 2 +- .../burn/TestData/PrereqBaTests/BundleC/BundleC.wxs | 10 ++++------ .../PrereqBaTests/BundleC/bad.runtimeconfig.json | 10 ---------- .../TestData/PrereqBaTests/BundleD/BundleD.wixproj | 2 +- .../burn/TestData/PrereqBaTests/BundleD/BundleD.wxs | 11 ++++------- .../burn/TestData/PrereqBaTests/BundleE/BundleE.wxs | 4 ++-- .../PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp | 20 ++++++++++++-------- 10 files changed, 32 insertions(+), 60 deletions(-) delete mode 100644 src/test/burn/TestData/PrereqBaTests/BundleA/bad.runtimeconfig.json delete mode 100644 src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json (limited to 'src/test/burn/TestData') diff --git a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs index a86f498f..5f0fefe5 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs +++ b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs @@ -1,13 +1,11 @@  - - + - @@ -17,13 +15,12 @@ - - + + Permanent="yes" DetectCondition="TestBAConfigPresent" + InstallArguments=""[BARuntimeDirectory]\TestBA.runtimeconfig.json" "[BARuntimeDirectory]\good.runtimeconfig.json"" /> diff --git a/src/test/burn/TestData/PrereqBaTests/BundleA/bad.runtimeconfig.json b/src/test/burn/TestData/PrereqBaTests/BundleA/bad.runtimeconfig.json deleted file mode 100644 index 07a1a830..00000000 --- a/src/test/burn/TestData/PrereqBaTests/BundleA/bad.runtimeconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "runtimeOptions": { - "tfm": "net5.5", - "rollForward": "Disable", - "framework": { - "name": "Microsoft.WindowsDesktop.App", - "version": "5.5.0" - } - } -} \ No newline at end of file diff --git a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs index 7a84bd5b..f5745d0f 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs +++ b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs @@ -1,12 +1,9 @@  - - + - @@ -16,13 +13,12 @@ - - + + Permanent="yes" DetectCondition="TestBAConfigPresent" + InstallArguments=""[BARuntimeDirectory]TestBA.exe.config" "[BARuntimeDirectory]good.config"" /> diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj index 7ed34aa5..27b9c196 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj +++ b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj @@ -2,7 +2,7 @@ Bundle - BrokenDncAlwaysPrereq + BrokenDncSecondary {D2763AB7-979B-485C-AE52-DD03C23CCB93} diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs index e03cad62..12607cf0 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs +++ b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs @@ -2,11 +2,10 @@ - + - @@ -16,13 +15,12 @@ - - + + Permanent="yes" DetectCondition="TestBAConfigPresent" + InstallArguments=""[BARuntimeDirectory]TestBA.runtimeconfig.json" "[BARuntimeDirectory]good.runtimeconfig.json"" /> diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json b/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json deleted file mode 100644 index 07a1a830..00000000 --- a/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "runtimeOptions": { - "tfm": "net5.5", - "rollForward": "Disable", - "framework": { - "name": "Microsoft.WindowsDesktop.App", - "version": "5.5.0" - } - } -} \ No newline at end of file diff --git a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj index 280193df..1888bc7d 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj +++ b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj @@ -2,7 +2,7 @@ Bundle - BrokenMbaAlwaysPrereq + BrokenMbaSecondary {415CA128-60E1-4D16-ACE8-A1D43E98B997} diff --git a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs index 2eed4bd1..1b414cb2 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs +++ b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs @@ -1,11 +1,9 @@  - - + - @@ -15,13 +13,12 @@ - - + + Permanent="yes" DetectCondition="TestBAConfigPresent" + InstallArguments=""[BARuntimeDirectory]TestBA.exe.config" "[BARuntimeDirectory]good.config"" /> diff --git a/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs index b6962b65..b994847e 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs +++ b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs @@ -14,11 +14,11 @@ - + diff --git a/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp index 1fa71bc2..b8172e6b 100644 --- a/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp +++ b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp @@ -7,27 +7,31 @@ int __cdecl wmain( __in LPWSTR argv[] ) { + DWORD er = ERROR_SUCCESS; HRESULT hr = S_OK; - DWORD dwExitCode = 0; LPCWSTR wzDestinationFile = argc > 1 ? argv[1] : NULL; LPCWSTR wzGoodFile = argc > 2 ? argv[2] : NULL; - LPCWSTR wzBadFile = argc > 3 ? argv[3] : NULL; + LPCWSTR wzBackupFile = argc > 3 ? argv[3] : NULL; - if (argc != 4) + if (!wzDestinationFile || !*wzDestinationFile || !wzGoodFile || !*wzGoodFile) { ExitWithRootFailure(hr, E_INVALIDARG, "Invalid args"); } - if (!::MoveFileW(wzDestinationFile, wzBadFile)) + if (wzBackupFile && *wzBackupFile && !::CopyFileW(wzDestinationFile, wzBackupFile, FALSE)) { - ExitWithLastError(hr, "Failed to move bad file"); + er = ::GetLastError(); + if (ERROR_PATH_NOT_FOUND != er && ERROR_FILE_NOT_FOUND != er) + { + ExitOnWin32Error(er, hr, "Failed to copy to backup file"); + } } - if (!::MoveFileW(wzGoodFile, wzDestinationFile)) + if (!::CopyFileW(wzGoodFile, wzDestinationFile, FALSE)) { - ExitWithLastError(hr, "Failed to move good file"); + ExitWithLastError(hr, "Failed to copy in good file"); } LExit: - return FAILED(hr) ? (int)hr : (int)dwExitCode; + return FAILED(hr) ? (int)hr : (int)0; } -- cgit v1.2.3-55-g6feb