Skip to content

Android: add Module lifecycle and API coverage tests#19125

Open
psiddh wants to merge 2 commits intopytorch:mainfrom
psiddh:module-lifecycle-tests
Open

Android: add Module lifecycle and API coverage tests#19125
psiddh wants to merge 2 commits intopytorch:mainfrom
psiddh:module-lifecycle-tests

Conversation

@psiddh
Copy link
Copy Markdown
Contributor

@psiddh psiddh commented Apr 24, 2026

Add 13 new tests covering previously untested Module public APIs:

  • Load modes: MMAP, FILE
  • getMethods(): verify returns array containing "forward"
  • getMethodMetadata(): verify name and backends
  • readLogBuffer() / readLogBufferStatic(): verify non-null
  • etdump(): verify callable
  • Destroyed-state throws for getMethods, getMethodMetadata, readLogBuffer, etdump
  • Double destroy is safe (idempotent)

This commit was authored with the help of Claude.

Add 13 new tests covering previously untested Module public APIs:
- Load modes: MMAP, FILE
- getMethods(): verify returns array containing "forward"
- getMethodMetadata(): verify name and backends
- readLogBuffer() / readLogBufferStatic(): verify non-null
- etdump(): verify callable
- Destroyed-state throws for getMethods, getMethodMetadata,
  readLogBuffer, etdump
- Double destroy is safe (idempotent)

This commit was authored with the help of Claude.
Copilot AI review requested due to automatic review settings April 24, 2026 22:26
@psiddh psiddh requested a review from kirklandsign as a code owner April 24, 2026 22:26
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 24, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19125

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ You can merge normally! (2 Unrelated Failures)

As of commit 7a8f8e0 with merge base b8f04aa (image):

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 24, 2026
@github-actions
Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

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.

Pull request overview

Adds Android instrumentation tests to increase coverage of the org.pytorch.executorch.Module public API and lifecycle behavior, ensuring key methods work across load modes and correctly fail after destruction.

Changes:

  • Add tests for Module.load() with LOAD_MODE_MMAP and LOAD_MODE_FILE.
  • Add tests for getMethods(), getMethodMetadata(), readLogBuffer() / readLogBufferStatic(), and etdump().
  • Add destroyed-state and idempotent-destroy tests for the above APIs.

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

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants