comparison upreckon/upreckon-vcs @ 241:478d4217fe03 2.04 2.04.0

Created a branch for the 2.04 release
author Oleg Oshmyan <chortos@inbox.lv>
date Tue, 11 Dec 2012 01:08:08 +0200
parents 9d21cef40e5a
children bbd735702dc4
comparison
equal deleted inserted replaced
240:2798cbebd83a 241:478d4217fe03
9 9
10 parser = optparse.OptionParser(version='Upreckon 2.04.0 ($$REV$$)', epilog='Python 2.6 or newer is required.') 10 parser = optparse.OptionParser(version='Upreckon 2.04.0 ($$REV$$)', epilog='Python 2.6 or newer is required.')
11 parser.add_option('-1', dest='legacy', action='store_true', default=False, help='handle configuration files in a way more compatible with test.py 1.x') 11 parser.add_option('-1', dest='legacy', action='store_true', default=False, help='handle configuration files in a way more compatible with test.py 1.x')
12 parser.add_option('-p', '--problem', dest='problems', metavar='PROBLEM', action='append', help='test only the PROBLEM (this option can be specified more than once with different problem names, all of which will be tested)') 12 parser.add_option('-p', '--problem', dest='problems', metavar='PROBLEM', action='append', help='test only the PROBLEM (this option can be specified more than once with different problem names, all of which will be tested)')
13 parser.add_option('--list-problems', action='store_true', default=False, help='just list all problem names') 13 parser.add_option('--list-problems', action='store_true', default=False, help='just list all problem names')
14 parser.add_option('-c', '--cleanup', dest='cleanup', action='store_true', default=False, help='delete the copies of input/output files and exit')
15 parser.add_option('-m', '--copy-io', dest='copyonly', action='store_true', default=False, help='create a copy of the input/output files of the last test case for manual testing and exit')
16 parser.add_option('-x', '--auto-exit', dest='pause', action='store_false', default=True, help='do not wait for a key to be pressed after finishing testing') 14 parser.add_option('-x', '--auto-exit', dest='pause', action='store_false', default=True, help='do not wait for a key to be pressed after finishing testing')
17 parser.add_option('-s', '--save-io', dest='erase', action='store_false', default=True, help='do not delete the copies of input/output files after the last test case; create copies of input files and store output in files even if the solution uses standard I/O; delete the stored input/output files if the solution uses standard I/O and the -c/--cleanup option is specified') 15 parser.add_option('-s', '--save-io', dest='erase', action='store_false', default=True, help='do not delete the copies of input/output files after the last test case; create copies of input files and store output in files even if the solution uses standard I/O')
18 parser.add_option('-k', '--skim', action='store_true', default=False, help='skip test groups as soon as one test case is failed') 16 parser.add_option('-k', '--skim', action='store_true', default=False, help='skip test groups as soon as one test case is failed')
19 parser.add_option('--no-time-limits', dest='no_maxtime', action='store_true', default=False, help='disable all time limits') 17 parser.add_option('--no-time-limits', dest='no_maxtime', action='store_true', default=False, help='disable all time limits')
20 18
21 options, args = parser.parse_args() 19 options, args = parser.parse_args()
22 parser.destroy() 20 parser.destroy()
74 realscore = 0 72 realscore = 0
75 73
76 for taskname in options.problems or globalconf.problems: 74 for taskname in options.problems or globalconf.problems:
77 problem = Problem(taskname) 75 problem = Problem(taskname)
78 76
79 if ntasks and not (options.cleanup or options.copyonly): say() 77 if ntasks: say()
80 if shouldprintnames: say(taskname) 78 if shouldprintnames: say(taskname)
81 79
82 if options.cleanup: 80 real, max = problem.test()
83 problem.cleanup()
84 elif options.copyonly:
85 problem.copytestdata()
86 else:
87 real, max = problem.test()
88 81
89 ntasks += 1 82 ntasks += 1
90 nfulltasks += real == max 83 nfulltasks += real == max
91 realscore += real 84 realscore += real
92 maxscore += max 85 maxscore += max
93
94 if options.cleanup or options.copyonly:
95 sys.exit()
96 86
97 if ntasks != 1: 87 if ntasks != 1:
98 say() 88 say()
99 say('Grand total: %g/%g weighted points; %d/%d problems solved fully' % (realscore, maxscore, nfulltasks, ntasks)) 89 say('Grand total: %g/%g weighted points; %d/%d problems solved fully' % (realscore, maxscore, nfulltasks, ntasks))
100 except KeyboardInterrupt: 90 except KeyboardInterrupt: