Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sio2project/sioworkers
Browse files Browse the repository at this point in the history
  • Loading branch information
otargowski committed Jan 27, 2024
2 parents c818cee + 55776ac commit 12a1328
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name = "sioworkers",
version = '1.4.2',
version = '1.4.3',
author = "SIO2 Project Team",
author_email = '[email protected]',
description = "Programming contest judging infrastructure",
Expand Down
5 changes: 5 additions & 0 deletions sio/executors/inwer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def _run_in_executor(environ, command, executor, **kwargs):

def _run_inwer(environ, use_sandboxes=False):
command = [tempcwd('inwer')]
if 'in_file_name' in environ:
command.append(environ['in_file_name'])
if use_sandboxes:
executor = SupervisedExecutor()
else:
Expand All @@ -49,6 +51,9 @@ def run(environ):
``in_file``: the file redirected to the program's stdin
``in_file_name``: the name of the input file. It's passed to inwer as
the second argument.
``use_sandboxes``: if this key equals ``True``, the program is executed
in the SupervisedExecutor, otherwise the UnsafeExecutor
is used
Expand Down
14 changes: 14 additions & 0 deletions sio/workers/test/sources/inwer_argument.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <stdio.h>

int main(int argc, char *argv[]) {
if (argc != 2) {
printf("WRONG\nWrong number of arguments");
return 1;
}
if (strcmp(argv[1], "inwer_ok") != 0) {
printf("WRONG\nWrong test name");
return 1;
}
printf("OK\n");
return 0;
}
3 changes: 3 additions & 0 deletions sio/workers/test/test_executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ def inner(env):
yield '/inwer_big_output.c', '/inwer_ok', use_sandboxes, check_inwer_big_output(
use_sandboxes
)
yield '/inwer_argument.c', '/inwer_ok', use_sandboxes, check_inwer_ok
yield '/inwer_argument.c', '/inwer_wrong', use_sandboxes, check_inwer_wrong


@pytest.mark.parametrize(
Expand All @@ -449,6 +451,7 @@ def test_inwer(inwer, in_file, use_sandboxes, callback):
with TemporaryCwd():
env = {
'in_file': in_file,
'in_file_name': os.path.basename(in_file),
'exe_file': inwer_bin,
'use_sandboxes': use_sandboxes,
'inwer_output_limit': SMALL_OUTPUT_LIMIT,
Expand Down

0 comments on commit 12a1328

Please sign in to comment.