Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add timeout for validators #207

Merged
merged 6 commits into from
May 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bin/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import threading

from util import *
from colorama import Fore

EXTRA_LANGUAGES = '''
checktestdata:
Expand Down Expand Up @@ -475,7 +476,7 @@ def run(self, bar, cwd, name, args=[]):

if result.ok == -9:
# Timeout -> stop retrying and fail.
bar.error(f'TIMEOUT after {timeout}s')
bar.log(f'TIMEOUT after {timeout}s',color=Fore.RED)
RagnarGrootKoerkamp marked this conversation as resolved.
Show resolved Hide resolved
return result

if result.ok is not True:
Expand All @@ -490,7 +491,7 @@ def run(self, bar, cwd, name, args=[]):
stdout_path.rename(in_path)
else:
if not in_path.is_file():
bar.error(f'Did not write {name}.in and stdout is empty!')
bar.log(f'Did not write {name}.in and stdout is empty!',color=Fore.RED)
result.ok = False
return result

Expand Down
3 changes: 3 additions & 0 deletions bin/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ def build_parser():
action='store_true',
help='Skip sanity checks on testcases.',
)
validate_parser.add_argument(
'--timeout', '-t', type=int, help='Override the default timeout. Default: 30.'
)

# constraints validation
constraintsparser = subparsers.add_parser(
Expand Down
3 changes: 3 additions & 0 deletions bin/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def run(self, testcase, constraints=None, args=None):
expect=config.RTV_WA if testcase.bad_input else config.RTV_AC,
stdin=in_file,
cwd=cwd,
timeout=self.problem.settings.timeout,
)

if constraints is not None:
Expand Down Expand Up @@ -150,6 +151,7 @@ def run(self, testcase, run=None, constraints=None, args=None):
expect=config.RTV_WA if testcase.bad_output else config.RTV_AC,
stdin=ans_file,
cwd=cwd,
timeout=self.problem.settings.timeout,
RagnarGrootKoerkamp marked this conversation as resolved.
Show resolved Hide resolved
)

if constraints is not None:
Expand All @@ -171,4 +173,5 @@ def run(self, testcase, run=None, constraints=None, args=None):
expect=config.RTV_AC,
stdin=out_file,
cwd=run.feedbackdir,
timeout=self.problem.settings.timeout,
)