Skip to content

[test] Check LLVM and Binaryen versions when rebaselining codesize tests - #28053

Merged
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:rebaseline-check-versions
Oct 22, 2026
Merged

sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:rebaseline-check-versions

Conversation

@sbc100

@sbc100 sbc100 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

When running codesize tests with --rebaseline, check that the active LLVM and Binaryen revisions match the revisions specified by test/emsdk_version.txt via emscripten-releases.

This should help prevent confusion when folks get a different results locally to the CI

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces revision verification for LLVM and Binaryen during rebaselining in test_codesize.py by extracting dependency-fetching logic into a reusable get_deps_revisions function in sync_deps.py. Feedback suggests refactoring the verification logic from __init__ to setUpClass to prevent issues during test discovery, wrapping the network call in a try-except block for offline resilience, and making the revision comparison more robust to support short SHAs.

Comment thread test/test_codesize.py Outdated
@sbc100
sbc100 force-pushed the rebaseline-check-versions branch from 2ad29f9 to b1f0e13 Compare October 22, 2026 22:08
@sbc100
sbc100 requested review from dschuff and kripken October 22, 2026 22:09
@kripken

kripken commented Oct 22, 2026

Copy link
Copy Markdown
Member

Maybe I'm missing something, but this is just the official version, correct? But we update between versions and changes happen all the time. The commit that happens to update the official version is not special?

@sbc100

sbc100 commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Maybe I'm missing something, but this is just the official version, correct? But we update between versions and changes happen all the time. The commit that happens to update the official version is not special?

Its not really an "official" version but just the current blessed version that all codesize tests are reported against.

If you try to rebaseline against a different version then CI will for sure fail. This early error means that contributors won't get frustrated when trying to match the code size expectations with the CI machines (Which always pin to this version)

@sbc100

sbc100 commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Any commit that updates the official/blessed version will also need to be accompanied by the corresponding codesize changes.

@kripken

kripken commented Oct 22, 2026

Copy link
Copy Markdown
Member

But the CI machines pin to a git revision, while this checks wasm-opt --version which is 130, 131, etc and changes rarely? Or am I reading this code wrong? The --version changes so rarely that I wonder if this is helpful?

@sbc100

sbc100 commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

But the CI machines pin to a git revision, while this checks wasm-opt --version which is 130, 131, etc and changes rarely? Or am I reading this code wrong? The --version changes so rarely that I wonder if this is helpful?

$ ../binaryen-out/bin/wasm-opt --version
wasm-opt version 133 (version_133-96-ga631c1445)

Here we are grabbing the a631c1445 part which is a git commit.

@kripken kripken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, now I see.

Comment thread test/test_codesize.py Outdated
When running `codesize` tests with `--rebaseline`, check that the active
LLVM and Binaryen revisions match the revisions specified by
`test/emsdk_version.txt` via `emscripten-releases`.
@sbc100
sbc100 force-pushed the rebaseline-check-versions branch from b1f0e13 to 710c160 Compare October 22, 2026 23:45
@sbc100
sbc100 merged commit 96abee1 into emscripten-core:main Oct 22, 2026
17 of 24 checks passed
@sbc100
sbc100 deleted the rebaseline-check-versions branch October 22, 2026 23:51
sbc100 added a commit to WebAssembly/binaryen that referenced this pull request Oct 23, 2026
Previously `git describe` was only executed when configuring CMake, so
switching git revisions and running an incremental build left
`PROJECT_VERSION` (and `--version` output) stale unless CMake happened
to re-run.

This change (or something like this) is needed to make the version check
in emscripten-core/emscripten#28053 work. Right
now `--version` lies which is not great.

Inspired by LLVM's `GenerateVersionFromVCS.cmake` / `VCSRevision.h`
setup, move `config.h` generation into `scripts/gen-version.cmake` and
wire it up via `add_custom_command` depending on `.git/logs/HEAD`.

Because `configure_file` only updates `config.h`'s timestamp when its
contents actually change, and only `src/support/command-line.cpp`
includes `config.h`, incremental rebuilds only recompile that single
file when `HEAD` changes. `config.h` is also still generated at
configure time so tools like `clang-tidy` that run before a build can
find it.
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