Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Independent daily [test262](https://github.com/tc39/test262) (standard test suit
- [x] Nova <small>[site](https://trynova.dev)</small> <small>[source](https://github.com/trynova/nova)</small>
- [X] NJS <small>[site](https://nginx.org/en/docs/njs/)</small> <small>[source](https://github.com/nginx/njs)</small>
- [ ] Bali <small>[source](https://github.com/ferus-web/bali)</small>
- [X] Escargot <small>[source](https://github.com/Samsung/escargot)</small>
- Request more in GitHub issues!

### Transpilers
Expand Down
3 changes: 2 additions & 1 deletion controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const engines = [
'xs',
'njs',
'kiesel',
'nova'
'nova',
'escargot'
];

let queue = process.argv[2]?.split(',').map(x => x.trim()).filter(x => x);
Expand Down
2 changes: 1 addition & 1 deletion controller/oom-killer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { execFile } from 'node:child_process';

const limit = 1 * 1024 * 1024 * 1024, // 2G
const limit = 1 * 1024 * 1024 * 1024, // 1G
filter = 'test262/test';

let interval, running = false;
Expand Down
8 changes: 8 additions & 0 deletions engines/escargot/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { $$ } from '../../util.js';

export default (file, module = false) => {
const args = [ file ];
if (module) args.unshift('--module');

return $$('./escargot', args);
};
1 change: 1 addition & 0 deletions engines/escargot/runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Escargot provides the test262 host API natively when built with ESCARGOT_TEST=ON.
34 changes: 34 additions & 0 deletions engines/escargot/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { $, $$ } from '../../util.js';

const buildDir = 'escargot-src';

// escargot needs icu, which is keg-only in homebrew so pkg-config can't find it by default
const icuEnv = () => {
if (process.platform !== 'darwin') return {};

const { stdout, error } = $$('brew', ['--prefix', 'icu4c']);
if (error) {
console.error('escargot: could not locate icu4c via homebrew, build will likely fail (install with `brew install icu4c`, or set PKG_CONFIG_PATH yourself)');
return {};
}

return {
PKG_CONFIG_PATH: [`${stdout.trim()}/lib/pkgconfig`, process.env.PKG_CONFIG_PATH].filter(Boolean).join(':')
};
};

export default async () => {
const env = icuEnv();

$(`rm -rf ${buildDir}`);
$(`git clone https://github.com/Samsung/escargot.git ${buildDir} --depth=1 --recurse-submodules --shallow-submodules`);
const version = $(`git -C ${buildDir} rev-parse HEAD`).trim().slice(0, 7);

// escargot and its submodules still declare cmake_minimum_required 2.8.12, which cmake 4 rejects outright
$(`cmake -S ${buildDir} -B ${buildDir}/build -GNinja -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DESCARGOT_MODE=release -DESCARGOT_OUTPUT=shell -DESCARGOT_TEST=ON -DESCARGOT_TEMPORAL=ON -DESCARGOT_SHADOWREALM=ON`, env);
$(`cmake --build ${buildDir}/build`, env);
$(`cp -rf ${buildDir}/build/escargot ./escargot`);
$(`rm -rf ${buildDir}`);

return { version };
};