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

Run interactive validation with submission's working directory #278

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions problemtools/run/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self) -> None:
self._compile_result: tuple[bool, str|None]|None = None

def run(self, infile='/dev/null', outfile='/dev/null', errfile='/dev/null',
args=None, timelim=1000, memlim=1024, set_work_dir=False):
args=None, timelim=1000, memlim=1024, work_dir=None):
"""Run the program.

Args:
Expand All @@ -49,7 +49,7 @@ def run(self, infile='/dev/null', outfile='/dev/null', errfile='/dev/null',

status, runtime = self.__run_wait(runcmd + args,
infile, outfile, errfile,
timelim, memlim, self.path if set_work_dir else None)
timelim, memlim, work_dir)

self.runtime = max(self.runtime, runtime)

Expand Down
4 changes: 2 additions & 2 deletions problemtools/verifyproblem.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def run_submission_real(self, sub, context: Context, timelim: int, timelim_low:
errfile = os.path.join(self._problem.tmpdir, f'error-{self.counter}')
status, runtime = sub.run(infile=self.infile, outfile=outfile, errfile=errfile,
timelim=timelim_high+1,
memlim=self._problem.config.get('limits')['memory'], set_work_dir=True)
memlim=self._problem.config.get('limits')['memory'], work_dir=sub.path)
if is_TLE(status) or runtime > timelim_high:
res_high = SubmissionResult('TLE')
elif is_RTE(status):
Expand Down Expand Up @@ -1614,7 +1614,7 @@ def validate_interactive(self, testcase: TestCase, submission, timelim: int, err
interactive_out = f.name
f.close()
i_status, _ = interactive.run(outfile=interactive_out,
args=initargs + val.get_runcmd(memlim=val_memlim) + validator_args + [';'] + submission_args)
args=initargs + val.get_runcmd(memlim=val_memlim) + validator_args + [';'] + submission_args, work_dir=submission.path)
if is_RTE(i_status):
errorhandler.error(f'Interactive crashed, status {i_status}')
else:
Expand Down