Commits

mattip committed 65392c9

fix till test passes

Comments (0)

Files changed (2)

pypy/translator/platform/test/test_platform.py

         for i in range(900):
             txt += '    j += func%03d();\n' % i
         txt += '    printf("%d\\n", j);\n'
-        txt += '    return j;};\n'
+        txt += '    return 0;};\n'
         cfile = udir.join('test_900_files.c')
         cfile.write(txt)
         cfiles = [cfile]
         mk.write()
         self.platform.execute_makefile(mk)
         res = self.platform.execute(udir.join('test_900_files'))
-        self.check_res(res, sum(range(900)))
+        self.check_res(res, '%d\n' %sum(range(900)))
 
 
     def test_nice_errors(self):

pypy/translator/platform/windows.py

             m.rule(*rule)
         
         objects = ' $(OBJECTS)'
-        create_obj_response_file = ''
+        create_obj_response_file = []
         if len(' '.join(rel_ofiles)) > 4000:
-            create_obj_response_file = 'echo $(OBJECTS) > obj_names.rsp'
+            # cmd.exe has a limit of ~4000 characters before a command line is too long.
+            # Use a response file instead, at the cost of making the Makefile very ugly.
+            for i in range(len(rel_ofiles) - 1):
+                create_obj_response_file.append('echo %s >> obj_names.rsp' % \
+                                                rel_ofiles[i])
+            # use cmd /c for the last one so that the file is flushed 
+            create_obj_response_file.append('cmd /c echo %s >> obj_names.rsp' % \
+                                            rel_ofiles[-1])
             objects = ' @obj_names.rsp'
         if self.version < 80:
             m.rule('$(TARGET)', '$(OBJECTS)',
-                    [create_obj_response_file,
+                    create_obj_response_file + [\
                    '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA)' + objects + ' /out:$@ $(LIBDIRS) $(LIBS)',
                    ])
         else:
             m.rule('$(TARGET)', '$(OBJECTS)',
-                   [create_obj_response_file,
+                    create_obj_response_file + [\
                     '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA)' + objects + ' $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS) /MANIFEST /MANIFESTFILE:$*.manifest',
                     'mt.exe -nologo -manifest $*.manifest -outputresource:$@;1',
                     ])
         m.rule('debugmode_$(TARGET)', '$(OBJECTS)',
-               [create_obj_response_file,
+                create_obj_response_file + [\
                '$(CC_LINK) /nologo /DEBUG $(LDFLAGS) $(LDFLAGSEXTRA)' + objects + ' $(LINKFILES) /out:$@ $(LIBDIRS) $(LIBS)',
                 ])