-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare_compiled_noir_test_programs.py
26 lines (23 loc) · 1.18 KB
/
prepare_compiled_noir_test_programs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import subprocess
origin_path = os.path.abspath(os.getcwd())
custom_nargo_path = origin_path + "/noir/target/release/nargo"
custom_backend_path = origin_path + "/plonky2-backend/target/release/plonky2-backend"
base_test_programs_path = origin_path + "/plonky2-backend/src/circuit_translation/tests/factories/noir_circuits_for_testing/"
print(origin_path)
def execute_noir_project(noir_project_name):
cur_dir = base_test_programs_path + noir_project_name
os.chdir(cur_dir)
try:
command = f"{custom_nargo_path} execute witness"
result = subprocess.check_output(command, shell=True, text=True)
rename_circuit_command = f"mv {cur_dir}/target/{noir_project_name}.json {cur_dir}/target/circuit.json"
subprocess.check_output(rename_circuit_command, shell=True, text=True)
print(result)
except Exception as e:
print(f"An error has occurred while trying to execute the Noir program {noir_project_name}: {e}")
return
for noir_project_name in os.listdir(base_test_programs_path):
subdir_path = os.path.join(base_test_programs_path, noir_project_name)
if os.path.isdir(subdir_path):
execute_noir_project(noir_project_name)