Skip to content
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
3 changes: 2 additions & 1 deletion example_package/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ sinol_contest_type: oi
sinol_latex_compiler: auto

# You can specify which tests are static (handwritten). This allows sinol-make to differentiate between
# old and handwritten tests. If this key is not present old tests won't be removed.
# old and handwritten tests. If this key is not present old tests won't be removed. The values can be
# either a list of test names (e.g. `["__ID__0.in", "__ID__1.in"]`) or a glob pattern (e.g. `"__ID__*.in"`).
# This key is optional and should be a list of tests.
sinol_static_tests: ["__ID__0.in", "__ID__0a.in"]

Expand Down
7 changes: 5 additions & 2 deletions src/sinol_make/commands/ingen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ def delete_dangling_files(self, dates):
static_files = config['sinol_static_tests']
if isinstance(static_files, str):
static_files = [static_files]
static_files = set([os.path.basename(test) for test in static_files])
to_delete = to_delete - static_files
found_static_files = set()
for static in static_files:
files = [os.path.basename(f) for f in glob.glob(os.path.join(os.getcwd(), "in", static))]
found_static_files.update(files)
to_delete = to_delete - found_static_files
if to_delete:
print('Cleaning up old input files.')
for test in to_delete:
Expand Down
11 changes: 11 additions & 0 deletions tests/commands/gen/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,17 @@ def test_dangling_inputs(create_package, capsys):
for f in ["gen1.in", "gen2.in"]:
assert os.path.exists(os.path.join(create_package, "in", f))

# Test if globbing works correctly
config = package_util.get_config()
config["sinol_static_tests"] = ["gen?.in"]
sm_util.save_config(config)
simple_run(["prog/geningen5.cpp"], command="ingen")
for f in ["gen1.in", "gen2.in"]:
assert os.path.exists(os.path.join(create_package, "in", f))
simple_run(["prog/geningen7.cpp"], command="ingen")
for f in ["gen1.in", "gen2.in"]:
assert os.path.exists(os.path.join(create_package, "in", f))


@pytest.mark.parametrize("create_package", [util.get_simple_package_path()], indirect=True)
def test_outgen_cache_cleaning(create_package, capsys):
Expand Down
9 changes: 9 additions & 0 deletions tests/packages/gen/prog/geningen7.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <bits/stdc++.h>

using namespace std;

int main() {
ofstream f("gen3.in");
f << "2 3\n";
f.close();
}
Loading