Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run output improvements #32

Merged
merged 8 commits into from
Jul 5, 2023
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
22 changes: 16 additions & 6 deletions src/sinol_make/commands/run/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def parse_memory(self, memory_str):


def extract_test_no(self, test_path):
return os.path.split(os.path.splitext(test_path)[0])[1][3:]
return os.path.split(os.path.splitext(test_path)[0])[1][len(self.ID):]


def extract_file_name(self, file_path):
Expand Down Expand Up @@ -730,21 +730,21 @@ def run(self, args):
self.compilers, self.timetool_path = self.validate_arguments(args)

title = self.config["title"]
print("Task %s (%s)" % (title, self.ID))
print("Task: %s (tag: %s)" % (title, self.ID))
config_time_limit = self.config["time_limit"]
config_memory_limit = self.config["memory_limit"]
self.time_limit = args.tl * 1000.0 if args.tl is not None else config_time_limit
self.memory_limit = args.ml * 1024 if args.ml is not None else config_memory_limit
self.cpus = args.cpus or mp.cpu_count()
if self.time_limit == config_time_limit:
print("Time limit (in ms):", self.time_limit)
print(f'Time limit: {self.time_limit} ms')
else:
print("Time limit (in ms):", self.time_limit,
print(f'Time limit: {self.time_limit} ms',
util.warning(("[originally was %.1f ms]" % config_time_limit)))
if self.memory_limit == config_memory_limit:
print("Memory limit (in kb):", self.memory_limit)
print(f'Memory limit: {self.memory_limit} kB')
else:
print("Memory limit (in kb):", self.memory_limit,
print(f'Memory limit: {self.memory_limit} kB',
util.warning(("[originally was %.1f kb]" % config_memory_limit)))
self.scores = collections.defaultdict(int)
print("Scores:")
Expand All @@ -758,6 +758,16 @@ def run(self, args):
print()

self.tests = self.get_tests(args.tests)

if len(self.tests) > 0:
print(util.bold('Tests that will be run:'), ' '.join([self.extract_file_name(test) for test in self.tests]))

example_tests = [test for test in self.tests if self.get_group(test) == 0]
if len(example_tests) == len(self.tests):
print(util.warning('Running only on example tests.'))
else:
print(util.warning('There are no tests to run.'))

self.groups = list(sorted(set([self.get_group(test) for test in self.tests])))
self.possible_score = self.get_possible_score(self.groups)

Expand Down
1 change: 1 addition & 0 deletions tests/packages/vso/prog/vso1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using namespace std;

int main() {
int a, b;
cin >> a >> b;
if (a == 1 && b == 1) {
cout << 0;
Expand Down
3 changes: 2 additions & 1 deletion tests/packages/vso/prog/vsoingen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ using namespace std;

int main() {
for (char c = 'a'; c <= 'e'; c++) {
ofstream f("vso1" + c + ".in");
string letter(1, c);
ofstream f("vso1" + letter + ".in");
f << "1 " << (c - 'a' + 1) << endl;
f.close();
}
Expand Down