Skip to content

[android] Fix TrainingModuleE2ETest missing-file assertions - #23480

Open
ricardoasouz wants to merge 1 commit into
pytorch:mainfrom
ricardoasouz:fix/training-test-messages
Open

ricardoasouz wants to merge 1 commit into
pytorch:mainfrom
ricardoasouz:fix/training-test-messages

Conversation

@ricardoasouz

@ricardoasouz ricardoasouz commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

testMissingPteFile and testMissingPtdFile fail on main. TrainingModule.load validates paths with ExecuTorchRuntime.validateFilePath, which throws Cannot load model path: path does not exist: <path> (and the same for the data path), but the tests still expect the old Cannot load model path!! <path> and Cannot load data path!! <path> messages, which #17648 removed.

The assertions also passed exception.message as the expected value, so the JUnit failure showed the two strings swapped. This updates the expected messages and passes the arguments as (expected, actual).

Found while validating #22959.

Test plan

On an x86_64 emulator (API 30), with the native library built from this branch:

./gradlew :executorch_android:connectedDebugAndroidTest \
  -Pandroid.testInstrumentationRunnerArguments.class=org.pytorch.executorch.training.TrainingModuleE2ETest

All 4 tests pass. Without this change, testMissingPteFile and testMissingPtdFile fail with a message mismatch.

cc @kirklandsign @cbilgin @nil-is-all

@pytorch-bot

pytorch-bot Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⚠️ 16 Awaiting Approval

As of commit 0efadb5 with merge base e0015e1 (image):

AWAITING APPROVAL - The following workflows need approval before CI can run:

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 Oct 6, 2026
@ricardoasouz

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot Bot added the release notes: none Do not include this in the release notes label Oct 6, 2026
@executorch-triage executorch-triage Bot added the community: contribution PRs coming from community (excluding hardware partners) label Oct 6, 2026
@kirklandsign

Copy link
Copy Markdown
Contributor

@claude review

@claude

claude Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Claude finished @kirklandsign's task in 58s —— View job


This fix is correct and I found no issues. Both expected messages now match what ExecuTorchRuntime.validateFilePath actually throws, and the arguments are in JUnit's (expected, actual) order. Approve.

Detailed review

PR Review: #23480

Summary

The PR updates the expected messages in testMissingPteFile and testMissingPtdFile to match the current validateFilePath output, and passes assertEquals its arguments as (expected, actual). I found no issues.

  • TrainingModule.load calls validateFilePath(modelPath, "model path") and validateFilePath(dataPath, "data path") (TrainingModule.kt:126-127, :140). When a file is missing, that produces "Cannot load <description>: path does not exist: <path>" (ExecuTorchRuntime.kt:46). This is exactly the new expected string in both tests.
  • In testMissingPtdFile, xor.pte is copied to disk before load is called. So the model-path check passes and the data-path check throws, which means the test exercises the path it means to.
  • There are no other "!! " messages left anywhere under extension/android, so no other test is stuck on the old message format.

Testing

  • Optional: both tests still use assertThrows(RuntimeException::class.java). validateFilePath documents and throws IllegalArgumentException, so narrowing to that type would make the tests stricter. It isn't required for this fix.

Recommendation

Approve. Nothing blocks merging.

@nil-is-all nil-is-all added the module: android Issues related to Android code, build, and execution label Oct 6, 2026
@nil-is-all

Copy link
Copy Markdown
Contributor

@ricardoasouz PR looks good, once the branch is updated up-to-date we can approve & merge.

@ricardoasouz
ricardoasouz force-pushed the fix/training-test-messages branch from 2fc4d7d to ba49d41 Compare October 12, 2026 19:46
@ricardoasouz

Copy link
Copy Markdown
Contributor Author

@ricardoasouz PR looks good, once the branch is updated up-to-date we can approve & merge.

Thanks @nil-is-all! I've rebased the branch onto the latest main.

TrainingModule checks paths with ExecuTorchRuntime.validateFilePath
since pytorch#17648, so the "!!" messages these two tests expect are never
produced and both tests fail. Expect the current messages and pass
the assertEquals arguments as (expected, actual).

Signed-off-by: Ricardo Alves de Souza <ricardoasouz@hotmail.com>
@ricardoasouz
ricardoasouz force-pushed the fix/training-test-messages branch from ba49d41 to 0efadb5 Compare November 8, 2026 00:08
@ricardoasouz

Copy link
Copy Markdown
Contributor Author

Hi @nil-is-all and @kirklandsign,

I've rebased this PR onto the latest main and force-pushed the updated commit (0efadb5dbe).

I also rebuilt the Android x86_64 native library and reran TrainingModuleE2ETest on an API 30 emulator. All 4 tests passed, and the working tree is clean.

The PR is currently showing 16 workflows awaiting maintainer approval, including the required checks.

Could you please approve the pending workflows when convenient?

Thanks for your time and review!

This branch has not been deployed

No deployments
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. community: contribution PRs coming from community (excluding hardware partners) module: android Issues related to Android code, build, and execution release notes: none Do not include this in the release notes

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants