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 compile
17 def copy_test_suite():
18 dest
= tempfile
.mktemp()
20 os
.system("cp -r %s/* %s" % (test
.__path
__[0], dest
))
21 print "Creating copy of test suite in", dest
24 def compile_files(dir):
27 for file in os
.listdir(dir):
28 base
, ext
= os
.path
.splitext(file)
29 if ext
== '.py' and base
[:4] == 'test':
30 source
= os
.path
.join(dir, file)
31 line_len
= line_len
+ len(file) + 1
34 line_len
= len(source
) + 9
37 # make sure the .pyc file is not over-written
38 os
.chmod(source
+ "c", 444)
41 def run_regrtest(test_dir
):
43 os
.system("%s -v regrtest.py" % sys
.executable
)
46 os
.system("rm -rf %s" % dir)
49 test_dir
= copy_test_suite()
50 compile_files(test_dir
)
51 run_regrtest(test_dir
)
54 if __name__
== "__main__":