Merged
Conversation
If RMW_FAKE_HOME is ever unset mid-script, rmw falls back to $HOME. Override HOME in the meson test environment so that fallback still lands in the sandbox rather than the real home directory. test_media_root.sh is excluded from the HOME override since it intentionally unsets RMW_FAKE_HOME to exercise real-home behavior; it skips automatically on machines without the expected mount point. Closes #519 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The old test only ran on Andy's workstation (hardcoded /mnt/918375c2 mount point and /home/andy paths). The new approach: - Compares the device ID of /tmp with $HOME using stat - Skips if they are on the same device (test condition not met) - Otherwise uses /tmp as the simulated removable media root - Creates a temporary rmw config and waste folder under /tmp - Verifies the trashinfo Path is relative per FreeDesktop Trash spec - Cleans up after itself This makes the test portable and runnable on any system where /tmp is on a separate device (e.g. tmpfs on Linux CI runners). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
stat flag syntax differs between GNU (-c) and BSD/macOS (-f), making the previous approach unreliable. Hard links only succeed within the same filesystem, so attempting ln across /tmp and $HOME gives a portable, unambiguous cross-device check on Linux, macOS, and FreeBSD. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Containers and macOS often have /tmp on the root filesystem, in which case rmw correctly writes an absolute path (not a topdir relative path). Use 'df -P' to check the mount point; skip silently if /tmp is not its own top-level mount rather than failing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
awk is not available in all CI containers. /proc/mounts is a standard Linux procfs file with no external tool dependencies; grep on its second field reliably detects whether /tmp is its own top-level mount point. On macOS/BSD where /proc/mounts does not exist the grep exits non-zero and the test skips silently. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Set XDG_DATA_HOME and XDG_CONFIG_HOME in the meson test environment so rmw cannot accidentally read/write the real user's XDG dirs during tests. Add a trap in test_media_root.sh to clean up /tmp dirs on failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
shellcheck cannot see that cleanup() is called indirectly via trap. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #519