Skip to content

Make stateful regression tests self-contained - #7401

Closed
mdenesfe wants to merge 1 commit into
basecamp:quattrofrom
mdenesfe:quattro
Closed

Make stateful regression tests self-contained#7401
mdenesfe wants to merge 1 commit into
basecamp:quattrofrom
mdenesfe:quattro

Conversation

@mdenesfe

Copy link
Copy Markdown

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.sh
  • Bash syntax checks for both changed tests
  • git diff --check

The power profile test requires the project's Bash 5/GNU environment and cannot run fully under macOS's system Bash 3.2.

Copilot AI balanced review requested due to automatic review settings August 18, 2026 16:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 1 always 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 ||
@mdenesfe

mdenesfe commented Aug 18, 2026

Copy link
Copy Markdown
Author

Closing because this PR was accidentally opened from the fork's quattro branch. Superseded by #7402

@mdenesfe mdenesfe closed this Aug 18, 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.

Two test assertions read state they did not produce, so a no-op passes

2 participants