Skip to content

Commit

Permalink
chore: update .gitignore, change "log" to "output"
Browse files Browse the repository at this point in the history
  • Loading branch information
harveyghq committed Jul 5, 2024
1 parent 7085408 commit 7227756
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ __pycache__
.vscode
ready_to_production.py
*.wat
log/log/*
log/result/*
output/log/*
output/result/*
bfs_test/*
**/debug
**/rust/**/target
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion seewasm/arch/wasm/emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
Expand Down
4 changes: 2 additions & 2 deletions seewasm/arch/wasm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 7227756

Please sign in to comment.