Skip to content

Commit

Permalink
Run interactive validation with submission's working directory
Browse files Browse the repository at this point in the history
Tagl committed Sep 25, 2024
1 parent e6a48b9 commit 650fa45
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions problemtools/run/program.py
Original file line number Diff line number Diff line change
@@ -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:
@@ -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)

4 changes: 2 additions & 2 deletions problemtools/verifyproblem.py
Original file line number Diff line number Diff line change
@@ -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):
@@ -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:

0 comments on commit 650fa45

Please sign in to comment.