Skip to content

test: output binary size at _demo/xxx test#1589

Open
fennoai[bot] wants to merge 2 commits intomainfrom
xgopilot/issue-1588-1769415880
Open

test: output binary size at _demo/xxx test#1589
fennoai[bot] wants to merge 2 commits intomainfrom
xgopilot/issue-1588-1769415880

Conversation

@fennoai
Copy link
Copy Markdown
Contributor

@fennoai fennoai Bot commented Jan 26, 2026

Requested by @luoliwoshang

This PR fixes #1588 by adding binary size output when running .github/workflows/test_demo.sh.

Summary

  • Changed llgo run . to llgo build -o to produce persistent binaries
  • Output binary size (in KB and bytes) after each demo build
  • Collect all sizes to a file using flock for parallel execution safety
  • Output a Markdown table with all binary sizes at the end
  • Show total size summary (MB/KB)

Example Output

=== Binary Size Report ===
| Demo | Size (KB) | Size (bytes) |
|------|-----------|--------------|
| ./_demo/c/hello | 123 | 126976 |
| ./_demo/go/defer | 456 | 467968 |
...
|------|-----------|--------------|
| **Total** | **5678** | **5814272** |

Total size: 5 MB (5678 KB)

Test Plan

  • Run test_demo.sh and verify binary sizes are output
  • Verify the size report table is correctly formatted
  • Verify parallel execution works correctly with flock

- Build binaries to temp directory using `llgo build -o` instead of `llgo run`
- Output binary size after each demo build
- Collect sizes in a file (using flock for parallel safety)
- Output a Markdown table with all binary sizes at the end
- Show total size summary

Fixes #1588

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
@luoliwoshang
Copy link
Copy Markdown
Contributor

@xgopilot check

Testing ./_demo/go/readdir
Binary size: 1809 KB (1853400 bytes)
panic: Bad readdir entries go.mod/go.sum
llgo isDir[true]

[0x76C379A6 (null)+0x0, SP = 0x76c2f6cb]
[0x76C28AB8 (null)+0x0, SP = 0x76c2f6cb]
[0x0D02A1CA (null)+0x0, SP = 0x76c2f6cb]
[0x0D02A28B __libc_start_main+0x11, SP = 0x8b]
[0x76C289C5 __libc_start_main+0x11, SP = 0x8b]
FAIL

@fennoai
Copy link
Copy Markdown
Contributor Author

fennoai Bot commented Jan 26, 2026

Fix Applied

Root Cause: The _demo/go/readdir test uses a relative path ../ to read its parent directory. With the change from llgo run . to llgo build -o, the binary was being executed from the workspace root instead of from within _demo/go/readdir/, causing ../ to point to the wrong directory.

Fix: Changed the binary execution to run from the demo's source directory:

# Before
if "$bin_path"; then

# After  
if (cd "$dir" && "$bin_path"); then

This preserves the working directory context for demos that use relative paths.

Commit: ead0aad

The readdir demo uses relative paths (../), so we need to
run the binary from the same directory it was built in to
preserve the correct working directory context.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <51194195+luoliwoshang@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.01%. Comparing base (ebf66ae) to head (ead0aad).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1589   +/-   ##
=======================================
  Coverage   91.01%   91.01%           
=======================================
  Files          45       45           
  Lines       11971    11971           
=======================================
  Hits        10896    10896           
  Misses        899      899           
  Partials      176      176           

☔ 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.

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.

test: output binary size at _demo/xxx test

2 participants