Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 11, 2025

Azure DevOps cannot display cargo test results without conversion to a supported format (JUnit, TRX, etc.). The issue requested using cargo2junit, but that tool requires nightly Rust's JSON test output format, which is unavailable on stable.

Changes

Test-Packages.ps1

  • Added -CI switch that captures test output to timestamped text files
  • Parses output to display pass/fail/ignored counts and failed test names
  • Maintains backward compatibility (original behavior when -CI omitted)

Convert-TestResults.ps1 (new)

  • Parses cargo test plain text output and generates JUnit XML
  • Pure PowerShell implementation, no external dependencies

Documentation

  • TEST_RESULTS_REPORTING.md - Implementation details and alternatives analysis (cargo2junit, nightly Rust, cargo-nextest)
  • PIPELINE_INTEGRATION.md - YAML integration guide with examples
  • IMPLEMENTATION_SUMMARY.md - Architecture and design decisions

Pipeline Integration

- task: Powershell@2
  displayName: "Test Packages"
  inputs:
    filePath: $(Build.SourcesDirectory)/eng/scripts/Test-Packages.ps1
    arguments: -PackageInfoDirectory '$(Build.ArtifactStagingDirectory)/PackageInfo' -CI

- task: Powershell@2
  displayName: "Convert Test Results to JUnit XML"
  condition: succeededOrFailed()
  inputs:
    filePath: $(Build.SourcesDirectory)/eng/scripts/Convert-TestResults.ps1

- task: PublishTestResults@2
  condition: succeededOrFailed()
  inputs:
    testResultsFormat: 'JUnit'
    testResultsFiles: '**/test-results/junit/*.xml'

Alternative Approaches

  • cargo2junit: Incompatible with stable Rust (expects nightly's --format json test output)
  • Nightly Rust: Not suitable for production pipelines
  • cargo-nextest: Viable but adds external dependency and changes test execution model
  • PowerShell parser: Chosen for zero dependencies and stable Rust compatibility

Pipeline YAML updates in ci.tests.yml and live.tests.yml pending (see PIPELINE_INTEGRATION.md for specifics).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • i1qvsblobprodcus353.vsblob.vsassets.io
    • Triggering command: pwsh -NoProfile -File /home/REDACTED/work/azure-sdk-for-rust/azure-sdk-for-rust/eng/scripts/Test-Packages.ps1 -? (dns block)
  • www.powershellgallery.com
    • Triggering command: pwsh -NoProfile -File /home/REDACTED/work/azure-sdk-for-rust/azure-sdk-for-rust/eng/scripts/Test-Packages.ps1 -? (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Test results should be reported in DevOps</issue_title>
<issue_description>PublishTestResults accepts JUnit and other test result formats https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/publish-test-results-v2?view=azure-pipelines&tabs=trx%2Ctrxattachments%2Cyaml

There should be a way to convert test results from cargo test to one of the accepted formats. A possible approach would be cargo2junit https://docs.rs/crate/cargo2junit/latest</issue_description>

<agent_instructions>Add logic to Test-Packages.ps1 that will, instead of using Invoke-LoggedCommand, call the command directly and write the output to a JSON file. Read the JSON file and output a somewhat human readable summary of failed tests and a summary at the end of total tests run. If there is an error then also output that additional details are available in the test tab for the build. Use a unique file name per run. And only behave this way if we're in CI (as controlled by a switch param)... if running locally just output in human format.

Then in a separate .ps1 file in the scripts repo convert the JSON to junit using cargo2junit before uploading the results using the PublishTestResults task.

Enumerate other possible ways that this output work can be done. Is it possible to have cargo test output results to some --target-dir and will that have the assets we need so that we don't have to force it to not be human readable? </agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits November 11, 2025 23:14
Co-authored-by: danieljurek <2158838+danieljurek@users.noreply.github.com>
Co-authored-by: danieljurek <2158838+danieljurek@users.noreply.github.com>
Co-authored-by: danieljurek <2158838+danieljurek@users.noreply.github.com>
Co-authored-by: danieljurek <2158838+danieljurek@users.noreply.github.com>
Co-authored-by: danieljurek <2158838+danieljurek@users.noreply.github.com>
Copilot AI changed the title [WIP] Add logic to report test results in DevOps Add test results reporting for Azure DevOps pipelines Nov 11, 2025
Copilot AI requested a review from danieljurek November 11, 2025 23:32
Copilot finished work on behalf of danieljurek November 11, 2025 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test results should be reported in DevOps

2 participants