Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 3fe2153

Browse files
author
jashook
committed
Use runtest.py to run tests for all platforms
Change build-test.sh to always build the xunit wrappers. Before it would drop a token and check the existence of the token. Unify x64 linux/OSX/Windows excludes into one file, issues.targets. I have added different locations in the file which show where to put excludes. Remove all target specific aspects of issues.targets, all tests are excluded now via wildcard, this allows expanding to .cmd and .sh based on the build platform Unify path separators to forward slash(/) in issues.targets to support both platforms Clean up issues.targets by removing long standing exclude tests, specifically tests that have been excluded due to missing features like rva_statics Add DisableProjectBuild to tests which have been removed from issues.targets Conditionally add DisableProjectBuild to tests which have been marked as unsupported on unix. This is mostly a port of the unsupportedOnUnix.txt list. Instead of excluding the tests, unix will simply not build them. Note that this refcount dependency on running tests on the same platform as where they were built All exclusions ported to issues.targets for linux targets. Expand runtest.py, this includes simple issues that made it past the original CR. In addition it adds more optional features to help with inner loop dev work such as: creating a repro folder under bin/repro/.. which sets up the env and calls the failing test. In addition a launch.json will now be created under bin/repro/.. which can be used to easily debug using vscode. More logging, such as printing failures, longest running tests ect. Initial excludes ported for arm64 windows Arm64 linux, armhf unix excludes and enables running runtest.sh for these targets. arm64 windows and arm32 windows excludes and enables running runtest.cmd on arm64 targets init-tools.sh changes to pull armhf and aarch64 dotnetcli init-tools.cmd changes to pull x86 packages for dotnetcli for arm64 windows runtest.cmd for almost all scenarios will call runtest.py runtest.sh for almsot all scenarios will call runtest.py Removes all logic for running tests using runtest.sh
1 parent ff9b943 commit 3fe2153

File tree

310 files changed

+5455
-1950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+5455
-1950
lines changed

Documentation/building/test-configuration.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,17 @@ Test cases are categorized by priority level. The most important subset should b
3939
```
4040
* Disable building of a test by conditionally setting the `<DisableProjectBuild>` property.
4141
* e.g. `<DisableProjectBuild Condition=" '$(Platform)' == 'arm64' ">true</DisableProjectBuild>`
42+
* Exclude test from GCStress runs by adding the following to the csproj:
43+
* `<GCStressIncompatible>true</GCStressIncompatible>`
44+
* Exclude test from JIT stress runs runs by adding the following to the csproj:
45+
* `<JitOptimizationSensitive>true</JitOptimizationSensitive>`
4246
* Add NuGet/MyGet references by updating the following [test project](https://github.com/dotnet/coreclr/blob/master/tests/src/Common/test_dependencies/test_dependencies.csproj).
4347
* Build against the `mscorlib` facade by adding `<ReferenceLocalMscorlib>true</ReferenceLocalMscorlib>` to the test project.
4448
* Update relevent exclusion lists:
45-
* Note that there are two build pipelines Jenkin's CI and nightly Helix - both must be updated for expected exclusion.
46-
* Jenkin's CI build - see the associated `*.txt` files under `tests/` (e.g. `tests/testsUnsupportedOutsideWindows.txt`).
47-
* Official nightly Helix build - see the `tests/issues.targets` file.
48-
* ARM/ARM64
49-
* `tests/arm/Tests.lst` and `tests/arm64/Tests.lst` are used to define the tests to run due to limitations with XUnit.
50-
* These files can be manually edited or the generated using `tests/scripts/lst_creator.py`.
49+
There are currently three different exclude lists. Tests.lst is currently only used by CI.
50+
- `tests/issues.targets`
51+
- `tests/arm/Tests.lst` - Used by Windows arm32 testing
52+
- `tests/arm64/Tests.lst` - Used by Windows arm64 testing
5153
5254
### Creating a C# test project
5355

Documentation/building/unix-test-instructions.md

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -81,50 +81,15 @@ sudo apt-get install libunwind8:armhf libunwind8-dev:armhf libicu-dev:armhf libl
8181
The following instructions assume that on the Unix machine:
8282
- The CoreCLR repo is cloned at `/mnt/coreclr`
8383
84-
If DotNet is unsupported
85-
- The CoreFX repo is cloned at `/mnt/corefx`
86-
- The other platform's clone of the CoreCLR repo is mounted at `/media/coreclr`
87-
88-
The following steps are different if DotNet is supported or not on your arch and os.
89-
90-
### DotNet is supported
91-
92-
build-test.sh will have setup the Core_Root directory correctly after the test build. If this was either skipped or needs to be regenerated use:
93-
94-
>`build-test.sh generatelayoutonly`
95-
96-
To run the tests run with the --coreOverlayDir path
84+
build-test.sh will have setup the Core_Root directory correctly after the test build.
9785
9886
```bash
99-
~/coreclr$ tests/runtest.sh
100-
--testRootDir=/mnt/coreclr/bin/tests/Linux.x64.Debug
101-
--testNativeBinDir=/mnt/coreclr/bin/obj/Linux.x64.Debug/tests
102-
--coreOverlayDir=/mnt/coreclr/bin/tests/Linux.x64.Debug/Tests/Core_Root
103-
--copyNativeTestBin
87+
~/coreclr$ tests/runtest.sh x64 checked
10488
```
10589

106-
### DotNet is not supported
107-
108-
Tests need to be built on another platform and copied over to the Unix machine for testing. Copy the test build over to the Unix machine:
109-
110-
> `cp --recursive /media/coreclr/bin/tests/Windows_NT.x64.Debug /mnt/test/`
111-
112-
See `runtest.sh` usage information:
113-
114-
> `/mnt/coreclr$ tests/runtest.sh --help`
115-
116-
Run tests (`Debug` may be replaced with `Release` or `Checked`, depending on which Configuration you've built):
90+
Please use the following command for help.
11791

118-
```bash
119-
/mnt/coreclr$ tests/runtest.sh
120-
--testRootDir=/mnt/test/Windows_NT.x64.Debug
121-
--testNativeBinDir=/mnt/coreclr/bin/obj/Linux.x64.Debug/tests
122-
--coreClrBinDir=/mnt/coreclr/bin/Product/Linux.x64.Debug
123-
--mscorlibDir=/mnt/coreclr/bin/Product/Linux.x64.Debug
124-
--coreFxBinDir=/mnt/corefx/bin/runtime/netcoreapp-Linux-Debug-x64
125-
```
126-
127-
The method above will copy dependencies from the set of directories provided to create an 'overlay' directory.
92+
>./tests/runtest.sh -h
12893
12994
### Results
13095

@@ -134,13 +99,21 @@ Test results will go into:
13499
135100
### Unsupported and temporarily disabled tests
136101

137-
These tests are skipped by default:
138-
- Tests that are not supported outside Windows, are listed in:
139-
> `~/coreclr/tests/testsUnsupportedOutsideWindows.txt`
140-
- Tests that are temporarily disabled outside Windows due to unexpected failures (pending investigation), are listed in:
141-
> `~/coreclr/tests/testsFailingOutsideWindows.txt`
102+
Unsupported tests outside of Windows have two annotations in their csproj to
103+
ignore them when run.
104+
105+
```
106+
<TestUnsupportedOutsideWindows>true</TestUnsupportedOutsideWindows>
107+
```
108+
109+
This will write in the bash target to skip the test by returning a passing value if run outside Windows.
110+
111+
In addition:
112+
```
113+
<DisableProjectBuild Condition="'$(TargetsUnix)' == 'true'">true</DisableProjectBuild>
114+
```
142115

143-
To run only the set of temporarily disabled tests, pass in the `--runFailingTestsOnly` argument to `runtest.sh`.
116+
Is used to disable the build, that way if building on unix cycles are saved building/running.
144117

145118
PAL tests
146119
---------

Documentation/building/windows-test-instructions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ This will use `crossgen.exe` to precompile the test executables before they are
2121

2222
## Building Other Priority Tests
2323

24-
C:\git\coreclr>build-test.cmd -priority=2
24+
C:\git\coreclr>build-test.cmd -priority=1
2525

26-
The number '2' is just an example. The default value (if no priority is specified) is 0. To clarify, if '2' is specified, all tests with CLRTestPriorty 0, 1 **and** 2 will be built and consequently run.
26+
The number '1' is just an example. The default value (if no priority is specified) is 0. To clarify, if '1' is specified, all tests with CLRTestPriorty 0 **and** 1 will be built and consequently run.
2727

2828
## Examples
2929

@@ -35,7 +35,7 @@ To run a clean, priority 1, crossgen test pass:
3535

3636
### Building Individual Tests
3737

38-
Note: buildtest.cmd or build.cmd skipnative skipmscorlib needs to be run atleast once
38+
Note: build-test.cmd or build.cmd skipnative needs to be run atleast once
3939

4040
* Native Test: Build the generated Visual Studio solution or make file corresponding to Test cmake file.
4141

@@ -47,7 +47,7 @@ Note: buildtest.cmd or build.cmd skipnative skipmscorlib needs to be run atleast
4747

4848
For example to run all of the tests using your checked build:
4949

50-
<repo_root>\tests\runtest.cmd -checked
50+
<repo_root>\tests\runtest.cmd checked
5151

5252
This will generate a report named as `TestRun_<arch>_<flavor>.html` (e.g. `TestRun_Windows_NT__x64__Checked.html`) in the subdirectory `<repo_root>\bin\Logs`. Any tests that failed will be listed in `TestRunResults_Windows_NT__x64__Checked.err`.
5353

build-test.sh

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -289,22 +289,18 @@ build_Tests()
289289
if [ $__BuildTestWrappers -ne -0 ]; then
290290
echo "${__MsgPrefix}Creating test wrappers..."
291291

292-
__XUnitWrapperBuiltMarker=${__TestBinDir}/xunit_wrapper_build
292+
# Always create the test wrappers and set the exclude file.
293+
export __Exclude="$__TestDir/issues.targets"
294+
echo "Exclude set to $__TestDir/issues.targets"
295+
build_Tests_internal "Tests_XunitWrapper" "$__ProjectDir/tests/runtest.proj" "Test Xunit Wrapper" "-BuildWrappers" "-MsBuildEventLogging= " "-TargetsWindows=false"
293296

294-
if [ ! -f $__XUnitWrapperBuiltMarker ]; then
295-
296-
build_MSBuild_projects "Tests_XunitWrapper" "$__ProjectDir/tests/runtest.proj" "Test Xunit Wrapper" "-BuildWrappers" "-MsBuildEventLogging= " "-TargetsWindows=false"
297-
298-
if [ $? -ne 0 ]; then
299-
echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
300-
exit 1
301-
else
302-
echo "XUnit Wrappers have been built."
303-
echo "Create marker \"${__XUnitWrapperBuiltMarker}\""
304-
touch $__XUnitWrapperBuiltMarker
305-
fi
297+
if [ $? -ne 0 ]; then
298+
echo "${__MsgPrefix}Error: build failed. Refer to the build log files for details (above)"
299+
exit 1
306300
else
307-
echo "XUnit Wrappers had been built before."
301+
echo "XUnit Wrappers have been built."
302+
echo "Create marker \"${__XUnitWrapperBuiltMarker}\""
303+
touch $__XUnitWrapperBuiltMarker
308304
fi
309305
fi
310306

init-tools.cmd

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,33 @@ echo Running %0 > "%INIT_TOOLS_LOG%"
4747
set /p DOTNET_VERSION=< "%~dp0DotnetCLIVersion.txt"
4848
if exist "%DOTNET_CMD%" goto :afterdotnetrestore
4949

50+
REM Use x86 tools on arm64 and x86.
51+
REM arm32 host is not currently supported, please crossbuild.
52+
if /i "%PROCESSOR_ARCHITECTURE%" == "arm" (
53+
echo "Error, arm32 arch not supported for build tools."
54+
exit /b 1
55+
)
56+
57+
if /i "%PROCESSOR_ARCHITECTURE%" == "amd64" (
58+
set _Arch="x64"
59+
goto ArchSet
60+
)
61+
62+
REM If this is not amd64 and not arm, then we should be running on arm64 or x86
63+
REM either way we can (and should) use the x86 dotnet cli
64+
REM
65+
REM TODO: consume native arm64 toolset, blocked by official arm64 windows cli
66+
REM : release. See https://github.com/dotnet/coreclr/issues/19614 for more
67+
REM : information
68+
set _Arch="x86"
69+
70+
echo "init-tools.cmd: Setting arch to %_Arch% for build tools"
71+
72+
:ArchSet
73+
5074
echo Installing dotnet cli...
5175
if NOT exist "%DOTNET_PATH%" mkdir "%DOTNET_PATH%"
52-
set DOTNET_ZIP_NAME=dotnet-sdk-%DOTNET_VERSION%-win-x64.zip
76+
set DOTNET_ZIP_NAME=dotnet-sdk-%DOTNET_VERSION%-win-%_Arch%.zip
5377
set DOTNET_REMOTE_PATH=https://dotnetcli.azureedge.net/dotnet/Sdk/%DOTNET_VERSION%/%DOTNET_ZIP_NAME%
5478
set DOTNET_LOCAL_PATH=%DOTNET_PATH%%DOTNET_ZIP_NAME%
5579
echo Installing '%DOTNET_REMOTE_PATH%' to '%DOTNET_LOCAL_PATH%' >> "%INIT_TOOLS_LOG%"

init-tools.sh

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,17 @@ if [ ! -e "$__DOTNET_PATH" ]; then
7171
echo "Warning: build not supported on 32 bit Unix"
7272
fi
7373

74-
__PKG_ARCH=x64
74+
if [ "$(uname -m)" = "armhf" ] || [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then
75+
if [ "$(uname -m)" = "armhf" ]; then
76+
__PKG_ARCH=arm
77+
fi
78+
79+
if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "aarch64" ]; then
80+
__PKG_ARCH=arm64
81+
fi
82+
else
83+
__PKG_ARCH=x64
84+
fi
7585

7686
OSName=$(uname -s)
7787
case $OSName in
@@ -171,26 +181,30 @@ if [ -n "${DotNetBootstrapCliTarPath-}" ]; then
171181
unset ILASMCOMPILER_VERSION
172182
fi
173183

174-
echo "Initializing BuildTools..."
175-
echo "Running: $__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR $__PACKAGES_DIR" >> "$__init_tools_log"
176-
177-
# Executables restored with .NET Core 2.0 do not have executable permission flags. https://github.com/NuGet/Home/issues/4424
178-
chmod +x "$__BUILD_TOOLS_PATH/init-tools.sh"
179-
"$__BUILD_TOOLS_PATH/init-tools.sh" "$__scriptpath" "$__DOTNET_CMD" "$__TOOLRUNTIME_DIR" "$__PACKAGES_DIR" >> "$__init_tools_log"
180-
if [ "$?" != "0" ]; then
181-
echo "ERROR: An error occurred when trying to initialize the tools." 1>&2
182-
display_error_message
183-
exit 1
184-
fi
185-
186-
echo "Making all .sh files executable under Tools."
187-
# Executables restored with .NET Core 2.0 do not have executable permission flags. https://github.com/NuGet/Home/issues/4424
188-
ls "$__scriptpath/Tools/"*.sh | xargs chmod +x
189-
ls "$__scriptpath/Tools/scripts/docker/"*.sh | xargs chmod +x
184+
# Build tools only supported on x64
185+
if [ "${__PKG_ARCH}" != "x64" ] && [ "${__PKG_ARCH}" != "arm" ]; then
186+
echo "Skipped installing build tools."
187+
else
188+
echo "Initializing BuildTools..."
189+
echo "Running: $__BUILD_TOOLS_PATH/init-tools.sh $__scriptpath $__DOTNET_CMD $__TOOLRUNTIME_DIR $__PACKAGES_DIR" >> "$__init_tools_log"
190+
191+
# Executables restored with .NET Core 2.0 do not have executable permission flags. https://github.com/NuGet/Home/issues/4424
192+
chmod +x "$__BUILD_TOOLS_PATH/init-tools.sh"
193+
"$__BUILD_TOOLS_PATH/init-tools.sh" "$__scriptpath" "$__DOTNET_CMD" "$__TOOLRUNTIME_DIR" "$__PACKAGES_DIR" >> "$__init_tools_log"
194+
if [ "$?" != "0" ]; then
195+
echo "ERROR: An error occurred when trying to initialize the tools." 1>&2
196+
display_error_message
197+
exit 1
198+
fi
190199

191-
"$__scriptpath/Tools/crossgen.sh" "$__scriptpath/Tools" $__PKG_RID
200+
echo "Making all .sh files executable under Tools."
201+
# Executables restored with .NET Core 2.0 do not have executable permission flags. https://github.com/NuGet/Home/issues/4424
202+
ls "$__scriptpath/Tools/"*.sh | xargs chmod +x
203+
ls "$__scriptpath/Tools/scripts/docker/"*.sh | xargs chmod +x
192204

193-
mkdir -p "$(dirname "$__BUILD_TOOLS_SEMAPHORE")" && touch "$__BUILD_TOOLS_SEMAPHORE"
205+
"$__scriptpath/Tools/crossgen.sh" "$__scriptpath/Tools" $__PKG_RID
194206

195-
echo "Done initializing tools."
207+
mkdir -p "$(dirname "$__BUILD_TOOLS_SEMAPHORE")" && touch "$__BUILD_TOOLS_SEMAPHORE"
196208

209+
echo "Done initializing tools."
210+
fi

tests/arm/Tests.lst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53204,14 +53204,6 @@ MaxAllowedDurationSeconds=600
5320453204
Categories=EXPECTED_PASS;Pri1
5320553205
HostStyle=0
5320653206

53207-
[b12011.cmd_6691]
53208-
RelativePath=JIT\Regression\VS-ia64-JIT\V1.2-M02\b12011\b12011\b12011.cmd
53209-
WorkingDir=JIT\Regression\VS-ia64-JIT\V1.2-M02\b12011\b12011
53210-
Expected=0
53211-
MaxAllowedDurationSeconds=600
53212-
Categories=EXPECTED_PASS
53213-
HostStyle=0
53214-
5321553207
[FlowControlNext.cmd_6692]
5321653208
RelativePath=CoreMangLib\cti\system\reflection\emit\flowcontrol\FlowControlNext\FlowControlNext.cmd
5321753209
WorkingDir=CoreMangLib\cti\system\reflection\emit\flowcontrol\FlowControlNext

tests/arm64/Tests.lst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70244,14 +70244,6 @@ MaxAllowedDurationSeconds=600
7024470244
Categories=JIT;EXPECTED_PASS
7024570245
HostStyle=0
7024670246

70247-
[b12011.cmd_9160]
70248-
RelativePath=JIT\Regression\VS-ia64-JIT\V1.2-M02\b12011\b12011\b12011.cmd
70249-
WorkingDir=JIT\Regression\VS-ia64-JIT\V1.2-M02\b12011\b12011
70250-
Expected=0
70251-
MaxAllowedDurationSeconds=600
70252-
Categories=EXPECTED_PASS
70253-
HostStyle=0
70254-
7025570247
[b14355.cmd_9161]
7025670248
RelativePath=JIT\Regression\VS-ia64-JIT\V1.2-M02\b14355\b14355\b14355.cmd
7025770249
WorkingDir=JIT\Regression\VS-ia64-JIT\V1.2-M02\b14355\b14355

0 commit comments

Comments
 (0)