Skip to content

Commit b3ec57a

Browse files
committed
Merge branch 'main' into add_logging_to_http3_test
2 parents 594d3a5 + 99dd60d commit b3ec57a

File tree

862 files changed

+31506
-16495
lines changed

Some content is hidden

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

862 files changed

+31506
-16495
lines changed

.config/dotnet-tools.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
]
1616
},
1717
"microsoft.dotnet.xharness.cli": {
18-
"version": "9.0.0-prerelease.24208.1",
18+
"version": "9.0.0-prerelease.24224.1",
1919
"commands": [
2020
"xharness"
2121
]

.github/dependabot.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 5
8+
labels:
9+
- area-codeflow

.github/workflows/bump-chrome-version.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: >-
2828
make -C src/mono/wasm build-tasks &&
2929
PATH=$PWD/.dotnet:$PATH dotnet build eng/testing/bump-chrome-version.proj -p:Configuration=Release &&
30-
git add eng/testing/ChromeVersions.props &&
30+
git add eng/testing/BrowserVersions.props &&
3131
cat eng/testing/bump-chrome-pr.env >> "$GITHUB_ENV"
3232
3333
- name: Check for changes

.github/workflows/locker.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ permissions:
2020
jobs:
2121
main:
2222
runs-on: ubuntu-latest
23+
if: ${{ github.repository_owner == 'dotnet' }}
2324
steps:
2425
- name: Checkout Actions
2526
uses: actions/checkout@v4
2627
with:
2728
repository: "microsoft/vscode-github-triage-actions"
2829
path: ./actions
29-
ref: cd16cd2aad6ba2da74bb6c6f7293adddd579a90e
30+
ref: 066bee9cefa6f0b4bf306040ff36fc7d96a6d56d # locker action commit sha
3031
- name: Install Actions
3132
run: npm install --production --prefix ./actions
3233
- name: Run Locker

Directory.Build.props

+15-11
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,22 @@
5656
- eng/native/configurecompiler.cmake
5757
- eng/native/build-commons.sh
5858
- src/native/libs/build-native.sh
59-
- src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs
59+
- src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ObjectWriter/MachObjectWriter.cs
6060
- src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
61+
- src/mono/mono/tools/offsets-tool/offsets-tool.py
62+
- src/mono/msbuild/apple/build/AppleBuild.targets
6163
- src/installer/pkg/sfx/bundle/shared-framework-distribution-template-x64.xml
6264
- src/installer/pkg/sfx/bundle/shared-framework-distribution-template-arm64.xml
65+
- src/tasks/AotCompilerTask/MonoAOTCompiler.props
66+
- src/tasks/AppleAppBuilder/Xcode.cs
6367
- src/tasks/MobileBuildTasks/Apple/AppleProject.cs
6468
- dotnet/installer repo > src/redist/targets/GeneratePKG.targets
6569
-->
6670
<AndroidApiLevelMin>21</AndroidApiLevelMin>
67-
<iOSVersionMin>11.0</iOSVersionMin>
68-
<tvOSVersionMin>11.0</tvOSVersionMin>
69-
<macOSVersionMin>10.15</macOSVersionMin>
70-
<macOSVersionMin Condition="('$(TargetOS)' == 'osx' or '$(TargetOS)' == 'maccatalyst') and '$(TargetArchitecture)' == 'arm64'">11.0</macOSVersionMin>
71+
<iOSVersionMin>12.2</iOSVersionMin>
72+
<tvOSVersionMin>12.2</tvOSVersionMin>
73+
<macOSVersionMin>12.0</macOSVersionMin>
74+
<MacCatalystVersionMin>15.0</MacCatalystVersionMin>
7175
</PropertyGroup>
7276

7377
<PropertyGroup>
@@ -180,7 +184,9 @@
180184
<TestExclusionListTasksAssemblyPath>$([MSBuild]::NormalizePath('$(TestExclusionListTasksDir)', 'TestExclusionListTasks.dll'))</TestExclusionListTasksAssemblyPath>
181185
<CoreCLRToolPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(RuntimeConfiguration)'))</CoreCLRToolPath>
182186
<ILAsmToolPath Condition="'$(DotNetBuildSourceOnly)' == 'true' or '$(BuildArchitecture)' == 's390x' or '$(BuildArchitecture)' == 'ppc64le'">$(CoreCLRToolPath)</ILAsmToolPath>
187+
<!-- force download temmporarily https://github.com/dotnet/runtime/issues/101528
183188
<WasmtimeDir Condition="'$(WasmtimeDir)' == '' and '$(WASMTIME_PATH)' != '' and Exists($(WASMTIME_PATH))">$(WASMTIME_PATH)</WasmtimeDir>
189+
-->
184190
<WasmtimeDir Condition="'$(WasmtimeDir)' == ''">$([MSBuild]::NormalizeDirectory($(ArtifactsObjDir), 'wasmtime'))</WasmtimeDir>
185191
<InstallWasmtimeForTests Condition="'$(InstallWasmtimeForTests)' == '' and !Exists($(WasmtimeDir))">true</InstallWasmtimeForTests>
186192
<WasmCommonTargetsPath>$([MSBuild]::NormalizeDirectory($(WasmProjectRoot), 'build'))</WasmCommonTargetsPath>
@@ -397,12 +403,10 @@
397403
<PropertyGroup Condition="$(MSBuildProjectFullPath.Contains('$([System.IO.Path]::DirectorySeparatorChar)tests$([System.IO.Path]::DirectorySeparatorChar)'))">
398404
<IsTestProject Condition="$(MSBuildProjectName.EndsWith('.UnitTests')) or $(MSBuildProjectName.EndsWith('.Tests'))">true</IsTestProject>
399405
<IsTrimmingTestProject Condition="$(MSBuildProjectName.EndsWith('.TrimmingTests'))">true</IsTrimmingTestProject>
400-
<IsNativeAotTestProject Condition="$(MSBuildProjectName.EndsWith('.NativeAotTests'))">true</IsNativeAotTestProject>
401-
<IsPublishedAppTestProject Condition="'$(IsTrimmingTestProject)' == 'true' or '$(IsNativeAotTestProject)' == 'true'">true</IsPublishedAppTestProject>
402-
<IsTestSupportProject Condition="'$(IsTestProject)' != 'true' and '$(IsPublishedAppTestProject)' != 'true'">true</IsTestSupportProject>
406+
<IsTestSupportProject Condition="'$(IsTestProject)' != 'true' and '$(IsTrimmingTestProject)' != 'true'">true</IsTestSupportProject>
403407

404408
<!-- Treat test assemblies as non-shipping (do not publish or sign them). -->
405-
<IsShipping Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsPublishedAppTestProject)' == 'true'">false</IsShipping>
409+
<IsShipping Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsTrimmingTestProject)' == 'true'">false</IsShipping>
406410
</PropertyGroup>
407411

408412
<PropertyGroup>
@@ -413,7 +417,7 @@
413417
'$(IsReferenceAssemblyProject)' != 'true' and
414418
'$(IsGeneratorProject)' != 'true' and
415419
'$(IsTestProject)' != 'true' and
416-
'$(IsPublishedAppTestProject)' != 'true' and
420+
'$(IsTrimmingTestProject)' != 'true' and
417421
'$(IsTestSupportProject)' != 'true' and
418422
'$(UsingMicrosoftDotNetSharedFrameworkSdk)' != 'true' and
419423
'$(MSBuildProjectExtension)' != '.pkgproj' and
@@ -464,7 +468,7 @@
464468
</PropertyGroup>
465469

466470
<!-- Warnings that should be disabled in our test projects. -->
467-
<PropertyGroup Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsPublishedAppTestProject)' == 'true'">
471+
<PropertyGroup Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsTrimmingTestProject)' == 'true'">
468472
<!-- we need to re-enable BinaryFormatter within test projects since some tests exercise these code paths to ensure compat -->
469473
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
470474
<!-- don't warn on usage of BinaryFormatter or legacy serialization infrastructure from test projects -->

Directory.Build.targets

+3-2
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@
8686
</PropertyGroup>
8787

8888
<PropertyGroup>
89-
<!-- when building from source we need to use the current version of MetadataLoadContext as the toolset version, but source-build imports
90-
another props file which overrides the SystemReflectionMetadataLoadContextVersion from Version.props so we can't set it there -->
89+
<!-- when building from source we need to use the current version of various packages as the toolset version, but source-build imports
90+
another props file which overrides the versions from Version.props so we can't set it there -->
9191
<SystemReflectionMetadataLoadContextToolsetVersion Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(SystemReflectionMetadataLoadContextVersion)</SystemReflectionMetadataLoadContextToolsetVersion>
92+
<SystemTextJsonToolsetVersion Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(SystemTextJsonVersion)</SystemTextJsonToolsetVersion>
9293
</PropertyGroup>
9394

9495
<Target Name="ValidateTargetOSLowercase"

docs/coding-guidelines/coding-style.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The general rule we follow is "use Visual Studio defaults".
3636

3737
An [EditorConfig](https://editorconfig.org "EditorConfig homepage") file (`.editorconfig`) has been provided at the root of the runtime repository, enabling C# auto-formatting conforming to the above guidelines.
3838

39-
We also use the [.NET Codeformatter Tool](https://github.com/dotnet/codeformatter) to ensure the code base maintains a consistent style over time, the tool automatically fixes the code base to conform to the guidelines outlined above.
39+
We also use the [dotnet-format Tool](https://github.com/dotnet/format) to ensure the code base maintains a consistent style over time, the tool automatically fixes the code base to conform to the guidelines outlined above.
4040

4141
### Example File:
4242

docs/design/datacontracts/contract-descriptor.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ struct DotNetRuntimeContractDescriptor
2424
uint32_t flags;
2525
uint32_t descriptor_size;
2626
const char *descriptor;
27-
uint32_t aux_data_count;
27+
uint32_t pointer_data_count;
2828
uint32_t pad0;
29-
uintptr_t *aux_data;
29+
uintptr_t *pointer_data;
3030
};
3131
```
3232

@@ -45,7 +45,7 @@ reserved bits should be written as zero. Diagnostic tooling may ignore non-zero
4545

4646
The `descriptor` is a pointer to a UTF-8 JSON string described in [data descriptor physical layout](./data_descriptor.md#Physical_JSON_descriptor). The total number of bytes is given by `descriptor_size`.
4747

48-
The auxiliary data for the JSON descriptor is stored at the location `aux_data` in `aux_data_count` pointer-sized slots.
48+
The auxiliary data for the JSON descriptor is stored at the location `pointer_data` in `pointer_data_count` pointer-sized slots.
4949

5050
### Architecture properties
5151

@@ -83,7 +83,7 @@ a JSON integer constant.
8383
"globals":
8484
{
8585
"FEATURE_COMINTEROP": 0,
86-
"s_pThreadStore": [ 0 ] // indirect from aux data offset 0
86+
"s_pThreadStore": [ 0 ] // indirect from pointer data offset 0
8787
},
8888
"contracts": {"Thread": 1, "GCHandle": 1, "ThreadStore": 1}
8989
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// the empty baseline data descriptor
2+
{
3+
"version": 0
4+
}

docs/project/list-of-diagnostics.md

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ The PR that reveals the implementation of the `<IncludeInternalObsoleteAttribute
109109
| __`SYSLIB0052`__ | This API supports obsolete mechanisms for Regex extensibility. It is not supported. |
110110
| __`SYSLIB0053`__ | AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size. |
111111
| __`SYSLIB0054`__ | Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead. |
112+
| __`SYSLIB0055`__ | The underlying hardware instruction does not perform a signed saturate narrowing operation, and it always returns an unsigned result. Use the unsigned overload instead. |
112113

113114
## Analyzer Warnings
114115

docs/workflow/testing/coreclr/testing.md

+28-10
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
* [Building an Individual Test](#building-an-individual-test)
88
* [Building a Test Directory](#building-a-test-directory)
99
* [Building a Test Subtree](#building-a-test-subtree)
10+
* [Test Executors](#test-executors)
11+
* [The Standalone Test Runner and Build Time Test Filtering](#the-standalone-test-runner-and-build-time-test-filtering)
12+
* [Building all tests with the Standalone Runner](#building-all-tests-with-the-standalone-runner)
1013
* [Building C++/CLI Native Test Components Against the Live Ref Assemblies](#building-ccli-native-test-components-against-the-live-ref-assemblies)
1114
* [Test Priorities](#test-priorities)
1215
* [Running the Tests](#running-the-tests)
1316
* [Running Individual Tests](#running-individual-tests)
14-
* [Tests Without a Main Method](#tests-without-a-main-method)
1517
* [PAL Tests (macOS and Linux only)](#pal-tests-macos-and-linux-only)
1618
* [Building PAL Tests](#building-pal-tests)
1719
* [Running PAL Tests](#running-pal-tests)
@@ -62,7 +64,7 @@ This example assumes you built CoreCLR on _Debug_ mode and the Libraries on _Rel
6264

6365
The following subsections will explain how to segment the test suite according to your needs. There are three main scopes of building tests:
6466

65-
* Individual Test
67+
* Individual Test Runner
6668
* Full Directory
6769
* Entire Subtree
6870

@@ -83,19 +85,19 @@ To build an individual test, you have to pass the `-test` flag along with the pa
8385
On Windows:
8486

8587
```cmd
86-
.\src\tests\build.cmd test JIT\Intrinsics\MathRoundDouble_ro.csproj test JIT\Intrinsics\MathFloorDouble_ro.csproj
88+
.\src\tests\build.cmd test JIT\Methodical\Methodical_d1.csproj test JIT\JIT_ro.csproj
8789
```
8890

8991
On macOS and Linux:
9092

9193
```bash
92-
./src/tests/build.sh -test:JIT/Intrinsics/MathRoundDouble_ro.csproj -test:JIT/Intrinsics/MathFloorDouble_ro.csproj
94+
./src/tests/build.sh -test:JIT/Methodical/Methodical_d1.csproj -test:JIT/JIT_ro.csproj
9395
```
9496

9597
Alternatively, you can call _build_ directly using the `dotnet.cmd/dotnet.sh` script at the root of the repo and pass all arguments directly yourself:
9698

9799
```bash
98-
./dotnet.sh build -c <Your Configuration> src/tests/path/to/test/csproj
100+
./dotnet.sh build -c <Your Configuration> src/tests/path/to/test.csproj
99101
```
100102

101103
### Building a Test Directory
@@ -105,13 +107,13 @@ To build all the tests contained in an individual directory, you have to pass th
105107
On Windows:
106108

107109
```cmd
108-
.\src\tests\build.cmd dir JIT\Methodical\Arrays\lcs dir JIT\Methodical\cctor\misc\Desktop
110+
.\src\tests\build.cmd dir JIT dir Loader
109111
```
110112

111113
On macOS and Linux:
112114

113115
```bash
114-
./src/tests/build.sh -dir:JIT/Methodical/Arrays/lcs -dir:JIT/Methodical/cctor/misc/Desktop
116+
./src/tests/build.sh -dir:JIT -dir:Loader
115117
```
116118

117119
### Building a Test Subtree
@@ -130,6 +132,24 @@ On macOS and Linux:
130132
./src/tests/build.sh -tree:baseservices/exceptions -tree:JIT/Methodical
131133
```
132134

135+
### Test Executors
136+
137+
We have multiple different mechanisms of executing tests.
138+
139+
Our test entrypoints are generally what we call "merged test runners", as they provide an executable runner project for multiple different test assemblies. These projects can be identified by the `<Import Project="$(TestSourceDir)MergedTestRunner.targets" />` line in their .csproj file. These projects provide a simple experience for running tests. When executing a merged runner project, it will run each test sequentially and record if it passes or fails in an xunit results file. The merged test runner support runtime test filtering. If specified, the first argument to the test runner is treated as a `dotnet test --filter` argument following the xUnit rules in their documentation. Today, the runner only supports the simple form, a substring of a test's fully-qualified name, in the format `Namespace.ContainingTypeName.TypeName.Method`. If support for further filtering options is desired, please open an issue requesting it.
140+
141+
Some tests need to be run in their own process as they interact with global process state, they have a custom test entrypoint, or they interact poorly with other tests in the same process. These tests are generally marked with `<RequiresProcessIsolation>true</RequiresProcessIsolation>` in their project files. These tests can be run directly, but they can also be invoked through their corresponding merged test runner. The merged test runner will invoke them as a subprocess in the same manner as if they were run individually.
142+
143+
#### The Standalone Test Runner and Build Time Test Filtering
144+
145+
Sometimes you may want to run a test with the least amount of code before actually executing the test. In addition to the merged test runner, we have another runner mode known as the "Standalone" runner. This runner is used by default in tests that require process isolation. This runner consists of a simple `try-catch` around executing each test sequentially, with no test results file or runtime test filtering.
146+
147+
To filter tests on a merged test runner built as standalone, you can set the `TestFilter` property, like so: `./dotnet.sh build -c Checked src/tests/path/to/test.csproj -p:TestFilter=SubstringOfFullyQualifiedTestName`. This mechanism supports the same filtering as the runtime test filtering. Using this mechanism will allow you to skip individual test cases at build time instead of at runtime.
148+
149+
#### Building all tests with the Standalone Runner
150+
151+
If you wish to use the Standalone runner described in the [previous section](#the-standalone-test-runner-and-build-time-test-filtering), you can set the `BuildAllTestsAsStandalone` environment variable to `true` when invoking the `./src/tests/build.sh` or `./src/tests/build.cmd` scripts (for example, `export BuildAllTestsAsStandalone=true` or `set BuildAllTestsAsStandalone=true`). This will build all tests that are not directly in a merged test runner's project as separate executable tests and build only the tests that are compiled into the runner directly. If a runner has no tests that are built directly into the runner, then it will be excluded.
152+
133153
### Building C++/CLI Native Test Components Against the Live Ref Assemblies
134154

135155
By default, the _C++/CLI_ native test components build against the _ref pack_ from the SDK specified in the `global.json` file in the root of the repository. To build these components against the _ref assemblies_ produced in the build, pass the `-cmakeargs -DCPP_CLI_LIVE_REF_ASSEMBLIES=1` parameters to the test build. For example:
@@ -233,9 +253,7 @@ cd path/to/JIT/Intrinsics/MathRoundDouble_ro
233253
./MathRoundDouble_ro.sh -coreroot=<repo_root>/artifacts/tests/coreclr/<OS>.<Arch>.<Configuration>/Tests/Core_Root
234254
```
235255

236-
#### Tests Without a Main Method
237-
238-
Guide on how to run tests without a `Main()` Method coming soon!
256+
If you want to run an individual test from a test runner, use the filtering capabilities described in the [Test Executors section](#test-executors).
239257

240258
### PAL Tests (macOS and Linux only)
241259

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Testing managed tools
2+
3+
There are managed unit and functional tests for a number of tools including the
4+
compiler for NativeAOT (`ILCompiler`), and the trimmer (`illink`).
5+
6+
## Adding new testsuites
7+
8+
To add a new test suite, create a new `.csproj` with a name that ends in `Tests`, such as:
9+
`MyTool.Tests.csproj`. The property `IsTestProject` will be set by the `Directories.Build.props` in
10+
the repository root. The property will, in turn, add references to the xunit package and the
11+
apropriate test runner.
12+
13+
Now add a `ProjectToBuild` item in `eng/Substes.props` to one of the existing subsets, such as
14+
`clr.toolstests`, or a new subset.
15+
16+
## Adding new testsuites to CI
17+
18+
To run the tests in CI, add a new pipeline or add to an exsiting pipeline such as `CLR_Tools_Tests`
19+
in `eng/pipelines/runtime.yml`. Update the trigger condition, perhaps by adding a new set of paths
20+
to `eng/pipelines/common/evaluate-default-paths.yml` in order to run the tests when the tool source
21+
or the test sources change.
22+
23+
## Running tests locally
24+
25+
Build and run the tests locally either with
26+
27+
```console
28+
./build.[sh|cmd] -s clr.toolstests -c [Release|Debug] -build -test
29+
```
30+
31+
or
32+
33+
```console
34+
./dotnet.[sh|cmd] test .../MyTool.Tests.csproj -c [Release|Debug]
35+
```
36+
37+
The `dotnet-test` xunit filter mechanisms work to run a single test or a subset of the tests
38+
39+
```console
40+
./dotnet.[sh|cmd] test .../MyTool.Tests.csproj -c [Release|Debug] --filter "FullyQualifiedName~MyTest"
41+
```
42+
43+
The above command runs all tests whose fully-qualified name contains the substring `MyTest`. See
44+
[dotnet test - Run selective unit tests](https://learn.microsoft.com/en-us/dotnet/core/testing/selective-unit-tests?pivots=mstest#syntax)
45+
for the full syntax.

eng/DotNetBuild.props

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
<InnerBuildArgs Condition="'$(SourceBuiltNonShippingPackagesDir)' != ''">$(InnerBuildArgs) /p:SourceBuiltNonShippingPackagesDir=$(SourceBuiltNonShippingPackagesDir)</InnerBuildArgs>
8585
<InnerBuildArgs Condition="'$(SourceBuiltAssetManifestsDir)' != ''">$(InnerBuildArgs) /p:SourceBuiltAssetManifestsDir=$(SourceBuiltAssetManifestsDir)</InnerBuildArgs>
8686
<InnerBuildArgs Condition="'$(SourceBuiltSymbolsDir)' != ''">$(InnerBuildArgs) /p:SourceBuiltSymbolsDir=$(SourceBuiltSymbolsDir)</InnerBuildArgs>
87+
<InnerBuildArgs Condition="'$(GitHubRepositoryName)' != ''">$(InnerBuildArgs) /p:GitHubRepositoryName=$(GitHubRepositoryName)</InnerBuildArgs>
8788
</PropertyGroup>
8889
</Target>
8990

0 commit comments

Comments
 (0)