1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-25 03:34:05 +00:00

tests use WASM if available

This commit is contained in:
Steven Hugg 2020-07-13 17:15:48 -05:00
parent f5a4844af3
commit e70b8a9749
4 changed files with 10 additions and 8 deletions

View File

@ -7,7 +7,7 @@ before_install:
- git submodule update --init --recursive - git submodule update --init --recursive
language: node_js language: node_js
node_js: node_js:
- "10.16.0" - "14.3.0"
script: script:
- npm run build - npm run build
- npm test - npm test

View File

@ -10,13 +10,11 @@ const emglobal : any = this['window'] || this['global'] || this;
const ENVIRONMENT_IS_WEB = typeof window === 'object'; const ENVIRONMENT_IS_WEB = typeof window === 'object';
const ENVIRONMENT_IS_WORKER = typeof importScripts === 'function'; const ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
//const self = emglobal.self;
//const __WORKER__ = function() {
// WebAssembly module cache // WebAssembly module cache
// TODO: leaks memory even when disabled... // TODO: leaks memory even when disabled...
var _WASM_module_cache = {}; var _WASM_module_cache = {};
var CACHE_WASM_MODULES = true; var CACHE_WASM_MODULES = true; // if false, use asm.js only
function getWASMModule(module_id:string) { function getWASMModule(module_id:string) {
var module = _WASM_module_cache[module_id]; var module = _WASM_module_cache[module_id];
if (!module) { if (!module) {

View File

@ -4,9 +4,6 @@ var fs = require('fs');
var wtu = require('./workertestutils.js'); var wtu = require('./workertestutils.js');
//var heapdump = require('heapdump'); //var heapdump = require('heapdump');
// TODO: why memory leak?
CACHE_WASM_MODULES = false;
global.onmessage({data:{preload:'cc65', platform:'nes'}}); global.onmessage({data:{preload:'cc65', platform:'nes'}});
global.onmessage({data:{preload:'ca65', platform:'nes'}}); global.onmessage({data:{preload:'ca65', platform:'nes'}});
global.onmessage({data:{preload:'cc65', platform:'apple2'}}); global.onmessage({data:{preload:'cc65', platform:'apple2'}});

View File

@ -7,6 +7,13 @@ var worker = {};
global.window = global; global.window = global;
global.exports = {}; global.exports = {};
global.self = global;
global.location = {href:'.'};
global.require = (modname) => {
console.log("REQUIRE",modname);
if (modname == 'path')
return require(modname);
};
global.btoa = require('btoa'); global.btoa = require('btoa');
global.atob = require('atob'); global.atob = require('atob');