Skip to content

Commit b67283d

Browse files
authored
CI: Run tests on mac M1 hardware. NFC (#18970)
1 parent 18badf3 commit b67283d

File tree

2 files changed

+54
-16
lines changed

2 files changed

+54
-16
lines changed

.circleci/config.yml

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ executors:
2626
macos:
2727
xcode: "13.4.1"
2828
resource_class: macos.x86.medium.gen2
29+
mac-arm64:
30+
environment:
31+
EMSDK_NOTTY: "1"
32+
macos:
33+
xcode: "14.2.0"
34+
resource_class: macos.m1.medium.gen1
2935

3036
commands:
3137
download-chrome:
@@ -261,6 +267,21 @@ commands:
261267
test_targets: << parameters.test_targets >>
262268
title: << parameters.title >>
263269
- upload-test-results
270+
setup-macos:
271+
steps:
272+
- run:
273+
name: Install brew package dependencies
274+
environment:
275+
HOMEBREW_NO_AUTO_UPDATE: "1"
276+
command: |
277+
brew list cmake || brew install cmake
278+
brew list ninja || brew install ninja
279+
brew list python3 || brew install python3
280+
brew list pkg-config || brew install pkg-config
281+
- checkout
282+
- run:
283+
name: submodule update
284+
command: git submodule update --init
264285
test-firefox:
265286
description: "Runs emscripten tests under firefox"
266287
steps:
@@ -657,9 +678,9 @@ jobs:
657678
- run:
658679
name: Add python to bash path
659680
command: echo "export PATH=\"$PATH:/c/Python27amd64/\"" >> $BASH_ENV
660-
- build
661681
# note we do *not* build all libraries and freeze the cache; as we run
662682
# only limited tests here, it's more efficient to build on demand
683+
- build
663684
- pip-install:
664685
python: "$EMSDK_PYTHON"
665686
- run-tests:
@@ -684,30 +705,43 @@ jobs:
684705
EMTEST_SKIP_SCONS: "1"
685706
EMCC_SKIP_SANITY_CHECK: "1"
686707
steps:
687-
- run:
688-
name: Install brew package dependencies
689-
environment:
690-
HOMEBREW_NO_AUTO_UPDATE: "1"
691-
command: |
692-
brew list cmake || brew install cmake
693-
brew list ninja || brew install ninja
694-
brew list python3 || brew install python3
695-
brew list pkg-config || brew install pkg-config
708+
- setup-macos
696709
- attach_workspace:
697710
at: ~/
698-
- checkout
699-
- run:
700-
name: submodule update
701-
command: git submodule update --init
702711
- run:
703712
name: Remove Linux binaries
704713
command: |
705714
rm -rf ~/emsdk ~/vms ~/.jsvu
706-
- build
707715
# note we do *not* build all libraries and freeze the cache; as we run
708716
# only limited tests here, it's more efficient to build on demand
717+
- build
709718
- pip-install:
710719
python: "$EMSDK_PYTHON"
720+
- run-tests:
721+
title: "other+extras"
722+
test_targets: "other skip:other.test_native_link_error_message"
723+
- upload-test-results
724+
725+
test-mac-arm64:
726+
executor: mac-arm64
727+
environment:
728+
# We don't install d8 or modern node on the mac runner so we skip any
729+
# tests that depend on those.
730+
EMTEST_SKIP_V8: "1"
731+
EMTEST_SKIP_EH: "1"
732+
EMTEST_SKIP_WASM64: "1"
733+
EMTEST_SKIP_SIMD: "1"
734+
EMTEST_SKIP_SCONS: "1"
735+
EMCC_SKIP_SANITY_CHECK: "1"
736+
steps:
737+
- setup-macos
738+
- build
739+
# TODO: We can't currently do pip install here since numpy and other packages
740+
# are currently missing arm64 macos binaries.
741+
# TODO: Remove this once emsdk has an arm64 version of node
742+
- run:
743+
name: Install Rosetta
744+
command: /usr/sbin/softwareupdate --install-rosetta --agree-to-license
711745
- run-tests:
712746
title: "crossplatform tests"
713747
test_targets: "--crossplatform-only"
@@ -756,6 +790,7 @@ workflows:
756790
- build-linux
757791
- test-node-compat
758792
- test-windows
793+
- test-mac-arm64
759794
- test-mac:
760795
# The mac tester also uses the libraries built on the linux builder to
761796
# save total build time (this is fine because the libraries are wasm

test/runner.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import math
2626
import operator
2727
import os
28+
import platform
2829
import random
2930
import sys
3031
import unittest
@@ -314,7 +315,9 @@ def run_tests(options, suites):
314315
print([s[0] for s in suites])
315316
# Run the discovered tests
316317

317-
if os.getenv('CI'):
318+
# We currently don't support xmlrunner on macOS M1 runner since
319+
# `pip` doesn't seeem to yet have pre-built binaries for M1.
320+
if os.getenv('CI') and not (utils.MACOS and platform.machine() == 'arm64'):
318321
os.makedirs('out', exist_ok=True)
319322
# output fd must remain open until after testRunner.run() below
320323
output = open('out/test-results.xml', 'wb')

0 commit comments

Comments
 (0)