Skip to content

Conversation

@fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Jan 15, 2026

Description

  • factor duplicated test target settings into helper functions
  • reuse helpers for onnxruntime_test_all and onnxruntime_provider_test
  • keep target-specific settings intact

Motivation and Context

There are some duplicated codes in the onnxruntime_unittests. Originally there is only one unit test onnxruntime_test_all and later it is split into two: onnxruntime_test_all and onnxruntime_provider_test. Some lines for setting up build flags are simply copied. This causes potential risk for inconsistency in future.

Copy link
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.

Pull request overview

This PR refactors duplicated test target settings in the CMake build configuration by extracting common compile and link settings into reusable helper functions. The refactoring addresses code duplication between onnxruntime_test_all and onnxruntime_provider_test targets that occurred when the test suite was split.

Changes:

  • Introduced two helper functions: onnxruntime_apply_common_test_target_settings for compile flags and onnxruntime_apply_emscripten_test_link_settings for Emscripten link settings
  • Applied these functions to both onnxruntime_test_all and onnxruntime_provider_test targets
  • Removed duplicated configuration blocks that were previously copy-pasted between targets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fs-eire and others added 2 commits January 14, 2026 16:37
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fs-eire fs-eire changed the title refactor common test target settings [test] refactor common test target settings Jan 18, 2026
@fs-eire fs-eire enabled auto-merge (squash) January 18, 2026 23:12
Copy link
Contributor

@edgchen1 edgchen1 left a comment

Choose a reason for hiding this comment

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

thanks for cleaning it up!

@fs-eire fs-eire merged commit f94987d into main Jan 22, 2026
101 of 102 checks passed
@fs-eire fs-eire deleted the fs-eire/test-target-settings branch January 22, 2026 00:43
fs-eire added a commit to fs-eire/onnxruntime that referenced this pull request Jan 22, 2026
### Description
- factor duplicated test target settings into helper functions
- reuse helpers for onnxruntime_test_all and onnxruntime_provider_test
- keep target-specific settings intact


### Motivation and Context

There are some duplicated codes in the onnxruntime_unittests. Originally
there is only one unit test `onnxruntime_test_all` and later it is split
into two: `onnxruntime_test_all` and `onnxruntime_provider_test`. Some
lines for setting up build flags are simply copied. This causes
potential risk for inconsistency in future.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

3 participants