Skip to content

Commit 421e527

Browse files
authored
Add time tool option to verify (#293)
1 parent 673ad9e commit 421e527

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/sinol_make/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from sinol_make.task_type.interactive import InteractiveTaskType # noqa
1313

1414

15-
__version__ = "1.9.7"
15+
__version__ = "1.9.8"
1616

1717

1818
def configure_parsers():

src/sinol_make/commands/run/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,6 @@ def configure_subparser(self, subparser):
280280
After running the solutions, it compares the solutions\' scores with the ones saved in config.yml.'
281281
)
282282

283-
default_timetool = 'sio2jail' if sio2jail.sio2jail_supported() else 'time'
284-
285283
parser.add_argument('-s', '--solutions', type=str, nargs='+',
286284
help='solutions to be run, for example prog/abc{b,s}*.{cpp,py}')
287285
parser.add_argument('-t', '--tests', type=str, nargs='+',
@@ -291,8 +289,7 @@ def configure_subparser(self, subparser):
291289
parser.add_argument('--ml', type=float, help='memory limit for all tests (in MB)')
292290
parser.add_argument('--hide-memory', dest='hide_memory', action='store_true',
293291
help='hide memory usage in report')
294-
parser.add_argument('-T', '--time-tool', dest='time_tool', choices=['sio2jail', 'time'],
295-
help=f'tool to measure time and memory usage (default: {default_timetool})')
292+
parsers.add_time_tool_argument(parser)
296293
parser.add_argument('--sio2jail-path', dest='sio2jail_path', type=str,
297294
help='path to sio2jail executable (default: `~/.local/bin/sio2jail`)')
298295
parser.add_argument('-a', '--apply-suggestions', dest='apply_suggestions', action='store_true',

src/sinol_make/commands/verify/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def configure_subparser(self, subparser):
4848
help='ignore expected scores from config.yml. When this flag is set, '
4949
'the expected scores are not compared with the actual scores. '
5050
'This flag will be passed to the run command.')
51+
parsers.add_time_tool_argument(parser)
5152
parsers.add_compilation_arguments(parser)
5253

5354
def correct_contest_type(self):

src/sinol_make/helpers/parsers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import argparse
33

4-
from sinol_make import util
4+
from sinol_make import util, sio2jail
55
from sinol_make.helpers import compiler
66

77

@@ -43,3 +43,9 @@ def add_fsanitize_argument(parser: argparse.ArgumentParser):
4343
parser.add_argument('-f', '--fsanitize', default=False, action='store_true',
4444
help='Use -fsanitize=address,undefined for compilation. Warning: this may fail on some '
4545
'systems. Tof fix this, run `sudo sysctl vm.mmap_rnd_bits = 28`.')
46+
47+
48+
def add_time_tool_argument(parser: argparse.ArgumentParser):
49+
default_timetool = 'sio2jail' if sio2jail.sio2jail_supported() else 'time'
50+
parser.add_argument('-T', '--time-tool', dest='time_tool', choices=['sio2jail', 'time'],
51+
help=f'tool to measure time and memory usage (default: {default_timetool})')

0 commit comments

Comments
 (0)