Skip to content

Commit 74d6a15

Browse files
authored
Run one websockify test on macOS during CI. NFC (#16395)
This requires more consistent running of `pip install`
1 parent fa6afb8 commit 74d6a15

File tree

2 files changed

+40
-66
lines changed

2 files changed

+40
-66
lines changed

.circleci/config.yml

Lines changed: 38 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,15 @@ commands:
4747
- run: npm ci
4848
pip-install:
4949
description: "pip install"
50+
parameters:
51+
python:
52+
description: "Python executable to use"
53+
type: string
54+
default: python3
5055
steps:
51-
- run: pip3 install -r requirements-dev.txt
56+
- run:
57+
name: pip install
58+
command: << parameters.python >> -m pip install -r requirements-dev.txt
5259
build:
5360
description: "Install emsdk"
5461
steps:
@@ -93,6 +100,7 @@ commands:
93100
build-libs-and-freeze:
94101
description: "Build all libraries, and freeze the cache"
95102
steps:
103+
- pip-install
96104
- run:
97105
name: embuilder build ALL
98106
command: |
@@ -134,12 +142,8 @@ commands:
134142
- vms/
135143
- wasi-sdk/
136144
- .jsvu/
137-
run-tests:
138-
description: "Runs emscripten tests"
139-
parameters:
140-
test_targets:
141-
description: "Test suites to run"
142-
type: string
145+
prepare-for-tests:
146+
description: "Setup emscripten tests"
143147
steps:
144148
- attach_workspace:
145149
# Must be absolute path or relative path from working_directory
@@ -150,49 +154,33 @@ commands:
150154
command: git submodule update --init
151155
- emsdk-env
152156
- npm-install
153-
- run:
154-
name: run tests
155-
command: |
156-
./tests/runner << parameters.test_targets >>
157-
$EMSDK_PYTHON ./tools/check_clean.py
158-
run-tests-mac:
157+
- pip-install
158+
run-tests:
159159
description: "Runs emscripten tests"
160160
parameters:
161161
test_targets:
162162
description: "Test suites to run"
163163
type: string
164164
steps:
165-
- attach_workspace:
166-
# Must be absolute path or relative path from working_directory
167-
at: ~/
168-
- checkout
169-
- emsdk-env
170-
- npm-install
171-
- run:
172-
name: Install brew package dependencies
173-
environment:
174-
HOMEBREW_NO_AUTO_UPDATE: "1"
175-
command: |
176-
brew list cmake || brew install cmake
177-
brew list python3 || brew install python3
178165
- run:
179166
name: run tests
180167
command: |
181168
./tests/runner << parameters.test_targets >>
182169
$EMSDK_PYTHON ./tools/check_clean.py
170+
run-tests-linux:
171+
description: "Runs emscripten tests"
172+
parameters:
173+
test_targets:
174+
description: "Test suites to run"
175+
type: string
176+
steps:
177+
- prepare-for-tests
178+
- run-tests:
179+
test_targets: << parameters.test_targets >>
183180
test-firefox:
184181
description: "Runs emscripten tests under firefox"
185182
steps:
186-
- attach_workspace:
187-
# Must be absolute path or relative path from working_directory
188-
at: ~/
189-
- checkout
190-
- run:
191-
name: submodule update
192-
command: git submodule update --init
193-
- emsdk-env
194-
- npm-install
195-
- pip-install
183+
- prepare-for-tests
196184
- run:
197185
name: download firefox
198186
command: |
@@ -242,16 +230,7 @@ commands:
242230
test-chrome:
243231
description: "Runs emscripten browser tests under chrome"
244232
steps:
245-
- attach_workspace:
246-
# Must be absolute path or relative path from working_directory
247-
at: ~/
248-
- checkout
249-
- run:
250-
name: submodule update
251-
command: git submodule update --init
252-
- emsdk-env
253-
- npm-install
254-
- pip-install
233+
- prepare-for-tests
255234
- download-chrome
256235
- run:
257236
name: run tests
@@ -274,13 +253,7 @@ commands:
274253
test-sockets-chrome:
275254
description: "Runs emscripten sockets tests under chrome"
276255
steps:
277-
- attach_workspace:
278-
# Must be absolute path or relative path from working_directory
279-
at: ~/
280-
- checkout
281-
- emsdk-env
282-
- npm-install
283-
- pip-install
256+
- prepare-for-tests
284257
- download-chrome
285258
- run:
286259
name: run sockets tests
@@ -321,7 +294,7 @@ jobs:
321294
test-sanity:
322295
executor: bionic
323296
steps:
324-
- run-tests:
297+
- run-tests-linux:
325298
test_targets: "sanity"
326299
build-linux:
327300
executor: bionic
@@ -366,7 +339,7 @@ jobs:
366339
test-posixtest:
367340
executor: bionic
368341
steps:
369-
- run-tests:
342+
- run-tests-linux:
370343
test_targets: "posixtest"
371344
test-core0:
372345
executor: bionic
@@ -375,37 +348,37 @@ jobs:
375348
environment:
376349
EMCC_READ_METADATA: "compare"
377350
steps:
378-
- run-tests:
351+
- run-tests-linux:
379352
test_targets: "core0"
380353
test-core2:
381354
executor: bionic
382355
environment:
383356
EMTEST_BROWSER: "node"
384357
steps:
385-
- run-tests:
358+
- run-tests-linux:
386359
# also add a few asan tests and a single test of EMTEST_BROWSER=node
387360
test_targets: "core2 asan.test_stat asan.test_float_builtins asan.test_embind* asan.test_abort_on_exceptions asan.test_ubsan_full_left_shift_fsanitize_integer asan.test_pthread* asan.test_dyncall_specific_minimal_runtime asan.test_async_hello lsan.test_stdio_locking lsan.test_pthread_create browser.test_pthread_join"
388361
test-core3:
389362
executor: bionic
390363
steps:
391-
- run-tests:
364+
- run-tests-linux:
392365
# also add a little select testing for wasm2js in -O3
393366
# also add a little select wasmfs testing
394367
test_targets: "core3 wasm2js3.test_memorygrowth_2 wasmfs.test_hello_world wasmfs.test_hello_world_standalone wasmfs.test_unistd_links* wasmfs.test_atexit_standalone wasmfs.test_emscripten_get_now wasmfs.test_dyncall_specific_minimal_runtime core2ss.test_pthread_dylink wasmfs.test_utime wasmfs.test_unistd_unlink wasmfs.test_unistd_access wasmfs.test_unistd_close wasmfs.test_unistd_truncate wasmfs.test_readdir wasmfs.test_unistd_pipe"
395368
test-wasm2js1:
396369
executor: bionic
397370
steps:
398-
- run-tests:
371+
- run-tests-linux:
399372
test_targets: "wasm2js1"
400373
test-wasm64:
401374
executor: bionic
402375
steps:
403-
- run-tests:
376+
- run-tests-linux:
404377
test_targets: "wasm64.test_hello_world"
405378
test-other:
406379
executor: bionic
407380
steps:
408-
- run-tests:
381+
- run-tests-linux:
409382
# some native-dependent tests fail because of the lack of native
410383
# headers on emsdk-bundled clang
411384
test_targets: "other skip:other.test_native_link_error_message"
@@ -468,8 +441,10 @@ jobs:
468441
- build
469442
# note we do *not* build all libraries and freeze the cache; as we run
470443
# only limited tests here, it's more efficient to build on demand
471-
- run-tests-mac:
472-
test_targets: "other core0.test_lua core0.test_longjmp_standalone core2.test_sse1 skip:other.test_native_link_error_message"
444+
- pip-install:
445+
python: "$EMSDK_PYTHON"
446+
- run-tests:
447+
test_targets: "other sockets.test_nodejs_sockets_echo core0.test_lua core0.test_longjmp_standalone core2.test_sse1 skip:other.test_native_link_error_message"
473448

474449
workflows:
475450
build-test:

tests/test_sockets.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import shutil
1010
import sys
1111
import time
12-
from subprocess import Popen, PIPE
12+
from subprocess import Popen
1313

1414
if __name__ == '__main__':
1515
raise Exception('do not run this file directly; do something like: tests/runner sockets')
@@ -60,8 +60,7 @@ def __enter__(self):
6060
# NOTE empty filename support is a hack to support
6161
# the current test_enet
6262
if self.filename:
63-
proc = run_process([CLANG_CC, test_file(self.filename), '-o', 'server', '-DSOCKK=%d' % self.target_port] + clang_native.get_clang_native_args() + self.args, clang_native.get_clang_native_env(), stdout=PIPE, stderr=PIPE)
64-
print('Socket server build: out:', proc.stdout, '/ err:', proc.stderr)
63+
run_process([CLANG_CC, test_file(self.filename), '-o', 'server', '-DSOCKK=%d' % self.target_port] + clang_native.get_clang_native_args() + self.args, env=clang_native.get_clang_native_env())
6564
process = Popen([os.path.abspath('server')])
6665
self.processes.append(process)
6766

0 commit comments

Comments
 (0)