git ssb

0+

wanderer🌟 / js-primea-hypervisor



Tree: 2c04524fc8e9b757c060e0e2cf80d26d6d411e57

Files: 2c04524fc8e9b757c060e0e2cf80d26d6d411e57 / tests / runner.js

1263 bytesRaw
1'use strict'
2const tape = require('tape')
3const fs = require('fs')
4const cp = require('child_process')
5
6// This
7const Environment = require('../environment.js')
8const Interface = require('../interface.js')
9// console.log('tes1 11')
10// get the test names
11let tests = fs.readdirSync(__dirname).filter((file) => file.endsWith('.wast'))
12// tests = ['balance.wast']
13// run the tests
14for (let testName of tests) {
15 testName = testName.split('.')[0]
16 tape(testName, (t) => {
17 // Compile Command
18 cp.execSync(`${__dirname}/../../evm-wasm-transcompiler/deps/sexpr-wasm-prototype/out/sexpr-wasm ${__dirname}/${testName}.wast -o ${__dirname}/${testName}.wasm`)
19 const buffer = fs.readFileSync(`${__dirname}/${testName}.wasm`)
20 const envData = fs.readFileSync(`${__dirname}/${testName}.json`)
21
22 const environment = new Environment(envData)
23 const ethInterface = new Interface(environment)
24
25 try {
26 const mod = Wasm.instantiateModule(buffer, {'ethereum': ethInterface})
27 ethInterface.setModule(mod)
28 // ethInterface.address(0)
29 // console.log(ethInterface.environment);
30 mod.exports.test()
31 } catch (e) {
32 console.error('FAIL')
33 console.error(e)
34 } finally {
35 console.log('done')
36 }
37 t.end()
38 })
39}
40

Built with git-ssb-web