sinol-make 1.6.0.dev3__tar.gz → 1.7.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sinol_make-1.6.0.dev3/src/sinol_make.egg-info → sinol_make-1.7.0.dev1}/PKG-INFO +4 -1
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/README.md +3 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/setup.cfg +1 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/__init__.py +15 -12
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/doc/__init__.py +3 -3
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/export/__init__.py +4 -5
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/gen/__init__.py +5 -8
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/ingen/__init__.py +28 -14
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/inwer/__init__.py +4 -8
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/outgen/__init__.py +7 -10
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/run/__init__.py +54 -314
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/verify/__init__.py +14 -4
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/contest_types/__init__.py +3 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/contest_types/default.py +6 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/contest_types/icpc.py +3 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/contest_types/oi.py +4 -1
- sinol_make-1.7.0.dev1/src/sinol_make/contest_types/oij.py +32 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/helpers/cache.py +3 -3
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/helpers/compile.py +4 -5
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/helpers/compiler.py +11 -6
- sinol_make-1.7.0.dev1/src/sinol_make/helpers/func_cache.py +30 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/helpers/package_util.py +35 -9
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/helpers/parsers.py +17 -3
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/oiejq/__init__.py +20 -8
- sinol_make-1.7.0.dev1/src/sinol_make/structs/package_structs.py +7 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/structs/run_structs.py +2 -0
- sinol_make-1.7.0.dev1/src/sinol_make/task_type/__init__.py +17 -0
- sinol_make-1.7.0.dev1/src/sinol_make/task_type/base.py +273 -0
- sinol_make-1.7.0.dev1/src/sinol_make/task_type/interactive_io.py +219 -0
- sinol_make-1.7.0.dev1/src/sinol_make/task_type/normal.py +77 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/util.py +3 -8
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1/src/sinol_make.egg-info}/PKG-INFO +4 -1
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make.egg-info/SOURCES.txt +7 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make.egg-info/entry_points.txt +1 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/tests/test_oiejq.py +41 -4
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/tests/test_util.py +8 -5
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/LICENSE +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/pyproject.toml +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/ingen/ingen_util.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/init/__init__.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/inwer/inwer_util.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/commands/outgen/outgen_util.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/helpers/__init__.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/helpers/paths.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/helpers/printer.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/interfaces/BaseCommand.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/interfaces/Errors.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/interfaces/__init__.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/oiejq/perf_test.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/structs/__init__.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/structs/cache_structs.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/structs/compiler_structs.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/structs/gen_structs.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/structs/inwer_structs.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make/structs/status_structs.py +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make.egg-info/dependency_links.txt +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make.egg-info/requires.txt +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/src/sinol_make.egg-info/top_level.txt +0 -0
- {sinol_make-1.6.0.dev3 → sinol_make-1.7.0.dev1}/tests/test_multiple_arguments.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sinol_make
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0.dev1
|
|
4
4
|
Summary: CLI tool for creating sio2 task packages
|
|
5
5
|
Author: Mateusz Masiarz
|
|
6
6
|
Author-email: m.masiarz@fri.edu.pl
|
|
@@ -113,6 +113,9 @@ Run `sinol-make ingen --help` to see available flags.
|
|
|
113
113
|
program to use, what tests to check and how many CPUs to use. Run `sinol-make inwer --help` to see available flags.
|
|
114
114
|
- `sinol-make export` -- Creates archive ready to upload to sio2 or szkopul. Run `sinol-make export --help` to see all available flags.
|
|
115
115
|
- `sinol-make doc` -- Compiles all LaTeX files in doc/ directory to PDF. Run `sinol-make doc --help` to see all available flags.
|
|
116
|
+
- `sinol-make verify` -- Verifies the package. This command runs stress tests (if available), verifies the config,
|
|
117
|
+
generates tests, generates problem statements, runs inwer and run all solutions. Ingen and inwer are compiled with
|
|
118
|
+
address and UB sanitizers. Run `sinol-make verify --help` to see all available flags.
|
|
116
119
|
- `sinol-make init [id]` -- Creates package from template [on github](https://github.com/sio2project/sinol-make/tree/main/example_package) and sets task id to provided `[id]`. Requires an internet connection to run.
|
|
117
120
|
|
|
118
121
|
You can also run multiple commands at once, for example:
|
|
@@ -83,6 +83,9 @@ Run `sinol-make ingen --help` to see available flags.
|
|
|
83
83
|
program to use, what tests to check and how many CPUs to use. Run `sinol-make inwer --help` to see available flags.
|
|
84
84
|
- `sinol-make export` -- Creates archive ready to upload to sio2 or szkopul. Run `sinol-make export --help` to see all available flags.
|
|
85
85
|
- `sinol-make doc` -- Compiles all LaTeX files in doc/ directory to PDF. Run `sinol-make doc --help` to see all available flags.
|
|
86
|
+
- `sinol-make verify` -- Verifies the package. This command runs stress tests (if available), verifies the config,
|
|
87
|
+
generates tests, generates problem statements, runs inwer and run all solutions. Ingen and inwer are compiled with
|
|
88
|
+
address and UB sanitizers. Run `sinol-make verify --help` to see all available flags.
|
|
86
89
|
- `sinol-make init [id]` -- Creates package from template [on github](https://github.com/sio2project/sinol-make/tree/main/example_package) and sets task id to provided `[id]`. Requires an internet connection to run.
|
|
87
90
|
|
|
88
91
|
You can also run multiple commands at once, for example:
|
|
@@ -6,7 +6,8 @@ import argcomplete
|
|
|
6
6
|
|
|
7
7
|
from sinol_make import util, oiejq
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
__version__ = "1.7.0.dev1"
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def configure_parsers():
|
|
@@ -33,7 +34,7 @@ def configure_parsers():
|
|
|
33
34
|
|
|
34
35
|
def check_oiejq():
|
|
35
36
|
if util.is_linux() and not oiejq.check_oiejq():
|
|
36
|
-
print(util.warning('`oiejq` in `~/.local/bin/` not found, installing
|
|
37
|
+
print(util.warning('Up to date `oiejq` in `~/.local/bin/` not found, installing new version...'))
|
|
37
38
|
try:
|
|
38
39
|
if oiejq.install_oiejq():
|
|
39
40
|
print(util.info('`oiejq` was successfully installed.'))
|
|
@@ -50,8 +51,10 @@ def main_exn():
|
|
|
50
51
|
parser = configure_parsers()
|
|
51
52
|
arguments = []
|
|
52
53
|
curr_args = []
|
|
54
|
+
commands = util.get_commands()
|
|
55
|
+
commands_dict = {command.get_name(): command for command in commands}
|
|
53
56
|
for arg in sys.argv[1:]:
|
|
54
|
-
if arg in
|
|
57
|
+
if arg in commands_dict.keys() and not (len(curr_args) > 0 and curr_args[0] == 'init'):
|
|
55
58
|
if curr_args:
|
|
56
59
|
arguments.append(curr_args)
|
|
57
60
|
curr_args = [arg]
|
|
@@ -59,19 +62,19 @@ def main_exn():
|
|
|
59
62
|
curr_args.append(arg)
|
|
60
63
|
if curr_args:
|
|
61
64
|
arguments.append(curr_args)
|
|
62
|
-
|
|
65
|
+
if not arguments:
|
|
66
|
+
parser.print_help()
|
|
67
|
+
exit(1)
|
|
63
68
|
check_oiejq()
|
|
64
69
|
|
|
65
70
|
for curr_args in arguments:
|
|
66
71
|
args = parser.parse_args(curr_args)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
command.run(args)
|
|
74
|
-
if not command_found:
|
|
72
|
+
command = commands_dict.get(args.command, None)
|
|
73
|
+
if command:
|
|
74
|
+
if len(arguments) > 1:
|
|
75
|
+
print(f' {command.get_name()} command '.center(util.get_terminal_size()[1], '='))
|
|
76
|
+
command.run(args)
|
|
77
|
+
else:
|
|
75
78
|
parser.print_help()
|
|
76
79
|
exit(1)
|
|
77
80
|
|
|
@@ -18,7 +18,7 @@ class Command(BaseCommand):
|
|
|
18
18
|
return "doc"
|
|
19
19
|
|
|
20
20
|
def compile_file_latex_div(self, file_path):
|
|
21
|
-
print(
|
|
21
|
+
print(f'Compiling {os.path.basename(file_path)} (latex to dvi)...')
|
|
22
22
|
os.chdir(os.path.dirname(file_path))
|
|
23
23
|
subprocess.run(['latex', file_path])
|
|
24
24
|
dvi_file = os.path.splitext(file_path)[0] + '.dvi'
|
|
@@ -35,7 +35,7 @@ class Command(BaseCommand):
|
|
|
35
35
|
return True
|
|
36
36
|
|
|
37
37
|
def compile_pdf_latex(self, file_path):
|
|
38
|
-
print(
|
|
38
|
+
print(f'Compiling {os.path.basename(file_path)} (pdflatex)...')
|
|
39
39
|
os.chdir(os.path.dirname(file_path))
|
|
40
40
|
subprocess.run(['pdflatex', file_path])
|
|
41
41
|
pdf_file = os.path.splitext(file_path)[0] + '.pdf'
|
|
@@ -62,7 +62,7 @@ class Command(BaseCommand):
|
|
|
62
62
|
for pattern in self.LOG_PATTERNS:
|
|
63
63
|
for file in glob.glob(os.path.join(os.getcwd(), 'doc', pattern)):
|
|
64
64
|
os.rename(file, os.path.join(output_dir, os.path.basename(file)))
|
|
65
|
-
print(
|
|
65
|
+
print(f'Compilation log files can be found in {os.path.relpath(output_dir, os.getcwd())}')
|
|
66
66
|
|
|
67
67
|
def configure_subparser(self, subparser: argparse.ArgumentParser):
|
|
68
68
|
parser = subparser.add_parser(
|
|
@@ -28,10 +28,7 @@ class Command(BaseCommand):
|
|
|
28
28
|
self.get_name(),
|
|
29
29
|
help='Create archive for oioioi upload',
|
|
30
30
|
description='Creates archive in the current directory ready to upload to sio2 or szkopul.')
|
|
31
|
-
|
|
32
|
-
help=f'number of cpus to use to generate output files '
|
|
33
|
-
f'(default: {util.default_cpu_count()})',
|
|
34
|
-
default=util.default_cpu_count())
|
|
31
|
+
parsers.add_cpus_argument(parser, 'number of cpus to use to generate output files')
|
|
35
32
|
parser.add_argument('--no-statement', dest='no_statement', action='store_true',
|
|
36
33
|
help='allow export without statement')
|
|
37
34
|
parser.add_argument('--export-ocen', dest='export_ocen', action='store_true',
|
|
@@ -118,12 +115,14 @@ class Command(BaseCommand):
|
|
|
118
115
|
shutil.copy(test, os.path.join(ocen_dir, ext, os.path.basename(test)))
|
|
119
116
|
num_tests += 1
|
|
120
117
|
|
|
118
|
+
dlazaw_dir = os.path.join(os.getcwd(), 'dlazaw')
|
|
121
119
|
if num_tests == 0:
|
|
122
120
|
print(util.warning('No ocen tests found.'))
|
|
121
|
+
elif os.path.exists(dlazaw_dir):
|
|
122
|
+
print(util.warning('Skipping ocen archive creation because dlazaw directory exists.'))
|
|
123
123
|
else:
|
|
124
124
|
shutil.make_archive(os.path.join(attachments_dir, f'{self.task_id}ocen'), 'zip', tmpdir)
|
|
125
125
|
|
|
126
|
-
dlazaw_dir = os.path.join(os.getcwd(), 'dlazaw')
|
|
127
126
|
if os.path.exists(dlazaw_dir):
|
|
128
127
|
print('Archiving dlazaw directory and adding to attachments.')
|
|
129
128
|
os.makedirs(os.path.join(tmpdir, 'dlazaw'), exist_ok=True)
|
|
@@ -5,6 +5,7 @@ from sinol_make.commands.ingen import Command as IngenCommand
|
|
|
5
5
|
from sinol_make.commands.outgen import Command as OutgenCommand
|
|
6
6
|
from sinol_make.helpers import parsers
|
|
7
7
|
from sinol_make.interfaces.BaseCommand import BaseCommand
|
|
8
|
+
from sinol_make.task_type import get_task_type
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class Command(BaseCommand):
|
|
@@ -31,20 +32,16 @@ class Command(BaseCommand):
|
|
|
31
32
|
help='path to ingen source file, for example prog/abcingen.cpp')
|
|
32
33
|
parser.add_argument('-i', '--only-inputs', action='store_true', help='generate input files only')
|
|
33
34
|
parser.add_argument('-o', '--only-outputs', action='store_true', help='generate output files only')
|
|
34
|
-
|
|
35
|
-
help=f'number of cpus to use to generate output files '
|
|
36
|
-
f'(default: {util.default_cpu_count()})',
|
|
37
|
-
default=util.default_cpu_count())
|
|
35
|
+
parsers.add_cpus_argument(parser, 'number of cpus to use to generate output files')
|
|
38
36
|
parser.add_argument('-n', '--no-validate', default=False, action='store_true',
|
|
39
37
|
help='do not validate test contents')
|
|
40
|
-
|
|
41
|
-
help='Use -fsanitize=address,undefined for ingen compilation. Warning: this may fail on some '
|
|
42
|
-
'systems. To fix this, run `sudo sysctl vm.mmap_rnd_bits = 28`.')
|
|
38
|
+
parsers.add_fsanitize_argument(parser)
|
|
43
39
|
parsers.add_compilation_arguments(parser)
|
|
44
40
|
return parser
|
|
45
41
|
|
|
46
42
|
def run(self, args: argparse.Namespace):
|
|
47
43
|
args = util.init_package_command(args)
|
|
44
|
+
task_type = get_task_type()
|
|
48
45
|
|
|
49
46
|
self.args = args
|
|
50
47
|
self.ins = args.only_inputs
|
|
@@ -58,6 +55,6 @@ class Command(BaseCommand):
|
|
|
58
55
|
command = IngenCommand()
|
|
59
56
|
command.run(args)
|
|
60
57
|
|
|
61
|
-
if self.outs:
|
|
58
|
+
if self.outs and task_type.run_outgen():
|
|
62
59
|
command = OutgenCommand()
|
|
63
60
|
command.run(args)
|
|
@@ -30,22 +30,43 @@ class Command(BaseCommand):
|
|
|
30
30
|
help='path to ingen source file, for example prog/abcingen.cpp')
|
|
31
31
|
parser.add_argument('-n', '--no-validate', default=False, action='store_true',
|
|
32
32
|
help='do not validate test contents')
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
'systems. Tof fix this, run `sudo sysctl vm.mmap_rnd_bits = 28`.')
|
|
33
|
+
parsers.add_cpus_argument(parser, 'number of cpus used for validating tests')
|
|
34
|
+
parsers.add_fsanitize_argument(parser)
|
|
36
35
|
parsers.add_compilation_arguments(parser)
|
|
37
36
|
return parser
|
|
38
37
|
|
|
38
|
+
def delete_dangling_files(self, dates):
|
|
39
|
+
to_delete = set()
|
|
40
|
+
for test in glob.glob(os.path.join(os.getcwd(), "in", f"{self.task_id}*.in")):
|
|
41
|
+
basename = os.path.basename(test)
|
|
42
|
+
if basename in dates and dates[basename] == os.path.getmtime(test):
|
|
43
|
+
to_delete.add(os.path.basename(test))
|
|
44
|
+
if to_delete:
|
|
45
|
+
config = package_util.get_config()
|
|
46
|
+
if 'sinol_static_tests' not in config:
|
|
47
|
+
print(util.warning('Old input files won\'t be deleted, '
|
|
48
|
+
'because static tests are not defined. '
|
|
49
|
+
'You can define them in config.yml with `sinol_static_tests` key.'))
|
|
50
|
+
else:
|
|
51
|
+
static_files = config['sinol_static_tests']
|
|
52
|
+
if isinstance(static_files, str):
|
|
53
|
+
static_files = [static_files]
|
|
54
|
+
static_files = set([os.path.basename(test) for test in static_files])
|
|
55
|
+
to_delete = to_delete - static_files
|
|
56
|
+
if to_delete:
|
|
57
|
+
print('Cleaning up old input files.')
|
|
58
|
+
for test in to_delete:
|
|
59
|
+
os.remove(os.path.join(os.getcwd(), "in", test))
|
|
60
|
+
|
|
39
61
|
def run(self, args: argparse.Namespace):
|
|
40
62
|
args = util.init_package_command(args)
|
|
41
63
|
|
|
42
64
|
self.args = args
|
|
43
65
|
|
|
44
66
|
self.task_id = package_util.get_task_id()
|
|
45
|
-
package_util.validate_test_names(self.task_id)
|
|
46
67
|
util.change_stack_size_to_unlimited()
|
|
47
68
|
self.ingen = get_ingen(self.task_id, args.ingen_path)
|
|
48
|
-
print(
|
|
69
|
+
print(f'Using ingen file {os.path.basename(self.ingen)}')
|
|
49
70
|
self.ingen_exe = compile_ingen(self.ingen, self.args, self.args.compile_mode, self.args.fsanitize)
|
|
50
71
|
|
|
51
72
|
previous_tests = []
|
|
@@ -64,18 +85,11 @@ class Command(BaseCommand):
|
|
|
64
85
|
else:
|
|
65
86
|
util.exit_with_error('Failed to generate input files.')
|
|
66
87
|
|
|
67
|
-
|
|
68
|
-
for test in glob.glob(os.path.join(os.getcwd(), "in", f"{self.task_id}*.in")):
|
|
69
|
-
basename = os.path.basename(test)
|
|
70
|
-
if basename in dates and dates[basename] == os.path.getmtime(test):
|
|
71
|
-
os.unlink(test)
|
|
88
|
+
self.delete_dangling_files(dates)
|
|
72
89
|
|
|
73
90
|
with open(paths.get_cache_path("input_tests"), "w") as f:
|
|
74
91
|
f.write("\n".join(glob.glob(os.path.join(os.getcwd(), "in", f"{self.task_id}*.in"))))
|
|
75
92
|
|
|
76
93
|
if not self.args.no_validate:
|
|
77
|
-
print(util.info('Validating input test contents.'))
|
|
78
94
|
tests = sorted(glob.glob(os.path.join(os.getcwd(), "in", f"{self.task_id}*.in")))
|
|
79
|
-
|
|
80
|
-
package_util.validate_test(test)
|
|
81
|
-
print(util.info('Input test contents are valid!'))
|
|
95
|
+
package_util.validate_tests(tests, self.args.cpus, 'input')
|
|
@@ -10,8 +10,7 @@ from typing import Dict, List
|
|
|
10
10
|
|
|
11
11
|
from sinol_make import util
|
|
12
12
|
from sinol_make.structs.inwer_structs import TestResult, InwerExecution, VerificationResult, TableData
|
|
13
|
-
from sinol_make.helpers import package_util,
|
|
14
|
-
from sinol_make.helpers.parsers import add_compilation_arguments
|
|
13
|
+
from sinol_make.helpers import package_util, printer, paths, parsers
|
|
15
14
|
from sinol_make.interfaces.BaseCommand import BaseCommand
|
|
16
15
|
from sinol_make.commands.inwer import inwer_util
|
|
17
16
|
|
|
@@ -37,12 +36,9 @@ class Command(BaseCommand):
|
|
|
37
36
|
help='path to inwer source file, for example prog/abcinwer.cpp')
|
|
38
37
|
parser.add_argument('-t', '--tests', type=str, nargs='+',
|
|
39
38
|
help='test to verify, for example in/abc{0,1}*')
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
help='Use -fsanitize=address,undefined for compilation. Warning: this may fail on some '
|
|
44
|
-
'systems. Tof fix this, run `sudo sysctl vm.mmap_rnd_bits = 28`.')
|
|
45
|
-
add_compilation_arguments(parser)
|
|
39
|
+
parsers.add_cpus_argument(parser, 'number of cpus to use when verifying tests')
|
|
40
|
+
parsers.add_fsanitize_argument(parser)
|
|
41
|
+
parsers.add_compilation_arguments(parser)
|
|
46
42
|
return parser
|
|
47
43
|
|
|
48
44
|
@staticmethod
|
|
@@ -10,6 +10,7 @@ from sinol_make.commands.outgen.outgen_util import get_correct_solution, compile
|
|
|
10
10
|
from sinol_make.structs.gen_structs import OutputGenerationArguments
|
|
11
11
|
from sinol_make.helpers import parsers, package_util, cache, paths
|
|
12
12
|
from sinol_make.interfaces.BaseCommand import BaseCommand
|
|
13
|
+
from sinol_make.task_type import get_task_type
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class Command(BaseCommand):
|
|
@@ -26,11 +27,7 @@ class Command(BaseCommand):
|
|
|
26
27
|
help='Generate output files',
|
|
27
28
|
description='Generate output files using the correct solution.'
|
|
28
29
|
)
|
|
29
|
-
|
|
30
|
-
parser.add_argument('-c', '--cpus', type=int,
|
|
31
|
-
help=f'number of cpus to use to generate output files '
|
|
32
|
-
f'(default: {util.default_cpu_count()})',
|
|
33
|
-
default=util.default_cpu_count())
|
|
30
|
+
parsers.add_cpus_argument(parser, 'number of cpus to use to generate output files')
|
|
34
31
|
parser.add_argument('-n', '--no-validate', default=False, action='store_true',
|
|
35
32
|
help='do not validate test contents')
|
|
36
33
|
parsers.add_compilation_arguments(parser)
|
|
@@ -50,7 +47,7 @@ class Command(BaseCommand):
|
|
|
50
47
|
for i, result in enumerate(pool.imap(generate_output, arguments)):
|
|
51
48
|
results.append(result)
|
|
52
49
|
if result:
|
|
53
|
-
print(
|
|
50
|
+
print(f'Successfully generated output file {os.path.basename(arguments[i].output_test)}')
|
|
54
51
|
else:
|
|
55
52
|
print(util.error(f'Failed to generate output file {os.path.basename(arguments[i].output_test)}'))
|
|
56
53
|
|
|
@@ -110,6 +107,9 @@ class Command(BaseCommand):
|
|
|
110
107
|
|
|
111
108
|
def run(self, args: argparse.Namespace):
|
|
112
109
|
args = util.init_package_command(args)
|
|
110
|
+
task_type = get_task_type()
|
|
111
|
+
if not task_type.run_outgen():
|
|
112
|
+
util.exit_with_error('This task type does not support output generation.')
|
|
113
113
|
|
|
114
114
|
self.args = args
|
|
115
115
|
self.task_id = package_util.get_task_id()
|
|
@@ -130,7 +130,4 @@ class Command(BaseCommand):
|
|
|
130
130
|
yaml.dump(md5_sums, f)
|
|
131
131
|
|
|
132
132
|
if not self.args.no_validate:
|
|
133
|
-
|
|
134
|
-
for test in sorted(outputs_to_generate):
|
|
135
|
-
package_util.validate_test(test)
|
|
136
|
-
print(util.info('Output test contents are valid!'))
|
|
133
|
+
package_util.validate_tests(sorted(outputs_to_generate), self.args.cpus, 'outputs')
|