[pypy-commit] pypy sandbox-2: Next test

arigo pypy.commits at gmail.com
Wed Aug 7 12:32:43 EDT 2019


Author: Armin Rigo <arigo at tunes.org>
Branch: sandbox-2
Changeset: r97090:2b59f76840c5
Date: 2019-08-07 18:32 +0200
http://bitbucket.org/pypy/pypy/changeset/2b59f76840c5/

Log:	Next test

diff --git a/rpython/translator/sandbox/sandboxio.py b/rpython/translator/sandbox/sandboxio.py
--- a/rpython/translator/sandbox/sandboxio.py
+++ b/rpython/translator/sandbox/sandboxio.py
@@ -34,7 +34,8 @@
     def close(self):
         """Kill the subprocess and close the file descriptors to the pipe.
         """
-        self.popen.terminate()
+        if self.popen.returncode is None:
+            self.popen.terminate()
         self.child_stdin.close()
         self.child_stdout.close()
 
diff --git a/rpython/translator/sandbox/test/test_sandboxio.py b/rpython/translator/sandbox/test/test_sandboxio.py
--- a/rpython/translator/sandbox/test/test_sandboxio.py
+++ b/rpython/translator/sandbox/test/test_sandboxio.py
@@ -57,6 +57,7 @@
 def expect_done(sandio):
     with py.test.raises(EOFError):
         sandio.read_message()
+    assert sandio.popen.wait() == 0   # exit code 0
     sandio.close()
 
 def compile(f, gc='ref', **kwds):
@@ -126,13 +127,10 @@
         return 1 - y
 
     exe = compile(entry_point)
-    g, f = run_in_subprocess(exe)
-    expect(f, g, "ll_os.ll_os_dup2",   (34, 56, True), None)
-    expect(f, g, "ll_os.ll_os_access", ("spam", 77), True)
-    g.close()
-    tail = f.read()
-    f.close()
-    assert tail == ""
+    sandio = run_in_subprocess(exe)
+    expect(sandio, "dup2(ii)i",   (34, 56), 0)
+    expect(sandio, "access(pi)i", ("spam", 77), 0)
+    expect_done(sandio)
 
 def test_stat_ftruncate():
     from rpython.translator.sandbox.sandlib import RESULTTYPE_STATRESULT


More information about the pypy-commit mailing list