Skip to content

tests: Added test to keep canonical root at the correct location#1144

Open
unbelievableflavour wants to merge 1 commit intoutkarshdalal:masterfrom
unbelievableflavour:canonical-root-test
Open

tests: Added test to keep canonical root at the correct location#1144
unbelievableflavour wants to merge 1 commit intoutkarshdalal:masterfrom
unbelievableflavour:canonical-root-test

Conversation

@unbelievableflavour
Copy link
Copy Markdown
Contributor

@unbelievableflavour unbelievableflavour commented Apr 8, 2026

Description

It's very important this drive dir does not shift. I've implemented a fix earlier. And adding a test now to keep it this way.


Summary by cubic

Add a Robolectric test for WineUtils.createDosdevicesSymlinks to ensure the Z: drive uses the canonical ImageFs root so the drive dir doesn’t shift. Also verifies the C: drive symlink points to ../drive_c under .wine/dosdevices.

Written for commit b0adee8. Summary will update on new commits.

Summary by CodeRabbit

  • Tests
    • Added a test that verifies DOS-device symlink creation uses the expected targets and correctly handles non-canonical filesystem roots.
    • Ensures symlink creation is exercised safely using mocks (no real symlinks are created) and that temporary filesystem state is cleaned up after each run.

@unbelievableflavour unbelievableflavour changed the title Added test to keep canonical root at the correct location [Tests] Added test to keep canonical root at the correct location Apr 8, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8e2128f0-06de-4161-853f-9bb7e40efd0d

📥 Commits

Reviewing files that changed from the base of the PR and between fed79f1 and b0adee8.

📒 Files selected for processing (1)
  • app/src/test/java/com/winlator/core/WineUtilsTest.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/test/java/com/winlator/core/WineUtilsTest.kt

📝 Walkthrough

Walkthrough

Adds a Robolectric unit test verifying WineUtils.createDosdevicesSymlinks(context, container) creates expected DOS device symlinks and that the Z: symlink uses the canonicalized ImageFs.rootDir; uses mocked ImageFs, stubbed FileUtils.symlink, and a temporary .wine/dosdevices layout.

Changes

Cohort / File(s) Summary
WineUtils test
app/src/test/java/com/winlator/core/WineUtilsTest.kt
New Robolectric unit test: sets up Android Context, mocks ImageFs.find(context) to return a non-canonical rootDir, stubs FileUtils.symlink, creates a temporary .wine/dosdevices layout, invokes WineUtils.createDosdevicesSymlinks(...), verifies FileUtils.symlink calls for c: and z: (Z: uses canonicalized root), and cleans up mocks/temp files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐇 I hopped through temp dirs bright,
Mocked roots that hid from sight,
C: found its home in wine,
Z: now points to truth — canonical line,
Tests green, I nibble a bite.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description explains the purpose and context, but is missing the checklist items required by the template. Complete the checklist section by checking off the three items or explaining why they cannot be completed.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: adding a test to ensure the canonical root stays at the correct location.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
app/src/test/java/com/winlator/core/WineUtilsTest.kt (1)

50-51: Optional: The drives mock may be redundant.

Since drivesIterator() returns an empty list, the drives property mock at line 50 is likely never accessed by the production code. Consider removing it for clarity, or keep it if it documents the container's expected state.

♻️ Suggested simplification
         every { container.rootDir } returns rootDir
-        every { container.drives } returns "D:/downloads;E:/storage"
         every { container.drivesIterator() } returns emptyList<Array<String>>()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/src/test/java/com/winlator/core/WineUtilsTest.kt` around lines 50 - 51,
The test currently stubs both container.drives and container.drivesIterator(),
but container.drivesIterator() is configured to return an empty list so
container.drives is likely never used; remove the redundant every {
container.drives } returns "D:/downloads;E:/storage" mock (or alternatively keep
it only as documentation) and leave every { container.drivesIterator() } returns
emptyList<Array<String>>() as the single behavior to simplify the test and avoid
dead mocks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@app/src/test/java/com/winlator/core/WineUtilsTest.kt`:
- Around line 50-51: The test currently stubs both container.drives and
container.drivesIterator(), but container.drivesIterator() is configured to
return an empty list so container.drives is likely never used; remove the
redundant every { container.drives } returns "D:/downloads;E:/storage" mock (or
alternatively keep it only as documentation) and leave every {
container.drivesIterator() } returns emptyList<Array<String>>() as the single
behavior to simplify the test and avoid dead mocks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3b68485a-7ad0-4c65-90d1-303108a94703

📥 Commits

Reviewing files that changed from the base of the PR and between 24508c2 and 393465e.

📒 Files selected for processing (1)
  • app/src/test/java/com/winlator/core/WineUtilsTest.kt

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@unbelievableflavour unbelievableflavour changed the title [Tests] Added test to keep canonical root at the correct location tests: Added test to keep canonical root at the correct location Apr 8, 2026
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.

1 participant