diff --git a/eng/helix/content/InstallAppRuntime.ps1 b/eng/helix/content/InstallAppRuntime.ps1 index 9d9aaffb5c..5307a09e60 100644 --- a/eng/helix/content/InstallAppRuntime.ps1 +++ b/eng/helix/content/InstallAppRuntime.ps1 @@ -30,8 +30,6 @@ $ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138 Set-StrictMode -Version 1 -Write-Host "Extracting to $InstallDir" - $zipPackage = [io.path]::ChangeExtension($AppRuntimePath, ".zip") Write-Host "Renaming to $zipPackage" Rename-Item -Path $AppRuntimePath -NewName $zipPackage @@ -46,8 +44,9 @@ else { [System.IO.Compression.ZipFile]::ExtractToDirectory($zipPackage, ".\tmpRuntime") } -Get-ChildItem -Path ".\tmpRuntime" -Recurse - +New-Item -ItemType Directory -Force -Path $InstallDir +Write-Host "Copying *.txt to $InstallDir" +Copy-Item -Path ".\tmpRuntime\*.txt" $InstallDir Write-Host "Copying managed files to $InstallDir" Copy-Item -Path ".\tmpRuntime\runtimes\$RuntimeIdentifier\lib\$Framework\*" $InstallDir Write-Host "Copying native files to $InstallDir" diff --git a/eng/helix/content/InstallAspNetRef.ps1 b/eng/helix/content/InstallAspNetRef.ps1 new file mode 100644 index 0000000000..d5a4d2a9c6 --- /dev/null +++ b/eng/helix/content/InstallAspNetRef.ps1 @@ -0,0 +1,40 @@ + <# + .SYNOPSIS + Unzips an AspNetCore.App.Ref nupkg + .DESCRIPTION + This script unzips an AspNetCore.App.Ref nupkg + .PARAMETER RefPath + The path to the AspNetCore.App.Ref package to install. + .PARAMETER InstallDir + The directory to install to. + #> +param( + [Parameter(Mandatory = $true)] + $RefPath, + + [Parameter(Mandatory = $true)] + $InstallDir +) + +$ErrorActionPreference = 'Stop' +$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138 + +Set-StrictMode -Version 1 + +Write-Host "Extracting to $InstallDir" + +$zipPackage = [io.path]::ChangeExtension($RefPath, ".zip") +Write-Host "Renaming to $zipPackage" +Rename-Item -Path $RefPath -NewName $zipPackage +if (Get-Command -Name 'Microsoft.PowerShell.Archive\Expand-Archive' -ErrorAction Ignore) { + # Use built-in commands where possible as they are cross-plat compatible + Microsoft.PowerShell.Archive\Expand-Archive -Path $zipPackage -DestinationPath "$InstallDir" -Force +} +else { + Remove-Item "$InstallDir" -Recurse -ErrorAction Ignore + # Fallback to old approach for old installations of PowerShell + Add-Type -AssemblyName System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::ExtractToDirectory($zipPackage, "$InstallDir") +} + +Get-ChildItem -Path "$InstallDir" -Recurse diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs index 850d0b629d..2a9fadfb01 100644 --- a/eng/helix/content/RunTests/TestRunner.cs +++ b/eng/helix/content/RunTests/TestRunner.cs @@ -65,17 +65,17 @@ namespace RunTests } } - public void DisplayContents() + public void DisplayContents(string path = "./") { try { Console.WriteLine(); - Console.WriteLine("Displaying directory contents:"); - foreach (var file in Directory.EnumerateFiles("./")) + Console.WriteLine($"Displaying directory contents for {path}:"); + foreach (var file in Directory.EnumerateFiles(path)) { Console.WriteLine(Path.GetFileName(file)); } - foreach (var file in Directory.EnumerateDirectories("./")) + foreach (var file in Directory.EnumerateDirectories(path)) { Console.WriteLine(Path.GetFileName(file)); } @@ -83,7 +83,7 @@ namespace RunTests } catch (Exception e) { - Console.WriteLine($"Exception in DisplayInitialState: {e.ToString()}"); + Console.WriteLine($"Exception in DisplayContents: {e.ToString()}"); } } @@ -95,11 +95,17 @@ namespace RunTests if (Directory.Exists("Microsoft.AspNetCore.App")) { var appRuntimePath = $"{Options.DotnetRoot}/shared/Microsoft.AspNetCore.App/{Options.RuntimeVersion}"; + Console.WriteLine($"Creating directory: {appRuntimePath}"); + Directory.CreateDirectory(appRuntimePath); Console.WriteLine($"Found Microsoft.AspNetCore.App/, copying to {appRuntimePath}"); + Console.WriteLine($"Set ASPNET_RUNTIME_PATH: {appRuntimePath}"); + EnvironmentVariables.Add("ASPNET_RUNTIME_PATH", appRuntimePath); foreach (var file in Directory.EnumerateFiles("Microsoft.AspNetCore.App", "*.*", SearchOption.AllDirectories)) { - File.Copy(file, Path.Combine(appRuntimePath, file), overwrite: true); + File.Copy(file, Path.Combine(appRuntimePath, Path.GetFileName(file)), overwrite: true); } + + DisplayContents(appRuntimePath); Console.WriteLine($"Adding current directory to nuget sources: {Options.HELIX_WORKITEM_ROOT}"); diff --git a/eng/helix/content/installappruntime.sh b/eng/helix/content/installappruntime.sh index 45cb1554fa..09a82953a9 100755 --- a/eng/helix/content/installappruntime.sh +++ b/eng/helix/content/installappruntime.sh @@ -16,5 +16,6 @@ mkdir -p $tmpDir unzip sharedFx.zip -d $tmpDir mkdir -p $output_dir echo "Copying to $output_dir" +cp $tmpDir/*.txt $output_dir cp $tmpDir/runtimes/$rid/lib/$framework/* $output_dir cp $tmpDir/runtimes/$rid/native/* $output_dir diff --git a/eng/helix/content/installaspnetref.sh b/eng/helix/content/installaspnetref.sh new file mode 100644 index 0000000000..6ab719a09f --- /dev/null +++ b/eng/helix/content/installaspnetref.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# Cause the script to fail if any subcommand fails +set -e + +refPath=$1 +output_dir=$2 +tmpDir=./tmpRuntime + +echo "Installing ref package from $refPath" +cp $refPath sharedFx.zip + +mkdir -p $output_dir +echo "Unzip to $output_dir" +unzip sharedFx.zip -d $output_dir diff --git a/eng/helix/content/runtests.sh b/eng/helix/content/runtests.sh index 2ce725910c..d643d7c5bf 100755 --- a/eng/helix/content/runtests.sh +++ b/eng/helix/content/runtests.sh @@ -90,6 +90,6 @@ echo "Restore for RunTests..." $DOTNET_ROOT/dotnet restore RunTests/RunTests.csproj --source https://api.nuget.org/v3/index.json --ignore-failed-sources echo "Running tests..." $DOTNET_ROOT/dotnet run --project RunTests/RunTests.csproj -- --target $1 --sdk $2 --runtime $3 --queue $4 --arch $5 --quarantined $6 --ef $7 -exit_code = $? +exit_code=$? echo "Finished tests...exit_code=$exit_code" exit $exit_code diff --git a/eng/targets/Helix.targets b/eng/targets/Helix.targets index 154ce92ee6..93b8feb54f 100644 --- a/eng/targets/Helix.targets +++ b/eng/targets/Helix.targets @@ -16,6 +16,16 @@ + + + + + + + + + + diff --git a/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj b/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj index 8d9b26e7d0..03b96c27fe 100644 --- a/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj +++ b/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj @@ -3,9 +3,10 @@ $(DefaultNetCoreTargetFramework) Microsoft.AspNetCore - - false true + true + true + true diff --git a/src/Framework/test/SharedFxTests.cs b/src/Framework/test/SharedFxTests.cs index 558fc34439..2b7fae9f29 100644 --- a/src/Framework/test/SharedFxTests.cs +++ b/src/Framework/test/SharedFxTests.cs @@ -23,7 +23,9 @@ namespace Microsoft.AspNetCore _output = output; _expectedTfm = "netcoreapp" + TestData.GetSharedFxVersion().Substring(0, 3); _expectedRid = TestData.GetSharedFxRuntimeIdentifier(); - _sharedFxRoot = Path.Combine(TestData.GetTestDataValue("SharedFrameworkLayoutRoot"), "shared", "Microsoft.AspNetCore.App", TestData.GetTestDataValue("RuntimePackageVersion")); + _sharedFxRoot = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ASPNET_RUNTIME_PATH")) + ? Path.Combine(TestData.GetTestDataValue("SharedFrameworkLayoutRoot"), "shared", TestData.GetTestDataValue("RuntimePackageVersion")) + : Environment.GetEnvironmentVariable("ASPNET_RUNTIME_PATH"); } [Fact] diff --git a/src/Framework/test/TargetingPackTests.cs b/src/Framework/test/TargetingPackTests.cs index 54da276513..e296884e45 100644 --- a/src/Framework/test/TargetingPackTests.cs +++ b/src/Framework/test/TargetingPackTests.cs @@ -26,7 +26,9 @@ namespace Microsoft.AspNetCore { _output = output; _expectedRid = TestData.GetSharedFxRuntimeIdentifier(); - _targetingPackRoot = Path.Combine(TestData.GetTestDataValue("TargetingPackLayoutRoot"), "packs", "Microsoft.AspNetCore.App.Ref", TestData.GetTestDataValue("TargetingPackVersion")); + _targetingPackRoot = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")) + ? Path.Combine(TestData.GetTestDataValue("TargetingPackLayoutRoot"), "packs", "Microsoft.AspNetCore.App.Ref", TestData.GetTestDataValue("TargetingPackVersion")) + : Path.Combine(Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT"), "Microsoft.AspNetCore.App.Ref"); _isTargetingPackBuilding = bool.Parse(TestData.GetTestDataValue("IsTargetingPackBuilding")); }