Skip to content

Commit

Permalink
Adding --save-temps and --statistics to krun
Browse files Browse the repository at this point in the history
  • Loading branch information
Robertorosmaninho committed Jan 31, 2025
1 parent 1f2715a commit 3cab1b5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pyk/src/pyk/ktool/krun.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def run_process(
pipe_stderr: bool = True,
bug_report: BugReport | None = None,
debugger: bool = False,
save_temps: bool = False,
statistics: bool = False,
) -> CompletedProcess:
with self._temp_file() as ntf:
pgm.write(ntf)
Expand All @@ -94,6 +96,8 @@ def run_process(
pmap=pmap,
term=term,
temp_dir=self.use_directory,
save_temps=save_temps,
statistics=statistics,
no_expand_macros=not expand_macros,
search_final=search_final,
no_pattern=no_pattern,
Expand All @@ -113,6 +117,8 @@ def run_proof_hint(
parser: str | None = None,
term: bool = False,
temp_dir: Path | None = None,
save_temps: bool = False,
statistics: bool = False,
depth: int | None = None,
expand_macros: bool = True,
search_final: bool = False,
Expand All @@ -137,6 +143,8 @@ def run_proof_hint(
cmap=cmap,
term=term,
temp_dir=temp_dir,
save_temps=save_temps,
statistics=statistics,
no_expand_macros=not expand_macros,
search_final=search_final,
no_pattern=no_pattern,
Expand Down Expand Up @@ -216,6 +224,8 @@ def run(
check: bool = False,
pipe_stderr: bool = True,
bug_report: BugReport | None = None,
save_temps: bool = False,
statistics: bool = False,
debugger: bool = False,
) -> None:
result = self.run_process(
Expand All @@ -230,6 +240,8 @@ def run(
output=output,
pipe_stderr=pipe_stderr,
bug_report=bug_report,
save_temps=save_temps,
statistics=statistics,
debugger=debugger,
)

Expand Down Expand Up @@ -301,6 +313,8 @@ def _krun(
pmap: Mapping[str, str] | None = None,
term: bool = False,
temp_dir: Path | None = None,
save_temps: bool = False,
statistics: bool = False,
no_expand_macros: bool = False,
search_final: bool = False,
no_pattern: bool = False,
Expand Down Expand Up @@ -334,6 +348,8 @@ def _krun(
cmap=cmap,
term=term,
temp_dir=temp_dir,
save_temps=save_temps,
statistics=statistics,
no_expand_macros=no_expand_macros,
search_final=search_final,
no_pattern=no_pattern,
Expand Down Expand Up @@ -364,6 +380,8 @@ def _build_arg_list(
cmap: Mapping[str, str] | None,
term: bool,
temp_dir: Path | None,
save_temps: bool,
statistics: bool,
no_expand_macros: bool,
search_final: bool,
no_pattern: bool,
Expand All @@ -389,6 +407,10 @@ def _build_arg_list(
args += ['--term']
if temp_dir:
args += ['--temp-dir', str(temp_dir)]
if save_temps:
args += ['--save-temps']
if statistics:
args += ['--statistics']
if no_expand_macros:
args += ['--no-expand-macros']
if search_final:
Expand Down
4 changes: 4 additions & 0 deletions pyk/src/tests/unit/ktool/test_krun.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
('cmap', None),
('term', False),
('temp_dir', None),
('save_temps', False),
('statistics', False),
('no_expand_macros', False),
('search_final', False),
('no_pattern', False),
Expand All @@ -37,6 +39,8 @@
'cmap': ({'COO': 'car', 'FUZZ': 'bill'}, ['-cCOO=car', '-cFUZZ=bill']),
'term': (True, ['--term']),
'temp_dir': (Path('/tmp/path'), ['--temp-dir', '/tmp/path']),
'save_temps': (True, ['--save-temps']),
'statistics': (True, ['--statistics']),
'no_expand_macros': (True, ['--no-expand-macros']),
'search_final': (True, ['--search-final']),
'no_pattern': (True, ['--no-pattern']),
Expand Down

0 comments on commit 3cab1b5

Please sign in to comment.