Skip to content

Add native artifact tests and dedicated Linux CI - #5366

Merged
mattleibow merged 21 commits into
mainfrom
mattleibow-native-artifact-tests
Oct 17, 2026
Merged

mattleibow merged 21 commits into
mainfrom
mattleibow-native-artifact-tests

Conversation

@mattleibow

@mattleibow mattleibow commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add a native-artifact suite using xUnit v3/Microsoft.Testing.Platform. Tests are PowerShell scripts under Cases, either Name.ps1 or Name/test.ps1 when supporting files are needed. MSBuild runtime configuration supplies the repository path, and results use ordinary TRX reporting.

Twelve inspection cases cover native and native_msvc: dependency policy, GLIBC compatibility, Android alignment/debug files, Windows imports/PDB identities, Apple framework/dSYM contents, Tizen ABI, and WASM archives. An inventory guard rejects missing artifacts and newly introduced binaries without inspection coverage. Shared helpers live in Cases/Helpers.psm1.

Run one Linux-container native-test job as a leaf in Test and Complete. Package remains build-only and neither runs nor waits for these tests. Move duplicated artifact assertions out of Cake while retaining compilation, stripping, symbol preparation, and build-input/toolchain validation. ELF inspection calls llvm-readobj --elf-output-style=GNU directly; missing tools/APIs fail rather than selecting alternatives.

Current verdict: after rebasing onto main d29d6e6cd419, the native-test job at exact PR head 32d724a04eecfcd75a37d04a2eb27f8ce3df9112 passed 12/12 with no skips against freshly produced public artifacts. Public Complete run 1638964 nevertheless completed failed because Windows Host samples hit HttpClient.Timeout in BasicSampleRunTests.WebSampleReturnsImage. This is different from the earlier Blazor cleared-page comparison failure. The full pipeline is not green; the timeout has not been established as pre-existing or flaky.

Windows-hosted native execution is deferred because the public image's LLVM directory is not on PATH. Linux still runs the Windows DLL/PDB inspections; existing managed Windows jobs are unchanged. No case was skipped to hide missing tools, and no installer was restored.

The HarfBuzz runtime case was removed after CI confirmed the expected failure against unfixed artifacts, so it can arrive with the contributor's linker fix in #5352. Both fix and runtime case are excluded here. The pre-rebase case is recoverable from 02c37d85817; restoring it also needs compiler dependencies and the current reader API.

Related issues

Related to #3038 and #5352. This infrastructure PR does not resolve the HarfBuzz bug itself.

Required skia PR

None.

Areas affected

  • Managed API (binding/)
  • Native / C API (externals/skia/src/c, include/c)
  • Generated P/Invoke bindings
  • Native dependency or Skia update (libpng, HarfBuzz, FreeType, zlib, milestone bump, …)
  • Views & integrations (MAUI, Uno, WPF, WinUI, Blazor, …)
  • Rendering output / visual behavior
  • Performance
  • Tests
  • Build, packaging, or CI
  • Documentation or samples

Changes

No public API, ABI, or application runtime behavior changes. Artifact validation moves from native-build assertions to separate test jobs; Package stays build-only. PDB runtime markers are not proof of compiler mitigation or complete Spectre protection. The current suite performs static inspection without executing target libraries or requiring a C compiler.

Testing

Rebased current-head public build: native suite passed; sample timeout

Public Complete run 1638964, exact source 32d724a04eecfcd75a37d04a2eb27f8ce3df9112, completed failed:

  • dotnet cake --target=tests-native — 12 passed, 0 failed, 0 skipped, published TRX 45519180, publisher log 2445. Individual results confirm all native inspections passed against fresh public artifacts.
  • The sole failed job was Windows (Host) samples: 15 passed, 1 failed, 0 skipped. BasicSampleRunTests.WebSampleReturnsImage exceeded HttpClient.Timeout of 4 seconds, at RunningApp.cs:30 / BasicSampleRunTests.cs:37. Evidence: task log 3279, job log 3289.
  • The earlier Blazor cleared-page golden failure is not the failure in this run. No target-branch comparison has established this timeout as pre-existing or flaky; no sample source, timeout, threshold, or retry was changed as part of this native-test work.

The native test sources and stage semantics are unchanged by the rebase. Main now includes the browser screenshot/startup fixes, but that does not establish the separate HTTP sample timeout is resolved.

Earlier public artifact validation

Public run 1637595, pre-rebase source a68229e50fd, passed all twelve native cases (TRX 45472836) but failed the Windows Host sample job's BlazorWebAssemblyDrawingSampleDrawsAndClears cleared-page golden comparison: 1,906 / 1,152,000 pixels (0.165%), above 0.075%. This is historical evidence, not the current-head failure.

Internal production-artifact validation

Internal run 3106805, pre-rebase source a031953f728, succeeded against Package 3104558, version 4.156.0-preview.0.26513.5+main, producer 1d1d1b1db3dda7aeda1822377f2fbac76465b2a2:

Host Command TRX run Result
Linux dotnet cake --target=tests-native 58048945 12 passed, 0 failed, 0 skipped
Internal Windows dotnet cake --target=tests-native 58048977 12 passed, 0 failed, 0 skipped

No Windows installation or PATH changes were used. This validates the strict ABI, GLIBC and artifact-path contracts against production artifacts.

Public Windows host investigation — not enabled in current CI

Public run 1637516, pre-rebase source a031953, passed twelve Linux inspections (TRX 45470996), but public Windows reported 2 passed / 10 failed (TRX 45471274), all missing LLVM commands on PATH.

Diagnostic 1637594 confirmed LLVM 22.1.3 tools exist and execute at C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\Llvm\x64\bin, outside PATH. It performed no installation, PATH changes or recursive search. The Windows native-job invocation is removed, not artifact coverage.

Historical 3106773 / 3106749 runs identified the earlier missing llvm-readelf dependency. The suite now explicitly uses llvm-readobj, not fallback selection or installation.

HarfBuzz red control before deferral

Run 3106713 used pinned unfixed Package 3104558:

  • Linux TRX 58048007: 12 passed, 1 expected HarfBuzz failure. Bundled-only passed, the fake interposer detected exit 86, and the actual unfixed library called globally loaded hb_font_set_funcs_using and exited 86.
  • Windows TRX 58048059: 12 passed, 0 failed, 1 declared Linux-runtime skip.
  • Runtime files were physically removed before landing the infrastructure; no skip was added to hide the Linux regression.

Local checks

  • dotnet build tests/SkiaSharp.Tests.Native.slnx --no-restore -v minimal — passed after rebase, zero warnings/errors.
  • dotnet test tests/SkiaSharp.Tests.Native.slnx --no-restore -- --report-trx --report-trx-filename rebased-main.trx --results-directory /work/output/logs/testlogs/SkiaSharp.Tests.Native — passed after rebase: 12 passed, 0 failed, 0 skipped against compiled fixtures.
  • Earlier readobj-only tests passed with llvm-readelf absent; missing llvm-readobj failed even with llvm-readelf available.
  • pwsh -NoLogo -NoProfile -File /fixtures/inventory-build/negative-controls.ps1 — 29 negative controls passed, plus strict controls for empty GLIBC output, musl substitutions, wrong ABI/debug pairs and alternate paths.
  • dotnet cake native/linux/build.cake --showtree — passed; Android, nodeps, Windows, WinUI and ANGLE graph checks also passed after assertion migration.
  • Pipeline YAML / PowerShell parsing, repository C# formatting and git diff --check passed. Rebase verification preserved the native-test sources, Linux-only leaf stage and build-only Package policy.

No C API/submodule changes, binding regeneration, rendering screenshots or GPU validation apply. No full local native rebuild was performed.

Checklist

  • Tests added or updated (if omitted, explain why above)
  • Changes above lists all public API and behavioral changes (or "None.")
  • New/changed public API? Added or updated accurate source /// documentation and regenerated bindings when applicable — N/A: no public API changes.
  • Native change? Companion mono/skia PR linked above and bindings regenerated — N/A: no C API or submodule changes.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 5366

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 5366"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-5366/packages --name skiasharp-pr-5366
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-5366

@github-actions

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

Add the automation/staging label to build and publish a documentation preview for this PR.

Removing the label removes the preview. While the label is present, each new commit updates it.


This comment is automatically updated by the documentation staging workflow.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

📊 SkiaSharp benchmarks — PR #5366

⭐ this PR (full source build) vs 🌙 nightly · Linux · macOS

Informational only — this never blocks the PR. 🟢 faster / less allocation · 🔴 slower / more allocation; moves under 5% are hidden as noise.

⏱️ Times are raw BenchmarkDotNet means, and the ⭐ PR and baseline legs run on separate CI runners, so microbenchmarks can swing run-to-run — treat small time deltas as noise. Allocations are deterministic and the reliable signal. The interactive perf-dashboard (linked below) applies smoothing for the trend view.

Highlights

⏱️ Time — 🔴 37 slower · 🟢 19 faster

  • 🔴 ColorMathBenchmark.ToColor(Colors: 4096) · Linux · 4.93 µs → 14.15 µs (+187%)
  • 🔴 ColorParseBenchmark.Parse(Iterations: 1000) · Linux · 41.71 µs → 74.82 µs (+79%)
  • 🔴 ColorMathBenchmark.PreMultiply(Colors: 4096) · Linux · 7.25 µs → 12.86 µs (+77%)
  • 🔴 RasterImageLifecycleBenchmark.CreateDataWithReleaseProc(Count: 256) · Linux · 61.65 µs → 106.92 µs (+73%)
  • 🔴 RasterImageLifecycleBenchmark.CreateRasterImage(Count: 256) · Linux · 156.93 µs → 269.77 µs (+72%)
  • …and 51 more (see details below)
Full per-OS benchmark deltas

Linux

⏱️ Time (vs 🌙 nightly 4.156.0-nightly.26515.9)

Benchmark baseline this PR Δ
ColorMathBenchmark.ToColor(Colors: 4096) 4.93 µs 14.15 µs 🔴 +187%
ColorParseBenchmark.Parse(Iterations: 1000) 41.71 µs 74.82 µs 🔴 +79%
ColorMathBenchmark.PreMultiply(Colors: 4096) 7.25 µs 12.86 µs 🔴 +77%
RasterImageLifecycleBenchmark.CreateDataWithReleaseProc(Count: 256) 61.65 µs 106.92 µs 🔴 +73%
RasterImageLifecycleBenchmark.CreateRasterImage(Count: 256) 156.93 µs 269.77 µs 🔴 +72%
MatrixMapPointsBenchmark.MapPoints(Points: 256) 132.4 ns 222.9 ns 🔴 +68%
ColorMathBenchmark.ToColorF(Colors: 4096) 7.80 µs 13.12 µs 🔴 +68%
PathBoundsBenchmark.TightBounds(Points: 64) 582.6 ns 976.2 ns 🔴 +68%
MatrixMapPointsBenchmark.MapPoints(Points: 4096) 1.53 µs 2.54 µs 🔴 +66%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 64) 155.22 µs 250.42 µs 🔴 +61%
PathBoundsBenchmark.TightBounds(Points: 1024) 6.32 µs 9.96 µs 🔴 +58%
MatrixMapPointsBenchmark.MapPoint(Points: 256) 2.94 µs 4.62 µs 🔴 +57%
MatrixMapPointsBenchmark.MapPoint(Points: 4096) 47.03 µs 73.82 µs 🔴 +57%
ColorMathBenchmark.UnPreMultiply(Colors: 4096) 7.14 µs 11.15 µs 🔴 +56%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 64) 231.39 µs 360.03 µs 🔴 +56%
MatrixOpsBenchmark.Concat(Count: 4096) 141.45 µs 217.58 µs 🔴 +54%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 256) 613.88 µs 940.12 µs 🔴 +53%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 2048) 4.97 ms 7.57 ms 🔴 +52%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 1024) 1.30 ms 1.96 ms 🔴 +51%
LargeImageScaleBenchmark.UpscaleOpaque(Size: 2048) 1.77 ms 2.63 ms 🔴 +49%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 256) 896.42 µs 1.33 ms 🔴 +48%
MatrixMapPointsBenchmark.MapVector(Points: 4096) 118.47 µs 174.56 µs 🔴 +47%
LargeImageScaleBenchmark.UpscaleOpaque(Size: 1024) 466.51 µs 685.34 µs 🔴 +47%
MatrixMapPointsBenchmark.MapVector(Points: 256) 7.56 µs 10.92 µs 🔴 +45%
MatrixMapPointsBenchmark.MapRadius(Points: 4096) 152.82 µs 217.59 µs 🔴 +42%
…and 8 more

macOS

⏱️ Time (vs 🌙 nightly 4.156.0-nightly.26515.9)

Benchmark baseline this PR Δ
LargeImageScaleBenchmark.UpscaleOpaque(Size: 1024) 843.18 µs 508.19 µs 🟢 -40%
ColorMathBenchmark.ToColor(Colors: 4096) 26.09 µs 16.54 µs 🟢 -37%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 1024) 1.73 ms 1.25 ms 🟢 -28%
LargeImageScaleBenchmark.UpscaleOpaque(Size: 2048) 3.21 ms 2.34 ms 🟢 -27%
SceneRenderBenchmark.RenderFrame(Complexity: 1) 1.52 ms 1.15 ms 🟢 -24%
ColorMathBenchmark.ToColorF(Colors: 4096) 6.27 µs 4.91 µs 🟢 -22%
MatrixMapPointsBenchmark.MapPoints(Points: 256) 149.8 ns 181.9 ns 🔴 +21%
ColorParseBenchmark.Parse(Iterations: 1000) 82.13 µs 65.33 µs 🟢 -20%
MatrixOpsBenchmark.Invert(Count: 4096) 70.65 µs 56.90 µs 🟢 -19%
CanvasDrawBenchmark.Draw(Shapes: 512) 13.86 ms 11.16 ms 🟢 -19%
ColorMathBenchmark.PreMultiply(Colors: 4096) 9.83 µs 8.29 µs 🟢 -16%
SceneRenderBenchmark.RenderFrame(Complexity: 4) 6.34 ms 5.38 ms 🟢 -15%
CanvasDrawBenchmark.Draw(Shapes: 64) 1.76 ms 1.51 ms 🟢 -14%
ColorMathBenchmark.UnPreMultiply(Colors: 4096) 8.92 µs 7.71 µs 🟢 -14%
MatrixMapPointsBenchmark.MapRect(Points: 4096) 60.33 µs 53.43 µs 🟢 -11%
PathBoundsBenchmark.TightBounds(Points: 1024) 8.74 µs 9.72 µs 🔴 +11%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 64) 290.17 µs 258.58 µs 🟢 -11%
MatrixMapPointsBenchmark.MapPoints(Points: 4096) 1.89 µs 1.69 µs 🟢 -11%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 2048) 6.39 ms 5.78 ms 🟢 -10%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 64) 222.03 µs 202.25 µs 🟢 -9%
MatrixMapPointsBenchmark.MapRect(Points: 256) 3.33 µs 3.62 µs 🔴 +9%
RuntimeEffectShaderBenchmark.DrawFrame 547.65 µs 513.84 µs 🟢 -6%
MatrixMapPointsBenchmark.MapVector(Points: 256) 2.60 µs 2.74 µs 🔴 +5%

📈 Full interactive perf-dashboard & run details →

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Moving cross-platform validation out of native builds still needs maintainer review and the pending all-green production-artifact CI rerun.

0 open findings

What changed in this PR

Moves native-artifact validation from build assertions into a dedicated cross-platform test suite, without changing public APIs or runtime behavior.

Changes:

  • Adds twelve static inspection cases, shared inventory checks, and an xUnit runner with TRX reporting.
  • Adds Linux-container and Windows-host jobs to Test and Complete; Package remains build-only.
  • Removes migrated Cake assertions. The HarfBuzz fix and runtime regression remain deferred to #5352.
File Description
tests/​SkiaSharp.Tests.Native/​SkiaSharp.Tests.Native.csproj Configures the test executable and script deployment.
tests/​SkiaSharp.Tests.Native/​NativeTests.cs Discovers and runs PowerShell cases with timeouts.
tests/​SkiaSharp.Tests.Native/​Cases/​WindowsSymbols.ps1 Validates PDB identities and CLI metadata.
tests/​SkiaSharp.Tests.Native/​Cases/​WindowsRuntimeMarker.ps1 Checks native runtime markers.
tests/​SkiaSharp.Tests.Native/​Cases/​WindowsDependencies.ps1 Checks prohibited hard imports.
tests/​SkiaSharp.Tests.Native/​Cases/​WindowsDelayLoads.ps1 Validates Direct3D delay imports.
tests/​SkiaSharp.Tests.Native/​Cases/​WasmArtifacts.ps1 Checks archive members and public symbols.
tests/​SkiaSharp.Tests.Native/​Cases/​TizenArtifacts.ps1 Checks ELF architecture and exports.
tests/​SkiaSharp.Tests.Native/​Cases/​LinuxGlibcCompatibility.ps1 Enforces architecture-specific GLIBC ceilings.
tests/​SkiaSharp.Tests.Native/​Cases/​LinuxDependencies.ps1 Validates fontconfig dependency policy.
tests/​SkiaSharp.Tests.Native/​Cases/​Helpers.psm1 Defines artifact inventories and inspection helpers.
tests/​SkiaSharp.Tests.Native/​Cases/​ArtifactCoverage.ps1 Rejects missing or unclaimed artifacts.
tests/​SkiaSharp.Tests.Native/​Cases/​AppleArtifacts.ps1 Validates Mach-O, dSYM, and framework contents.
tests/​SkiaSharp.Tests.Native/​Cases/​AndroidPageAlignment.ps1 Checks 16 KB page compatibility.
tests/​SkiaSharp.Tests.Native/​Cases/​AndroidDebugSymbols.ps1 Checks build IDs and debug links.
tests/​SkiaSharp.Tests.Native.slnx Adds a dedicated test solution.
scripts/​infra/​tests/​tests-native.cake Runs the native-artifact test project.
scripts/​infra/​tests/​provision-native-windows.ps1 Provisions Windows LLVM inspection tools.
scripts/​infra/​tests/​docker/​native/​Dockerfile Provides the Linux inspection environment.
scripts/​infra/​native/​windows/​windows-shared.cake Removes migrated dependency exclusions.
scripts/​infra/​native/​shared/​native-shared.cake Removes migrated dependency-check helpers.
scripts/​infra/​native/​linux/​docker/​bionic/​build-local.sh Removes the obsolete verification argument.
scripts/​infra/​native/​android/​ndk.cake Removes assertions while retaining symbol preparation.
scripts/​azure-templates-stages-test.yml Adds the native-test leaf stage.
scripts/​azure-templates-stages-native-linux.yml Removes migrated verification arguments.
scripts/​azure-templates-jobs-tests-native.yml Configures artifact downloads, execution, and reporting.
native/​winui/​build.cake Removes migrated WinUI assertions.
native/​winui-angle/​build.cake Removes migrated ANGLE assertions.
native/​windows/​build.cake Removes migrated Windows assertions.
native/​linuxnodeps/​build.cake Removes obsolete verification arguments.
native/​linux/​build.cake Removes migrated Linux assertions and options.
build.cake Exposes the native-test target.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@mattleibow mattleibow changed the title Add native artifact tests and dedicated Linux/Windows CI Add native artifact tests and dedicated Linux CI Oct 15, 2026
VirgilMing and others added 21 commits October 17, 2026 02:42
A globally loaded system HarfBuzz can preempt calls inside
libHarfBuzzSharp.so and receive incompatible private objects. Bind
internal function references locally with -Bsymbolic-functions.

All 565 public hb_* exports in the tested library are functions.
Both symbolic options eliminate the same 67 preemptible hb_*
relocations, so function-only binding covers the conflict without
changing data-symbol binding.

Add a standalone native regression that loads conflicting functions
globally before creating a bundled font and initializing OpenType
functions.

Validated Linux x64 source builds with libstdc++ and libc++/libc++abi,
native load-order probes, Avalonia font initialization, and the
unfiltered net10.0 Console solution: 6450 passed, 0 failed, and 38
existing skips.

Other architectures, musl, nodeps/Bionic/Tizen variants, and release
cross-images using static libc++ with GCC ABI remain unverified.
LLD was tested only in the earlier libstdc++ comparison. The original
complete GtkSharp reproduction, actual SourceGit GUI, and published
packages were not tested.
Move existing Linux dependency/GLIBC and Windows dependency/delay-load/PDB-marker gates into a discoverable Python suite with JUnit reports. Check HarfBuzz exports and internal function relocations without executing cross-built binaries.

Run isolated preemption probes against matching glibc and musl artifacts in dedicated images, including nodeps variants, with negative controls, libc/architecture guards and bounded subprocess cleanup. Publish gating results and include the suite in native cache keys.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Replace the Python inspection framework with one xUnit theory over copied case folders. Each case owns its Bash script and native sources; the runner resolves output/native automatically and reports subprocess failures through standard TRX.

Restore native build images and existing Cake dependency gates. Run the initial HarfBuzz regression in one dedicated Linux test image and job, preserving its deterministic negative control.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Rename the project to SkiaSharp.Tests.Native.Console and use SkiaSharp.Tests.Native for its assembly and namespace, matching existing console-host conventions. Update Cake, pipeline report paths and documentation.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Register SkiaSharp.Tests.Native.Console in SkiaSharp.Tests.Native.slnx so the Linux native suite has a solution entry point without adding compiler requirements to the cross-platform managed solution.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Use SkiaSharp.Tests.Native for the standalone native test project. Move its job into a Native Tests stage directly after native artifact merging and require it before packaging. The standalone Tests pipeline runs the stage after preparation, using the existing source artifacts. Forward the official container-template setting.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Include native tests only in Test and Complete pipelines. Preserve the Package pipeline dependency on native artifacts alone; Complete explicitly gates packaging on native tests.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Run native tests after native artifact merging without making packaging or downstream stages wait for them. Package remains build-only.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Add Linux dependency and build-matrix GLIBC ceiling checks, Android 16 KB alignment and split-debug identity checks, and Windows hard-import, delay-load and PDB runtime-marker checks. Inspect cross-built artifacts on the existing Linux test host using binutils and LLVM; no target execution is required for the new cases.

Retain existing native build checks and leaf CI behavior. Keep PDB marker reporting limited to runtime provenance, not compiler mitigation guarantees. Validate all eight folder theories using compiled ELF/PE fixtures and negative controls.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Discover standalone scripts or scenario folders, share PowerShell helpers as a module, and bind repository paths through MSBuild runtime configuration. Keep the small process runner in NativeTests and document each case with readable multiline formatting.

Require complete coverage of native and native_msvc outputs, including Apple, Tizen, WASM, PDB identities and materialized framework aliases. New or missing artifacts fail the coverage case. Remove duplicated Cake artifact assertions while preserving build transformations and toolchain checks; compatibility limits live directly in their test.

Validate 13 xUnit cases against 277 compiled fixture artifacts plus 29 negative controls. Keep native tests as leaf stages in Test and Complete; Package remains build-only.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Add a Windows native-test job alongside Linux in the Test and Complete leaf stage, using the existing Windows pool without Docker. Provision a verified complete LLVM19.1.1 toolset when required, since the smaller installer omits llvm-readelf.

Use LLVM ELF inspection consistently on both hosts. Linux/glibc-only runtime cases explicitly declare skips with exit77 and a reason; missing tools, artifacts and unexplained failures still fail. Preserve build-only Package behavior and separate TRX publication.

Validate 13 passing Linux fixture cases and 12 passing portable cases plus one declared skip on macOS; real Windows CI execution remains to be run.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Keep this branch infrastructure-only by removing the symbolic-binding flag and its comment. Retain the HarfBuzz regression temporarily to confirm the expected CI failure against unfixed artifacts before deferring the case.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Production CI confirmed the expected Linux symbol-preemption failure and passed all twelve artifact inspections on Linux and Windows. Remove only the runtime regression from this infrastructure PR so it can land with the contributor linker fix; the case remains recoverable from 02c37d8.

Retain the twelve static artifact cases and remove their unused Linux compiler packages. Update usage and current suite counts without introducing skips to hide the bug.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Drop the unneeded guide and its link from the container testing documentation.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Keep the independent native_tests leaf and its Linux/Windows jobs unchanged while removing the extra stage template. Forward the official container-template setting through the existing test-stage entry point; Package remains build-only.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Test jobs always use the standard templates. Keep 1ES selection only for native builds, not the test-stage or native-test job parameters.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Keep normal and native tests at the bottom of the shared stage entry point without changing leaf dependencies. Remove the redundant platform parameter and use buildAgent.pool.os for job naming and host setup.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Remove custom LLVM provisioning and let public and internal CI demonstrate whether the existing Windows toolset is sufficient. Missing required tools remain test failures; no skip or fallback is added.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Reject empty or non-glibc version inspection and verify Android ELF class/machine against its ABI directory. Require the published Windows ARM64 and HarfBuzz WASM alias paths directly instead of searching for alternative spellings.

Keep declared tool dependencies fail-fast with no installation or alternate-tool fallback. Validate all twelve cases plus negative controls for missing tools, wrong ABI, empty GLIBC requirements and alternate paths.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Declare llvm-readobj --elf-output-style=GNU as the single ELF inspection API, using its native option names. Remove the llvm-readelf assertion wrapper and dependency rather than searching for an alternate tool.

All twelve cases pass with llvm-readelf absent; missing readobj still fails even when readelf is available. Strict ABI, GLIBC and artifact-path negative controls remain passing.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
Keep the Linux native-test job, which inspects all platform artifacts, and defer the Windows host until the public image's LLVM setup is resolved. Do not change or skip any artifact cases or normal Windows test jobs.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: e108ef36-df39-44b3-8fa7-6ec8272316a5
@mattleibow
mattleibow force-pushed the mattleibow-native-artifact-tests branch from a68229e to 32d724a Compare October 17, 2026 00:43
@mattleibow
mattleibow marked this pull request as ready for review October 17, 2026 14:39
@mattleibow
mattleibow merged commit 86e6dd0 into main Oct 17, 2026
122 of 125 checks passed
@mattleibow
mattleibow deleted the mattleibow-native-artifact-tests branch October 17, 2026 14:42
mattleibow added a commit that referenced this pull request Oct 17, 2026
Bind bundled HarfBuzz functions locally on Linux (#5352)

Fixes: #3038
Context: #2247
Context: #5366
Context: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1637759
Context: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1637595

Keep internal HarfBuzz calls within the bundled implementation and add a
native regression that demonstrates the failure without depending on GTK,
system HarfBuzz versions, fonts, or a managed-process crash.

~~ Prevent ELF preemption from mixing private HarfBuzz objects ~~

Using HarfBuzzSharp after GTK initialization can cause SIGSEGV or invalid
pointer errors. GTK can load system HarfBuzz into the global symbol scope;
ELF lookup can then redirect internal calls from libHarfBuzzSharp.so to
that implementation, passing private objects between incompatible builds.
Resolving the initial managed import from the intended library does not
control the native calls made inside it.

The earlier RTLD_DEEPBIND workaround lived in the custom library loader,
so it did not protect the .NET import path reported in this regression.
Apply -Wl,-Bsymbolic-functions in the common Linux HarfBuzz link recipe
instead, following the native-binding diagnosis in the issue discussion.

Choose function-only binding rather than -Bsymbolic: the observed conflict
is in function references, and the narrower option avoids extending the
change to global data binding. Keep the exported hb_* entry points and
managed signatures unchanged rather than introducing prefixed wrappers.
The nodeps and clang-cross recipes delegate to this common recipe and
inherit the option; other native recipes are not changed.

~~ Make load-order regression failures observable in native CI ~~

Add HarfBuzzSymbolBinding as a folder-discovered PowerShell case in the
SkiaSharp.Tests.Native project introduced by #5366. Separate the loader,
conflicting exports, and intentionally preemptible control into probe.c,
interposer.c, and control.c.

The loader obtains entry points from the explicit library handle and
exercises font creation and OpenType function initialization. Each probe
runs in a fresh native process, optionally loading the interposer with
RTLD_GLOBAL first. This keeps load-order state separate between probes
and prevents a native failure from terminating the xUnit host.

Have the interposer report the unexpectedly called function and exit 86,
rather than relying on incompatible object layouts to produce a segfault.
Require the fake control to pass alone and fail with that diagnostic and
exit code before trusting the produced-library checks. This rejects a
false pass caused by an inactive conflict.

Validate the exact linux and linuxnodeps artifact paths, ELF class,
endianness, machine, shared-library type, and glibc dependency before
execution. Exercise both variants alone and with the conflicting exports.
Declare a non-Linux runtime skip; unsupported Linux hosts, missing tools,
missing artifacts, and failed native commands remain failures. Remove
LD_PRELOAD and LD_AUDIT from the probe environment.

Use the existing xUnit execution, timeout, and TRX reporting rather than
adding another runner. Install gcc, glibc-devel, and binutils explicitly
in the Linux test image alongside LLVM; GCC also needs the assembler and
linker to compile these probes.

A Linux ARM64 before/after run used identical test sources and image,
substituting the standard HarfBuzz binary and its versioned alias. The
unfixed production binary from build 1637595 passed alone but called the
global hb_font_set_funcs_using with the interposer, producing exit 86:
12 native cases passed and this case failed. Restoring the fixed binary
from contributor build 1637759 produced 13 passes with no skips; its
nodeps HarfBuzz binary also passed both load orders.

Those runtime checks used production-built HarfBuzz libraries; the other
artifact inspections in that local run used retained fixtures. They do
not establish a full GTK application run or runtime coverage of musl,
Bionic, Tizen, or every cross-built architecture.

Co-authored-by: vgm <[email protected]>
Co-authored-by: Matthew Leibowitz <[email protected]>
Co-authored-by: Nikita Tsukanov <[email protected]>
Co-authored-by: Copilot App <[email protected]>
@github-actions github-actions Bot added this to the 4.156.0-rc.1 milestone Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants