1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

[FunC] Enrich and refactor testing framework, add negative tests

* fully refactor run_tests.py, make it extensible for the future
* an ability to write @compilation_should_fail tests
* an ability to launch run_tests.py for a single .fc file
* keep run_tests.js in sync with run_tests.py
* extract legacy_tests names/hashes to a separate file
  shared between legacy_tester.py and legacy_tester.js
This commit is contained in:
Aleksandr Kirsanov 2024-04-20 01:10:50 +03:00
parent 0bc6305f96
commit a5d2a1003f
No known key found for this signature in database
GPG key ID: B758BBAA01FFB3D3
9 changed files with 615 additions and 203 deletions

View file

@ -17,7 +17,8 @@ const copyFromCString = (mod, ptr) => {
return mod.UTF8ToString(ptr);
};
async function compileFile(mod, filename) {
/** @return {{status: string, message: string, fiftCode: string, codeBoc: string, codeHashHex: string}} */
function compileFile(mod, filename) {
const callbackPtr = mod.addFunction((_kind, _data, contents, error) => {
const kind = copyFromCString(mod, _kind);
const data = copyFromCString(mod, _data);
@ -28,7 +29,7 @@ async function compileFile(mod, filename) {
try {
copyToCStringPtr(mod, fsSync.readFileSync(path).toString('utf-8'), contents);
} catch (err) {
copyToCStringPtr(mod, e.message, error);
copyToCStringPtr(mod, err.message, error);
}
} else {
copyToCStringPtr(mod, 'Unknown callback kind ' + kind, error);
@ -47,14 +48,11 @@ async function compileFile(mod, filename) {
return JSON.parse(copyFromCString(mod, responsePtr));
}
const wasmModule = require(process.env.FUNCFIFTLIB_MODULE)
async function compileWasm(fiftFuncLibJsFileName, fiftFuncLibWasmFileName) {
const wasmModule = require(fiftFuncLibJsFileName)
const wasmBinary = new Uint8Array(fsSync.readFileSync(fiftFuncLibWasmFileName))
const wasmBinary = new Uint8Array(fsSync.readFileSync(process.env.FUNCFIFTLIB_WASM))
async function compileWasm() {
const mod = await wasmModule({ wasmBinary })
return mod
return await wasmModule({ wasmBinary })
}
module.exports = {