Skip to content

test[DeckPickerContextMenu]: load the backend so the test can run first - #21604

Open
criticalAY wants to merge 1 commit into
ankidroid:mainfrom
criticalAY:fix/deck-picker-context-menu-backend
Open

test[DeckPickerContextMenu]: load the backend so the test can run first#21604
criticalAY wants to merge 1 commit into
ankidroid:mainfrom
criticalAY:fix/deck-picker-context-menu-backend

Conversation

@criticalAY

@criticalAY criticalAY commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Note

Assisted-by: Claude Opus 5

Purpose / Description

DeckPickerContextMenuTest does not extend RobolectricTest, so it never calls RustBackendLoader.ensureSetup(). It only passes when some test that does happens to run earlier in the same JVM. When it runs first, every one of its tests dies on:

java.lang.UnsatisfiedLinkError: 'byte[][] net.ankiweb.rsdroid.NativeMethods.openBackend(byte[])'
    at net.ankiweb.rsdroid.Backend.<init>(Backend.kt:86)
    at com.ichi2.anki.CollectionManager.getTR(CollectionManager.kt:188)
    at com.ichi2.anki.dialogs.DeckPickerContextMenu$DeckPickerContextMenuOption.label(DeckPickerContextMenu.kt:98)

Fixes

How Has This Been Tested?

CI and here:

  • ./gradlew :AnkiDroid:testPlayDebugUnitTest --tests "com.ichi2.anki.dialogs.DeckPickerContextMenuTest"

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the [Google Accessibility Scanner]

DeckPickerContextMenuTest does not extend RobolectricTest, so it never
 calls RustBackendLoader.ensureSetup(). It only passes when some test
 which does happens to run earlier in the same JVM.

Test class discovery order is filesystem dependent, so an unrelated new
 test class elsewhere in the tree can push it to the front and turn the
 macOS JUnit job red while ubuntu and windows stay green.

Loading the backend in the fixture lets it stand on its own.

Part of ankidroid#14796

Assisted-by: Claude Opus 5
@criticalAY criticalAY added the Review High Priority Request for high priority review label Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Review High Priority Request for high priority review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant