Mercurial > ~astiob > upreckon > hgweb
comparison upreckon/upreckon-vcs @ 215:f5169e4f605d
Added option -c/--cleanup (but it does not work)
Now we just need it to actually be implemented.
And -m/--copy-io too.
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Thu, 18 Aug 2011 22:49:02 +0300 |
parents | 1cbe2c428942 |
children | 9d21cef40e5a |
comparison
equal
deleted
inserted
replaced
212:1cbe2c428942 | 215:f5169e4f605d |
---|---|
9 | 9 |
10 parser = optparse.OptionParser(version='Upreckon 2.03.0 ($$REV$$)', epilog='Python 2.6 or newer is required.') | 10 parser = optparse.OptionParser(version='Upreckon 2.03.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') | |
14 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') | 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') |
15 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') | 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') |
16 #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') | 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') |
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') | |
18 parser.add_option('-k', '--skim', action='store_true', default=False, help='skip test groups as soon as one test case is failed') | 18 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') | 19 parser.add_option('--no-time-limits', dest='no_maxtime', action='store_true', default=False, help='disable all time limits') |
20 | 20 |
21 options, args = parser.parse_args() | 21 options, args = parser.parse_args() |
22 parser.destroy() | 22 parser.destroy() |
74 realscore = 0 | 74 realscore = 0 |
75 | 75 |
76 for taskname in options.problems or globalconf.problems: | 76 for taskname in options.problems or globalconf.problems: |
77 problem = Problem(taskname) | 77 problem = Problem(taskname) |
78 | 78 |
79 if ntasks and not options.copyonly: say() | 79 if ntasks and not (options.cleanup or options.copyonly): say() |
80 if shouldprintnames: say(taskname) | 80 if shouldprintnames: say(taskname) |
81 | 81 |
82 if options.copyonly: | 82 if options.cleanup: |
83 problem.cleanup() | |
84 elif options.copyonly: | |
83 problem.copytestdata() | 85 problem.copytestdata() |
84 else: | 86 else: |
85 real, max = problem.test() | 87 real, max = problem.test() |
86 | 88 |
87 ntasks += 1 | 89 ntasks += 1 |
88 nfulltasks += real == max | 90 nfulltasks += real == max |
89 realscore += real | 91 realscore += real |
90 maxscore += max | 92 maxscore += max |
91 | 93 |
92 if options.copyonly: | 94 if options.cleanup or options.copyonly: |
93 sys.exit() | 95 sys.exit() |
94 | 96 |
95 if ntasks != 1: | 97 if ntasks != 1: |
96 say() | 98 say() |
97 say('Grand total: %g/%g weighted points; %d/%d problems solved fully' % (realscore, maxscore, nfulltasks, ntasks)) | 99 say('Grand total: %g/%g weighted points; %d/%d problems solved fully' % (realscore, maxscore, nfulltasks, ntasks)) |