Repository navigation
Conversation
Running settings-core-tests directly used the real HOME and overwrote ~/.local/state/omarchy/current/theme. A static guard now exits before main() unless HOME is inside the temp dir and is not the user's home.
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.
@derekross the settings core tests write theme files under
QDir::homePath()(tests/core_tests.cpp, the look tests write~/.local/state/omarchy/current/theme).test/allpoints HOME at a temp fixture, so that's fine through the runner, but running the builtsettings-core-testsbinary by hand uses your real home. I did that on my desktop on 11-18 and it overwrote my real theme with the test values ([font] base-size=18, the test colours), which I only noticed after the next reboot when the bar and icons came up bigger.While fixing it I also found
test/allpasses the caller'sXDG_STATE_HOMEandXDG_DATA_HOMEthrough, so even the runner isn't sealed when those are set.What this does:
tests/home_guard.hruns beforemain()and exits 2 with a message pointing atpackages/omamobile-settings/test/all(ortests/all) if HOME is unset, is your real home (from passwd), contains it, or isn't inside$TMPDIR(/tmpwhen unset). A fixture inside your home is fine as long as it's under TMPDIR, so CI withTMPDIR=$RUNNER_TEMPstill works.XDG_STATE_HOME,XDG_CONFIG_HOME,XDG_DATA_HOMEandXDG_CACHE_HOME.test/allnow setsXDG_STATE_HOMEandXDG_DATA_HOMEto fixture paths too.Tested:
test/allpasses,tools/pr-check origin/mainis clean, and the path decision is two small functions I checked with a probe on made-up paths (11 cases, including equal, parent, inside home but in TMPDIR, outside TMPDIR). I never ran the binary against a real home to "prove" it. Not tested: your CI, it should pass since it usesmktemp -dunder /tmp.I didn't bump the version, leaving that to you.