Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

Description

Android CI failed due to -Werror,-Wunused-result treating ignored return values as errors. Fixed 7 instances in ep_compatibility_test.cc where C API functions marked with warn_unused_result were called without checking their OrtStatus* returns:

  • 6 calls to GetAllocatorWithDefaultOptions
  • 1 call to AllocatorFree

Changed from:

api->GetAllocatorWithDefaultOptions(&allocator);
api->AllocatorFree(allocator, compat_info);

To:

ASSERT_EQ(api->GetAllocatorWithDefaultOptions(&allocator), nullptr);
ASSERT_EQ(api->AllocatorFree(allocator, compat_info), nullptr);

Motivation and Context

The Android build uses Clang with strict warnings. These C API functions return OrtStatus* to indicate success/failure, and ignoring them violates the warn_unused_result attribute. The fix follows the pattern used in other test files (e.g., test_inference.cc) and improves test robustness by catching API errors.

Original prompt

Fix the failing GitHub Actions workflow Android CI Pipeline

Analyze the workflow logs, identify the root cause of the failure, and implement a fix.

Job ID: 60532176150

Job URL: https://github.com/microsoft/onnxruntime/actions/runs/21049485371/job/60532176150


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

- Add return value checks for GetAllocatorWithDefaultOptions calls (6 instances)
- Add return value check for AllocatorFree call (1 instance)
- These functions return OrtStatus* which must be checked due to warn_unused_result attribute
- Addresses all 7 compilation errors causing Android CI Pipeline failure

Co-authored-by: adrastogi <8368026+adrastogi@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions workflow for Android CI Pipeline Fix Android CI build: check return values in ep_compatibility_test.cc Jan 16, 2026
Copilot AI requested a review from adrastogi January 16, 2026 00:56
@adrastogi adrastogi marked this pull request as ready for review January 16, 2026 01:27
@adrastogi adrastogi merged commit 355082b into adrastogi/compat-metadata-api Jan 16, 2026
9 of 10 checks passed
@adrastogi adrastogi deleted the copilot/fix-android-ci-pipeline-again branch January 16, 2026 01:33

OrtAllocator* allocator = nullptr;
api->GetAllocatorWithDefaultOptions(&allocator);
ASSERT_EQ(api->GetAllocatorWithDefaultOptions(&allocator), nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

in general, the returned OrtStatus* should be released with ReleaseStatus() if it is not nullptr. the other code in this test does that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! Will patch in the parent branch.

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