Skip to content

Commit 22f1d6a

Browse files
authored
Add some initial testing in the spidermonkey shell. NFC (#19675)
This will allow us to run some basic spidermonkey tests without spinning up firefox. For example, I an planning on using it to experiment with wasm64 under spidermonkey.
1 parent 3bd2c17 commit 22f1d6a

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.circleci/config.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,28 @@ jobs:
602602
echo "JS_ENGINES = [JSC_ENGINE]" >> ~/emsdk/.emscripten
603603
- run-tests:
604604
test_targets: "core0.test_hello_world"
605+
test-spidermonkey:
606+
executor: linux-python
607+
steps:
608+
- checkout
609+
- run:
610+
name: submodule update
611+
command: git submodule update --init
612+
- pip-install
613+
- build
614+
- run:
615+
name: install spidermonkey
616+
command: |
617+
cd $HOME
618+
wget https://nodejs.org/dist/v18.12.0/node-v18.12.0-linux-x64.tar.xz
619+
tar -xf node-v18.12.0-linux-x64.tar.xz
620+
export PATH="`pwd`/node-v18.12.0-linux-x64/bin:${PATH}"
621+
npm install jsvu -g
622+
jsvu --os=default --engines=spidermonkey
623+
echo "JSC_ENGINE = [os.path.expanduser('~/.jsvu/bin/spidermonkey')]" >> ~/emsdk/.emscripten
624+
echo "JS_ENGINES = [JSC_ENGINE]" >> ~/emsdk/.emscripten
625+
- run-tests:
626+
test_targets: "core0.test_hello_world"
605627
test-node-compat:
606628
# We don't use `bionic` here since its tool old to run recent node versions:
607629
# `/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found`
@@ -815,6 +837,7 @@ workflows:
815837
requires:
816838
- build-linux
817839
- test-jsc
840+
- test-spidermonkey
818841
- test-node-compat
819842
- test-windows
820843
- test-mac-arm64

src/shell.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,18 @@ if (ENVIRONMENT_IS_SHELL) {
319319
};
320320

321321
readAsync = (f, onload, onerror) => {
322-
setTimeout(() => onload(readBinary(f)), 0);
322+
setTimeout(() => onload(readBinary(f)));
323323
};
324324

325325
if (typeof clearTimeout == 'undefined') {
326326
globalThis.clearTimeout = (id) => {};
327327
}
328328

329+
if (typeof setTimeout == 'undefined') {
330+
// spidermonkey lacks setTimeout but we use it above in readAsync.
331+
globalThis.setTimeout = (f) => (typeof f == 'function') ? f() : abort();
332+
}
333+
329334
if (typeof scriptArgs != 'undefined') {
330335
arguments_ = scriptArgs;
331336
} else if (typeof arguments != 'undefined') {

0 commit comments

Comments
 (0)