diff --git a/.gitignore b/.gitignore index 9140856b..d503030f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ __pycache__ .vscode ready_to_production.py *.wat -log/log/* -log/result/* +output/log/* +output/result/* bfs_test/* +**/debug +**/rust/**/target \ No newline at end of file diff --git a/README.md b/README.md index 3aca845a..a9690b06 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ The `-v` option controls the logging level, allowing users to adjust the verbosi The `-s` is a mandatory option. It enables symbolic execution analysis on the given Wasm binary. ## Output -The output of SeeWasm, including logs and results, is stored in the `log` folder, with each file named according to the pattern `NAME_TIMESTAMP`. +The output of SeeWasm, including logs and results, is stored in the `output` folder, with each file named according to the pattern `NAME_TIMESTAMP`. The log file follows a specific format, which illustrates the call trace of the anaylzed program: diff --git a/launcher.py b/launcher.py index 9a3079ab..019bc566 100755 --- a/launcher.py +++ b/launcher.py @@ -90,7 +90,7 @@ def main(): Configuration.set_incremental_solving(args.incremental) Configuration.set_elem_index_to_func(wat_file_path) - command_file_name = f"./log/result/{Configuration.get_file_name()}_{Configuration.get_start_time()}/command.json" + command_file_name = f"./output/result/{Configuration.get_file_name()}_{Configuration.get_start_time()}/command.json" makedirs(path.dirname(command_file_name), exist_ok=True) with open(command_file_name, 'w') as fp: json.dump({"Command": " ".join(sys.argv)}, fp, indent=4) diff --git a/log/log/.placeholder b/output/log/.placeholder similarity index 100% rename from log/log/.placeholder rename to output/log/.placeholder diff --git a/log/result/.placeholder b/output/result/.placeholder similarity index 100% rename from log/result/.placeholder rename to output/result/.placeholder diff --git a/seewasm/arch/wasm/emulator.py b/seewasm/arch/wasm/emulator.py index c6e79300..4e504a61 100644 --- a/seewasm/arch/wasm/emulator.py +++ b/seewasm/arch/wasm/emulator.py @@ -34,7 +34,7 @@ # config the logger logging_config = { - 'filename': f'./log/log/{Configuration.get_file_name()}_{Configuration.get_start_time()}.log', + 'filename': f'./output/log/{Configuration.get_file_name()}_{Configuration.get_start_time()}.log', 'filemode': 'w+', 'format': '%(asctime)s | %(levelname)s | %(message)s', } diff --git a/seewasm/arch/wasm/utils.py b/seewasm/arch/wasm/utils.py index 05e68ef4..f0cf3f97 100644 --- a/seewasm/arch/wasm/utils.py +++ b/seewasm/arch/wasm/utils.py @@ -144,7 +144,7 @@ def str_to_little_endian_int(string): def write_result(state, exit=False): """ - Write result in ./log/result folder in json format + Write result in ./output/result folder in json format """ # if it is existed, and the stderr has no output # it means that it is raised by ProcFailTermination @@ -157,7 +157,7 @@ def write_result(state, exit=False): if unsat == state.solver.check(): return - file_name = f"./log/result/{Configuration.get_file_name()}_{Configuration.get_start_time()}/state_{datetime.timestamp(datetime.now()):.3f}_{random():.5f}.json" + file_name = f"./output/result/{Configuration.get_file_name()}_{Configuration.get_start_time()}/state_{datetime.timestamp(datetime.now()):.3f}_{random():.5f}.json" makedirs(path.dirname(file_name), exist_ok=True) state_result = {} with open(file_name, 'w') as fp: diff --git a/test.py b/test.py index c4050b2f..3007eb3a 100644 --- a/test.py +++ b/test.py @@ -33,7 +33,7 @@ def test_return_simulation(): cmd = [sys.executable, 'launcher.py', '-f', wasm_path, '-s', '-v', 'info', '--source_type', 'rust'] subprocess.run(cmd, timeout=60, check=True) - result_dir = glob.glob('./log/result/test_return_*') + result_dir = glob.glob('./output/result/test_return_*') assert len(result_dir) == 1, 'more than one matching results, do you have multiple `test_return*` cases?' result_dir = result_dir[0] state_path = glob.glob(f'{result_dir}/state*.json') @@ -49,7 +49,7 @@ def test_unreachable_simulation(): cmd = [sys.executable, 'launcher.py', '-f', wasm_path, '-s', '-v', 'info', '--source_type', 'rust'] subprocess.run(cmd, timeout=60, check=True) - result_dir = glob.glob('./log/result/test_unreachable_*') + result_dir = glob.glob('./output/result/test_unreachable_*') assert len(result_dir) == 1, 'more than one matching results, do you have multiple `test_unreachable*` cases?' result_dir = result_dir[0] state_path = glob.glob(f'{result_dir}/state*.json') @@ -68,7 +68,7 @@ def test_hello_c_to_wasm(): os.remove("hello_c.wasm") os.remove("hello_c.wat") - result_dir = glob.glob('./log/result/hello_c*') + result_dir = glob.glob('./output/result/hello_c*') assert len(result_dir) == 1, 'more than one matching results, do you have multiple `hello_c*` cases?' result_dir = result_dir[0] state_path = glob.glob(f'{result_dir}/state*.json') @@ -88,7 +88,7 @@ def test_sym_c_to_wasm(): cmd = [sys.executable, 'launcher.py', '-f', "sym_c.wasm", '-s', '--sym_args', '1', '-v', 'info', '--source_type', 'c', '--entry', '__main_void'] subprocess.run(cmd, timeout=60, check=True) - result_dir = glob.glob('./log/result/sym_c*') + result_dir = glob.glob('./output/result/sym_c*') assert len(result_dir) == 1, 'more than one matching results, do you have multiple `sym_c*` cases?' result_dir = result_dir[0] state_path = glob.glob(f'{result_dir}/state*.json') @@ -125,7 +125,7 @@ def test_hello_rust_to_wasm(): cmd = ["rm", "-rf", "./test/rust/hello/target"] subprocess.run(cmd, timeout=60, check=True) - result_dir = glob.glob('./log/result/hello_rust*') + result_dir = glob.glob('./output/result/hello_rust*') assert len(result_dir) == 1, 'more than one matching results, do you have multiple `hello_rust*` cases?' result_dir = result_dir[0] state_path = glob.glob(f'{result_dir}/state*.json')