* Enable run-time tests when command-line option set

* Enable Burn_RetryThenCancel test and make it pass

* Dispose SummaryInformation explicitly to avoid it on other thread
This commit is contained in:
Jeremy Hurren 2016-05-15 11:04:27 -06:00 коммит произвёл Bob Arnson
Родитель c489d7e8f0
Коммит 98b828d610
3 изменённых файлов: 21 добавлений и 4 удалений

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

@ -14,7 +14,7 @@ namespace WixTest.BurnIntegrationTests
private PackageBuilder packageA;
private BundleBuilder bundleA;
[NamedFact(Skip="Disabling this test since it does not consistently lock the file in a way that the Windows Installer sees FilesInUse.")]
[NamedFact]
[RuntimeTest]
public void Burn_RetryThenCancel()
{
@ -26,7 +26,7 @@ namespace WixTest.BurnIntegrationTests
// Lock the file that will be installed.
string targetInstallFile = this.GetTestInstallFolder("A\\A.wxs");
Directory.CreateDirectory(Path.GetDirectoryName(targetInstallFile));
using (FileStream lockTargetFile = new FileStream(targetInstallFile, FileMode.Create, FileAccess.Write, FileShare.Read))
using (FileStream lockTargetFile = new FileStream(targetInstallFile, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None, 4096, FileOptions.DeleteOnClose))
{
installA.Install(expectedExitCode:(int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT);
}

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

@ -273,6 +273,15 @@ namespace WixTest
throw new NullReferenceException(String.Format("The Method {0} could not be found in {1}", getPropertyMethodName, summaryInformationTypeName));
}
// Find the SummaryInformation.Dispose method
BindingFlags disposeBindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
string disposeMethodName = "Dispose";
MethodInfo disposeMethod = summaryInformationType.GetMethod(disposeMethodName, disposeBindingFlags);
if (null == disposeMethod)
{
throw new NullReferenceException(String.Format("The Method {0} could not be found in {1}", disposeMethodName, summaryInformationTypeName));
}
// Create an instance of a SummaryInformation object
Object[] constructorArguments = { msi };
BindingFlags constructorBindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
@ -282,6 +291,9 @@ namespace WixTest
Object[] arguments = { propertyIndex };
string value = (string)getPropertyMethod.Invoke(instance, arguments);
// Dispose this instance explicitly so it is disposed on the same thread, avoiding a ?bug? in MSIHANDLEs
disposeMethod.Invoke(instance, null);
return value;
}

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

@ -45,6 +45,11 @@ if not "%INTEGRATIONTESTS%"=="true" (
set TESTASSEMBLIES=!TESTASSEMBLIES! "%WIX_BUILD_X86%\WixTests.dll"
)
REM Enable runtime tests
if "%ENABLERUNTIMETESTS%"=="true" (
set RuntimeTestsEnabled=true
)
for /f "usebackq" %%i in (`where /f xunit.console.clr4.*`) do (
set COMMAND=%%i
)
@ -55,7 +60,7 @@ if not "!COMMAND!"=="" (
if not "!EXITCODE!"=="0" set EXITCODE=%ERRORLEVEL%
)
) else (
call msbuild "%~dp0\test\All.testproj" /p:Configuration=%FLAVOR%
call msbuild "%WIX_TEST_ROOT%test\All.testproj" /p:Configuration=%FLAVOR%
if not "!EXITCODE!"=="0" set EXITCODE=%ERRORLEVEL%
)