[pypy-commit] pypy pypyw: fix standalone test, add pypyw.exe to driver and test

mattip noreply at buildbot.pypy.org
Thu May 21 23:30:07 CEST 2015


Author: mattip <matti.picus at gmail.com>
Branch: pypyw
Changeset: r77461:8892e919f8ba
Date: 2015-05-21 21:17 +0300
http://bitbucket.org/pypy/pypy/changeset/8892e919f8ba/

Log:	fix standalone test, add pypyw.exe to driver and test

diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py
--- a/rpython/translator/c/test/test_standalone.py
+++ b/rpython/translator/c/test/test_standalone.py
@@ -846,11 +846,12 @@
         out, err = cbuilder.cmdexec("a b")
         assert out == "3"
         if sys.platform == 'win32':
-            # Make sure we have a test_1w.exe and it does not use stdout, stderr
+            # Make sure we have a test_1w.exe
+            # Since stdout, stderr are piped, we will get output
             exe = cbuilder.executable_name
             wexe = exe.new(purebasename=exe.purebasename + 'w')
             out, err = cbuilder.cmdexec("a b", exe = wexe)
-            assert out == ''
+            assert out == "3"
 
     def test_gcc_options(self):
         # check that the env var CC is correctly interpreted, even if
diff --git a/rpython/translator/driver.py b/rpython/translator/driver.py
--- a/rpython/translator/driver.py
+++ b/rpython/translator/driver.py
@@ -458,11 +458,14 @@
             shutil_copy(str(fname), str(dstname))
             self.log.info('Static data info written to %s' % dstname)
 
-    def compute_exe_name(self):
+    def compute_exe_name(self, suffix=''):
         newexename = self.exe_name % self.get_info()
         if '/' not in newexename and '\\' not in newexename:
             newexename = './' + newexename
-        return py.path.local(newexename)
+        newname = py.path.local(newexename)
+        if suffix:
+            newname = newname.new(purebasename = newname.purebasename + suffix)
+        return newname
 
     def create_exe(self):
         """ Copy the compiled executable into current directory, which is
@@ -478,6 +481,11 @@
                 shutil_copy(str(soname), str(newsoname))
                 self.log.info("copied: %s" % (newsoname,))
                 if sys.platform == 'win32':
+                    # Copy pypyw.exe
+                    newexename = mkexename(self.compute_exe_name(suffix='w'))
+                    exe = py.path.local(exename)
+                    exename = exe.new(purebasename=exe.purebasename + 'w')
+                    shutil_copy(str(exename), str(newexename))
                     # the import library is named python27.lib, according
                     # to the pragma in pyconfig.h
                     libname = str(newsoname.dirpath().join('python27.lib'))
diff --git a/rpython/translator/test/test_driver.py b/rpython/translator/test/test_driver.py
--- a/rpython/translator/test/test_driver.py
+++ b/rpython/translator/test/test_driver.py
@@ -53,17 +53,21 @@
 
     dst_name = udir.join('dst/pypy.exe')
     src_name = udir.join('src/dydy2.exe')
+    wsrc_name = udir.join('src/dydy2w.exe')
     dll_name = udir.join('src/pypy.dll')
     lib_name = udir.join('src/pypy.lib')
     pdb_name = udir.join('src/pypy.pdb')
     src_name.ensure()
     src_name.write('exe')
+    wsrc_name.ensure()
+    wsrc_name.write('wexe')
     dll_name.ensure()
     dll_name.write('dll')
     lib_name.ensure()
     lib_name.write('lib')
     pdb_name.ensure()
     pdb_name.write('pdb')
+    # Create the dst directory
     dst_name.ensure()
 
     class CBuilder(object):
@@ -76,6 +80,7 @@
     assert dst_name.read() == 'exe'
     assert dst_name.new(ext='dll').read() == 'dll'
     assert dst_name.new(purebasename='python27',ext='lib').read() == 'lib'
+    assert dst_name.new(purebasename=dst_name.purebasename + 'w').read() == 'wexe'
 
 def test_shutil_copy():
     if os.name == 'nt':


More information about the pypy-commit mailing list