diff --git a/problemtools/run/program.py b/problemtools/run/program.py index 895e1f3..023ff0e 100644 --- a/problemtools/run/program.py +++ b/problemtools/run/program.py @@ -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) diff --git a/problemtools/verifyproblem.py b/problemtools/verifyproblem.py index a45cbf9..51d7a6c 100644 --- a/problemtools/verifyproblem.py +++ b/problemtools/verifyproblem.py @@ -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: