[pypy-svn] r35620 - pypy/dist/pypy/translator/llvm/test

mwh at codespeak.net mwh at codespeak.net
Tue Dec 12 11:43:47 CET 2006


Author: mwh
Date: Tue Dec 12 11:43:43 2006
New Revision: 35620

Modified:
   pypy/dist/pypy/translator/llvm/test/test_extfunc.py
Log:
three skipped, failing tests for execv[e] nicked from genc.


Modified: pypy/dist/pypy/translator/llvm/test/test_extfunc.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/test/test_extfunc.py	(original)
+++ pypy/dist/pypy/translator/llvm/test/test_extfunc.py	Tue Dec 12 11:43:43 2006
@@ -592,3 +592,56 @@
         assert os.WIFEXITED(status1)
         assert os.WEXITSTATUS(status1) == 4
 
+if hasattr(posix, 'execv'):
+    def test_execv():
+        py.test.skip("fails to link")
+        filename = str(udir.join('test_execv.txt'))
+        executable = sys.executable
+        def does_stuff():
+            progname = str(executable)
+            l = ['', '']
+            l[0] = progname
+            l[1] = "-c"
+            l.append('open("%s","w").write("1")' % filename)
+            pid = os.fork()
+            if pid == 0:
+                os.execv(progname, l)
+            else:
+                os.waitpid(pid, 0)
+            return 1
+        func = compile_function(does_stuff, [])
+        func()
+        assert open(filename).read() == "1"
+
+    def test_execv_raising():
+        py.test.skip("fails to link")
+        def does_stuff():
+            l = []
+            l.append("asddsadw32eewdfwqdqwdqwd")
+            os.execv(l[0], l)
+            return 1
+        func = compile_function(does_stuff, [])
+        py.test.raises(OSError, "func()")
+
+    def test_execve():
+        py.test.skip("fails to link")
+        filename = str(udir.join('test_execve.txt'))
+        executable = sys.executable
+        def does_stuff():
+            progname = executable
+            l = []
+            l.append(progname)
+            l.append("-c")
+            l.append('import os; open("%s", "w").write(os.environ["STH"])' % filename)
+            env = {}
+            env["STH"] = "42"
+            env["sthelse"] = "a"
+            pid = os.fork()
+            if pid == 0:
+                os.execve(progname, l, env)
+            else:
+                os.waitpid(pid, 0)
+            return 1
+        func = compile_function(does_stuff, [])
+        func()
+        assert open(filename).read() == "42"



More information about the Pypy-commit mailing list