Author: Matti Picus <[email protected]>
Branch: precompiled-headers
Changeset: r68989:d3af251178e9
Date: 2014-01-29 13:24 +0200
http://bitbucket.org/pypy/pypy/changeset/d3af251178e9/
Log: add a 'clean' target and test non-precompiled header make
diff --git a/rpython/translator/platform/posix.py
b/rpython/translator/platform/posix.py
--- a/rpython/translator/platform/posix.py
+++ b/rpython/translator/platform/posix.py
@@ -202,7 +202,8 @@
def write_list(prefix, lst):
lst = lst or ['']
for i, fn in enumerate(lst):
- fn = fn.replace('\\', '\\\\')
+ if sys.platform != 'win32':
+ fn = fn.replace('\\', '\\\\')
print >> f, prefix, fn,
if i < len(lst)-1:
print >> f, '\\'
diff --git a/rpython/translator/platform/test/test_platform.py
b/rpython/translator/platform/test/test_platform.py
--- a/rpython/translator/platform/test/test_platform.py
+++ b/rpython/translator/platform/test/test_platform.py
@@ -87,13 +87,14 @@
self.check_res(res, '%d\n' %sum(range(900)))
def test_precompiled_headers(self):
+ import time
tmpdir = udir.join('precompiled_headers').ensure(dir=1)
# Create an eci that should not use precompiled headers
eci = ExternalCompilationInfo(include_dirs=[tmpdir])
main_c = tmpdir.join('main_no_pch.c')
eci.separate_module_files = [main_c]
ncfiles = 10
- nprecompiled_headers = 4
+ nprecompiled_headers = 20
txt = ''
for i in range(ncfiles):
txt += "int func%03d();\n" % i
@@ -109,7 +110,7 @@
for i in range(nprecompiled_headers):
pch_name =tmpdir.join('pcheader%03d.h' % i)
txt = ''
- for j in range(1200):
+ for j in range(3000):
txt += "int pcfunc%03d_%03d();\n" %(i, j)
pch_name.write(txt)
cfiles_precompiled_headers.append(pch_name)
@@ -124,11 +125,30 @@
c_name.write(txt)
cfiles.append(c_name)
mk = self.platform.gen_makefile(cfiles, eci, path=udir,
-
cfile_precompilation=cfiles_precompiled_headers)
+ cfile_precompilation=cfiles_precompiled_headers)
+ if sys.platform == 'win32':
+ clean = ('clean', '', 'for %f in ( $(OBJECTS) $(TARGET) ) do @if
exist %f del /f %f')
+ else:
+ clean = ('clean', '', 'rm -f $(OBJECTS) $(TARGET) ')
+ mk.rule(*clean)
mk.write()
+ t0 = time.clock()
self.platform.execute_makefile(mk)
+ t1 = time.clock()
+ t_precompiled = t1 - t0
res = self.platform.execute(mk.exe_name)
self.check_res(res, '%d\n' %sum(range(ncfiles)))
+ self.platform.execute_makefile(mk, extra_opts=['clean'])
+ #Rewrite a non-precompiled header makefile
+ mk = self.platform.gen_makefile(cfiles, eci, path=udir)
+ mk.rule(*clean)
+ mk.write()
+ t0 = time.clock()
+ self.platform.execute_makefile(mk)
+ t1 = time.clock()
+ t_normal = t1 - t0
+ print "precompiled haeder 'make' time %.2f, non-precompiled header
time %.2f" %(t_precompiled, t_normal)
+ assert t_precompiled < t_normal * 0.5
def test_nice_errors(self):
cfile = udir.join('test_nice_errors.c')
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit