Make stateful regression tests self-contained - #7401
Closed
mdenesfe wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Improves reliability of shell-based tests by resetting captured output between assertions and tightening matching to avoid false positives.
Changes:
- Truncate the powerprofiles call log before running commands so
tail -n 1always inspects the current invocation. - Clear the Hyprctl eval output file before a scaling run to avoid reading stale output.
- Make the monitor-scaling assertion match the full expected eval line (exact match).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| test/shell.d/powerprofiles-set-test.sh | Clears the call log before each invocation to make tail-based assertions deterministic. |
| test/shell.d/monitor-scaling-test.sh | Clears eval output between runs and uses a stricter grep to validate the exact emitted monitor command. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| export POWERPROFILES_LOG="$tmp_dir/calls" | ||
| export OMARCHY_POWERPROFILES_STATE_DIR="$tmp_dir/state" | ||
|
|
||
| : >"$POWERPROFILES_LOG" |
| [[ $(tail -n 1 "$tmp_dir/calls") == "balanced" ]] || fail "power profile applies selected AC preference" | ||
| pass "power profile stores and applies AC preference" | ||
|
|
||
| : >"$POWERPROFILES_LOG" |
| [[ $(<"$tmp_dir/state/battery") == "performance" ]] || fail "power profile stores battery preference" | ||
| pass "power profile stores battery preference separately" | ||
|
|
||
| : >"$POWERPROFILES_LOG" |
| [[ $(tail -n 1 "$tmp_dir/calls") == "balanced" ]] || fail "battery preference does not replace AC preference" | ||
| pass "power profile keeps AC and battery preferences separate" | ||
|
|
||
| : >"$POWERPROFILES_LOG" |
| pass "power profile autodetect restores battery preference" | ||
|
|
||
| rm "$tmp_dir/state/ac" | ||
| : >"$POWERPROFILES_LOG" |
| pass "power profile retains performance as AC default" | ||
|
|
||
| "$ROOT/bin/omarchy-powerprofiles-set" ac power-saver | ||
| : >"$POWERPROFILES_LOG" |
| pass "monitor scaling down recovers 3x to 2x" | ||
|
|
||
| write_monitor_config | ||
| : >"$eval_out" |
| : >"$eval_out" | ||
| OMARCHY_TEST_MONITOR_SCALE=3.0000000000000004 run_scaling down | ||
| grep -F 'scale = 2' "$eval_out" >/dev/null || fail "monitor scaling down snaps floating point 3x to 2x" | ||
| grep -Fx 'hl.monitor({ output = "eDP-1", mode = "2880x1800@120.0", position = "auto", scale = 2 })' "$eval_out" >/dev/null || |
Author
|
Closing because this PR was accidentally opened from the fork's quattro branch. Superseded by #7402 |
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 #7121.
Two stateful regression checks could pass using output produced by an earlier test case.
The monitor scaling test now clears the previous Hyprland evaluation output and verifies the complete command generated by the floating-point scaling case.
The power profile tests now clear their call log before each command under test, ensuring every assertion observes a call produced by that specific scenario.
Tested with:
bash test/shell.d/monitor-scaling-test.shgit diff --checkThe power profile test requires the project's Bash 5/GNU environment and cannot run fully under macOS's system Bash 3.2.