changeset 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 ce1285728952
files upreckon/upreckon-vcs
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/upreckon/upreckon-vcs	Thu Aug 18 17:17:15 2011 +0300
+++ b/upreckon/upreckon-vcs	Thu Aug 18 22:49:02 2011 +0300
@@ -11,10 +11,10 @@
 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')
 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)')
 parser.add_option('--list-problems', action='store_true', default=False, help='just list all problem names')
+parser.add_option('-c', '--cleanup', dest='cleanup', action='store_true', default=False, help='delete the copies of input/output files and exit')
 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')
 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')
-#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')
-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')
+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')
 parser.add_option('-k', '--skim', action='store_true', default=False, help='skip test groups as soon as one test case is failed')
 parser.add_option('--no-time-limits', dest='no_maxtime', action='store_true', default=False, help='disable all time limits')
 
@@ -76,10 +76,12 @@
 	for taskname in options.problems or globalconf.problems:
 		problem = Problem(taskname)
 		
-		if ntasks and not options.copyonly: say()
+		if ntasks and not (options.cleanup or options.copyonly): say()
 		if shouldprintnames: say(taskname)
 		
-		if options.copyonly:
+		if options.cleanup:
+			problem.cleanup()
+		elif options.copyonly:
 			problem.copytestdata()
 		else:
 			real, max = problem.test()
@@ -89,7 +91,7 @@
 		realscore += real
 		maxscore += max
 	
-	if options.copyonly:
+	if options.cleanup or options.copyonly:
 		sys.exit()
 	
 	if ntasks != 1: