Skip to content

Commit

Permalink
chore: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
harveyghq committed Jul 2, 2024
1 parent 30de7c6 commit 9a22934
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ If you need to visualize the graph (`--visualize`), make sure you have installed
To verify everything is set up correctly, run the following command:

```shell
pytest test.py
pytest test.py -m basic
```

This command traverses the `./test` folder and performs symbolic execution on all Wasm binaries.
Expand Down
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
markers =
basic: basic test
3 changes: 3 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
('password.wasm', '')
])

@pytest.mark.basic
def test_wasm_can_be_analyzed(wasm_path, entry):
wasm_path = os.path.join(testcase_dir, wasm_path)
cmd = [sys.executable, 'launcher.py', '-f', wasm_path, '-s', '-v', 'info']
if entry != "":
cmd.extend(['--entry', entry])
subprocess.run(cmd, timeout=900, check=True)

@pytest.mark.basic
def test_return_simulation():
wasm_path = './test/test_return.wasm'
cmd = [sys.executable, 'launcher.py', '-f', wasm_path, '-s', '-v', 'info', '--source_type', 'rust']
Expand All @@ -41,6 +43,7 @@ def test_return_simulation():
state = json.load(f)
assert state['Solution']['proc_exit'] == "\u0000", f'exit code should be 0, got {state["Solution"]["proc_exit"]}'

@pytest.mark.basic
def test_unreachable_simulation():
wasm_path = './test/test_unreachable.wasm'
cmd = [sys.executable, 'launcher.py', '-f', wasm_path, '-s', '-v', 'info', '--source_type', 'rust']
Expand Down

0 comments on commit 9a22934

Please sign in to comment.