summaryrefslogtreecommitdiff
path: root/lib/python2.7/test/tf_inherit_check.py
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2015-09-23 20:45:19 -0700
committerJosh Gao <jmgao@google.com>2015-09-23 20:46:13 -0700
commitf79bdee20cacc521d7ec3a8720a43087b47326d6 (patch)
treeee9330bdc29d1af5a033ca862a10a33e5e1c1b7f /lib/python2.7/test/tf_inherit_check.py
parentdf5f01881b6d4e9c59be106b4063247433737773 (diff)
downloadlinux-x86-f79bdee20cacc521d7ec3a8720a43087b47326d6.tar.gz
Import gdb 7.10 linux-x86_64 prebuilt.
Taken from aosp-master-ndk build 2274331. Bug: http://b/21920612 Change-Id: I2129ab5b85c96273bdb97ee9ca82116bb4db87fa
Diffstat (limited to 'lib/python2.7/test/tf_inherit_check.py')
-rw-r--r--lib/python2.7/test/tf_inherit_check.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/python2.7/test/tf_inherit_check.py b/lib/python2.7/test/tf_inherit_check.py
new file mode 100644
index 0000000..a8b80d2
--- /dev/null
+++ b/lib/python2.7/test/tf_inherit_check.py
@@ -0,0 +1,25 @@
+# Helper script for test_tempfile.py. argv[2] is the number of a file
+# descriptor which should _not_ be open. Check this by attempting to
+# write to it -- if we succeed, something is wrong.
+
+import sys
+import os
+
+verbose = (sys.argv[1] == 'v')
+try:
+ fd = int(sys.argv[2])
+
+ try:
+ os.write(fd, "blat")
+ except os.error:
+ # Success -- could not write to fd.
+ sys.exit(0)
+ else:
+ if verbose:
+ sys.stderr.write("fd %d is open in child" % fd)
+ sys.exit(1)
+
+except StandardError:
+ if verbose:
+ raise
+ sys.exit(1)