Skip to content

fix(esp32): stabilize emulator print stream and re-enable cabi demo#1715

Draft
luoliwoshang wants to merge 2 commits intogoplus:mainfrom
luoliwoshang:feat/esp32-emulator-ignore-refresh
Draft

fix(esp32): stabilize emulator print stream and re-enable cabi demo#1715
luoliwoshang wants to merge 2 commits intogoplus:mainfrom
luoliwoshang:feat/esp32-emulator-ignore-refresh

Conversation

@luoliwoshang
Copy link
Member

@luoliwoshang luoliwoshang commented Mar 13, 2026

Summary

  • add an esp-specific baremetal stdio binding that prefers newlib default streams via _impure_ptr and keeps fopen as fallback
  • route runtime print/println through a configurable stream and, on baremetal && esp, switch to stdout plus %.*s string emission to avoid the fwrite(stderr)+float crash pattern
  • remove ./_demo/c/cabi from ignore_esp32c3_basic so CI validates it again

Validation

  • go install ./cmd/llgo
  • cd _demo/go/complex && llgo run -target esp32c3-basic -emulator .
  • cd _demo/c/cabi && llgo run -target esp32c3-basic -emulator .

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces support for the ESP32 embedded target within the project's testing framework. It establishes a baseline for the ESP32 emulator by configuring which tests should be ignored due to known failures or timeouts, ensuring that the test suite can run effectively on this new target while acknowledging current limitations.

Highlights

  • ESP32 Target Integration: The ESP32 embedded target has been integrated into the test workflow, including updates to .github/workflows/test_demo.sh (as mentioned in the PR body).
  • Test Baseline Management: An ESP32-specific ignore list has been added, detailing reasons for demo scan failures or timeouts for various test cases.
  • Compiler Test Configuration: The cl/compile_test.go file was updated to include the ESP32 target configuration, complete with suite-level ignore lists and explanatory comments for each ignored test.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • cl/compile_test.go
    • Added a new embedTargetConfig entry for the "esp32" target.
    • Populated the ignoreByDir map for "esp32" with specific test cases and reasons for ignoring them across _testgo, _testlibc, _testrt, and _testdata directories.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/test_demo.sh
Activity
  • No human activity (comments, reviews, progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds test ignore baselines for the esp32 target by adding a new configuration block in cl/compile_test.go. The new configuration lists tests that are currently failing or timing out. The change follows an existing pattern, but there is an opportunity to improve the maintainability of this configuration by reducing data redundancy. I've added a comment with a suggestion for a future refactoring.

ignoreByDir: map[string][]string{
"./_testgo": {
"./_testgo/abimethod", // panic: internal/bytealg selected .s files require plan9asm translation
"./_testgo/alias", // unexpected output
Copy link
Contributor

Choose a reason for hiding this comment

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

The // unexpected output comments here (and on ~9 other entries) are less informative than the esp32c3-basic equivalents. For example, esp32c3-basic annotates sigsegv as // unexpected output: got "0/main", expected recover nil-pointer message and tpfunc as // unexpected output: type size mismatch (got 8 4 4, expected 16 8 8).

Adding a brief note on what was unexpected would make future triage significantly easier without needing to re-run each test.

"./_testrt/complex", // unexpected output
"./_testrt/fprintf", // link error: ld.lld undefined symbol __stderrp
"./_testrt/hello", // panic: cannot build SSA for packages
"./_testrt/len", // panic: runtime index out of range
Copy link
Contributor

Choose a reason for hiding this comment

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

The reason // panic: runtime index out of range is ambiguous — is this a compile-time panic in llgo itself or a runtime panic from the emulator? The same tests on esp32c3-basic are categorized as fast fail: build constraints exclude all Go files, suggesting a different failure stage. Consider clarifying, e.g. // llgo panic: runtime index out of range or // emulator runtime panic: index out of range.

},
"./_testlibc": {
"./_testlibc/atomic", // unexpected output
"./_testlibc/demangle", // link error: ld.lld unknown argument -Wl,-search_paths_first
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: the link error comment format differs from the existing esp32c3-basic entries. For example, esp32c3-basic uses link error: ld.lld: error: unknown argument '-Wl,-search_paths_first' while this uses link error: ld.lld unknown argument -Wl,-search_paths_first. Consider adopting the same ld.lld: error: format for consistency and easier grepping across targets.

@xgopilot
Copy link
Contributor

xgopilot bot commented Mar 13, 2026

Overall this is solid test infrastructure work. The per-entry reason comments are a great improvement over the existing esp32c3-basic list (which lacks comments on most entries). The structure follows established patterns well, and there are no security or performance concerns.

Main suggestion: the // unexpected output comments (10 entries) would benefit from brief details on what was unexpected, matching the more descriptive style used in the esp32c3-basic target. See inline comments for specifics.

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.15%. Comparing base (1398fa6) to head (81e2f40).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1715   +/-   ##
=======================================
  Coverage   93.15%   93.15%           
=======================================
  Files          48       48           
  Lines       13350    13350           
=======================================
  Hits        12436    12436           
  Misses        727      727           
  Partials      187      187           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@luoliwoshang luoliwoshang force-pushed the feat/esp32-emulator-ignore-refresh branch from c15b716 to 8e50a55 Compare March 16, 2026 03:12
@luoliwoshang luoliwoshang marked this pull request as draft March 16, 2026 12:18
@luoliwoshang luoliwoshang changed the title test(embed): add esp32 emulator ignore baselines fix(esp32): stabilize emulator print stream and re-enable cabi demo Mar 16, 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.

1 participant