Skip to content

Commit

Permalink
add --disable-gc flag
Browse files Browse the repository at this point in the history
  • Loading branch information
daejunpark committed Oct 10, 2024
1 parent 5fa702b commit 2c9009d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ jobs:
run: python -m pip install -e .

- name: Run pytest
run: pytest -v -k "not long and not ffi" --ignore=tests/lib --halmos-options="-st --solver-max-memory 2048 --solver-threads 1 --storage-layout ${{ matrix.storage-layout }} ${{ matrix.cache-solver }} --solver-timeout-assertion 0 ${{ inputs.halmos-options }}" ${{ inputs.pytest-options }}
run: pytest -v -k "not long and not ffi" --ignore=tests/lib --halmos-options="-st --disable-gc --solver-max-memory 2048 --solver-threads 1 --storage-layout ${{ matrix.storage-layout }} ${{ matrix.cache-solver }} --solver-timeout-assertion 0 ${{ inputs.halmos-options }}" ${{ inputs.pytest-options }}
4 changes: 4 additions & 0 deletions src/halmos/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0

import gc
import io
import json
import os
Expand Down Expand Up @@ -1337,6 +1338,9 @@ def _main(_args=None) -> MainResult:
print(f"halmos {metadata.version('halmos')}")
return MainResult(0)

if args.disable_gc:
gc.disable()

#
# compile
#
Expand Down
6 changes: 6 additions & 0 deletions src/halmos/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,12 @@ class Config:
group=debugging,
)

disable_gc: bool = arg(
help="disable Python's automatic garbage collection for cyclic objects. This does not affect reference counting based garbage collection.",
global_default=False,
group=debugging,
)

### Build options

forge_build_out: str = arg(
Expand Down
2 changes: 0 additions & 2 deletions tests/test_halmos.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import json

import pytest
import gc

from halmos.__main__ import _main, rendered_calldata
from halmos.bytevec import ByteVec
Expand Down Expand Up @@ -47,7 +46,6 @@
),
)
def test_main(cmd, expected_path, halmos_options):
gc.disable()
actual = dataclasses.asdict(_main(cmd + halmos_options.split()))
with open(expected_path, encoding="utf8") as f:
expected = json.load(f)
Expand Down

0 comments on commit 2c9009d

Please sign in to comment.