1 """Run the Python regression test using the compiler
3 This test runs the standard Python test suite using bytecode generated
4 by this compiler instead of by the builtin compiler.
6 The regression test is run with the interpreter in verbose mode so
7 that import problems can be observed easily.
10 from compiler
import compileFile
17 def copy_test_suite():
18 dest
= tempfile
.mkdtemp()
19 os
.system("cp -r %s/* %s" % (test
.__path
__[0], dest
))
20 print "Creating copy of test suite in", dest
24 dest
= tempfile
.mkdtemp()
25 libdir
= os
.path
.split(test
.__path
__[0])[0]
26 print "Found standard library in", libdir
27 print "Creating copy of standard library in", dest
28 os
.system("cp -r %s/* %s" % (libdir
, dest
))
31 def compile_files(dir):
32 print "Compiling", dir, "\n\t",
34 for file in os
.listdir(dir):
35 base
, ext
= os
.path
.splitext(file)
37 source
= os
.path
.join(dir, file)
38 line_len
= line_len
+ len(file) + 1
41 line_len
= len(source
) + 9
45 except SyntaxError, err
:
48 # make sure the .pyc file is not over-written
49 os
.chmod(source
+ "c", 444)
51 path
= os
.path
.join(dir, file)
52 if os
.path
.isdir(path
):
60 def run_regrtest(lib_dir
):
61 test_dir
= os
.path
.join(lib_dir
, "test")
63 os
.system("PYTHONPATH=%s %s -v regrtest.py" % (lib_dir
, sys
.executable
))
66 os
.system("rm -rf %s" % dir)
69 lib_dir
= copy_library()
70 compile_files(lib_dir
)
75 if __name__
== "__main__":