Refactoring test scripts

_nuget needs some RepoRoots

get the cats in line (d)

spaces

Fix Linux build breaks

add execution permissions

Pick up #999 Finish refactoring test scripts

remove auth

Reorder publishing to work!

fix rebase errors

fix more rebase errors

small fixes
This commit is contained in:
piotrp 2016-01-23 12:55:03 -08:00 committed by Bryan Thornbury
parent 4e365921f7
commit 51eca0bcba
40 changed files with 443 additions and 216 deletions

View file

@ -10,7 +10,7 @@
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-corefxlab" value="https://www.myget.org/F/dotnet-corefxlab/api/v3/index.json" />
<add key="corefxlab" value="https://www.myget.org/F/netcore-package-prototyping/api/v3/index.json" />
<add key="corert" value="https://www.myget.org/F/dotnet/auth/3e4f1dbe-f43a-45a8-b029-3ad4d25605ac/api/v2" />
<add key="corert" value="https://www.myget.org/F/dotnet/api/v3/index.json" />
<add key="dotnet-buildtools" value="https://www.myget.org/F/dotnet-buildtools/api/v3/index.json" />
<add key="fsharp-daily" value="https://www.myget.org/F/fsharp-daily/api/v3/index.json" />
</packageSources>

View file

@ -14,18 +14,6 @@ $ErrorActionPreference="Stop"
. "$RepoRoot\scripts\build\generate-version.ps1"
if ($env:CI_BUILD -eq "1") {
$env:NUGET_PACKAGES = (Join-Path $RepoRoot "artifacts\home\.nuget\packages")
} else {
$env:NUGET_PACKAGES = (Join-Path $env:USERPROFILE ".nuget\packages")
}
$env:DOTNET_PACKAGES = $env:NUGET_PACKAGES
$env:DNX_PACKAGES = $env:NUGET_PACKAGES
if(!(Test-Path $env:NUGET_PACKAGES)) {
mkdir $env:NUGET_PACKAGES | Out-Null
}
header "Building dotnet tools version $($env:DOTNET_CLI_VERSION) - $Configuration"
header "Checking Pre-Reqs"
@ -51,8 +39,8 @@ _ "$RepoRoot\scripts\compile\compile.ps1" @("$Configuration")
header "Setting Stage2 as PATH and DOTNET_TOOLS"
setPathAndHome "$Stage2Dir"
header "Running Tests"
_ "$RepoRoot\scripts\test\runtests.ps1"
header "Testing"
_ "$RepoRoot\scripts\test\test.ps1"
header "Validating Dependencies"
_ "$RepoRoot\scripts\test\validate-dependencies.ps1"

View file

@ -19,11 +19,6 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
source "$REPOROOT/scripts/build/generate-version.sh"
## Temporarily redirect to the NuGet package installation location
export NUGET_PACKAGES=~/.nuget/packages
export DOTNET_PACKAGES=$NUGET_PACKAGES
export DNX_PACKAGES=$NUGET_PACKAGES
header "Building dotnet tools version $DOTNET_CLI_VERSION - $CONFIGURATION"
header "Checking Pre-Reqs"
@ -55,8 +50,8 @@ $REPOROOT/scripts/compile/compile.sh
header "Setting Stage2 as PATH, DOTNET_HOME, and DOTNET_TOOLS"
export DOTNET_HOME=$STAGE2_DIR && export DOTNET_TOOLS=$STAGE2DIR && export PATH=$STAGE2_DIR/bin:$PATH
header "Running Tests"
$REPOROOT/scripts/test/runtests.sh
header "Testing"
$REPOROOT/scripts/test/test.sh
header "Validating Dependencies"
$REPOROOT/scripts/test/validate-dependencies.sh

View file

@ -8,12 +8,6 @@
# Restore packages
# NOTE(anurse): I had to remove --quiet, because NuGet3 is too quiet when that's provided :(
header "Restoring packages"
dotnet restore "$RepoRoot\src" --runtime "$Rid"
dotnet restore "$RepoRoot\test" --runtime "$Rid"
dotnet restore "$RepoRoot\tools" --runtime "$Rid"
$oldErrorAction=$ErrorActionPreference
$ErrorActionPreference="SilentlyContinue"
dotnet restore "$RepoRoot\testapp" --runtime "$Rid" 2>&1 | Out-Null
$ErrorActionPreference=$oldErrorAction
& dotnet restore "$RepoRoot\src" --runtime "$Rid"
& dotnet restore "$RepoRoot\tools" --runtime "$Rid"

View file

@ -18,9 +18,5 @@ source "$DIR/../common/_common.sh"
header "Restoring packages"
dotnet restore "$REPOROOT/src" --runtime $RID
dotnet restore "$REPOROOT/test" --runtime $RID
dotnet restore "$REPOROOT/tools" --runtime $RID
set +e
dotnet restore "$REPOROOT/testapp" --runtime $RID >/dev/null 2>&1
set -e
dotnet restore "$REPOROOT/src" --runtime "$RID"
dotnet restore "$REPOROOT/tools" --runtime "$RID"

View file

@ -9,21 +9,24 @@ $Rid = "win7-x64"
$Tfm = "dnxcore50"
$RepoRoot = Resolve-Path "$PSScriptRoot\..\.."
$OutputDir = "$RepoRoot\artifacts\$Rid"
$DnxDir = "$OutputDir\dnx"
$DnxRoot = "$DnxDir\bin"
$Stage1Dir = "$OutputDir\stage1"
$Stage1CompilationDir = "$OutputDir\stage1compilation"
$Stage2Dir = "$OutputDir\stage2"
$Stage2CompilationDir = "$OutputDir\stage2compilation"
$HostDir = "$OutputDir\corehost"
$PackageDir = "$RepoRoot\artifacts\packages\dnvm"
$TestBinRoot = "$RepoRoot\artifacts\tests"
$TestPackageDir = "$TestBinRoot\packages"
$env:ReleaseSuffix = "beta"
$env:Channel = "$env:ReleaseSuffix"
$env:TEST_ROOT = "$OutputDir\tests"
$env:TEST_ARTIFACTS = "$env:TEST_ROOT\artifacts"
# Set reasonable defaults for unset variables
setEnvIfDefault "DOTNET_INSTALL_DIR" "$(Convert-Path "$PSScriptRoot\..")\.dotnet_stage0\win7-x64"
setEnvIfDefault "DOTNET_CLI_VERSION" "0.1.0.0"
setPathAndHomeIfDefault "$Stage2Dir"
setVarIfDefault "Configuration" "Debug"
# Common Files which depend on above properties
. $PSScriptRoot\_nuget.ps1
. $PSScriptRoot\_configuration.ps1

View file

@ -18,13 +18,14 @@ source "$COMMONDIR/_rid.sh"
export TFM=dnxcore50
export REPOROOT=$(cd $COMMONDIR/../.. && pwd)
export OUTPUT_ROOT=$REPOROOT/artifacts/$RID
export DNX_DIR=$OUTPUT_ROOT/dnx
export DNX_ROOT=$DNX_DIR/bin
export STAGE1_DIR=$OUTPUT_ROOT/stage1
export STAGE1_COMPILATION_DIR=$OUTPUT_ROOT/stage1compilation
export STAGE2_DIR=$OUTPUT_ROOT/stage2
export STAGE2_COMPILATION_DIR=$OUTPUT_ROOT/stage2compilation
export HOST_DIR=$OUTPUT_ROOT/corehost
export TEST_BIN_ROOT="$REPOROOT/artifacts/tests"
export TEST_PACKAGE_DIR="$TEST_BIN_ROOT/packages"
export RELEASE_SUFFIX=beta
export CHANNEL=$RELEASE_SUFFIX
@ -33,5 +34,9 @@ export CHANNEL=$RELEASE_SUFFIX
[ -z "$DOTNET_HOME" ] && export DOTNET_HOME=$STAGE2_DIR && export PATH=$STAGE2_DIR/bin:$PATH
[ -z "$CONFIGURATION" ] && export CONFIGURATION=Debug
# Common Files which depend on above properties
source "$COMMONDIR/_nuget.sh"
source "$COMMONDIR/_configuration.sh"
unset COMMONSOURCE
unset COMMONDIR
unset COMMONDIR

View file

@ -0,0 +1,24 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
function loadTestProjectList()
{
return Import-CSV "$RepoRoot\scripts\configuration\testProjects.csv" -Header "ProjectName"
}
function loadTestScriptList()
{
return Import-CSV "$RepoRoot\scripts\configuration\testScripts.csv" -Header "ProjectName"
}
function loadTestPackageList()
{
return Import-CSV "$RepoRoot\scripts\configuration\testPackageProjects.csv" -Header "ProjectName"
}
function loadBuildProjectList()
{
return Import-CSV "$RepoRoot\scripts\configuration\buildProjects.csv" -Header "ProjectName"
}

View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
loadTestProjectList()
{
echo $(cat "$REPOROOT/scripts/configuration/testProjects.csv")
}
loadTestScriptList()
{
echo $(cat "$REPOROOT/scripts/configuration/testScripts.csv")
}
loadTestPackageList()
{
echo $(cat "$REPOROOT/scripts/configuration/testPackageProjects.csv")
}
loadBuildProjectList()
{
echo $(cat "$REPOROOT/scripts/configuration/buildProjects.csv")
}

16
scripts/common/_nuget.ps1 Normal file
View file

@ -0,0 +1,16 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
if ($env:CI_BUILD -eq "1") {
$env:NUGET_PACKAGES = (Join-Path $RepoRoot "artifacts\home\.nuget\packages")
} else {
$env:NUGET_PACKAGES = (Join-Path $env:USERPROFILE ".nuget\packages")
}
$env:DOTNET_PACKAGES = $env:NUGET_PACKAGES
$env:DNX_PACKAGES = $env:NUGET_PACKAGES
if(!(Test-Path $env:NUGET_PACKAGES)) {
mkdir $env:NUGET_PACKAGES | Out-Null
}

10
scripts/common/_nuget.sh Normal file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
## Temporarily redirect to the NuGet package installation location
export NUGET_PACKAGES=~/.nuget/packages
export DOTNET_PACKAGES=$NUGET_PACKAGES
export DNX_PACKAGES=$NUGET_PACKAGES

View file

@ -12,30 +12,10 @@ param(
[Parameter(Mandatory=$true)][string]$HostDir,
[Parameter(Mandatory=$true)][string]$CompilationOutputDir)
. $PSScriptRoot\..\common\_common.ps1
. $REPOROOT\scripts\package\projectsToPack.ps1
$Projects = @(
"dotnet",
"dotnet-build",
"dotnet-compile",
"dotnet-compile-csc",
"dotnet-compile-fsc",
"dotnet-compile-native",
"dotnet-new",
"dotnet-pack",
"dotnet-projectmodel-server",
"dotnet-publish",
"dotnet-restore",
"dotnet-repl",
"dotnet-repl-csi",
"dotnet-resgen",
"dotnet-run",
"dotnet-test",
"Microsoft.DotNet.Cli.Utils",
"Microsoft.DotNet.ProjectModel.Loader",
"Microsoft.DotNet.ProjectModel.Workspaces",
"Microsoft.Extensions.Testing.Abstractions"
)
$Projects = loadBuildProjectList
$BinariesForCoreHost = @(
"csi"
@ -55,9 +35,9 @@ $RuntimeOutputDir = "$OutputDir\runtime\coreclr"
# Publish each project
$Projects | ForEach-Object {
dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$OutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$($_.ProjectName)"
if (!$?) {
Write-Host Command failed: dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$OutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$_"
Write-Host Command failed: dotnet publish --native-subdirectory --framework "$Tfm" --runtime "$Rid" --output "$CompilationOutputDir\bin" --configuration "$Configuration" "$RepoRoot\src\$($_.ProjectName)"
exit 1
}
}

View file

@ -22,24 +22,7 @@ source "$DIR/../common/_common.sh"
[ ! -z "$OUTPUT_DIR" ] || die "Missing required environment variable OUTPUT_DIR"
[ ! -z "$HOST_DIR" ] || die "Missing required environment variable HOST_DIR"
PROJECTS=( \
dotnet \
dotnet-build \
dotnet-compile \
dotnet-compile-csc \
dotnet-compile-fsc \
dotnet-compile-native \
dotnet-new \
dotnet-pack \
dotnet-projectmodel-server \
dotnet-publish \
dotnet-repl \
dotnet-repl-csi \
dotnet-restore \
dotnet-resgen \
dotnet-run \
dotnet-test \
)
PROJECTS=$(loadBuildProjectList)
BINARIES_FOR_COREHOST=( \
csi \
@ -57,7 +40,7 @@ FILES_TO_CLEAN=( \
RUNTIME_OUTPUT_DIR="$OUTPUT_DIR/runtime/coreclr"
for project in ${PROJECTS[@]}
for project in $PROJECTS
do
echo dotnet publish --native-subdirectory --framework "$TFM" --output "$OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"
dotnet publish --native-subdirectory --framework "$TFM" --output "$OUTPUT_DIR/bin" --configuration "$CONFIGURATION" "$REPOROOT/src/$project"

View file

@ -0,0 +1,20 @@
dotnet
dotnet-build
dotnet-compile
dotnet-compile-csc
dotnet-compile-fsc
dotnet-compile-native
dotnet-new
dotnet-pack
dotnet-projectmodel-server
dotnet-publish
dotnet-restore
dotnet-repl
dotnet-repl-csi
dotnet-resgen
dotnet-run
dotnet-test
Microsoft.DotNet.Cli.Utils
Microsoft.DotNet.ProjectModel.Loader
Microsoft.DotNet.ProjectModel.Workspaces
Microsoft.Extensions.Testing.Abstractions
1 dotnet
2 dotnet-build
3 dotnet-compile
4 dotnet-compile-csc
5 dotnet-compile-fsc
6 dotnet-compile-native
7 dotnet-new
8 dotnet-pack
9 dotnet-projectmodel-server
10 dotnet-publish
11 dotnet-restore
12 dotnet-repl
13 dotnet-repl-csi
14 dotnet-resgen
15 dotnet-run
16 dotnet-test
17 Microsoft.DotNet.Cli.Utils
18 Microsoft.DotNet.ProjectModel.Loader
19 Microsoft.DotNet.ProjectModel.Workspaces
20 Microsoft.Extensions.Testing.Abstractions

View file

@ -0,0 +1,2 @@
dotnet-hello/v1/dotnet-hello
dotnet-hello/v2/dotnet-hello
1 dotnet-hello/v1/dotnet-hello
2 dotnet-hello/v2/dotnet-hello

View file

@ -0,0 +1,5 @@
E2E
StreamForwarderTests
dotnet-publish.Tests
dotnet-compile.Tests
dotnet-build.Tests
1 E2E
2 StreamForwarderTests
3 dotnet-publish.Tests
4 dotnet-compile.Tests
5 dotnet-build.Tests

View file

@ -0,0 +1,2 @@
argument-forwarding-tests
package-command-test
1 argument-forwarding-tests
2 package-command-test

View file

@ -0,0 +1,18 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
. "$PSScriptRoot\..\common\_common.ps1"
# Publish each test project
loadTestProjectList | foreach {
dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$TestBinRoot" --configuration "$Configuration" "$RepoRoot\test\$($_.ProjectName)"
if (!$?) {
Write-Host Command failed: dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$TestBinRoot" --configuration "$Configuration" "$RepoRoot\test\$($_.ProjectName)"
exit 1
}
}
# TODO: Remove this when publish paths change back
cp -rec -Force "$TestBinRoot\Debug\dnxcore50\*" "$TestBinRoot"

26
scripts/test/build-tests.sh Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
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
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
for project in loadTestList()
do
dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$TestBinRoot" --configuration "$CONFIGURATION" "$REPOROOT/test/$project"
done
# TODO: Remove this when publish paths change back
cp -a "$TestBinRoot/Debug/dnxcore50/." "$TestBinRoot"

View file

@ -5,40 +5,6 @@
. "$PSScriptRoot\..\common\_common.ps1"
$TestPackagesPath = "$RepoRoot\artifacts\tests\package-command-test\packages"
if((Test-Path $TestPackagesPath) -eq 0)
{
mkdir $TestPackagesPath;
}
"v1", "v2" |
foreach {
dotnet pack "$RepoRoot\test\PackagedCommands\Commands\dotnet-hello\$_\dotnet-hello"
cp "$RepoRoot\test\PackagedCommands\Commands\dotnet-hello\$_\dotnet-hello\bin\Debug\*.nupkg" -Destination $TestPackagesPath
if (!$?) {
error "Command failed: dotnet pack"
Exit 1
}
}
# workaround for dotnet-restore from the root failing for these tests since their dependencies aren't built yet
dir "$RepoRoot\test\PackagedCommands\Consumers" | where {$_.PsIsContainer} |
foreach {
pushd "$RepoRoot\test\PackagedCommands\Consumers\$_"
copy project.json.template project.json
popd
}
#restore test projects
pushd "$RepoRoot\test\PackagedCommands\Consumers"
dotnet restore -s "$TestPackagesPath"
if (!$?) {
error "Command failed: dotnet restore"
Exit 1
}
popd
#compile apps
dir "$RepoRoot\test\PackagedCommands\Consumers" | where {$_.PsIsContainer} | where {$_.Name.Contains("Direct")} |
foreach {

View file

@ -17,28 +17,6 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
TestPackagesPath="$REPOROOT/artifacts/tests/package-command-test/packages"
mkdir -p "$TestPackagesPath"
dotnet pack "$REPOROOT/test/PackagedCommands/Commands/dotnet-hello/v1/dotnet-hello"
cp "$REPOROOT/test/PackagedCommands/Commands/dotnet-hello/v1/dotnet-hello/bin/Debug/"*.nupkg "$TestPackagesPath"
dotnet pack "$REPOROOT/test/PackagedCommands/Commands/dotnet-hello/v2/dotnet-hello"
cp "$REPOROOT/test/PackagedCommands/Commands/dotnet-hello/v2/dotnet-hello/bin/Debug/"*.nupkg "$TestPackagesPath"
# enable restore for test projects
for test in $(ls -l "$REPOROOT/test/PackagedCommands/Consumers" | grep ^d | awk '{print $9}' | grep "AppWith")
do
pushd "$REPOROOT/test/PackagedCommands/Consumers/$test"
cp "project.json.template" "project.json"
popd
done
# restore test projects
pushd "$REPOROOT/test/PackagedCommands/Consumers"
dotnet restore -s "$TestPackagesPath"
popd
#compile tests with direct dependencies
for test in $(ls -l "$REPOROOT/test/PackagedCommands/Consumers" | grep ^d | awk '{print $9}' | grep "Direct")
do

View file

@ -0,0 +1,12 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
. $PSScriptRoot\..\common\_common.ps1
info "Restoring Test Projects"
# Restore packages
& dotnet restore "$RepoRoot\test" -f "$TestPackageDir"

25
scripts/test/restore-tests.sh Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
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
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
header "Restoring Test Packages"
dotnet restore "$REPOROOT/test" -f "$TEST_PACKAGE_DIR"
set +e
dotnet restore "$REPOROOT/testapp" >/dev/null 2>&1
set -e

View file

@ -5,35 +5,13 @@
. "$PSScriptRoot\..\common\_common.ps1"
$failCount = 0
$TestBinRoot = "$RepoRoot\artifacts\tests"
$TestProjects = @(
"E2E",
"StreamForwarderTests",
"dotnet-publish.Tests",
"dotnet-compile.Tests",
"dotnet-build.Tests"
)
$TestProjects = loadTestProjectList
$TestScripts = loadTestScriptList
$TestScripts = @(
"package-command-test.ps1",
"argument-forwarding-tests.ps1"
)
# Publish each test project
$TestProjects | ForEach-Object {
dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$TestBinRoot" --configuration "$Configuration" "$RepoRoot\test\$_"
if (!$?) {
Write-Host Command failed: dotnet publish --framework "dnxcore50" --runtime "$Rid" --output "$TestBinRoot" --configuration "$Configuration" "$RepoRoot\test\$_"
exit 1
}
}
if (Test-Path $TestBinRoot\$Configuration\dnxcore50) {
cp $TestBinRoot\$Configuration\dnxcore50\* $TestBinRoot -force -recurse
}
$failCount = 0
$failingTests = @()
## Temporary Workaround for Native Compilation
## Need x64 Native Tools Dev Prompt Env Vars
@ -47,21 +25,17 @@ foreach {
}
popd
# copy TestProjects folder which is used by the test cases
# copy TestProjects to $TestBinRoot
mkdir -Force "$TestBinRoot\TestProjects"
cp -rec -Force "$RepoRoot\test\TestProjects\*" "$TestBinRoot\TestProjects"
$failCount = 0
$failingTests = @()
pushd "$TestBinRoot"
# Run each test project
$TestProjects | ForEach-Object {
& ".\corerun" "xunit.console.netcore.exe" "$_.dll" -xml "$_-testResults.xml" -notrait category=failing
$TestProjects | foreach {
& ".\corerun" "xunit.console.netcore.exe" "$($_.ProjectName).dll" -xml "$($_.ProjectName)-testResults.xml" -notrait category=failing
$exitCode = $LastExitCode
if ($exitCode -ne 0) {
$failingTests += "$_"
$failingTests += "$($_.ProjectName)"
}
$failCount += $exitCode
@ -69,18 +43,20 @@ $TestProjects | ForEach-Object {
popd
$TestScripts | ForEach-Object {
& "$RepoRoot\scripts\test\$_"
$TestScripts | foreach {
$scriptName = "$($_.ProjectName).ps1"
& "$RepoRoot\scripts\test\$scriptName"
$exitCode = $LastExitCode
if ($exitCode -ne 0) {
$failingTests += "$_"
$failingTests += "$scriptName"
$failCount += 1
}
}
if ($failCount -ne 0) {
Write-Host -ForegroundColor Red "The following tests failed."
$failingTests | ForEach-Object {
$failingTests | foreach {
Write-Host -ForegroundColor Red "$_.dll failed. Logs in '$TestBinRoot\$_-testResults.xml'"
}
} else {

View file

@ -12,48 +12,24 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
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
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
TestBinRoot="$REPOROOT/artifacts/tests"
local TestProjects=$(loadTestProjectList)
local TestScripts=$(loadTestScriptList)
TestProjects=( \
E2E \
StreamForwarderTests \
dotnet-publish.Tests \
dotnet-compile.Tests \
dotnet-build.Tests \
)
local failedTests=()
local failCount=0
TestScripts=( \
"package-command-test.sh" \
"argument-forwarding-tests.sh" \
)
for project in ${TestProjects[@]}
do
dotnet publish --framework "dnxcore50" --output "$TestBinRoot" --configuration "$CONFIGURATION" "$REPOROOT/test/$project"
done
if [ -d "$TestBinRoot/$CONFIGURATION/dnxcore50" ]
then
cp -R -f $TestBinRoot/$CONFIGURATION/dnxcore50/* $TestBinRoot
fi
# copy TestProjects folder which is used by the test cases
# Copy TestProjects to $TestBinRoot
mkdir -p "$TestBinRoot/TestProjects"
cp -a $REPOROOT/test/TestProjects/* $TestBinRoot/TestProjects
pushd "$TestBinRoot"
set +e
failedTests=()
failCount=0
for project in ${TestProjects[@]}
for project in $TestProjects
do
./corerun "xunit.console.netcore.exe" "$project.dll" -xml "${project}-testResults.xml" -notrait category=failing
exitCode=$?
@ -63,12 +39,15 @@ do
fi
done
for script in ${TestScripts[@]}
do
"$REPOROOT/scripts/test/$script"
popd
for script in $TestScripts
local scriptName=${script}.sh
"$REPOROOT/scripts/test/${scriptName}"
exitCode=$?
if [ $exitCode -ne 0 ]; then
failedTests+=($script)
failedTests+=("$scriptName")
failCount+=1
fi
done
@ -78,7 +57,6 @@ do
error "$test failed. Logs in '$TestBinRoot/${test}-testResults.xml'"
done
popd
set -e
exit $failCount

View file

@ -0,0 +1,17 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
. "$PSScriptRoot\..\..\common\_common.ps1"
mkdir -Force $TestPackageDir
loadTestPackageList | foreach {
dotnet pack "$RepoRoot\test\TestPackages\$($_.ProjectName)" --output "$TestPackageDir"
if (!$?) {
error "Command failed: dotnet pack"
Exit 1
}
}

View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
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
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../../common/_common.sh"
mkdir -p "$TEST_PACKAGE_DIR"
for project in loadTestPackageList()
do
dotnet pack "$REPOROOT/test/TestPackages/$project" --output "$TEST_PACKAGE_DIR"
done

View file

@ -0,0 +1,14 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
". $PSScriptRoot\..\..\common\_common.ps1"
header "Restoring packages"
& dotnet restore "$RepoRoot\test\TestPackages" --quiet --runtime "$Rid"
$oldErrorAction=$ErrorActionPreference
$ErrorActionPreference="SilentlyContinue"
& dotnet restore "$RepoRoot\testapp" "$Rid" 2>&1 | Out-Null
$ErrorActionPreference=$oldErrorAction

View file

@ -0,0 +1,24 @@
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
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
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../../common/_common.sh"
header "Restoring packages"
dotnet restore "$REPOROOT/test/TestPackages" --quiet
set +e
dotnet restore "$REPOROOT/testapp" >/dev/null 2>&1
set -e

View file

@ -0,0 +1,12 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
. "$PSScriptRoot\..\..\common\_common.ps1"
header "Test Setup: Restoring Prerequisites"
_ "$RepoRoot\scripts\test\setup\restore-test-prerequisites.ps1"
header "Test Setup: Building Prerequisites"
_ "$RepoRoot\scripts\test\setup\build-test-prerequisites.ps1"

View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
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
done
source "$DIR/../../common/_common.sh"
header "Test Setup: Restoring Prerequisites"
"$RepoRoot/scripts/test/restore-test-prerequisites.sh"
header "Test Setup: Building Prerequisites"
"$RepoRoot/scripts/test/build-test-prerequisites.sh"

18
scripts/test/test.ps1 Normal file
View file

@ -0,0 +1,18 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
. "$PSScriptRoot\..\common\_common.ps1"
header "Setting up Tests"
_ "$RepoRoot\scripts\test\setup\setup-tests.ps1"
header "Restoring test projects"
_ "$RepoRoot\scripts\test\restore-tests.ps1"
header "Building test projects"
_ "$RepoRoot\scripts\test\build-tests.ps1"
header "Running Tests"
_ "$RepoRoot\scripts\test\run-tests.ps1"

30
scripts/test/test.sh Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
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
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
header "Setting up Tests"
"$REPOROOT/scripts/test/setup/setup-tests.sh"
header "Restoring test projects"
"$REPOROOT/scripts/test/restore-tests.sh"
header "Building test projects"
"$REPOROOT/scripts/test/build-tests.sh"
header "Running Tests"
"$REPOROOT/scripts/test/run-tests.sh"

View file

@ -14,7 +14,7 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
source "$DIR/../common/_common.sh"
. "$DIR/../common/_common.sh"
# Run Validation for Project.json dependencies
dotnet publish "$REPOROOT/tools/MultiProjectValidator" -o "$STAGE2_DIR/../tools" -c "$CONFIGURATION"

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>b8055234-9a66-4ba0-8b4c-d5e431494fe3</ProjectGuid>
<RootNamespace>dotnet-hello</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>282c5014-d0cd-4dde-af4e-531e4a2e7bcd</ProjectGuid>
<RootNamespace>dotnet-hello</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>