mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Revise regrtest to compile entire standard library.
The tests are run from a copy of the library directory, where everything has been compiled by the compiler package. Add a raw_input() call at the end of the script, so that I can check the output before the temp directory with the compiled code is removed.
This commit is contained in:
		
							parent
							
								
									33c2a627f1
								
							
						
					
					
						commit
						2a8ec79353
					
				
					 1 changed files with 28 additions and 9 deletions
				
			
		|  | @ -21,35 +21,54 @@ def copy_test_suite(): | ||||||
|     print "Creating copy of test suite in", dest |     print "Creating copy of test suite in", dest | ||||||
|     return dest |     return dest | ||||||
| 
 | 
 | ||||||
|  | def copy_library(): | ||||||
|  |     dest = tempfile.mktemp() | ||||||
|  |     os.mkdir(dest) | ||||||
|  |     libdir = os.path.split(test.__path__[0])[0] | ||||||
|  |     os.system("cp -r %s/* %s" % (libdir, dest)) | ||||||
|  |     print "Creating copy of standard library in", dest | ||||||
|  |     return dest | ||||||
|  | 
 | ||||||
| def compile_files(dir): | def compile_files(dir): | ||||||
|     print "Compiling", |     print "Compiling", dir | ||||||
|     line_len = 10 |     line_len = 10 | ||||||
|     for file in os.listdir(dir): |     for file in os.listdir(dir): | ||||||
|         base, ext = os.path.splitext(file) |         base, ext = os.path.splitext(file) | ||||||
|         if ext == '.py' and base[:4] == 'test': |         if ext == '.py': | ||||||
|             source = os.path.join(dir, file) |             source = os.path.join(dir, file) | ||||||
|             line_len = line_len + len(file) + 1 |             line_len = line_len + len(file) + 1 | ||||||
|             if line_len > 75: |             if line_len > 75: | ||||||
|                 print "\n\t", |                 print "\n\t", | ||||||
|                 line_len = len(source) + 9 |                 line_len = len(source) + 9 | ||||||
|             print file, |             print file, | ||||||
|             compile(source) |             try: | ||||||
|  |                 compile(source) | ||||||
|  |             except SyntaxError, err: | ||||||
|  |                 print err | ||||||
|  |                 continue | ||||||
|             # make sure the .pyc file is not over-written |             # make sure the .pyc file is not over-written | ||||||
|             os.chmod(source + "c", 444) |             os.chmod(source + "c", 444) | ||||||
|  |         else: | ||||||
|  |             path = os.path.join(dir, file) | ||||||
|  |             if os.path.isdir(path): | ||||||
|  |                 print | ||||||
|  |                 compile_files(path) | ||||||
|     print |     print | ||||||
| 
 | 
 | ||||||
| def run_regrtest(test_dir): | def run_regrtest(lib_dir): | ||||||
|  |     test_dir = os.path.join(lib_dir, "test") | ||||||
|     os.chdir(test_dir) |     os.chdir(test_dir) | ||||||
|     os.system("%s -v regrtest.py" % sys.executable) |     os.system("PYTHONPATH=%s %s -v regrtest.py -r" % (lib_dir, sys.executable)) | ||||||
| 
 | 
 | ||||||
| def cleanup(dir): | def cleanup(dir): | ||||||
|     os.system("rm -rf %s" % dir) |     os.system("rm -rf %s" % dir) | ||||||
| 
 | 
 | ||||||
| def main(): | def main(): | ||||||
|     test_dir = copy_test_suite() |     lib_dir = copy_library() | ||||||
|     compile_files(test_dir) |     compile_files(lib_dir) | ||||||
|     run_regrtest(test_dir) |     run_regrtest(lib_dir) | ||||||
|     cleanup(test_dir) |     raw_input("Cleanup?") | ||||||
|  |     cleanup(lib_dir) | ||||||
| 
 | 
 | ||||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||||
|     main() |     main() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jeremy Hylton
						Jeremy Hylton