Skip to content

test: stabilize sdkconfig partition offset UI test on Linux#1477

Merged
kolipakakondal merged 1 commit into
masterfrom
fix_build_linux
Jun 10, 2026
Merged

test: stabilize sdkconfig partition offset UI test on Linux#1477
kolipakakondal merged 1 commit into
masterfrom
fix_build_linux

Conversation

@kolipakakondal

@kolipakakondal kolipakakondal commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Wait for sdkconfig save to complete and use reliable hex field input so partition table offset changes persist on the self-hosted Linux runner.

Description

What the test does
NewEspressifIDFProjectSDKconfigTest (failure at line 61 → thenCheckChangesAreSaved()):

  • Creates a project and builds it
  • Opens sdkconfig, changes partition table offset 0x8000 → 0x4000, saves
  • Rebuilds
  • Reopens sdkconfig and expects offset 0x4000
  • The failure means after save + reopen, the UI still shows the default 0x8000 (or another value), not 0x4000.

Root cause (Linux GTK timing)
On Linux/GTK, SWTBot setText() on sdkconfig hex fields can be unreliable:

  • The modify listener that records changes in modifiedJsonMap may not fire consistently
  • Save can complete before the config server writes to sdkconfig
  • The test had no wait after clicking Save
  • Hex edits only update modifiedJsonMap locally until save; if the GTK event is missed, nothing is persisted.

This matches recent GTK sdkconfig editor layout fixes (f0c77e0, 8ff7e41) on the Eclipse 2026-03 platform used in CI.

Updated NewEspressifIDFProjectSDKconfigTest.java to be more reliable on Linux:

setPartitionTableOffset() — setFocus() → selectAll() → setText(), with typeText() fallback
waitForPartitionTableOffset() — polls until the UI shows the expected value
waitForOperationsInProgressToFinishSync() after save — ensures sdkconfig is written before rebuild/reopen
assertEquals with actual vs expected — clearer CI failure output

Fixes # https://github.com/espressif/idf-eclipse-plugin/actions/runs/27190770202/job/80270182500?pr=1476

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • ESP-IDF Version:
  • OS (Windows,Linux and macOS):

Dependent components impacted by this PR:

  • Component 1
  • Component 2

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • Tests
    • Refactored SDK Configuration partition table validation tests with new reusable helper methods for improved maintainability.
    • Enhanced test procedures with better wait and assertion mechanisms for offset field verification and configuration persistence checks.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kolipakakondal, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 13 minutes and 46 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6478f08-6ea9-46f2-911a-94bc604c436f

📥 Commits

Reviewing files that changed from the base of the PR and between d7b6e57 and b1875fe.

📒 Files selected for processing (1)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java
📝 Walkthrough

Walkthrough

This PR refactors partition table offset validation logic in the SDK configuration test by extracting inline UI interactions into four reusable helper methods. Existing test flows are updated to use these helpers, improving test maintainability and reducing duplication across verification and save-flow validation steps.

Changes

SDK Config Test Refactoring

Layer / File(s) Summary
Import updates and partition table helper methods
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java
Updated imports to include assertEquals and SWTBot types (DefaultCondition, SWTBotText) needed by the new helpers. Added four helper methods: openPartitionTableSettings(), setPartitionTableOffset(), waitForPartitionTableOffset(), and assertPartitionTableOffset() to encapsulate partition table UI interactions and offset value validation.
Test method refactoring to use helpers
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java
Refactored test flows to use the new partition table helpers for both initial content verification and edit validation. Updated "check changes are saved" flow to use the shared open/wait/assert helpers for 0x4000 offset verification instead of inline assertions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • espressif/idf-eclipse-plugin#1123: Both PRs modify the SWTBot-based NewEspressifIDFProjectSDKconfigTest workflow around opening/editing/saving SDKconfig, with the main PR specifically refactoring the partition table offset UI assertions used in that same test.
  • espressif/idf-eclipse-plugin#1131: Both PRs modify the SWTBot SDK configuration workflow in NewEspressifIDFProjectSDKconfigTest, with the main PR refactoring the partition-table editing and save-flow validation, while the retrieved PR updates SDK config tab waiting and adjusts edit/save steps with refresh/build helpers.

Suggested reviewers

  • alirana01
  • AndriiFilippov

Poem

🐰 Helpers hop and partition tables gleam,
No more inline assertions in the test stream!
Four methods extract what was tangled before,
Now offset checks dance across every door.
Maintainability hops with a UI-ful cheer!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: stabilizing a flaky sdkconfig partition offset UI test on Linux by introducing helper methods for reliable SWTBot interactions with polling and verification.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix_build_linux

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java (1)

175-176: ⚡ Quick win

Extract the offset field label into a single constant.

"Offset of partition table (hex)" is repeated across three helpers. One UI label change will break multiple call sites independently.

Proposed refactor
+       private static final String PARTITION_OFFSET_LABEL = "Offset of partition table (hex)";
...
-           SWTBotText offsetField = bot.textWithLabel("Offset of partition table (hex)");
+           SWTBotText offsetField = bot.textWithLabel(PARTITION_OFFSET_LABEL);
...
-                   return bot.textWithLabel("Offset of partition table (hex)").getText()
+                   return bot.textWithLabel(PARTITION_OFFSET_LABEL).getText()
                            .equalsIgnoreCase(hexValue);
...
-           String actual = bot.textWithLabel("Offset of partition table (hex)").getText();
+           String actual = bot.textWithLabel(PARTITION_OFFSET_LABEL).getText();

Also applies to: 197-198, 211-213

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java`
around lines 175 - 176, Extract the repeated UI label into a single class-level
constant in NewEspressifIDFProjectSDKconfigTest (e.g., private static final
String OFFSET_PARTITION_TABLE_LABEL = "Offset of partition table (hex)"); then
replace the literal string used in all bot.textWithLabel(...) calls (the
occurrences that create SWTBotText offsetField and similar helper calls) with
this constant so a single change to the label updates every call site.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java`:
- Around line 173-188: In setPartitionTableOffset, always use user-like typing
instead of setText: find the SWTBotText offsetField (variable offsetField) and
replace the primary write path (offsetField.setText(hexValue)) with
offsetField.selectAll() followed by offsetField.typeText(hexValue), keeping the
existing focus/selectAll and bot.sleep calls and leaving the fallback
check/remove of setText entirely; ensure you still retain the existing getText()
check only if you want to verify, but do not rely on setText to persist the
value—use selectAll()+typeText(hexValue) as the canonical write operation for
offsetField in the setPartitionTableOffset method.

---

Nitpick comments:
In
`@tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java`:
- Around line 175-176: Extract the repeated UI label into a single class-level
constant in NewEspressifIDFProjectSDKconfigTest (e.g., private static final
String OFFSET_PARTITION_TABLE_LABEL = "Offset of partition table (hex)"); then
replace the literal string used in all bot.textWithLabel(...) calls (the
occurrences that create SWTBotText offsetField and similar helper calls) with
this constant so a single change to the label updates every call site.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 55b17fbc-ddc6-4ebd-8061-a1ffe8775a1e

📥 Commits

Reviewing files that changed from the base of the PR and between 68bce8d and d7b6e57.

📒 Files selected for processing (1)
  • tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java

Comment on lines +173 to +188
private static void setPartitionTableOffset(String hexValue)
{
SWTBotText offsetField = bot.textWithLabel("Offset of partition table (hex)");
offsetField.setFocus();
offsetField.selectAll();
offsetField.setText(hexValue);
bot.sleep(500);

if (!offsetField.getText().equalsIgnoreCase(hexValue))
{
offsetField.setFocus();
offsetField.selectAll();
offsetField.typeText(hexValue);
bot.sleep(500);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

In SWTBot on Linux/GTK, does SWTBotText#setText(...) reliably trigger ModifyListeners for text fields, and is selectAll()+typeText(...) the recommended approach for listener-driven UI updates?

💡 Result:

In SWTBot, the method SWTBotText#setText(String) does not reliably trigger ModifyListeners on all platforms, including Linux/GTK [1]. Because it often updates the widget's text property directly (frequently using syncExec to set the widget value), it bypasses the native UI events that would typically fire a ModifyListener [1]. Using selectAll followed by typeText(String) is the recommended approach if your goal is to trigger listener-driven UI updates [2]. This sequence mimics actual user interaction by selecting the existing text and typing the new input, which forces the underlying SWT Text widget to process standard key events and trigger associated ModifyListeners as a user would [2]. While typeText is more realistic for testing UI behavior triggered by input events, it can be slower and occasionally inconsistent depending on focus or platform-specific GTK behavior [3][2]. If you do not require ModifyListener execution, setText remains the faster, more direct way to populate fields.

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java"
nl -ba "$FILE" | sed -n '150,210p'

Repository: espressif/idf-eclipse-plugin

Length of output: 115


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java"
awk 'NR>=150 && NR<=210 {printf "%d\t%s\n", NR, $0}' "$FILE"

Repository: espressif/idf-eclipse-plugin

Length of output: 2165


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java"
rg -n "setPartitionTableOffset\\(|waitForPartitionTableOffset\\(|click\\(\\)|Save|Menu Config|TestWidgetWaitUtility\\.waitForOperationsInProgressToFinishSync" "$FILE" || true

Repository: espressif/idf-eclipse-plugin

Length of output: 1442


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java"
awk 'NR>=80 && NR<=170 {printf "%d\t%s\n", NR, $0}' "$FILE"
echo "----"
awk 'NR>=200 && NR<=270 {printf "%d\t%s\n", NR, $0}' "$FILE"

Repository: espressif/idf-eclipse-plugin

Length of output: 6487


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java"
awk 'NR>=80 && NR<=170 {printf "%d\t%s\n", NR, $0}' "$FILE"
echo "----"
awk 'NR>=200 && NR<=270 {printf "%d\t%s\n", NR, $0}' "$FILE"

Repository: espressif/idf-eclipse-plugin

Length of output: 6487


Use user-like typing (selectAll + typeText) as the primary write path in setPartitionTableOffset

setPartitionTableOffset uses offsetField.setText(hexValue) first and only falls back to typeText when the displayed text doesn’t match. On SWTBot Linux/GTK, setText(...) can bypass native input/ModifyListener behavior, so the underlying persisted value can stay stale even when offsetField.getText() already equals the expected hex—leading to intermittent failures in the later save/reopen assertions. Prefer always doing selectAll() + typeText(hexValue) for this field.

[done]

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/NewEspressifIDFProjectSDKconfigTest.java`
around lines 173 - 188, In setPartitionTableOffset, always use user-like typing
instead of setText: find the SWTBotText offsetField (variable offsetField) and
replace the primary write path (offsetField.setText(hexValue)) with
offsetField.selectAll() followed by offsetField.typeText(hexValue), keeping the
existing focus/selectAll and bot.sleep calls and leaving the fallback
check/remove of setText entirely; ensure you still retain the existing getText()
check only if you want to verify, but do not rely on setText to persist the
value—use selectAll()+typeText(hexValue) as the canonical write operation for
offsetField in the setPartitionTableOffset method.

Wait for sdkconfig save to complete and use reliable hex field input so
partition table offset changes persist on the self-hosted Linux runner.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kolipakakondal kolipakakondal merged commit f2f8aef into master Jun 10, 2026
7 checks passed
@kolipakakondal kolipakakondal deleted the fix_build_linux branch June 10, 2026 06:29
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.

1 participant