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

Various changes in TVM, github builds and tests (#793)

* Bugfixes in TVM and node

* Upgrade to C++17

* Improve GitHub builds

* Fix existing tests and partially integrate them into builds

---------

Co-authored-by: neodiX42 <namlem@gmail.com>
Co-authored-by: EmelyanenkoK <emelyanenko.kirill@gmail.com>
This commit is contained in:
SpyCheese 2023-11-03 14:43:34 +03:00 committed by GitHub
parent 89700cb2aa
commit 5847897b37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
122 changed files with 2889 additions and 4100 deletions

View file

@ -4,6 +4,7 @@ import subprocess
import sys
import tempfile
def getenv(name, default=None):
if name in os.environ:
return os.environ[name]
@ -12,10 +13,9 @@ def getenv(name, default=None):
exit(1)
return default
FUNC_EXECUTABLE = getenv("FUNC_EXECUTABLE", "func")
FIFT_EXECUTABLE = getenv("FIFT_EXECUTABLE", "fift")
#FUNC_STDLIB = getenv("FUNC_STDLIB")
FIFT_LIBS = getenv("FIFT_LIBS")
TMP_DIR = tempfile.mkdtemp()
COMPILED_FIF = os.path.join(TMP_DIR, "compiled.fif")
RUNNER_FIF = os.path.join(TMP_DIR, "runner.fif")
@ -25,22 +25,26 @@ if len(sys.argv) != 2:
exit(1)
TESTS_DIR = sys.argv[1]
class ExecutionError(Exception):
pass
def compile_func(f):
res = subprocess.run([FUNC_EXECUTABLE, "-o", COMPILED_FIF, "-SPA", f], capture_output=True, timeout=10)
if res.returncode != 0:
raise ExecutionError(str(res.stderr, "utf-8"))
def run_runner():
res = subprocess.run([FIFT_EXECUTABLE, "-I", FIFT_LIBS, RUNNER_FIF], capture_output=True, timeout=10)
res = subprocess.run([FIFT_EXECUTABLE, RUNNER_FIF], capture_output=True, timeout=10)
if res.returncode != 0:
raise ExecutionError(str(res.stderr, "utf-8"))
s = str(res.stdout, "utf-8")
s = [x.strip() for x in s.split("\n")]
return [x for x in s if x != ""]
tests = [s for s in os.listdir(TESTS_DIR) if s.endswith(".fc")]
tests.sort()
print("Found", len(tests), "tests", file=sys.stderr)
@ -68,18 +72,18 @@ for ti, tf in enumerate(tests):
# preprocess arithmetics in input
for i in range(len(cases)):
inputs = cases[i][1].split(" ")
processed_inputs = ""
for in_arg in inputs:
if "x{" in in_arg:
processed_inputs += in_arg
continue
# filter and execute
# is it safe enough?
filtered_in = "".join(filter(lambda x: x in "0x123456789()+-*/<>", in_arg))
if(filtered_in):
processed_inputs += str(eval(filtered_in)) + " ";
cases[i][1] = processed_inputs.strip()
inputs = cases[i][1].split(" ")
processed_inputs = ""
for in_arg in inputs:
if "x{" in in_arg:
processed_inputs += in_arg
continue
# filter and execute
# is it safe enough?
filtered_in = "".join(filter(lambda x: x in "0x123456789()+-*/<>", in_arg))
if filtered_in:
processed_inputs += str(eval(filtered_in)) + " "
cases[i][1] = processed_inputs.strip()
with open(RUNNER_FIF, "w") as f:
print("\"%s\" include <s constant code" % COMPILED_FIF, file=f)
@ -103,4 +107,4 @@ for ti, tf in enumerate(tests):
exit(2)
print(" OK, %d cases" % len(cases), file=sys.stderr)
print("Done", file=sys.stderr)
print("Done", file=sys.stderr)