Skip to content

Commit

Permalink
Add some minimal testing with LLVM stable (v19)
Browse files Browse the repository at this point in the history
Fixes: #11362
  • Loading branch information
sbc100 committed Jan 6, 2025
1 parent 512e600 commit 208a081
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 58 deletions.
84 changes: 28 additions & 56 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,32 @@ jobs:
core2.test_exceptions_wasm
core2.test_pthread_unhandledrejection"
- upload-test-results
test-llvm-stable:
executor: focal
environment:
LANG: "C.UTF-8"
EMTEST_SKIP_V8: "1"
steps:
- run:
name: install llvm
command: |
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-19 main" >> /etc/apt/sources.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
apt-get update
apt-get install -q -y clang-19
- checkout
- run:
name: submodule update
command: git submodule update --init
- pip-install
- install-emsdk
- install-rust
- run:
name: configure LLVM
command: echo "LLVM_ROOT='/usr/lib/llvm-19/bin'" >> ~/emsdk/.emscripten
- run: apt-get install -q -y ninja-build scons ccache
- run-tests:
test_targets: "core0.test_hello_world"
test-other:
executor: focal
environment:
Expand Down Expand Up @@ -979,59 +1005,5 @@ jobs:
workflows:
build-test:
jobs:
- ruff
- mypy
- eslint
- build-docs
- build-linux
- test-sanity:
requires:
- build-linux
- test-posixtest:
requires:
- build-linux
- test-core0:
requires:
- build-linux
- test-core2:
requires:
- build-linux
- test-core3:
requires:
- build-linux
- test-wasm64:
requires:
- build-linux
- test-wasm64-4gb:
requires:
- build-linux
- test-wasm2js1:
requires:
- build-linux
- test-other:
requires:
- build-linux
- test-browser-chrome:
requires:
- build-linux
- test-browser-chrome-2gb:
requires:
- build-linux
- test-browser-chrome-wasm64:
requires:
- build-linux
- test-browser-chrome-wasm64-4gb:
requires:
- build-linux
- test-browser-firefox:
requires:
- build-linux
- test-browser-firefox-wasm64
- test-sockets-chrome:
requires:
- build-linux
- test-jsc
- test-spidermonkey
- test-node-compat
- test-windows
- test-mac-arm64
- test-llvm-stable

8 changes: 8 additions & 0 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,14 @@ def get_clang_flags(user_args):
if '-mbulk-memory' not in user_args:
flags.append('-mbulk-memory')

if shared.is_llvm_stable():
# LLVM 19 doesn't enable these features by default, but we want
# them on-by-default, like they are on LLVM tot.
if '-mbulk-memory' not in user_args:
flags.append('-mbulk-memory')
if '-mnontrapping-fptoint' not in user_args:
flags.append('-mnontrapping-fptoint')

if settings.RELOCATABLE and '-fPIC' not in user_args:
flags.append('-fPIC')

Expand Down
10 changes: 8 additions & 2 deletions tools/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
# This version currently matches the node version that we ship with emsdk
# which means that we can say for sure that this version is well supported.
MINIMUM_NODE_VERSION = (16, 20, 0)
EXPECTED_LLVM_STABLE_VERSION = 19
EXPECTED_LLVM_VERSION = 20

# These get set by setup_temp_dirs
Expand Down Expand Up @@ -298,17 +299,22 @@ def get_clang_version():
return m and m.group(1)


def is_llvm_stable():
return get_clang_version().startswith('%d.' % EXPECTED_LLVM_STABLE_VERSION)


def check_llvm_version():
actual = get_clang_version()
if actual.startswith('%d.' % EXPECTED_LLVM_VERSION):
expected = [EXPECTED_LLVM_VERSION, EXPECTED_LLVM_STABLE_VERSION]
if any(actual.startswith('%d.' % e) for e in expected):
return True
# When running in CI environment we also silently allow the next major
# version of LLVM here so that new versions of LLVM can be rolled in
# without disruption.
if 'BUILDBOT_BUILDNUMBER' in os.environ:
if actual.startswith('%d.' % (EXPECTED_LLVM_VERSION + 1)):
return True
diagnostics.warning('version-check', 'LLVM version for clang executable "%s" appears incorrect (seeing "%s", expected "%s")', CLANG_CC, actual, EXPECTED_LLVM_VERSION)
diagnostics.warning('version-check', f'LLVM version for clang executable "{CLANG_CC}" appears incorrect (seeing "{actual}", expected "{EXPECTED_LLVM_VERSION}" or "{EXPECTED_LLVM_STABLE_VERSION}")')
return False


Expand Down

0 comments on commit 208a081

Please sign in to comment.