Finish Refactoring Test Scripts

remove publish todo

small fixes

small fixes

fix packaging test bug

Fix script bug

script changes

fix packaging test

NuGet task cancelled workaround

script fixes further

more script fixes, + workaround tweak

use build rather than compile in package command test
This commit is contained in:
Bryan Thornbury 2016-01-29 19:13:07 +00:00
parent 51eca0bcba
commit afacc2c0a6
15 changed files with 33 additions and 36 deletions

1
.gitignore vendored
View file

@ -269,4 +269,3 @@ _Pvt_Extensions
# Exceptions # Exceptions
# Build Scripts # Build Scripts
!scripts/build/ !scripts/build/
test/PackagedCommands/Consumers/*/project.json

View file

@ -25,7 +25,7 @@ popd
## App Deps ## ## App Deps ##
pushd $APPDEPS_PROJECT_DIR pushd $APPDEPS_PROJECT_DIR
dotnet restore --packages $APPDEPS_PROJECT_DIR/packages dotnet restore --packages $APPDEPS_PROJECT_DIR/packages $DISABLE_PARALLEL
APPDEP_SDK=$APPDEPS_PROJECT_DIR/packages/toolchain*/*/ APPDEP_SDK=$APPDEPS_PROJECT_DIR/packages/toolchain*/*/
popd popd

View file

@ -18,5 +18,5 @@ source "$DIR/../common/_common.sh"
header "Restoring packages" header "Restoring packages"
dotnet restore "$REPOROOT/src" --runtime "$RID" dotnet restore "$REPOROOT/src" --runtime "$RID" $DISABLE_PARALLEL
dotnet restore "$REPOROOT/tools" --runtime "$RID" dotnet restore "$REPOROOT/tools" --runtime "$RID" $DISABLE_PARALLEL

View file

@ -38,5 +38,10 @@ export CHANNEL=$RELEASE_SUFFIX
source "$COMMONDIR/_nuget.sh" source "$COMMONDIR/_nuget.sh"
source "$COMMONDIR/_configuration.sh" source "$COMMONDIR/_configuration.sh"
#TODO this is a workaround for a nuget bug on ubuntu. Remove
export DISABLE_PARALLEL=""
[[ "$RID" =~ "ubuntu" ]] && export DISABLE_PARALLEL="--disable-parallel" && echo "heyheyhey"
unset COMMONSOURCE unset COMMONSOURCE
unset COMMONDIR unset COMMONDIR

View file

@ -7,12 +7,11 @@ param(
[Parameter(Mandatory=$true)][string]$Tfm, [Parameter(Mandatory=$true)][string]$Tfm,
[Parameter(Mandatory=$true)][string]$Rid, [Parameter(Mandatory=$true)][string]$Rid,
[Parameter(Mandatory=$true)][string]$Configuration, [Parameter(Mandatory=$true)][string]$Configuration,
[Parameter(Mandatory=$true)][string]$OutputDir, [Parameter(Mandatory=$true)][string]$StageOutputDir,
[Parameter(Mandatory=$true)][string]$RepoRoot, [Parameter(Mandatory=$true)][string]$RepoRoot,
[Parameter(Mandatory=$true)][string]$HostDir, [Parameter(Mandatory=$true)][string]$HostDir,
[Parameter(Mandatory=$true)][string]$CompilationOutputDir) [Parameter(Mandatory=$true)][string]$CompilationOutputDir)
. $PSScriptRoot\..\common\_common.ps1
. $REPOROOT\scripts\package\projectsToPack.ps1 . $REPOROOT\scripts\package\projectsToPack.ps1
$Projects = loadBuildProjectList $Projects = loadBuildProjectList
@ -31,13 +30,13 @@ $FilesToClean = @(
"Microsoft.DotNet.Runtime.pdb" "Microsoft.DotNet.Runtime.pdb"
) )
$RuntimeOutputDir = "$OutputDir\runtime\coreclr" $RuntimeOutputDir = "$StageOutputDir\runtime\coreclr"
# Publish each project # Publish each project
$Projects | ForEach-Object { $Projects | ForEach-Object {
dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$($_.ProjectName)" dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$StageOutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$($_.ProjectName)"
if (!$?) { if (!$?) {
Write-Host Command failed: dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$($_.ProjectName)" Write-Host Command failed: dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$StageOutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$($_.ProjectName)"
exit 1 exit 1
} }
} }
@ -67,7 +66,7 @@ $FilesToClean | ForEach-Object {
} }
# Copy the runtime app-local for the tools # Copy the runtime app-local for the tools
cp -rec "$RuntimeOutputDir\*" "$OutputDir\bin" -ErrorVariable capturedErrors -ErrorAction SilentlyContinue cp -rec "$RuntimeOutputDir\*" "$StageOutputDir\bin" -ErrorVariable capturedErrors -ErrorAction SilentlyContinue
$capturedErrors | foreach-object { $capturedErrors | foreach-object {
if ($_ -notmatch "already exists") { if ($_ -notmatch "already exists") {
write-error $_ write-error $_
@ -76,22 +75,22 @@ $capturedErrors | foreach-object {
} }
# Deploy the CLR host to the output # Deploy the CLR host to the output
cp "$HostDir\corehost.exe" "$OutputDir\bin" cp "$HostDir\corehost.exe" "$StageOutputDir\bin"
cp "$HostDir\hostpolicy.dll" "$OutputDir\bin" cp "$HostDir\hostpolicy.dll" "$StageOutputDir\bin"
# corehostify externally-provided binaries (csc, vbc, etc.) # corehostify externally-provided binaries (csc, vbc, etc.)
$BinariesForCoreHost | ForEach-Object { $BinariesForCoreHost | ForEach-Object {
mv $OutputDir\bin\$_.exe $OutputDir\bin\$_.dll -Force mv $StageOutputDir\bin\$_.exe $StageOutputDir\bin\$_.dll -Force
cp $OutputDir\bin\corehost.exe $OutputDir\bin\$_.exe -Force cp $StageOutputDir\bin\corehost.exe $StageOutputDir\bin\$_.exe -Force
} }
# Crossgen Roslyn # Crossgen Roslyn
#if (-not (Test-Path "$OutputDir\bin\csc.ni.exe")) { #if (-not (Test-Path "$StageOutputDir\bin\csc.ni.exe")) {
#header "Crossgening Roslyn compiler ..." #header "Crossgening Roslyn compiler ..."
#_cmd "$RepoRoot\scripts\crossgen\crossgen_roslyn.cmd ""$OutputDir""" #_cmd "$RepoRoot\scripts\crossgen\crossgen_roslyn.cmd ""$StageOutputDir"""
#} #}
# Copy in AppDeps # Copy in AppDeps
header "Acquiring Native App Dependencies" header "Acquiring Native App Dependencies"
_ "$RepoRoot\scripts\build\build_appdeps.ps1" @("$RepoRoot", "$OutputDir") _ "$RepoRoot\scripts\build\build_appdeps.ps1" @("$RepoRoot", "$StageOutputDir")

View file

@ -13,6 +13,3 @@ loadTestProjectList | foreach {
exit 1 exit 1
} }
} }
# TODO: Remove this when publish paths change back
cp -rec -Force "$TestBinRoot\Debug\dnxcore50\*" "$TestBinRoot"

View file

@ -9,7 +9,7 @@
dir "$RepoRoot\test\PackagedCommands\Consumers" | where {$_.PsIsContainer} | where {$_.Name.Contains("Direct")} | dir "$RepoRoot\test\PackagedCommands\Consumers" | where {$_.PsIsContainer} | where {$_.Name.Contains("Direct")} |
foreach { foreach {
pushd "$RepoRoot\test\PackagedCommands\Consumers\$_" pushd "$RepoRoot\test\PackagedCommands\Consumers\$_"
dotnet compile dotnet build
popd popd
} }
@ -21,7 +21,6 @@ foreach {
$outputArray = dotnet hello | Out-String $outputArray = dotnet hello | Out-String
$output = [string]::Join('\n', $outputArray).Trim("`r", "`n") $output = [string]::Join('\n', $outputArray).Trim("`r", "`n")
del "project.json"
if ($output -ne "hello") { if ($output -ne "hello") {
error "Test Failed: $testName\dotnet hello" error "Test Failed: $testName\dotnet hello"
error " printed $output" error " printed $output"

View file

@ -21,7 +21,7 @@ source "$DIR/../common/_common.sh"
for test in $(ls -l "$REPOROOT/test/PackagedCommands/Consumers" | grep ^d | awk '{print $9}' | grep "Direct") for test in $(ls -l "$REPOROOT/test/PackagedCommands/Consumers" | grep ^d | awk '{print $9}' | grep "Direct")
do do
pushd "$REPOROOT/test/PackagedCommands/Consumers/$test" pushd "$REPOROOT/test/PackagedCommands/Consumers/$test"
dotnet compile dotnet build
popd popd
done done
@ -34,7 +34,6 @@ do
output=$(dotnet hello) output=$(dotnet hello)
rm "project.json"
if [ "$output" == "Hello" ] ; if [ "$output" == "Hello" ] ;
then then

View file

@ -18,8 +18,4 @@ source "$DIR/../common/_common.sh"
header "Restoring Test Packages" header "Restoring Test Packages"
dotnet restore "$REPOROOT/test" -f "$TEST_PACKAGE_DIR" dotnet restore "$REPOROOT/test" -f "$TEST_PACKAGE_DIR" $DISABLE_PARALLEL
set +e
dotnet restore "$REPOROOT/testapp" >/dev/null 2>&1
set -e

6
scripts/test/setup/build-test-prerequisites.sh Normal file → Executable file
View file

@ -19,7 +19,9 @@ source "$DIR/../../common/_common.sh"
mkdir -p "$TEST_PACKAGE_DIR" mkdir -p "$TEST_PACKAGE_DIR"
for project in loadTestPackageList() PROJECTS=$(loadTestPackageList)
for project in $PROJECTS
do do
dotnet pack "$REPOROOT/test/TestPackages/$project" --output "$TEST_PACKAGE_DIR" dotnet pack "$REPOROOT/test/TestPackages/$project" --output "$TEST_PACKAGE_DIR"
done done

4
scripts/test/setup/restore-test-prerequisites.sh Normal file → Executable file
View file

@ -17,8 +17,8 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../../common/_common.sh" source "$DIR/../../common/_common.sh"
header "Restoring packages" header "Restoring packages"
dotnet restore "$REPOROOT/test/TestPackages" --quiet dotnet restore "$REPOROOT/test/TestPackages" --quiet $DISABLE_PARALLEL
set +e set +e
dotnet restore "$REPOROOT/testapp" >/dev/null 2>&1 dotnet restore "$REPOROOT/testapp" $DISABLE_PARALLEL >/dev/null 2>&1
set -e set -e

5
scripts/test/setup/setup-tests.sh Normal file → Executable file
View file

@ -12,11 +12,12 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
SOURCE="$(readlink "$SOURCE")" SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../../common/_common.sh" source "$DIR/../../common/_common.sh"
header "Test Setup: Restoring Prerequisites" header "Test Setup: Restoring Prerequisites"
"$RepoRoot/scripts/test/restore-test-prerequisites.sh" "$REPOROOT/scripts/test/setup/restore-test-prerequisites.sh"
header "Test Setup: Building Prerequisites" header "Test Setup: Building Prerequisites"
"$RepoRoot/scripts/test/build-test-prerequisites.sh" "$REPOROOT/scripts/test/setup/build-test-prerequisites.sh"