Build xunit wrappers the same way on windows and unix (#18695)
authorSven Boemer <sbomer@gmail.com>
Thu, 19 Jul 2018 20:44:16 +0000 (13:44 -0700)
committerGitHub <noreply@github.com>
Thu, 19 Jul 2018 20:44:16 +0000 (13:44 -0700)
* Initial change to allow build wrappers and runtest.py

* Build xunit wrappers on unix

The generated wrapper needs to target netcoreapp on unix. I had to
exclude assets from the xunit package and introduce a dependency on
the private corefx bits, to resolve a dependency conflict in which the
generated wrapper was depending on an older System.Runtime.dll than
the helper library.

I also disabled binclash logging, because the wrapper build binplaces
the helper library to the same location multiple times. I couldn't
find a simple way to disable binclash logging for the wrapper build
only, since that requires passing an empty switch to run.exe, and bash
word splitting makes this nontrivial from build-test.

* Correctly generate TestEnv xplat

Note that this will still require changes to the test wrapper
to actually source the TestEnv on unix

* Build xunit wrappers using SDK

* Target netcoreapp2.0 in xunit wrappers

This way, the wrappers can build even if the 2.1 SDK isn't installed on
the machine.

* Restore to packages directory for xunit wrappers

* Move common properties out to dir.common.props

When building wrappers using the SDK, we need some basic
properties (like the build os/arch/config, and the output directories)
to be set. I factored out properties used by both the old test build
and the new SDK-project test build.

At first I tried using Directory.Build.props (which is automatically
imported by the SDK), but our test build already imports SDK targets
in various places, so this was resulting in duplicate
imports. Instead, I used dir.common.props, and made the imports
explicit.

* Remove desktop-specific test wrapper csproj

* Pass build os/arch/type and logsdir to msbuild from runtest.py

* Remove xunit wrapper helper library from traversal build

* Fix parameter passing in build-test.sh

Use bash arrays to pass parameters for the build command. This makes
it possible to pass arguments with spaces to build_Tests_internal. We
use this to disable binclashlogging selectively (for the xunit wrapper
build only).

* Clean up factored .props files

* Undo runtest.sh changes

* Use latest xunit console runner everywhere

* Remove extra StaticDependency on xunit.runner.console

* Eliminate tests/src/dir.common.props, and rename dir.sdkbuild.props

tests/src/dir.common.props was only used for the desktop-specific
xunit wrapper helper library. There's no need for it any more, so its
properties have been moved into tests/src/dir.props.

dir.sdkbuild.props has been renamed to dir.common.props, since it
contains properties used by SDK projects and buildtools projects.

This change also re-enables the test build.

* Reintroduce dir.sdkbuild.props as a place for SDK-only props

With this, some properties shared by SDK projects can go in a global
location. The TargetFramework is shared by all SDK projects in the
test tree.

This change also uses a property for the xunit package directory that
contains the xunit.console.dll we copy to core_root.

* Add xml namespace to dir.common.props

This fixes a failure in the windows build.

* Satisfy xunit analyzer

* Satisfy xunit analyzer again

* Use SDK msbuild to build wrappers

On windows, the use of run.exe, config.json, and msbuild.cmd uses
msbuild.exe on the path. This change will build wrappers using the
local SDK via "dotnet msbuild", bypassing run.exe. Run.exe will go
away entirely with the move from buildtools to arcade, so other build
invocatios should follow suit.

* Remove Microsoft.CSharp.Core.targets workaround

UseBuildTools used to be true all the time. Now that we are building
wrappers on core, UseBuildTools becomes false. However, the rest of
the runtest.proj expects to build using buildtools, so we keep
UseBuildTools true until we switch to arcade.

The CSharpCoreTargetsPath was imported when running on core only. This
used to happen only on unix, but now it also happens when building
runtest.proj for the xunit wrappers on windows. On unix, this targets
file was a symlink to itself to work around some buildtools logic that
expected the file to exist. This workaround no longer appears
necessary, and on windows, this was never used in the first place, so
this change removes it.

* Remove UseRoslynCompilers prop and unify roslyn import

UseRoslynCompilers was introduced in buildtools by
https://github.com/dotnet/buildtools/pull/947, with different
behaviors on windows/unix. It was removed by
https://github.com/dotnet/buildtools/pull/1974, so we can unify our
roslyn imports now.

* Don't copy xunit dlls to corefx test host

The corefx tests run on specific versions of xunit dlls, defined in
CoreFX.depproj. We want to use these versions in the test host, not
those in CORE_ROOT, so exclude these from being copied to the test host
directory. This fixes the failing corefx tests.

* Don't pass run.exe arguments through build-test.cmd in test pipeline

These arguments get passed along to the xunit wrapper build as
unprocessed build args. They need to work for "dotnet msbuild" (used
for the wrapper build) as well as for run.exe.

* Fix parameter passing of priority arg in build-test.cmd

UnprocessedBuildArgs should contain arguments in the format expected by
msbuild, not by run.exe.

* Fix parameter passing of unprocessed args in build-test.cmd

The "--" syntax is used by run.exe to pass everything following to
msbuild directly. It should not be a part of unprocessed args.

* Pass TargetsWindowsArg to wrapper build in build-test.cmd

Helix builds tests on windows and runs them on unix using the xunit
wrappers. When cross-building the wrappers like this, TargetsWindows
is set to false by the test build pipeline. This variable ensures that
the wrapper uses correct directory separators when invoking the test
.sh file.

* Pass BuildTestsAgainstPackages arg to exclude unix tests

Helix builds xunit wrappers on windows, and runs them on unix. The
BuildTestsAgainstPackages should currently be set to true in the
windows wrapper build to properly filter the .cmd files based on
exclusions in issues.targets.

31 files changed:
build-test.cmd
build-test.sh
buildpipeline/tests/Dotnet-CoreClr-Trusted-BuildTests.json
dependencies.props
dir.common.props [new file with mode: 0644]
dir.props
run.sh
tests/build.proj
tests/dir.common.props [new file with mode: 0644]
tests/dir.props
tests/dir.sdkbuild.props [new file with mode: 0644]
tests/helixprep.proj
tests/override.targets
tests/runtest.proj
tests/runtest.py [new file with mode: 0755]
tests/scripts/scripts.csproj
tests/src/Common/Coreclr.TestWrapper/Coreclr.TestWrapper.csproj
tests/src/Common/Desktop.Coreclr.TestWrapper/Desktop.Coreclr.TestWrapper.csproj [deleted file]
tests/src/Common/external/external.depproj
tests/src/JIT/Performance/CodeQuality/Layout/SearchLoops.cs
tests/src/JIT/Performance/CodeQuality/SIMD/SeekUnroll/SeekUnroll.cs
tests/src/JIT/config/benchmark+roslyn/benchmark+roslyn.csproj
tests/src/JIT/config/benchmark+serialize/benchmark+serialize.csproj
tests/src/JIT/config/benchmark/benchmark.csproj
tests/src/TestWrappersConfig/TestWrappersConfig.csproj [deleted file]
tests/src/dir.common.props [deleted file]
tests/src/dir.props
tests/src/dirs.proj
tests/src/performance/performance.csproj
tests/tests.targets
tests/xunitwrapper.targets [deleted file]

index d125b5d..31c5ad3 100644 (file)
@@ -46,6 +46,7 @@ set processedArgs=
 set __unprocessedBuildArgs=
 set __RunArgs=
 set __BuildAgainstPackagesArg=
+set __BuildAgainstPackagesMsbuildArg=
 set __SkipRestorePackages=
 set __SkipManaged=
 set __SkipNative=
@@ -59,6 +60,8 @@ set __DoCrossgen=
 @REM appears to CMD parsing as "-priority 1". Handle -priority specially to avoid problems,
 @REM and allow the "-priority=1" syntax.
 set __Priority=0
+set __PriorityArg=
+set __PassThroughArg=
 
 :Arg_Loop
 if "%1" == "" goto ArgsDone
@@ -80,7 +83,7 @@ if /i "%1" == "skipmanaged"           (set __SkipManaged=1&set processedArgs=!pr
 if /i "%1" == "skipnative"            (set __SkipNative=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
 if /i "%1" == "buildtesthostonly"     (set __SkipNative=1&set __SkipManaged=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
 if /i "%1" == "toolset_dir"           (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
-if /i "%1" == "buildagainstpackages"  (set __ZipTests=1&set __BuildAgainstPackagesArg=-BuildTestsAgainstPackages&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "buildagainstpackages"  (set __ZipTests=1&set __BuildAgainstPackagesArg=-BuildTestsAgainstPackages&set __BuildAgainstPackagesMsbuildArg=/p:BuildTestsAgainstPackages=true&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
 if /i "%1" == "skiprestorepackages"   (set __SkipRestorePackages=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
 if /i "%1" == "ziptests"              (set __ZipTests=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
 if /i "%1" == "crossgen"              (set __DoCrossgen=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
@@ -88,6 +91,7 @@ if /i "%1" == "runtimeid"             (set __RuntimeId=%2&set processedArgs=!pro
 if /i "%1" == "targetsNonWindows"     (set __TargetsWindows=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
 if /i "%1" == "Exclude"               (set __Exclude=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
 if /i "%1" == "-priority"             (set __Priority=%2&shift&set processedArgs=!processedArgs! %1=%2&shift&goto Arg_Loop)
+if /i "%1" == "--"                    (set __PassThroughArg=%1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
 
 if [!processedArgs!]==[] (
   set __UnprocessedBuildArgs=%__args%
@@ -101,7 +105,7 @@ if [!processedArgs!]==[] (
 :ArgsDone
 
 @REM Special handling for -priority=N argument.
-if %__Priority% GTR 0 (set "__UnprocessedBuildArgs=!__UnprocessedBuildArgs! -priority=%__Priority%")
+if %__Priority% GTR 0 (set "__PriorityArg=-priority=%__Priority%")
 
 if defined __BuildAgainstPackagesArg (
     if not defined __RuntimeID (
@@ -113,6 +117,8 @@ if defined __BuildAgainstPackagesArg (
 @if defined _echo @echo on
 
 set __RunArgs=-BuildOS=%__BuildOS% -BuildType=%__BuildType% -BuildArch=%__BuildArch%
+REM As we move from buildtools to arcade, __RunArgs should be replaced with __msbuildArgs
+set __msbuildArgs=/p:__BuildOS=%__BuildOS% /p:__BuildType=%__BuildType% /p:__BuildArch=%__BuildArch%
 
 if defined __ToolsetDir (
     rem arm64 builds currently use private toolset which has not been released yet
@@ -156,6 +162,12 @@ REM ===
 REM =========================================================================================
 call "%__ProjectDir%\init-tools.cmd"
 @if defined _echo @echo on
+set "__ToolsDir=%__ProjectDir%\Tools"
+set "__DotnetHost=%__ToolsDir%\dotnetcli\dotnet.exe"
+if not exist "%__DotnetHost%" (
+   echo %__DotnetHost% not found after init-tools.
+   exit /b 1
+)
 
 REM =========================================================================================
 REM ===
@@ -220,7 +232,7 @@ set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
 
-call "%__ProjectDir%\run.cmd" build -Project="%__NativeTestIntermediatesDir%\install.vcxproj" -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__msbuildNativeArgs% %__RunArgs% %__unprocessedBuildArgs%
+call "%__ProjectDir%\run.cmd" build -Project="%__NativeTestIntermediatesDir%\install.vcxproj" -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__msbuildNativeArgs% %__RunArgs% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
 if errorlevel 1 (
     echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
     echo     %__BuildLog%
@@ -250,7 +262,7 @@ set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
 
-call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -BatchRestorePackages -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
+call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -BatchRestorePackages -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
 
 if not defined __BuildAgainstPackagesArg goto SkipRestoreProduct
 set __BuildLogRootName=Tests_GenerateRuntimeLayout
@@ -261,7 +273,7 @@ set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
 
-call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\runtest.proj -BinPlaceRef -BinPlaceProduct -CopyCrossgenToProduct -RuntimeId="%__RuntimeId%" -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
+call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\runtest.proj -BinPlaceRef -BinPlaceProduct -CopyCrossgenToProduct -RuntimeId="%__RuntimeId%" -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
 if errorlevel 1 (
     echo BinPlace of mscorlib.dll failed
     exit /b 1
@@ -309,7 +321,7 @@ for /l %%G in (1, 1, %__BuildLoopCount%) do (
     set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%";Append=!__AppendToLog!
 
     set TestBuildSlice=%%G
-    call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
+    call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
 
     if errorlevel 1 (
         echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
@@ -365,10 +377,13 @@ if defined __RuntimeId (
 )
 
 set TargetsWindowsArg=
+set TargetsWindowsMsbuildArg=
 if "%__TargetsWindows%"=="1" (
     set TargetsWindowsArg=-TargetsWindows=true
+    set TargetsWindowsMsbuildArg=/p:TargetsWindows=true
 ) else if "%__TargetsWindows%"=="0" (
     set TargetsWindowsArg=-TargetsWindows=false
+    set TargetsWindowsMsbuildArg=/p:TargetsWindows=false
 )
 
 echo %__MsgPrefix%Creating test overlay...
@@ -381,7 +396,7 @@ set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
 
-call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -testOverlay -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %RuntimeIdArg% %__unprocessedBuildArgs%
+call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -testOverlay -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %RuntimeIdArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
 if errorlevel 1 (
     echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
     echo     %__BuildLog%
@@ -403,7 +418,7 @@ set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
 
-call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -testHost -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %RuntimeIdArg% %__unprocessedBuildArgs%
+call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -testHost -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %RuntimeIdArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
 if errorlevel 1 (
     echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
     echo     %__BuildLog%
@@ -424,7 +439,8 @@ set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
 set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
 set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
 
-call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -BuildWrappers -MsBuildEventLogging=" " -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %TargetsWindowsArg% %__unprocessedBuildArgs%
+REM Build wrappers using the local SDK's msbuild. As we move to arcade, the other builds should be moved away from run.exe as well.
+call %__DotnetHost% msbuild %__ProjectDir%\tests\runtest.proj /p:BuildWrappers=true !__msbuildLog! !__msbuildWrn! !__msbuildErr! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__BuildAgainstPackagesMsbuildArg% %__unprocessedBuildArgs%
 if errorlevel 1 (
     echo Xunit Wrapper build failed
     exit /b 1
@@ -459,7 +475,7 @@ REM === Prep test binaries for Helix publishing
 REM ===
 REM =========================================================================================
 
-call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\helixprep.proj  -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %RuntimeIdArg% %TargetsWindowsArg% %__CrossgenArg% %__unprocessedBuildArgs%
+call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\helixprep.proj  -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %RuntimeIdArg% %TargetsWindowsArg% %__CrossgenArg% %__PriorityArg% %__PassThroughArg% %__unprocessedBuildArgs%
 if errorlevel 1 (
     echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
     echo     %__BuildLog%
index ab73f97..fd2d8af 100755 (executable)
@@ -152,7 +152,7 @@ generate_layout()
     # ===
     # =========================================================================================
 
-    build_Tests_internal "Restore_Packages" "${__ProjectDir}/tests/build.proj" " -BatchRestorePackages" "Restore product binaries (build tests)"
+    build_Tests_internal "Restore_Packages" "${__ProjectDir}/tests/build.proj" "Restore product binaries (build tests)" "-BatchRestorePackages"
 
     if [ -n "$__UpdateInvalidPackagesArg" ]; then
         __up=-updateinvalidpackageversion
@@ -172,7 +172,7 @@ generate_layout()
 
     mkdir -p $CORE_ROOT
 
-    build_Tests_internal "Tests_Overlay_Managed" "${__ProjectDir}/tests/runtest.proj" "-testOverlay" "Creating test overlay"
+    build_Tests_internal "Tests_Overlay_Managed" "${__ProjectDir}/tests/runtest.proj" "Creating test overlay" "-testOverlay" 
 
     chmod +x $__BinDir/corerun
     chmod +x $__BinDir/crossgen
@@ -180,14 +180,6 @@ generate_layout()
     # Make sure to copy over the pulled down packages
     cp -r $__BinDir/* $CORE_ROOT/ > /dev/null
 
-    # Work hardcoded path around
-    if [ ! -f "${__BuildToolsDir}/Microsoft.CSharp.Core.Targets" ]; then
-        ln -s "${__BuildToolsDir}/Microsoft.CSharp.Core.targets" "${__BuildToolsDir}/Microsoft.CSharp.Core.Targets"
-    fi
-    if [ ! -f "${__BuildToolsDir}/Microsoft.CSharp.targets" ]; then
-        ln -s "${__BuildToolsDir}/Microsoft.CSharp.Targets" "${__BuildToolsDir}/Microsoft.CSharp.targets"
-    fi
-
 }
 
 generate_testhost()
@@ -201,7 +193,7 @@ generate_testhost()
     echo "${__MsgPrefix}Creating test overlay..."    
     mkdir -p $TEST_HOST
 
-    build_Tests_internal "Tests_Generate_TestHost" "${__ProjectDir}/tests/runtest.proj" "-testHost" "Creating test host"
+    build_Tests_internal "Tests_Generate_TestHost" "${__ProjectDir}/tests/runtest.proj" "Creating test host" "-testHost"
 }
 
 
@@ -246,15 +238,15 @@ build_Tests()
     # ===
     # =========================================================================================
 
-    build_Tests_internal "Restore_Product" "${__ProjectDir}/tests/build.proj" " -BatchRestorePackages" "Restore product binaries (build tests)"
+    build_Tests_internal "Restore_Product" "${__ProjectDir}/tests/build.proj" "Restore product binaries (build tests)" "-BatchRestorePackages"
 
     if [ -n "$__BuildAgainstPackagesArg" ]; then
-        build_Tests_internal "Tests_GenerateRuntimeLayout" "${__ProjectDir}/tests/runtest.proj" "-BinPlaceRef -BinPlaceProduct -CopyCrossgenToProduct" "Restore product binaries (run tests)"
+        build_Tests_internal "Tests_GenerateRuntimeLayout" "${__ProjectDir}/tests/runtest.proj" "Restore product binaries (run tests)" "-BinPlaceRef" "-BinPlaceProduct" "-CopyCrossgenToProduct"
     fi
 
     echo "Starting the Managed Tests Build..."
 
-    build_Tests_internal "Tests_Managed" "$__ProjectDir/tests/build.proj" "$__up" "Managed tests build (build tests)"
+    build_Tests_internal "Tests_Managed" "$__ProjectDir/tests/build.proj" "Managed tests build (build tests)" "$__up"
 
     if [ $? -ne 0 ]; then
         echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
@@ -270,7 +262,7 @@ build_Tests()
 
         if [ ! -f $__XUnitWrapperBuiltMarker ]; then
 
-            build_Tests_internal "Tests_XunitWrapper" "$__ProjectDir/tests/runtest.proj" "-BuildWrappers -MsBuildEventLogging=\" \" " "Test Xunit Wrapper"
+            build_Tests_internal "Tests_XunitWrapper" "$__ProjectDir/tests/runtest.proj" "Test Xunit Wrapper" "-BuildWrappers" "-MsBuildEventLogging= " "-TargetsWindows=false"
 
             if [ $? -ne 0 ]; then
                 echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
@@ -295,16 +287,19 @@ build_Tests()
 
     if [ $__ZipTests -ne 0 ]; then
         echo "${__MsgPrefix}ZIP tests packages..."
-        build_Tests_internal "Helix_Prep" "$__ProjectDir/tests/helixprep.proj" " " "Prep test binaries for Helix publishing"
+        build_Tests_internal "Helix_Prep" "$__ProjectDir/tests/helixprep.proj" "Prep test binaries for Helix publishing" " "
     fi
 }
 
 build_Tests_internal()
 {
     subDirectoryName=$1
-    projectName=$2
-    extraBuildParameters=$3
-    stepName="$4"
+    shift
+    projectName=$1
+    shift
+    stepName="$1"
+    shift
+    extraBuildParameters=("$@")
 
     # Set up directories and file names
     __BuildLogRootName=$subDirectoryName
@@ -312,6 +307,13 @@ build_Tests_internal()
     __BuildWrn="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.wrn"
     __BuildErr="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.err"
 
+    # Use binclashlogger by default if no other logger is specified
+    if [[ "${extraBuildParameters[*]}" == *"-MsBuildEventLogging"* ]]; then
+        msbuildEventLogging=""
+    else
+        msbuildEventLogging="-MsBuildEventLogging=\"/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log\""
+    fi
+
     if [[ "$subDirectoryName" == "Tests_Managed" ]]; then
         # Execute msbuild managed test build in stages - workaround for excessive data retention in MSBuild ConfigCache
         # See https://github.com/Microsoft/msbuild/issues/2993
@@ -337,12 +339,16 @@ build_Tests_internal()
             export TestBuildSlice=$slice
 
             # Generate build command
-            buildCommand="$__ProjectRoot/run.sh build -Project=$projectName -MsBuildLog=${__msbuildLog} -MsBuildWrn=${__msbuildWrn} -MsBuildErr=${__msbuildErr} -MsBuildEventLogging=\"/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log\" $extraBuildParameters $__RunArgs $__UnprocessedBuildArgs"
+            buildArgs=("-Project=$projectName" "-MsBuildLog=${__msbuildLog}" "-MsBuildWrn=${__msbuildWrn}" "-MsBuildErr=${__msbuildErr}")
+            buildArgs+=("$msbuildEventLogging")
+            buildArgs+=("${extraBuildParameters[@]}")
+            buildArgs+=("${__RunArgs[@]}")
+            buildArgs+=("${__UnprocessedBuildArgs[@]}")
 
             echo "Building step '$stepName' slice=$slice via $buildCommand"
 
             # Invoke MSBuild
-            eval $buildCommand
+            "$__ProjectRoot/run.sh" build "${buildArgs[@]}"
 
             # Make sure everything is OK
             if [ $? -ne 0 ]; then
@@ -362,15 +368,16 @@ build_Tests_internal()
         __msbuildErr="\"/flp2:ErrorsOnly;LogFile=${__BuildErr}\""
 
         # Generate build command
-        buildCommand="$__ProjectRoot/run.sh build -Project=$projectName -MsBuildLog=${__msbuildLog} -MsBuildWrn=${__msbuildWrn} -MsBuildErr=${__msbuildErr} -MsBuildEventLogging=\"/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log\" $extraBuildParameters $__RunArgs $__UnprocessedBuildArgs"
+        buildArgs=("-Project=$projectName" "-MsBuildLog=${__msbuildLog}" "-MsBuildWrn=${__msbuildWrn}" "-MsBuildErr=${__msbuildErr}")
+        buildArgs+=("$msbuildEventLogging")
+        buildArgs+=("${extraBuildParameters[@]}")
+        buildArgs+=("${__RunArgs[@]}")
+        buildArgs+=("${__UnprocessedBuildArgs[@]}")
 
         echo "Building step '$stepName' via $buildCommand"
 
         # Invoke MSBuild
-        eval $buildCommand
-
-        # Invoke MSBuild
-        # $__ProjectRoot/run.sh build -Project=$projectName -MsBuildLog="$__msbuildLog" -MsBuildWrn="$__msbuildWrn" -MsBuildErr="$__msbuildErr" $extraBuildParameters $__RunArgs $__UnprocessedBuildArgs
+        "$__ProjectRoot/run.sh" build "${buildArgs[@]}"
 
         # Make sure everything is OK
         if [ $? -ne 0 ]; then
@@ -524,7 +531,7 @@ __ZipTests=0
 __NativeTestIntermediatesDir=
 __RunTests=0
 __RebuildTests=0
-__BuildTestWrappers=0
+__BuildTestWrappers=1
 __GenerateLayoutOnly=
 __GenerateTestHostOnly=
 __priority1=
@@ -686,10 +693,10 @@ while :; do
             ;;
         priority1)
             __priority1=1
-            __UnprocessedBuildArgs="$__UnprocessedBuildArgs -priority=1"
+            __UnprocessedBuildArgs+=("-priority=1")
             ;;
         *)
-            __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
+            __UnprocessedBuildArgs+=("$1")
             ;;
     esac
 
@@ -697,12 +704,12 @@ while :; do
 done
 
 
-__RunArgs="-BuildArch=$__BuildArch -BuildType=$__BuildType -BuildOS=$__BuildOS"
+__RunArgs=("-BuildArch=$__BuildArch" "-BuildType=$__BuildType" "-BuildOS=$__BuildOS")
 
 # Configure environment if we are doing a verbose build
 if [ $__VerboseBuild == 1 ]; then
     export VERBOSE=1
-    __RunArgs="$__RunArgs -verbose"
+    __RunArgs+=("-verbose")
 fi
 
 # Set default clang version
@@ -747,7 +754,7 @@ __CrossgenExe="$__CrossComponentBinDir/crossgen"
 
 isMSBuildOnNETCoreSupported
 
-# CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to set.
+# CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to it.
 # This is needed by CLI to function.
 if [ -z "$HOME" ]; then
     if [ ! -d "$__ProjectDir/temp_home" ]; then
index b865ba8..544a961 100644 (file)
       },
       "inputs": {
         "filename": "build-test.cmd",
-        "arguments": "$(ParentBuildType) $(Architecture) buildagainstpackages runtimeid $(Rid) $(TargetsNonWindowsArg)$(CrossgenArg)-OfficialBuildId=$(ParentOfficialBuildId) -OverwriteCoreClrPackageVersion -Priority=$(Priority) -- /p:IntermediateAzureFeed=$(IntermediateAzureFeed)",
+        "arguments": "$(ParentBuildType) $(Architecture) buildagainstpackages runtimeid $(Rid) $(TargetsNonWindowsArg) $(CrossgenArg) -Priority=$(Priority) -- /p:OfficialBuildId=$(ParentOfficialBuildId) /p:OverwriteCoreClrPackageVersion=true /p:IntermediateAzureFeed=$(IntermediateAzureFeed)",
         "workingFolder": "",
         "failOnStandardError": "false"
       }
index 5dc7438..8792554 100644 (file)
@@ -35,8 +35,7 @@
     <MicrosoftNETCorePlatformsPackageVersion>3.0.0-preview1-26717-04</MicrosoftNETCorePlatformsPackageVersion>
     <PgoDataPackageVersion>99.99.99-master-20180718-0214</PgoDataPackageVersion>
     <MicrosoftNETCoreRuntimeCoreCLRPackageVersion>3.0.0-preview1-26719-01</MicrosoftNETCoreRuntimeCoreCLRPackageVersion>
-    <XunitPackageVersion>2.2.0-beta2-build3300</XunitPackageVersion>
-    <XunitConsoleNetcorePackageVersion>2.2.0-preview1-02830-02</XunitConsoleNetcorePackageVersion>
+    <XunitPackageVersion>2.4.0-beta.2.build4010</XunitPackageVersion>
     <XunitPerformanceApiPackageVersion>1.0.0-beta-build0015</XunitPerformanceApiPackageVersion>
     <MicrosoftDiagnosticsTracingTraceEventPackageVersion>2.0.4</MicrosoftDiagnosticsTracingTraceEventPackageVersion>
     <CommandLineParserVersion>2.2.0</CommandLineParserVersion>
       <Version>$(XunitPerformanceApiPackageVersion)</Version>
     </StaticDependency>
 
-    <StaticDependency Include="xunit.console.netcore">
-      <Version>$(XunitConsoleNetcorePackageVersion)</Version>
-    </StaticDependency>
-
     <DependencyBuildInfo Include="@(StaticDependency)">
       <PackageId>%(Identity)</PackageId>
       <UpdateStableVersions>true</UpdateStableVersions>
diff --git a/dir.common.props b/dir.common.props
new file mode 100644 (file)
index 0000000..f945289
--- /dev/null
@@ -0,0 +1,36 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <!-- This file contains build properties that apply to product
+       projects and test projects. It's imported by
+       tests/dir.common.props, and the global dir.props. -->
+
+  <PropertyGroup>
+    <CoreclrDir>$(MSBuildThisFileDirectory)</CoreclrDir>
+    <PackagesDir>$(CoreclrDir)/packages</PackagesDir>
+  </PropertyGroup>
+
+  <!-- Set default Configuration and Platform -->
+  <PropertyGroup>
+    <BuildArch>$(__BuildArch)</BuildArch>
+    <BuildArch Condition="'$(__BuildArch)'==''">x64</BuildArch>
+    <BuildArch Condition="'$(__BuildArch)' == 'amd64'">x64</BuildArch>
+
+    <BuildType>$(__BuildType)</BuildType>
+    <BuildType Condition="'$(__BuildType)'==''">Debug</BuildType>
+    <BuildType Condition="'$(__BuildType)' == 'debug'">Debug</BuildType>
+    <BuildType Condition="'$(__BuildType)' == 'release'">Release</BuildType>
+    <BuildType Condition="'$(__BuildType)' == 'checked'">Checked</BuildType>
+
+    <BuildOS>$(__BuildOS)</BuildOS>
+    <BuildOS Condition="'$(__BuildOS)' == ''">Windows_NT</BuildOS>
+
+    <Configuration Condition="'$(Configuration)' == ''">$(BuildType)</Configuration>
+    <Platform Condition="'$(Platform)' == ''">$(BuildArch)</Platform>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <RestorePackagesPath>$(PackagesDir)</RestorePackagesPath>
+  </PropertyGroup>
+
+
+</Project>
index 1b3329f..ad66a0b 100644 (file)
--- a/dir.props
+++ b/dir.props
@@ -2,6 +2,8 @@
 <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <Import Condition="Exists('..\dir.props')" Project="..\dir.props" />
 
+  <Import Project="dir.common.props" />
+
   <!--
     $(OS) is set to Unix/Windows_NT. This comes from an environment variable on Windows and MSBuild on Unix.
   -->
 
   <!-- Common properties -->
   <PropertyGroup>
-    <!-- Set basic properties and normalize -->
-    <BuildArch>$(__BuildArch)</BuildArch>
-    <BuildArch Condition="'$(__BuildArch)'==''">x64</BuildArch>
-    <BuildArch Condition="'$(__BuildArch)' == 'amd64'">x64</BuildArch>
-
-    <BuildType Condition="'$(__BuildType)'==''">Debug</BuildType>
-    <BuildType Condition="'$(__BuildType)' == 'debug'">Debug</BuildType>
-    <BuildType Condition="'$(__BuildType)' == 'release'">Release</BuildType>
-    <BuildType Condition="'$(__BuildType)' == 'checked'">Checked</BuildType>
-
-    <BuildOS>$(__BuildOS)</BuildOS>
-    <BuildOS Condition="'$(__BuildOS)' == ''">Windows_NT</BuildOS>
 
     <ProjectDir>$(__ProjectDir)\</ProjectDir>
     <ProjectDir Condition="'$(__ProjectDir)'==''">$(MSBuildThisFileDirectory)</ProjectDir>
diff --git a/run.sh b/run.sh
index 2d037e9..cc6a184 100755 (executable)
--- a/run.sh
+++ b/run.sh
@@ -9,7 +9,7 @@ toolRuntime=$working_tree_root/Tools
 dotnet=$toolRuntime/dotnetcli/dotnet
 
 echo "Running: $dotnet $toolRuntime/run.exe $working_tree_root/config.json $*"
-$dotnet $toolRuntime/run.exe $working_tree_root/config.json $*
+$dotnet $toolRuntime/run.exe $working_tree_root/config.json "$@"
 if [ $? -ne 0 ]
 then
     echo "ERROR: An error occured in $dotnet $toolRuntime/run $#. Check $# logs under $working_tree_root."
index aede131..a421b13 100644 (file)
@@ -31,7 +31,6 @@
     <RestoreProjects Include="$(MSBuildThisFileDirectory)src\JIT\config\benchmark+serialize\benchmark+serialize.csproj" />
     <RestoreProjects Include="$(MSBuildThisFileDirectory)src\JIT\config\benchmark\benchmark.csproj" />
     <RestoreProjects Include="$(MSBuildThisFileDirectory)src\performance\performance.csproj" />
-    <RestoreProjects Include="$(MSBuildThisFileDirectory)src\TestWrappersConfig\TestWrappersConfig.csproj" />
   </ItemGroup>
 
   <Target Name="BuildTargetingPack" AfterTargets="BatchRestorePackages" Condition="$(__SkipTargetingPackBuild) != 'true'">
diff --git a/tests/dir.common.props b/tests/dir.common.props
new file mode 100644 (file)
index 0000000..5c596c0
--- /dev/null
@@ -0,0 +1,28 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="../dir.common.props" />
+
+  <!-- This file contains common build properties for projects under
+       the test tree, and also generated test projects in
+       bin/tests. It currently has only those properties that are
+       shared between buildtools test projects and SDK-style test
+       projects. Eventually every test project should build using the
+       SDK. Some test projects still bypass this by importing
+       tests/dir.props directly - these should eventually go away. -->
+
+  <PropertyGroup>
+    <OSPlatformConfig>$(BuildOS).$(Platform).$(Configuration)</OSPlatformConfig>
+
+    <TestSrcDir>$(CoreclrDir)/tests/src</TestSrcDir>
+    <BuildProjectRelativeDir>$([System.String]::Copy('$(MSBuildProjectDirectary)').Replace($(TestSrcDir),''))/$(MSBuildProjectName)</BuildProjectRelativeDir>
+
+    <!-- BaseIntermediateOutputPath is used by the SDK as the location
+         for the lock file, and props/targets from nuget packages. -->
+    <BaseIntermediateOutputPath>$(CoreclrDir)/bin/tests/obj/$(OSPlatformConfig)/Managed/$(BuildProjectRelativeDir)</BaseIntermediateOutputPath>
+    <IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>
+
+    <BaseOutputPath>$(CoreclrDir)/bin/tests/$(OSPlatformConfig)/$(BuildProjectRelativeDir)</BaseOutputPath>
+    <OutputPath>$(BaseOutputPath)</OutputPath>
+
+  </PropertyGroup>
+
+</Project>
index b29983c..5b07136 100644 (file)
@@ -34,7 +34,6 @@
     <BuildToolsTargets45>$(BuildToolsTargetsDesktop)</BuildToolsTargets45>
     <RunningOnUnix Condition="('$(RunningOnUnix)' == '') And ('$(MSBuildRuntimeType)' == 'Core') And ('$(OS)'!='Windows_NT')">true</RunningOnUnix>
     <UseBuildTools>true</UseBuildTools>
-    <UseBuildTools Condition="'$(OS)'=='Windows_NT' And '$(RunningOnCore)' == 'true'">false</UseBuildTools>
   </PropertyGroup>  
 
   <!-- Common repo directories -->
@@ -47,7 +46,6 @@
     <DotnetCliPath Condition="'$(DotnetCliPath)'==''">$(ToolsDir)dotnetcli\</DotnetCliPath>
     <BuildToolsTaskDir Condition="'$(BuildToolsTargets45)' == 'true'">$(ToolsDir)net46\</BuildToolsTaskDir>
     <OverrideToolHost Condition="'$(OS)' != 'Windows_NT'">$(DotnetCliPath)dotnet</OverrideToolHost>
-    <CSharpCoreTargetsPath Condition="('$(BuildToolsTargetsDesktop)' != 'true') And ('$(UseBuildTools)'=='true')">$(ToolsDir)\Microsoft.CSharp.Core.targets</CSharpCoreTargetsPath>
     <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two properties to any folder that exists to skip
          the GenerateReferenceAssemblyPaths task (not target) and to prevent it from outputting a warning (MSB3644). -->
     <_TargetFrameworkDirectories Condition="'$(BuildToolsTargetsDesktop)' != 'true'">$(MSBuildThisFileDirectory)/Documentation</_TargetFrameworkDirectories>
   </PropertyGroup>
 
   <!-- Use Roslyn Compilers to build -->
-  <Import Project="$(RoslynPropsFile)" Condition="'$(RunningOnUnix)'!='true' and Exists('$(RoslynPropsFile)') and '$(UseRoslynCompilers)'!='false' and '$(RoslynIncompatibleMsbuildVersion)' != 'true'" />
-  <Import Project="$(RoslynPropsFile)" Condition="'$(RunningOnUnix)'=='true' and Exists('$(RoslynPropsFile)') and '$(RoslynIncompatibleMsbuildVersion)' != 'true'" />
+  <Import Project="$(RoslynPropsFile)" Condition="Exists('$(RoslynPropsFile)') and '$(RoslynIncompatibleMsbuildVersion)' != 'true'" />
 
   <PropertyGroup Condition="'$(BuildAllProjects)'=='true'">
     <!-- When we do a traversal build we get all packages up front, don't restore them again -->
diff --git a/tests/dir.sdkbuild.props b/tests/dir.sdkbuild.props
new file mode 100644 (file)
index 0000000..b5a0fdd
--- /dev/null
@@ -0,0 +1,14 @@
+<Project>
+  <Import Project="dir.common.props" />
+
+  <!-- This file contains build properties that apply only to
+       SDK-style test projects. Properties that are shared between SDK
+       and buildtools projects should go in dir.common.props. -->
+
+  <PropertyGroup>
+    <TargetFramework>netcoreapp2.0</TargetFramework>
+    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
+  </PropertyGroup>
+
+</Project>
index 2d08e91..1cbf0ed 100644 (file)
@@ -38,7 +38,7 @@
     Inputs="@(XunitDlls)"
     Outputs="$(TestWorkingDir)archive\**" >
     
-    <Copy SourceFiles="$(CORE_ROOT)\xunit.console.netcore.exe"
+    <Copy SourceFiles="$(CORE_ROOT)\xunit.console.dll"
           DestinationFolder="%(XunitDlls.RootDir)%(XunitDlls.Directory)"
     />
     <Message Text="Deleting '.requires_signing' files to avoid file name lengths exceeding MAX_PATH" Importance="Low" />
@@ -85,8 +85,8 @@ set CORE_ROOT=%HELIX_CORRELATION_PAYLOAD%
 $(CmdCrossgenVar)
 
 ECHO BEGIN EXECUTION
-ECHO %HELIX_CORRELATION_PAYLOAD%\CoreRun.exe %HELIX_WORKITEM_PAYLOAD%\xunit.console.netcore.exe %HELIX_WORKITEM_PAYLOAD%\$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing
-%HELIX_CORRELATION_PAYLOAD%\CoreRun.exe %HELIX_WORKITEM_PAYLOAD%\xunit.console.netcore.exe %HELIX_WORKITEM_PAYLOAD%\$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing
+ECHO %HELIX_CORRELATION_PAYLOAD%\CoreRun.exe %HELIX_WORKITEM_PAYLOAD%\xunit.console.dll %HELIX_WORKITEM_PAYLOAD%\$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing
+%HELIX_CORRELATION_PAYLOAD%\CoreRun.exe %HELIX_WORKITEM_PAYLOAD%\xunit.console.dll %HELIX_WORKITEM_PAYLOAD%\$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing
 
 echo Finished running tests. Exit code = %ERRORLEVEL%
 EXIT /B %ERRORLEVEL%
@@ -149,8 +149,8 @@ EXIT /B %ERRORLEVEL%
       <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)%0a</WrapperShContents>
 
       <WrapperShContents>$(WrapperShContents)echo BEGIN EXECUTION%0a</WrapperShContents>
-      <WrapperShContents>$(WrapperShContents)echo "%24{HELIX_CORRELATION_PAYLOAD}/corerun" %24HELIX_WORKITEM_PAYLOAD/xunit.console.netcore.exe %24HELIX_WORKITEM_PAYLOAD/$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing%0a</WrapperShContents>
-      <WrapperShContents>$(WrapperShContents)"%24{HELIX_CORRELATION_PAYLOAD}/corerun" %24HELIX_WORKITEM_PAYLOAD/xunit.console.netcore.exe %24HELIX_WORKITEM_PAYLOAD/$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing%0a</WrapperShContents>
+      <WrapperShContents>$(WrapperShContents)echo "%24{HELIX_CORRELATION_PAYLOAD}/corerun" %24HELIX_WORKITEM_PAYLOAD/xunit.console.dll %24HELIX_WORKITEM_PAYLOAD/$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing%0a</WrapperShContents>
+      <WrapperShContents>$(WrapperShContents)"%24{HELIX_CORRELATION_PAYLOAD}/corerun" %24HELIX_WORKITEM_PAYLOAD/xunit.console.dll %24HELIX_WORKITEM_PAYLOAD/$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing%0a</WrapperShContents>
       <WrapperShContents>$(WrapperShContents)ErrorLevel=%24%3F%0a</WrapperShContents>
       <WrapperShContents>$(WrapperShContents)%0a</WrapperShContents>
       <WrapperShContents>$(WrapperShContents)echo Finished running tests. Exit code = %24ErrorLevel%0a</WrapperShContents>
index 0e7f82b..d4c07a0 100644 (file)
@@ -3,10 +3,6 @@
     Overrides for all other targets (including build tools) can go in this file.
   -->
 
-  <!-- Contains overrides for the nuget reference resolution.  The regular nuget reference resolution will not
-       copy references local, which we need in order to correctly execute the xunit project -->
-  <Import Project="xunitwrapper.targets" Condition="'$(IsXunitWrapperProject)'=='true'" />
-
   <!-- Override the AddDesignTimeFacadeReferences target to add the ability to reference System.Private.CoreLib.
        Some tests use functionality not available in the portable reference assemblies.
        For portability reasons it's generally a good idea to reference the facades instead of the
index e7e3bc7..df5ff2d 100644 (file)
@@ -6,7 +6,6 @@
   <PropertyGroup>
     <XunitTestBinBase Condition="'$(XunitTestBinBase)'==''" >$(BaseOutputPathWithConfig)</XunitTestBinBase>
     <XunitWrapperGeneratedCSDirBase>$(XunitTestBinBase)\TestWrappers\</XunitWrapperGeneratedCSDirBase>
-    <XunitWrapperOutputIntermediatedDirBase>$(XunitTestBinBase)\Tests\</XunitWrapperOutputIntermediatedDirBase>
     <MSBuildEnableAllPropertyFunctions>1</MSBuildEnableAllPropertyFunctions>
   </PropertyGroup>
 
@@ -75,63 +74,34 @@ $(_XunitEpilog)
       </_XunitWrapperGen>
       <XunitWrapperGenCsProj>
         <![CDATA[
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project>
+
+  <Import Project="$(ProjectDir)dir.sdkbuild.props" />
 
-  <Import Project="$(SourceDir)dir.props" />
   <PropertyGroup>
-    <Configuration Condition=" '%24(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '%24(Platform)' == '' ">AnyCPU</Platform>
-    <AssemblyName>$(XunitWrapper)</AssemblyName>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <TargetFrameworkIdentifier Condition ="('$(BuildTestsAgainstPackages)' != 'true') And ('$(BuildOS)' == 'Windows_NT')">.NETFramework</TargetFrameworkIdentifier>
-    <TargetFrameworkVersion Condition ="('$(BuildTestsAgainstPackages)' != 'true') And ('$(BuildOS)' == 'Windows_NT')">v4.5</TargetFrameworkVersion>
-    <NugetTargetMonikerShort Condition ="'$(BuildTestsAgainstPackages)' != 'true'">net45</NugetTargetMonikerShort>
-    <IsXunitWrapperProject>true</IsXunitWrapperProject>
-    <SkipSigning>true</SkipSigning>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB}%3B{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="%24(SolutionDir) == '' Or %24(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <CLRTestKind>BuildOnly</CLRTestKind>
-    <IsTestProject>true</IsTestProject>
-  </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '%24(Configuration)|%24(Platform)' == 'Debug|AnyCPU' ">
-  </PropertyGroup>
-  <PropertyGroup Condition=" '%24(Configuration)|%24(Platform)' == 'Release|AnyCPU' ">
+    <OutputPath>$(XUnitTestBinBase)\$(CategoryWithSlash)</OutputPath>
   </PropertyGroup>
+
+  <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
+
   <ItemGroup>
     <Compile Include="$(XunitWrapper).cs" />
   </ItemGroup>
+
   <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-   <ItemGroup>
-    <ProjectReference Include="$(SourceDir)Common\Desktop.Coreclr.TestWrapper\Desktop.Coreclr.TestWrapper.csproj" Condition="('$(BuildTestsAgainstPackages)' != 'true') And ('$(BuildOS)' == 'Windows_NT')">
-      <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
-      <Name>coreclr</Name>
-    </ProjectReference>
-    <ProjectReference Include="$(SourceDir)Common\Coreclr.TestWrapper\Coreclr.TestWrapper.csproj" Condition="('$(BuildTestsAgainstPackages)' == 'true') Or ('$(BuildOS)' != 'Windows_NT')">
-      <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
-      <Name>coreclr</Name>
-    </ProjectReference>
+    <ProjectReference Include="$(SourceDir)Common\Coreclr.TestWrapper\Coreclr.TestWrapper.csproj" />
   </ItemGroup>
 
   <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Runtime" />
-    <Reference Include="mscorlib" />
+    <PackageReference Include="xunit" Version="$(XunitPackageVersion)" />
+    <PackageReference Include="xunit.runner.console" Version="$(XunitPackageVersion)" />
   </ItemGroup>
-  <Import Project="$(SourceDir)dir.targets" />
-  <PropertyGroup>
-    <OutDir>$(XunitTestBinBase)\$(CategoryWithSlash)\</OutDir>
-    <ProjectAssetsFile Condition="'$(BuildTestsAgainstPackages)' != 'true'">%24(TestWrappersPackagesConfigFileDirectory)obj/project.assets.json</ProjectAssetsFile>
-  </PropertyGroup>
+
+  <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
+
 </Project>
-        ]]>
+]]>
       </XunitWrapperGenCsProj>
-
     </PropertyGroup>
 
     <!-- <Exec Command="md" -->
@@ -151,7 +121,7 @@ $(_XunitEpilog)
   </Target>
 
   <Target Name="BuildXunitWrapper">
-    <MSBuild Projects="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj"/>
+    <MSBuild Projects="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj" Targets="Restore;Build" />
   </Target>
 
   <Target Name="CreateXunitFacts">
@@ -166,7 +136,6 @@ $(_XunitEpilog)
       <Category Condition="'$(RunningOnUnix)' == 'true'" >$([System.String]::Copy('$(CategoryWithSlash)').Replace('/','.'))</Category>
       <XunitWrapper>$(Category).XUnitWrapper</XunitWrapper>
       <XunitWrapperSrcDir>$(XunitWrapperGeneratedCSDirBase)$(Category)</XunitWrapperSrcDir>
-      <XunitWrapperOutputDir>$(XunitWrapperOutputIntermediatedDirBase)$(Category)</XunitWrapperOutputDir>
     </PropertyGroup>
     <PropertyGroup>
       <_XunitProlog Condition=" '$(_XunitProlog)'=='' ">
@@ -191,7 +160,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
             {
                 reportBase = System.Environment.GetEnvironmentVariable(%22XunitTestReportDirBase%22)%3B
                 testBinaryBase = System.IO.Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath)%3B
-                coreRoot = System.IO.Path.GetFullPath(System.Environment.GetEnvironmentVariable(%22CORE_ROOT%22))%3B
+                coreRoot = System.Environment.GetEnvironmentVariable(%22CORE_ROOT%22)%3B
 
                 if (String.IsNullOrEmpty(reportBase)) {
                     reportBase = System.IO.Path.Combine(testBinaryBase, "Reports")%3B
@@ -205,6 +174,8 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
                     throw new ArgumentException("Environment variable CORE_ROOT is not set")%3B
                 }
 
+                coreRoot = System.IO.Path.GetFullPath(coreRoot)%3B
+
                 string operatingSystem = System.Environment.GetEnvironmentVariable("OS")%3B
                 runningInWindows = (operatingSystem != null && operatingSystem.StartsWith("Windows"))%3B
             }
@@ -258,7 +229,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
                 try
                 {
                   CoreclrTestWrapperLib wrapper = new CoreclrTestWrapperLib()%3B
-                  string testSubfolder = @"\$(Category)\$([System.String]::Copy('%(AllCMDs.RelativeDir)').Replace("$(_CMDDIR)\",''))"%3B
+                  string testSubfolder = @"\$(Category)\$([System.String]::Copy('%(AllCMDs.RelativeDir)').Replace("$(_CMDDIR)$([System.IO.Path]::DirectorySeparatorChar)",''))"%3B
                   outputFile = System.IO.Path.GetFullPath(_Global.reportBase + testSubfolder + @"%(AllCMDs.FileName).output.txt")%3B
                   errorFile = System.IO.Path.GetFullPath(_Global.reportBase + testSubfolder + @"%(AllCMDs.FileName).error.txt")%3B
                   testExecutable = System.IO.Path.GetFullPath(_Global.testBinaryBase + @"$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",''))")%3B
@@ -301,7 +272,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
                         outputText = "Unable to read output file: " + outputFile%3B
                     }
 
-                    string msg = infraEx != null ? "Test Infrastructure Failure: " + infraEx.Message
+                    string msg = infraEx != null ? "Test Infrastructure Failure: " + infraEx.ToString()
                                                  : sErrorText + "\n\n" +
                                                    "Return code:      " + ret + "\n" +
                                                    "Raw output file:      " + outputFile + "\n" +
@@ -329,7 +300,8 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
 
   <Target Name="GetListOfTestCmds">
     <ItemGroup>
-      <AllRunnableTestPaths Include="$(XunitTestBinBase)\**\*.cmd" />
+      <AllRunnableTestPaths Include="$(XunitTestBinBase)\**\*.cmd" Condition="'$(BuildOS)' == 'Windows_NT'" />
+      <AllRunnableTestPaths Include="$(XunitTestBinBase)\**\*.sh" Condition="'$(BuildOS)' != 'Windows_NT'" />
     </ItemGroup>
   </Target>
 
@@ -430,10 +402,13 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
       <!-- Workaround for packages on which Microsoft.NetCoreApp expresses a dependency 
       The <PackageToInclude> element doesn't allow a version to be specified and we end up with clashing assembly versions in Core_Root-->
       <NetCoreAppPackagedAssemblies Include="System.Text.Encoding.CodePages.dll"/>
+      <!-- Use xunit dependencies defined in CoreFX.depproj instead of conflicting versions from test dependencies. -->
+      <TestDependenciesToExclude Include="$(CORE_ROOT)\**\xunit*"/>
+      <CoreCLRBinariesToExclude Include="@(NetCoreAppPackagedAssemblies);@(TestDependenciesToExclude -> '%(Identity)')" />
     </ItemGroup>
 
     <ItemGroup>
-      <CoreCLRBinaries Include="$(CORE_ROOT)\**\*.*" Exclude="$(CORE_ROOT)\**\@(NetCoreAppPackagedAssemblies -> '%(Identity)' )" />
+      <CoreCLRBinaries Include="$(CORE_ROOT)\**\*.*" Exclude="$(CORE_ROOT)\**\@(CoreCLRBinariesToExclude -> '%(Identity)' )" />
       <HostFxFile Include="$(ToolsDir)\dotnetcli\**\$(HostFxrFileName).$(HostFxrFileExtension)" />
       <DotnetExe Include="$(ToolsDir)\dotnetcli\$(DotnetExecutableName)" />
       <HostPolicyFile Include="$(ToolsDir)\dotnetcli\**\$(HostPolicyFileName).$(HostPolicyExtension)" />
@@ -502,6 +477,6 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
   </Target>
 
   <Target Name="Clean">
-    <RemoveDir Condition=" '$(BuildWrappers)'=='true'" Directories="$(XunitWrapperGeneratedCSDirBase);$(XunitWrapperOutputIntermediatedDirBase)" ContinueOnError="WarnAndContinue" />
+    <RemoveDir Condition=" '$(BuildWrappers)'=='true'" Directories="$(XunitWrapperGeneratedCSDirBase);" ContinueOnError="WarnAndContinue" />
   </Target>
 </Project>
diff --git a/tests/runtest.py b/tests/runtest.py
new file mode 100755 (executable)
index 0000000..7cadfb4
--- /dev/null
@@ -0,0 +1,441 @@
+#!/usr/bin/env python
+################################################################################
+################################################################################
+#
+# Module: runtest.py
+#
+# Notes:
+#  
+# Universal script to setup and run the xunit msbuild test runner.
+#
+# Use the instructions here:
+#    https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-test-instructions.md 
+#    https://github.com/dotnet/coreclr/blob/master/Documentation/building/unix-test-instructions.md
+#
+################################################################################
+################################################################################
+
+import argparse
+import json
+import os
+import platform
+import shutil
+import subprocess
+import sys
+import tempfile
+
+from collections import defaultdict
+from sys import platform as _platform
+
+################################################################################
+# Argument Parser
+################################################################################
+
+description = ("""Simple script that essentially sets up and runs either runtest.cmd
+                  or runtests.sh. This wrapper is necessary to do all the setup work.
+
+                  Note that this is required because there is not a unified test runner
+                  for coreclr.""")
+
+# Use either - or / to designate switches.
+parser = argparse.ArgumentParser(description=description, prefix_chars='-/')
+
+parser.add_argument("-arch", dest="arch", nargs='?', default="x64")
+parser.add_argument("-build_type", dest="build_type", nargs='?', default="Debug")
+parser.add_argument("-test_location", dest="test_location", nargs="?", default=None)
+parser.add_argument("-core_root", dest="core_root", nargs='?', default=None)
+parser.add_argument("-coreclr_repo_location", dest="coreclr_repo_location", default=os.getcwd())
+
+# Only used on Unix
+parser.add_argument("-test_native_bin_location", dest="test_native_bin_location", nargs='?', default=None)
+
+################################################################################
+# Helper Functions
+################################################################################
+   
+def create_and_use_test_env(_os, env, func):
+    """ Create a test env based on the env passed
+
+    Args:
+        _os(str)                        : OS name
+        env(defaultdict(lambda: None))  : complus variables, key,value dict
+        func(lambda)                    : lambda to call, after creating the 
+                                        : test_env
+
+    Notes:
+        Using the env passed, create a temporary file to use as the
+        test_env to be passed for runtest.cmd. Note that this only happens
+        on windows, until xunit is used on unix there is no managed code run
+        in runtest.sh.
+    """
+
+    complus_vars = defaultdict(lambda: None)
+
+    for key in env:
+        value = env[key]
+        if "complus" in key.lower():
+            complus_vars[key] = value
+
+    if len(complus_vars.keys()) > 0:
+        print "Found COMPlus variables in the current environment"
+        print
+
+        file_header = None
+
+        if _os == "Windows_NT":
+            file_header = \
+"""@echo off
+REM Temporary test env for test run.
+
+"""
+        else:
+            file_header = \
+"""# Temporary test env for test run.
+
+"""
+
+        with tempfile.NamedTemporaryFile() as test_env:
+            with open(test_env.name, 'w') as file_handle:
+                file_handle.write(file_header)
+                
+                for key in complus_vars:
+                    value = complus_vars[key]
+                    command = None
+                    if _os == "Windows_NT":
+                        command = "set"
+                    else:
+                        command = "export"
+
+                    print "Unset %s" % key
+                    os.environ[key] = ""
+
+                    file_handle.write("%s %s=%s%s" % (command, key, value, os.linesep))
+
+            contents = None
+            with open(test_env.name) as file_handle:
+                contents = file_handle.read()
+
+            print
+            print "TestEnv: %s" % test_env.name
+            print 
+            print "Contents:"
+            print
+            print contents
+            print
+
+            func(test_env.name)
+
+    else:
+        func(None)
+
+def get_environment():
+    """ Get all the COMPlus_* Environment variables
+    
+    Notes:
+        Windows uses msbuild for its test runner. Therefore, all COMPlus
+        variables will need to be captured as a test_env script and passed
+        to runtest.cmd.
+    """
+
+    complus_vars = defaultdict(lambda: "")
+    
+    for key in os.environ:
+        if "complus" in key.lower():
+            complus_vars[key] = os.environ[key]
+            os.environ[key] = ''
+        elif "superpmi" in key.lower():
+            complus_vars[key] = os.environ[key]
+            os.environ[key] = ''
+
+    return complus_vars
+
+def call_msbuild(coreclr_repo_location,
+                 msbuild_location,
+                 host_os,
+                 arch,
+                 build_type, 
+                 sequential=False):
+    """ Call msbuild to run the tests built.
+
+    Args:
+        coreclr_repo_location(str)  : path to coreclr repo
+        msbuild_location(str)       : path to msbuild
+        sequential(bool)            : run sequentially if True
+
+        host_os(str)                : os
+        arch(str)                   : architecture
+        build_type(str)             : configuration
+
+    Notes:
+        At this point the environment should be setup correctly, including
+        the test_env, should it need to be passed.
+
+    """
+
+    common_msbuild_arguments = ["/nologo", "/nodeReuse:false", "/p:Platform=%s" % arch]
+
+    if sequential:
+        common_msbuild_arguments += ["/p:ParallelRun=false"]
+    else:
+        common_msbuild_arguments += ["/maxcpucount"]
+
+    logs_dir = os.path.join(coreclr_repo_location, "bin", "Logs")
+    if not os.path.isdir(logs_dir):
+        os.makedirs(logs_dir)
+    
+    command =   [msbuild_location,
+                os.path.join(coreclr_repo_location, "tests", "runtest.proj"),
+                "/p:Runtests=true",
+                "/clp:showcommandline"]
+
+    log_path = os.path.join(logs_dir, "TestRunResults_%s_%s_%s" % (host_os, arch, build_type))
+    build_log = log_path + ".log"
+    wrn_log = log_path + ".wrn"
+    err_log = log_path + ".err"
+
+    msbuild_log_args = ["/fileloggerparameters:\"Verbosity=normal;LogFile=%s\"" % build_log,
+                        "/fileloggerparameters1:\"WarningsOnly;LogFile=%s\"" % wrn_log,
+                        "/fileloggerparameters2:\"ErrorsOnly;LogFile=%s\"" % err_log,
+                        "/consoleloggerparameters:Summary",
+                        "/verbosity:diag"]
+
+    command += msbuild_log_args
+
+    command += ["/p:__BuildOS=%s" % host_os,
+                "/p:__BuildArch=%s" % arch,
+                "/p:__BuildType=%s" % build_type,
+                "/p:__LogsDir=%s" % logs_dir]
+
+    if host_os != "Windows_NT":
+        command = ["bash"] + command
+
+    print " ".join(command)
+    subprocess.check_output(command)
+
+def copy_native_test_bin_to_core_root(host_os, path, core_root):
+    """ Recursively copy all files to core_root
+    
+    Args:
+        host_os(str)    : os
+        path(str)       : native test bin location
+        core_root(str)  : core_root location
+    """
+    assert os.path.isdir(path) or os.path.isfile(path)
+    assert os.path.isdir(core_root)
+
+    extension = "so" if host_os == "Linux" else "dylib"
+
+    if os.path.isdir(path):
+        for item in os.listdir(path):
+            copy_native_test_bin_to_core_root(host_os, os.path.join(path, item), core_root)
+    elif path.endswith(extension):
+        print "cp -p %s %s" % (path, core_root)
+        shutil.copy2(path, core_root) 
+
+def run_tests(host_os,
+              arch,
+              build_type, 
+              core_root,
+              coreclr_repo_location, 
+              test_location, 
+              test_native_bin_location, 
+              test_env=None,
+              is_long_gc=False,
+              is_gcsimulator=False,
+              is_jitdasm=False,
+              is_ilasm=False,
+              run_sequential=False):
+    """ Run the coreclr tests
+    
+    Args:
+        host_os(str)                : os
+        arch(str)                   : arch
+        build_type(str)             : configuration
+        coreclr_repo_location(str)  : path to the root of the repo
+        core_root(str)              : Core_Root path
+        test_location(str)          : Test bin, location
+        test_native_bin_location    : Native test components, None and windows.
+        test_env(str)               : path to the test_env to be used
+    """
+
+    # Copy all the native libs to core_root
+    if host_os != "Windows_NT":
+        copy_native_test_bin_to_core_root(host_os, os.path.join(test_native_bin_location, "src"), core_root)
+
+    # Setup the msbuild location
+    msbuild_location = os.path.join(coreclr_repo_location, "Tools", "msbuild.%s" % ("cmd" if host_os == "Windows_NT" else "sh"))
+
+    # Setup the environment
+    if is_long_gc:
+        print "Running Long GC Tests, extending timeout to 20 minutes."
+        os.environ["__TestTimeout"] = "1200000" # 1,200,000
+        os.environ["RunningLongGCTests"] = "1"
+    
+    if is_gcsimulator:
+        print "Running GCSimulator tests, extending timeout to one hour."
+        os.environ["__TestTimeout"] = "3600000" # 3,600,000
+        os.environ["RunningGCSimulatorTests"] = "1"
+
+    if is_jitdasm:
+        print "Running jit disasm on framework and test assemblies."
+        os.environ["RunningJitDisasm"] = "1"
+
+    if is_ilasm:
+        print "Running ILasm round trip."
+        os.environ["RunningIlasmRoundTrip"] = "1"
+
+    # Set Core_Root
+    os.environ["CORE_ROOT"] = core_root
+
+    # Call msbuild.
+    call_msbuild(coreclr_repo_location,
+                 msbuild_location,
+                 host_os,
+                 arch,
+                 build_type,
+                 sequential=run_sequential)
+
+
+def setup_args(args):
+    """ Setup the args based on the argparser obj
+
+    Args:
+        args(ArgParser): Parsed arguments
+
+    Notes:
+        If there is no core_root, or test location passed, create a default
+        location using the build type and the arch.
+    """
+
+    host_os = None
+    arch = args.arch
+    build_type = args.build_type
+
+    test_location = args.test_location
+    core_root = args.core_root
+    test_native_bin_location = args.test_native_bin_location
+
+    coreclr_repo_location = args.coreclr_repo_location
+    if os.path.basename(coreclr_repo_location) == "tests":
+        coreclr_repo_location = os.path.dirname(coreclr_repo_location)
+   
+    if _platform == "linux" or _platform == "linux2":
+        host_os = "Linux"
+    elif _platform == "darwin":
+        host_os = "OSX"
+    elif _platform == "win32":
+        host_os = "Windows_NT"
+    else:
+        print "Unknown OS: %s" % host_os
+        sys.exit(1)
+
+    assert os.path.isdir(coreclr_repo_location)
+
+    if test_location is None:
+        print "Using default test location."
+        test_location = os.path.join(coreclr_repo_location, "bin", "tests", "%s.%s.%s" % (host_os, arch, build_type))
+        print "TestLocation: %s" % test_location
+        print
+
+    if core_root is None:
+        print "Using default location for core_root."
+        core_root = os.path.join(test_location, "Tests", "Core_Root")
+        print "Core_Root: %s" % core_root
+        print
+
+    if host_os != "Windows_NT":
+        if test_native_bin_location is None:
+            print "Using default location for test_native_bin_location."
+            test_native_bin_location = os.path.join(os.path.join(coreclr_repo_location, "bin", "obj", "%s.%s.%s" % (host_os, arch, build_type), "tests"))
+            print "Native bin location: %s" % test_native_bin_location
+            print
+
+    valid_arches = ["x64", "x86", "arm", "arm64"]
+    if not arch in valid_arches:
+        print "Unsupported architecture: %s." % arch
+        print "Supported architectures: %s" % "[%s]" % ", ".join(valid_arches)
+        sys.exit(1)
+
+    valid_build_types = ["Debug", "Checked", "Release"]
+    if not build_type in valid_build_types:
+        print "Unsupported configuration: %s." % build_type
+        print "Supported configurations: %s" % "[%s]" % ", ".join(valid_build_types)
+        sys.exit(1)
+
+    if not os.path.isdir(test_location):
+        print "Error, test location: %s, does not exist." % test_location
+        sys.exit(1)
+    
+    if not os.path.isdir(core_root):
+        print "Error, core_root: %s, does not exist." % core_root
+        sys.exit(1)
+
+    if host_os != "Windows_NT":
+        if not os.path.isdir(test_native_bin_location):
+            print "Error, test_native_bin_location: %s, does not exist." % test_native_bin_location
+            sys.exit(1)
+
+    return host_os, arch, build_type, coreclr_repo_location, core_root, test_location, test_native_bin_location
+
+def setup_tools(host_os, coreclr_repo_location):
+    """ Setup the tools for the repo
+
+    Args:
+        host_os(str)                : os
+        coreclr_repo_location(str)  : path to coreclr repo
+
+    """
+
+    # Is the tools dir setup
+    setup = False
+    tools_dir = os.path.join(coreclr_repo_location, "Tools")
+
+    is_windows = host_os == "Windows_NT"
+
+    if os.path.isfile(os.path.join(tools_dir, "msbuild.%s" % ("cmd" if is_windows else "sh"))):
+        setup = True
+    
+    # init the tools for the repo
+    if not setup:
+        command = None
+        if is_windows:
+            command = [os.path.join(coreclr_repo_location, "init_tools.cmd")]
+        else:
+            command = ["sh", os.path.join(coreclr_repo_location, "init_tools.sh")]
+
+        print " ".join(command)
+        subprocess.check_output(command)
+    
+        setup = True
+
+    return setup
+
+################################################################################
+# Main
+################################################################################
+
+def main(args):
+    host_os, arch, build_type, coreclr_repo_location, core_root, test_location, test_native_bin_location = setup_args(args)
+
+    # Setup the tools for the repo.
+    setup_tools(host_os, coreclr_repo_location)
+
+    env = get_environment()
+    ret_code = create_and_use_test_env(host_os, 
+                                       env, 
+                                       lambda path: run_tests(host_os, 
+                                                              arch,
+                                                              build_type,
+                                                              core_root, 
+                                                              coreclr_repo_location,
+                                                              test_location, 
+                                                              test_native_bin_location, 
+                                                              test_env=path))
+
+################################################################################
+# __main__
+################################################################################
+
+if __name__ == "__main__":
+    args = parser.parse_args()
+    sys.exit(main(args))
\ No newline at end of file
index b1a1aab..e803a60 100644 (file)
@@ -14,8 +14,8 @@
     <PackageReference Include="Microsoft.DotNet.xunit.performance">
       <Version>1.0.0-alpha-build0040</Version>
     </PackageReference>
-    <PackageReference Include="xunit.console.netcore">
-      <Version>1.0.2-prerelease-00177</Version>
+    <PackageReference Include="xunit.runner.console">
+      <Version>$(XunitPackageVersion)</Version>
     </PackageReference>
     <PackageReference Include="Microsoft.DotNet.BuildTools.TestSuite">
       <Version>1.0.0-prerelease-00629-04</Version>
index 2e7abfe..77629e6 100644 (file)
@@ -1,35 +1,17 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+<Project>
+
+  <Import Project="$([MSBuild]::GetPathOfFileAbove('dir.sdkbuild.props', '$(MSBuildThisFileDirectory)../'))" />
+
+  <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
+
   <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <AssemblyName>CoreclrTestWrapperLib</AssemblyName>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <CLRTestKind>BuildOnly</CLRTestKind>
-    <GenerateRunScript>false</GenerateRunScript>
-    <CLRTestKind>BuildOnly</CLRTestKind>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
-  <!-- Default configurations to help VS understand the configurations -->
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-  </PropertyGroup>
-  <ItemGroup>
-    <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
-      <Visible>False</Visible>
-    </CodeAnalysisDependentAssemblyPaths>
-  </ItemGroup>
+
   <ItemGroup>
     <Compile Include="CoreclrTestWrapperLib.cs" />
   </ItemGroup>
-  <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+
+  <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
+
 </Project>
diff --git a/tests/src/Common/Desktop.Coreclr.TestWrapper/Desktop.Coreclr.TestWrapper.csproj b/tests/src/Common/Desktop.Coreclr.TestWrapper/Desktop.Coreclr.TestWrapper.csproj
deleted file mode 100644 (file)
index b26c893..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-   <!-- dir.common.props was deliberately created so that Desktop and .Net Core can share most of the properties do not change it to dir.props-->
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.common.props))\dir.common.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{5259DD45-EA34-4EE7-B5C5-430B80384544}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <RootNamespace>Coreclr.TestWrapper</RootNamespace>
-    <AssemblyName>Coreclr.TestWrapper</AssemblyName>
-    <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
-    <SkipSigning>true</SkipSigning>
-    <CLRTestKind>BuildOnly</CLRTestKind>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ProjectJson></ProjectJson>
-    <ProjectLockJson></ProjectLockJson>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="mscorlib" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="..\Coreclr.TestWrapper\CoreclrTestWrapperLib.cs" />
-  </ItemGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
index 46d753c..aedcfe0 100644 (file)
@@ -12,8 +12,8 @@
     <NugetRuntimeIdentifier>win7-x64</NugetRuntimeIdentifier>
     <ContainsPackageReferences>true</ContainsPackageReferences>
     <OutputPath>$(TargetingPackPath)</OutputPath>
-    <XUnitRunnerPackageId Condition="'$(TargetGroup)' != 'netfx'">xunit.console.netcore</XUnitRunnerPackageId>
-    <XUnitRunnerPackageId Condition="'$(TargetGroup)' == 'netfx'">xunit.runner.console</XUnitRunnerPackageId>
+    <XUnitRunnerPackageId>xunit.runner.console</XUnitRunnerPackageId>
+    <XUnitRunnerTargetFramework>netcoreapp1.0</XUnitRunnerTargetFramework>
     <CLRTestKind>SharedLibrary</CLRTestKind>
     <IsTestProject>false</IsTestProject>
   </PropertyGroup>
@@ -45,8 +45,8 @@
     <PackageReference Include="xunit">
       <Version>$(XunitPackageVersion)</Version>
     </PackageReference>
-    <PackageReference Include="xunit.console.netcore">
-      <Version>$(XunitConsoleNetcorePackageVersion)</Version>
+    <PackageReference Include="$(XUnitRunnerPackageId)">
+      <Version>$(XunitPackageVersion)</Version>
     </PackageReference>
     <PackageReference Include="xunit.runner.utility">
       <Version>$(XunitPackageVersion)</Version>
@@ -75,7 +75,6 @@
     <PackageToInclude Include="Microsoft.CodeAnalysis.CSharp"/>
     <PackageToInclude Include="Microsoft.CodeAnalysis.VisualBasic"/>
     <PackageToInclude Include="CommandLineParser"/>
-    <PackageToInclude Include="$(XUnitRunnerPackageId)" />
   </ItemGroup>
 
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
     <ProjectAssetsFile>$(SourceDir)Common\external\obj\project.assets.json</ProjectAssetsFile>
   </PropertyGroup>
 
-  <Target Name="AddXunitConsoleRunner" BeforeTargets="ResolveReferences" Condition="'$(TargetGroup)' == 'netfx'">
-    <Error Condition="!Exists('$(PackagesDir)$(XUnitRunnerPackageId)\$(XUnitPackageVersion)\tools\xunit.console.exe')"
-            Text="Error: looks the package $(PackagesDir)$(XUnitRunnerPackageId)\$(XUnitPackageVersion) not restored or missing xunit.console.exe."
+  <Target Name="AddXunitConsoleRunner" BeforeTargets="ResolveReferences">
+    <Error Condition="!Exists('$(PackagesDir)\$(XUnitRunnerPackageId)\$(XUnitPackageVersion)\tools\$(XUnitRunnerTargetFramework)\xunit.console.dll')"
+            Text="Error: looks the package $(PackagesDir)\$(XUnitRunnerPackageId)\$(XUnitPackageVersion) not restored or missing xunit.console.dll."
     />
     <ItemGroup>
       <ReferenceCopyLocalPaths
-        Include="$(PackagesDir)$(XUnitRunnerPackageId)\$(XUnitPackageVersion)\tools\*.*"
-        Exclude="$(PackagesDir)$(XUnitRunnerPackageId)\$(XUnitPackageVersion)\tools\xunit.console.exe.config"
+        Include="$(PackagesDir)\$(XUnitRunnerPackageId)\$(XUnitPackageVersion)\tools\$(XUnitRunnerTargetFramework)\*.*"
+        Exclude="$(PackagesDir)\$(XUnitRunnerPackageId)\$(XUnitPackageVersion)\tools\$(XUnitRunnerTargetFramework)\xunit.console.dll.config"
       >
         <Private>false</Private>
         <NuGetPackageId>$(XUnitRunnerPackageId)</NuGetPackageId>
@@ -99,4 +98,4 @@
       </ReferenceCopyLocalPaths>
     </ItemGroup>
 </Target>
-</Project>
\ No newline at end of file
+</Project>
index 60684f6..1d2bdaf 100644 (file)
@@ -47,13 +47,13 @@ namespace Layout
         }
 
         [Benchmark(InnerIterationCount = 20000000)]
-        public void LoopReturn()
+        public void LoopReturnIter()
         {
             Benchmark.Iterate(() => LoopReturn(test1, test2));
         }
 
         [Benchmark(InnerIterationCount = 20000000)]
-        public void LoopGoto()
+        public void LoopGotoIter()
         {
             Benchmark.Iterate(() => LoopGoto(test1, test2));
         }
index bfa1f43..ed7ec61 100644 (file)
@@ -127,7 +127,7 @@ public static class SeekUnroll
     // Entrypoint for xunit-perf to call the benchmark
     [Benchmark]
     [MemberData(nameof(ArrayedBoxedIndicesToTest))]
-    public static bool Test(object boxedIndex)
+    public static bool TestWithXunit(object boxedIndex)
     {
         return Test((int)boxedIndex, true);
     }
index 563a9a7..881d84f 100644 (file)
@@ -82,8 +82,8 @@
     <PackageReference Include="xunit">
       <Version>$(XunitPackageVersion)</Version>
     </PackageReference>
-    <PackageReference Include="xunit.console.netcore">
-      <Version>$(XunitConsoleNetcorePackageVersion)</Version>
+    <PackageReference Include="xunit.runner.console">
+      <Version>$(XunitPackageVersion)</Version>
     </PackageReference>
     <PackageReference Include="xunit.runner.utility">
       <Version>$(XunitPackageVersion)</Version>
index d554c16..d2789e5 100644 (file)
@@ -79,8 +79,8 @@
     <PackageReference Include="xunit">
       <Version>$(XunitPackageVersion)</Version>
     </PackageReference>
-    <PackageReference Include="xunit.console.netcore">
-      <Version>$(XunitConsoleNetcorePackageVersion)</Version>
+    <PackageReference Include="xunit.runner.console">
+      <Version>$(XunitPackageVersion)</Version>
     </PackageReference>
     <PackageReference Include="xunit.runner.utility">
       <Version>$(XunitPackageVersion)</Version>
index 4d49fde..aecfdec 100644 (file)
@@ -97,8 +97,8 @@
     <PackageReference Include="xunit">
       <Version>$(XunitPackageVersion)</Version>
     </PackageReference>
-    <PackageReference Include="xunit.console.netcore">
-      <Version>$(XunitConsoleNetcorePackageVersion)</Version>
+    <PackageReference Include="xunit.runner.console">
+      <Version>$(XunitPackageVersion)</Version>
     </PackageReference>
     <PackageReference Include="xunit.runner.utility">
       <Version>$(XunitPackageVersion)</Version>
diff --git a/tests/src/TestWrappersConfig/TestWrappersConfig.csproj b/tests/src/TestWrappersConfig/TestWrappersConfig.csproj
deleted file mode 100644 (file)
index 7612842..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <CLRTestKind>BuildOnly</CLRTestKind>
-    <IsTestProject>false</IsTestProject>
-  </PropertyGroup>
-  <ItemGroup>
-    <PackageReference Include="Microsoft.NETCore.Platforms">
-      <Version>$(MicrosoftNETCorePlatformsPackageVersion)</Version>
-    </PackageReference>
-    <PackageReference Include="xunit">
-      <Version>$(XunitPackageVersion)</Version>
-    </PackageReference>
-    <PackageReference Include="xunit.assert">
-      <Version>$(XunitPackageVersion)</Version>
-    </PackageReference>
-    <PackageReference Include="xunit.core">
-      <Version>$(XunitPackageVersion)</Version>
-    </PackageReference>
-    <PackageReference Include="xunit.runner.msbuild">
-      <Version>$(XunitPackageVersion)</Version>
-    </PackageReference>
-  </ItemGroup>
-  <PropertyGroup>
-    <TargetFrameworks>netcoreapp1.1;net45</TargetFrameworks>
-    <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
-    <PackageTargetFallback>$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
-    <RuntimeIdentifiers>$(TargetRid)</RuntimeIdentifiers>
-    <ContainsPackageReferences>true</ContainsPackageReferences>
-    <PrereleaseResolveNuGetPackages>false</PrereleaseResolveNuGetPackages>
-  </PropertyGroup>
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-  <Target Name="Build"
-     DependsOnTargets="ResolveReferences" />
-</Project>
\ No newline at end of file
diff --git a/tests/src/dir.common.props b/tests/src/dir.common.props
deleted file mode 100644 (file)
index dda1755..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\dir.props" />
-
- <!-- Set default Configuration and Platform -->
-  <PropertyGroup>
-    <__BuildArch Condition="'$(__BuildArch)' == ''">x64</__BuildArch>
-    <__BuildType Condition="'$(__BuildType)' == ''">Debug</__BuildType>
-    <__BuildOS Condition="'$(__BuildOS)' == ''">Windows_NT</__BuildOS>
-    <BuildArch>$(__BuildArch)</BuildArch>
-    <BuildType>$(__BuildType)</BuildType>
-    <BuildOS>$(__BuildOS)</BuildOS>
-    <Configuration Condition="'$(Configuration)' ==''">$(BuildType)</Configuration>
-    <Platform Condition="'$(Platform)'==''">$(BuildArch)</Platform>
-  </PropertyGroup>
-  
-  <!-- Setup Default symbol and optimization for Configuration -->
-  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
-    <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
-    <Optimize Condition="'$(Optimize)' == ''">false</Optimize>
-    <DebugType Condition="'$(DebugType)' == ''">full</DebugType>
-    <DefineConstants>$(DefineConstants);DEBUG;TRACE;XUNIT_PERF</DefineConstants>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
-    <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
-    <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
-    <DebugType Condition="'$(DebugType)' == ''">pdbonly</DebugType>
-    <DefineConstants>$(DefineConstants);TRACE;XUNIT_PERF</DefineConstants>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)' == 'Checked'">
-    <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
-    <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
-    <DebugType Condition="'$(DebugType)' == ''">full</DebugType>
-    <DefineConstants>$(DefineConstants);DEBUG;TRACE;XUNIT_PERF</DefineConstants>
-  </PropertyGroup>
-  
-  <!-- Setup target platform pointer size in bit-->
-  <PropertyGroup>
-    <PointerSize Condition="'$(Platform)'=='x64'">64</PointerSize>
-    <PointerSize Condition="'$(Platform)'=='arm64'">64</PointerSize>
-    <PointerSize Condition="'$(Platform)'=='x86'">32</PointerSize>
-    <PointerSize Condition="'$(Platform)'=='arm'">32</PointerSize>
-  </PropertyGroup>
-
-<!-- Setup the default output and intermediate paths -->
-  <PropertyGroup>
-    <OSPlatformConfig>$(BuildOS).$(Platform).$(Configuration)</OSPlatformConfig>
-    <BaseOutputPath>$(ProjectDir)\..\bin\tests</BaseOutputPath>
-    <BaseOutputPath Condition="'$(__TestRootDir)' != ''">$(__TestRootDir)</BaseOutputPath>
-    <BaseOutputPathWithConfig>$(BaseOutputPath)\$(OSPlatformConfig)\</BaseOutputPathWithConfig>
-    <BinDir>$(BaseOutputPathWithConfig)</BinDir>
-    <BaseIntermediateOutputPath>$(ProjectDir)\..\bin\tests\obj\$(OSPlatformConfig)\Managed\</BaseIntermediateOutputPath>
-    <BaseIntermediateOutputPath Condition="'$(__ManagedTestIntermediatesDir)' != ''">$(__ManagedTestIntermediatesDir)\</BaseIntermediateOutputPath>
-    <__NativeTestIntermediatesDir Condition="'$(__NativeTestIntermediatesDir)' == ''">$([System.IO.Path]::GetFullPath($(BaseOutputPathWithConfig)..\obj\$(BuildOS).$(Platform).$(Configuration)\Native\))</__NativeTestIntermediatesDir>
-    <BuildProjectRelativeDir>$(MSBuildProjectName)\</BuildProjectRelativeDir>
-    <BuildProjectRelativeDir Condition="'$(MSBuildProjectDirectory.Contains($(SourceDir)))'">$([System.String]::Copy('$(MSBuildProjectDirectory)').Replace($(SourceDir),''))\$(MSBuildProjectName)</BuildProjectRelativeDir>
-    <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(BuildProjectRelativeDir)\</IntermediateOutputPath>
-    <OutputPath>$(BaseOutputPathWithConfig)$(BuildProjectRelativeDir)\</OutputPath>
-    <TestWorkingDir Condition="'$(TestWorkingDir)'==''">$(BaseOutputPath)\testStagingDir\</TestWorkingDir>
-    <TestPath Condition="'$(TestPath)'==''">$(TestWorkingDir)$(OSPlatformConfig)\$(MSBuildProjectName)/</TestPath>
-  </PropertyGroup>
-
-</Project>
-
index 925e3fa..f3f229d 100644 (file)
@@ -1,5 +1,52 @@
 <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="dir.common.props" />
+  <Import Project="..\dir.props" />
+
+  <Import Project="..\dir.common.props" />
+
+  <!-- Setup Default symbol and optimization for Configuration -->
+  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
+    <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
+    <Optimize Condition="'$(Optimize)' == ''">false</Optimize>
+    <DebugType Condition="'$(DebugType)' == ''">full</DebugType>
+    <DefineConstants>$(DefineConstants);DEBUG;TRACE;XUNIT_PERF</DefineConstants>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
+    <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
+    <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
+    <DebugType Condition="'$(DebugType)' == ''">pdbonly</DebugType>
+    <DefineConstants>$(DefineConstants);TRACE;XUNIT_PERF</DefineConstants>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)' == 'Checked'">
+    <DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
+    <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
+    <DebugType Condition="'$(DebugType)' == ''">full</DebugType>
+    <DefineConstants>$(DefineConstants);DEBUG;TRACE;XUNIT_PERF</DefineConstants>
+  </PropertyGroup>
+
+  <!-- Setup target platform pointer size in bit-->
+  <PropertyGroup>
+    <PointerSize Condition="'$(Platform)'=='x64'">64</PointerSize>
+    <PointerSize Condition="'$(Platform)'=='arm64'">64</PointerSize>
+    <PointerSize Condition="'$(Platform)'=='x86'">32</PointerSize>
+    <PointerSize Condition="'$(Platform)'=='arm'">32</PointerSize>
+  </PropertyGroup>
+
+<!-- Setup the default output and intermediate paths -->
+  <PropertyGroup>
+    <BaseOutputPath>$(ProjectDir)\..\bin\tests</BaseOutputPath>
+    <BaseOutputPath Condition="'$(__TestRootDir)' != ''">$(__TestRootDir)</BaseOutputPath>
+    <BaseOutputPathWithConfig>$(BaseOutputPath)\$(OSPlatformConfig)\</BaseOutputPathWithConfig>
+    <BinDir>$(BaseOutputPathWithConfig)</BinDir>
+    <BaseIntermediateOutputPath>$(ProjectDir)\..\bin\tests\obj\$(OSPlatformConfig)\Managed\</BaseIntermediateOutputPath>
+    <BaseIntermediateOutputPath Condition="'$(__ManagedTestIntermediatesDir)' != ''">$(__ManagedTestIntermediatesDir)\</BaseIntermediateOutputPath>
+    <__NativeTestIntermediatesDir Condition="'$(__NativeTestIntermediatesDir)' == ''">$([System.IO.Path]::GetFullPath($(BaseOutputPathWithConfig)..\obj\$(BuildOS).$(Platform).$(Configuration)\Native\))</__NativeTestIntermediatesDir>
+    <BuildProjectRelativeDir>$(MSBuildProjectName)\</BuildProjectRelativeDir>
+    <BuildProjectRelativeDir Condition="'$(MSBuildProjectDirectory.Contains($(SourceDir)))'">$([System.String]::Copy('$(MSBuildProjectDirectory)').Replace($(SourceDir),''))\$(MSBuildProjectName)</BuildProjectRelativeDir>
+    <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(BuildProjectRelativeDir)\</IntermediateOutputPath>
+    <OutputPath>$(BaseOutputPathWithConfig)$(BuildProjectRelativeDir)\</OutputPath>
+    <TestWorkingDir Condition="'$(TestWorkingDir)'==''">$(BaseOutputPath)\testStagingDir\</TestWorkingDir>
+    <TestPath Condition="'$(TestPath)'==''">$(TestWorkingDir)$(OSPlatformConfig)\$(MSBuildProjectName)/</TestPath>
+  </PropertyGroup>
 
   <!-- Disable some standard properties for building our projects -->
   <PropertyGroup>
@@ -11,8 +58,6 @@
     <NoWarn>78,162,164,168,169,219,251,252,414,429,642,649,652,675,1691,1717,1718,3001,3002,3003,3005,3008</NoWarn>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <SkipSigning Condition="'$(CrossGen)' == 'true'">true</SkipSigning>
-    <!-- Set the project.json directory for generated TestWrappers. -->
-    <TestWrappersPackagesConfigFileDirectory>$(MSBuildThisFileDirectory)TestWrappersConfig\</TestWrappersPackagesConfigFileDirectory>
     <AssemblyKey>Test</AssemblyKey>
   </PropertyGroup>
 
index 58c3559..785a058 100644 (file)
@@ -16,8 +16,7 @@
     <ItemGroup>
       <DisabledProjects Include="TestWrappers*\**\*.csproj" />
       <DisabledProjects Include="*\**\cs_template.csproj" />
-      <DisabledProjects Include="Common\Coreclr.TestWrapper\Coreclr.TestWrapper.csproj" Condition="('$(BuildTestsAgainstPackages)' != 'true') And ('$(BuildOS)' == 'Windows_NT')" />
-      <DisabledProjects Include="Common\Desktop.Coreclr.TestWrapper\Desktop.Coreclr.TestWrapper.csproj" Condition="('$(BuildTestsAgainstPackages)' == 'true') Or ('$(BuildOS)' != 'Windows_NT')" />
+      <DisabledProjects Include="Common\Coreclr.TestWrapper\Coreclr.TestWrapper.csproj" />
       <DisabledProjects Include="Common\test_runtime\test_runtime.csproj" />
       <DisabledProjects Include="Common\test_dependencies\test_dependencies.csproj" />
       <DisabledProjects Include="Common\CoreFX\TestFileSetup\CoreFX.TestUtils.TestFileSetup.csproj" />      
index 94caf35..c6c0b5c 100644 (file)
@@ -94,8 +94,8 @@
     <PackageReference Include="xunit">
       <Version>$(XunitPackageVersion)</Version>
     </PackageReference>
-    <PackageReference Include="xunit.console.netcore">
-      <Version>$(XunitConsoleNetcorePackageVersion)</Version>
+    <PackageReference Include="xunit.runner.console">
+      <Version>$(XunitPackageVersion)</Version>
     </PackageReference>
     <PackageReference Include="xunit.runner.utility">
       <Version>$(XunitPackageVersion)</Version>
index 8f00fd7..9a16cb0 100644 (file)
@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
-  <UsingTask AssemblyFile="$(PackagesDir)xunit.runner.msbuild\$(XunitPackageVersion)\build\portable-net45+win8+wp8+wpa81\xunit.runner.msbuild.dll" TaskName="Xunit.Runner.MSBuild.xunit" />
-  
   <ItemGroup>
     <_SkipTestAssemblies Include="$(SkipTestAssemblies)" />
   </ItemGroup>
     <Message Text= "_SkipTestAssemblies= @(_SkipTestAssemblies -> '$(TestAssemblyDir)%(Identity)\%(Identity).XUnitWrapper.dll')"/>
   </Target>
 
-  <UsingTask
-    AssemblyFile="$(SourceDir)\packages\xunit.runner.msbuild\$(XunitPackageVersion)\build\portable-net45+win8+wp8+wpa81\xunit.runner.msbuild.dll"
-    TaskName="Xunit.Runner.MSBuild.xunit" />
-
    <Target Name="RunTests"
           DependsOnTargets="FindTestDirectories"
           Condition="'$(SkipTests)' != 'True'">
 
     <PropertyGroup>
       <ExcludeTraits Condition="'$(ExcludeTraits)'==''">category=outerloop;category=failing</ExcludeTraits>
-      <ParallelRun Condition="'$(ParallelRun)'==''">true</ParallelRun>
+      <ParallelRun Condition="'$(ParallelRun)'==''">all</ParallelRun>
     </PropertyGroup>
     <ItemGroup>
       <IncludeTraitsItems Include="$(IncludeTraits)" />
       <ExcludeTraitsItems Include="$(ExcludeTraits)" />
     </ItemGroup>
 
-    <xunit Assemblies="@(TestAssemblies)"
-      ParallelizeAssemblies="$(ParallelRun)"
-      ParallelizeTestCollections="$(ParallelRun)"
-      Html="$(__TestRunHtmlLog)"
-      Xml="$(__TestRunXmlLog)"
-      IncludeTraits="@(IncludeTraitsItems)"
-      ExcludeTraits="@(ExcludeTraitsItems)" /> 
+    <Error Condition="'$(CORE_ROOT)' == ''" Text="CORE_ROOT is not set." />
+    <PropertyGroup>
+      <XunitConsoleRunner>$(CORE_ROOT)\xunit.console.dll</XunitConsoleRunner>
+
+      <XunitArgs>-parallel $(ParallelRun)</XunitArgs>
+      <XunitArgs>$(XunitArgs) -html $(__TestRunHtmlLog)</XunitArgs>
+      <XunitArgs>$(XunitArgs) -xml $(__TestRunXmlLog)</XunitArgs>
+      <XunitArgs>$(XunitArgs) @(IncludeTraitsItems->'-trait %(Identity)', ' ')</XunitArgs>
+      <XunitArgs>$(XunitArgs) @(ExcludeTraitsItems->'-notrait %(Identity)', ' ')</XunitArgs>
+
+      <CorerunExecutable Condition="'$(RunningOnUnix)' == 'true'">$(CORE_ROOT)\corerun</CorerunExecutable>
+      <CorerunExecutable Condition="'$(RunningOnUnix)' != 'true'">$(CORE_ROOT)\corerun.exe</CorerunExecutable>
+      <XunitCommandLine>$(CorerunExecutable) $(XunitConsoleRunner) @(TestAssemblies->'%(Identity)', ' ') $(XunitArgs)</XunitCommandLine>
+    </PropertyGroup>
+    <Exec Command="$(XunitCommandLine)" />
 
   </Target>
 
diff --git a/tests/xunitwrapper.targets b/tests/xunitwrapper.targets
deleted file mode 100644 (file)
index a0ff7f5..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This overrides the typical ResolveNuGetPackages so that it does copy local of the
-     referenced items.  This is used so that we can correctly resolve and copy the libraries necessary
-     to the core_root directory -->
-
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Target Name="ResolveNuGetPackages">
-    <PrereleaseResolveNuGetPackageAssets Condition="Exists($(ProjectAssetsFile))"
-                                         AllowFallbackOnTargetSelection="true"
-                                         IncludeFrameworkReferences="false"
-                                         NuGetPackagesDirectory="$(PackagesDir)"
-                                         RuntimeIdentifier="$(TestNugetRuntimeId)"
-                                         ProjectLanguage="$(Language)"
-                                         ProjectLockFile="$(ProjectAssetsFile)"
-                                         TargetMonikers="$(TargetFrameworkMoniker)">
-      <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" />
-      <Output TaskParameter="ResolvedReferences" ItemName="Reference" />
-      <Output TaskParameter="ResolvedCopyLocalItems" ItemName="CopyLocal" />
-    </PrereleaseResolveNuGetPackageAssets>
-
-    <!-- We may have an indirect package reference that we want to replace with a project reference -->
-    <ItemGroup>
-      <!-- Convert to file names so that we can intersect -->
-      <_ProjectReferenceFilenames Include="@(_ResolvedProjectReferencePaths->'%(FileName)%(Extension)')">
-        <OriginalIdentity>%(Identity)</OriginalIdentity>
-      </_ProjectReferenceFilenames>
-
-      <_ReferencesFileNames Include="@(Reference->'%(FileName)%(Extension)')">
-        <OriginalIdentity>%(Identity)</OriginalIdentity>
-      </_ReferencesFileNames>
-
-      <_CopyLocalFileNames Include="@(CopyLocal->'%(FileName)%(Extension)')">
-        <OriginalIdentity>%(Identity)</OriginalIdentity>
-      </_CopyLocalFileNames>
-      
-      <!-- Intersect project-refs with package-refs -->
-      <_ReferenceFileNamesToRemove Include="@(_ReferencesFileNames->'%(OriginalIdentity)')" Condition="'@(_ProjectReferenceFilenames)' == '@(_ReferencesFileNames)' and '%(Identity)' != ''"/>
-      <_CopyLocalFileNamesToRemove Include="@(_CopyLocalFileNames->'%(OriginalIdentity)')" Condition="'@(_ProjectReferenceFilenames)' == '@(_CopyLocalFileNames)' and '%(Identity)' != ''"/>
-
-      <Reference Remove="@(_ReferenceFileNamesToRemove)" />
-      <CopyLocal Remove="@(_CopyLocalFileNamesToRemove)"/>
-    </ItemGroup>
-    
-    <Message Text="Excluding @(_ReferenceFileNamesToRemove);@(_CopyLocalFileNamesToRemove) from package references since the same file is provided by a project reference."
-             Condition="'@(_ReferenceFileNamesToRemove)' != '' or '@(_CopyLocalFileNamesToRemove)' != ''"/>
-             
-    <Copy
-      SourceFiles="@(CopyLocal)"
-      DestinationFolder="$(OutDir)"
-      SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
-      OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
-      Retries="$(CopyRetryCount)"
-      RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
-      UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
-      
-      <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
-    </Copy>
-    
-  </Target>
-</Project>