Merge pull request #850 from PowerShell/andschwa/fix-xunit

Re-enable xUnit tests on Linux
This commit is contained in:
Andy Schwartzmeyer
2016-04-18 19:27:55 -07:00
6 changed files with 23 additions and 7 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ before_install:
- git submodule update --init -- src/windows-build src/Modules/Pester src/libpsl-native/test/googletest
- ./download.sh
script:
- ulimit -n 4096; powershell -c "Import-Module ./PowerShellGitHubDev.psm1; Start-PSBootstrap; Start-PSBuild; Start-PSPester"
- ulimit -n 4096; powershell -c "Import-Module ./PowerShellGitHubDev.psm1; Start-PSBootstrap; Start-PSBuild; Start-PSxUnit; Start-PSPester"
notifications:
slack:
secure: sKYd4n61+ZFzGZuWGUl8V1kN0NM16wRVOFVlNhlFCwnkrEsKROb++EvXf5uwnKuzxkhEjvPWO+UFgeshQDoR93y4s5YLfhC5JupK4nUzjPzWs208KTrh8u/x9MY8X6Ojxi85EEAiku5GzMoMlkucSStZUYwbIfnelzqdw8uoRwmm2MW4XCPwsuEuDUVghyiva0Mdx1G6MopCrK8T96WywJXT3chhfZQgVt+sQCBt9g+2kjDaObKrzG0P07IVK43ZpDgnu6AoxlyBzIx9mJH2Oa/tki3/kTO72Wcp3ps3qvmiStADamzVKR9p1VlWCLWAd6VOehxuByCGEyujpzk135Wud2DZYO+8LD6inZVhFe3Wt5pCU9BDXZppiATfMCqgXEH7nK54pEn79yHcjthRJ2+Z9ot7As2fu3RSBmTAi8nRP0fxRyX/jctR3S6P0qt0y1ynx9nzBfhmhPQW0PMVazWS/nruQIvK/3iiYXjZxM5bBwIvabmwV00EYeTdbL6ufXWNgQcG1ZWkDsi2I3vst/ytUbHwaFYg83bXWpxg9DCzJeWLVUvE5/3NfBxRAuCTot/fgTEA9IYScvrlL7Q/bT0cOt0vEM98MPf1UO+WP85uxhsRgHtwDEo+jMaL6ZFkPhlV6mmmED4NdY2//a571cLNXdnuMAze5O3TWGBG53g=
+5
View File
@@ -312,6 +312,11 @@ function Start-PSxUnit {
throw "xUnit tests are only currently supported on Linux / OS X"
}
if ($IsOSX) {
log "Not yet supported on OS X, pretending they passed..."
return
}
$Content = Split-Path -Parent (Get-PSOutput)
$Arguments = "--configuration", "Linux"
try {
+4 -2
View File
@@ -2,8 +2,10 @@
<configuration>
<packageSources>
<clear />
<add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="cli-deps" value="https://dotnet.myget.org/F/cli-deps/api/v3/index.json" />
<add key="CI Builds (dotnet-core)" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="CI Builds (dotnet-cli)" value="https://dotnet.myget.org/F/dotnet-cli/api/v3/index.json" />
<add key="CI Builds (aspnetvnext)" value="https://www.myget.org/F/aspnetvnext/api/v3/index.json" />
<add key="CI Builds (aspnetcidev)" value="http://myget.org/F/aspnetcidev/api/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="local" value="./src/windows-build/nuget-feed" />
</packageSources>
@@ -522,7 +522,15 @@ namespace System.Management.Automation
if (!IsInitialized)
{
var psAsmLoadContext = new PowerShellAssemblyLoadContext(basePaths);
AssemblyLoadContext.InitializeDefaultContext(psAsmLoadContext);
try
{
AssemblyLoadContext.InitializeDefaultContext(psAsmLoadContext);
}
catch (System.InvalidOperationException)
{
// We may not be able to set the default context. If we're under the
// xUnit test harness, it has already been set.
}
IsInitialized = true;
}
}
@@ -394,7 +394,9 @@ namespace System.Management.Automation
_psLoadContext = AssemblyLoadContext.Default as PowerShellAssemblyLoadContext;
if (_psLoadContext == null)
{
throw new InvalidOperationException(ParserStrings.InvalidAssemblyLoadContextInUse);
// The default load context may not be ours. This can happen during,
// for instance, xUnit testing.
_psLoadContext = new PowerShellAssemblyLoadContext(String.Empty);
}
}
return _psLoadContext;
+1 -2
View File
@@ -12,9 +12,8 @@
"netstandardapp1.5": {
"imports": [ "dnxcore50", "portable-net45+win8" ],
"dependencies": {
"NuGet.Packaging.Core": "3.5.0-beta-1145",
"xunit": "2.1.0",
"dotnet-test-xunit": "1.0.0-dev-91790-12"
"dotnet-test-xunit": "1.0.0-dev-140469-38"
}
}
},