Skip to content

[mmu probing] Add UT for lower bound upper_bound=1 edge case#24356

Open
yyynini wants to merge 1 commit intosonic-net:masterfrom
yyynini:ut/lower-bound-upper-bound-one
Open

[mmu probing] Add UT for lower bound upper_bound=1 edge case#24356
yyynini wants to merge 1 commit intosonic-net:masterfrom
yyynini:ut/lower-bound-upper-bound-one

Conversation

@yyynini
Copy link
Copy Markdown
Contributor

@yyynini yyynini commented May 1, 2026

Description of PR

Add unit test verifying LowerBoundProbingAlgorithm behavior when upper_bound=1.

Problem: When upper_bound=1, the start value (upper_bound//2) is 0, which falls below the loop guard (current >= 1). The while loop never executes, and the algorithm falls through to the max_iterations error path returning (None, phase_time). No existing test covers this edge case.

Test added: test_run_upper_bound_one_skips_loop (order 8360) - verifies no executor.check calls are made and the algorithm correctly reports max_iterations exceeded.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
  • Test case improvement

Approach

What is the motivation for this PR?

Coverage gap: no test validates behavior when upper_bound=1 causes the initial current to be 0.

How did you do it?

Added 1 unit test to test_lower_bound_probing_algorithm.py

How did you verify/test it?

Test passes against current implementation (loop guard prevents execution, falls through to error path).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

When upper_bound=1, start value (upper_bound//2) is 0, which falls below
the loop guard (current >= 1). The loop never executes and the algorithm
falls through to the max_iterations error path. This test verifies that
edge case behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Yawen Ni <yawenni@microsoft.com>
@yyynini yyynini force-pushed the ut/lower-bound-upper-bound-one branch from dbb4e15 to 241116e Compare May 1, 2026 04:21
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

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.

2 participants