-
Notifications
You must be signed in to change notification settings - Fork 0
/
.appveyor.test.py
46 lines (35 loc) · 1.41 KB
/
.appveyor.test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from __future__ import print_function
import codecs
import logging
import os
import sys
from dmoj import judgeenv, executors
from dmoj.testsuite import Tester
from dmoj.utils.ansi import ansi_style
from dmoj.utils.unicode import unicode_stdout_stderr
required_executors = ['AWK', 'BF', 'C', 'CPP03', 'CPP11', 'CS', 'PERL', 'PY2', 'PY3',
'RUBY19', 'RUBY2', 'SED', 'VB']
def main():
logging.basicConfig(level=logging.INFO)
sys.stdout = codecs.getwriter('utf-8')(os.fdopen(sys.stdout.fileno(), 'w', 0))
sys.stderr = codecs.getwriter('utf-8')(os.fdopen(sys.stderr.fileno(), 'w', 0))
judgeenv.load_env(cli=True, testsuite=True)
judgeenv.env['id'] = 'testsuite'
executors.load_executors()
executor_fail = not all(name in executors.executors for name in required_executors)
if executor_fail:
print(ansi_style('#ansi[A required executor failed to load.](red|bold)'))
else:
print(ansi_style('#ansi[All required executors loaded successfully.](green|bold)'))
print()
tester = Tester(judgeenv.problem_regex, judgeenv.case_regex)
fails = tester.test_all()
print()
print('Test complete')
if fails:
print(ansi_style('#ansi[A total of %d case(s) failed](red|bold).') % fails)
else:
print(ansi_style('#ansi[All cases passed.](green|bold)'))
raise SystemExit(int(executor_fail or fails != 0))
if __name__ == '__main__':
main()