Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(124041)

Side by Side Diff: Lib/test/test_fcntl.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_faulthandler.py ('k') | Lib/test/test_file_eintr.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Test program for the fcntl C module. 1 """Test program for the fcntl C module.
2 """ 2 """
3 import platform 3 import platform
4 import os 4 import os
5 import struct 5 import struct
6 import sys 6 import sys
7 import unittest 7 import unittest
8 from test.support import (verbose, TESTFN, unlink, run_unittest, import_module, 8 from test.support import (verbose, TESTFN, unlink, run_unittest, import_module,
9 cpython_only) 9 cpython_only)
10 10
11 # Skip test if no fcntl module. 11 # Skip test if no fcntl module.
12 fcntl = import_module('fcntl') 12 fcntl = import_module('fcntl')
13 13
14 14
15 # TODO - Write tests for flock() and lockf(). 15 # TODO - Write tests for flock() and lockf().
16 16
17 def get_lockdata(): 17 def get_lockdata():
18 try: 18 try:
19 os.O_LARGEFILE 19 os.O_LARGEFILE
20 except AttributeError: 20 except AttributeError:
21 start_len = "ll" 21 start_len = "ll"
22 else: 22 else:
23 start_len = "qq" 23 start_len = "qq"
24 24
25 if (sys.platform.startswith(('netbsd', 'freebsd', 'openbsd', 'bsdos')) 25 if (sys.platform.startswith(('netbsd', 'freebsd', 'openbsd', 'bsdos'))
26 or sys.platform == 'darwin'): 26 or sys.platform in ('darwin', 'ios')):
27 if struct.calcsize('l') == 8: 27 if struct.calcsize('l') == 8:
28 off_t = 'l' 28 off_t = 'l'
29 pid_t = 'i' 29 pid_t = 'i'
30 else: 30 else:
31 off_t = 'lxxxx' 31 off_t = 'lxxxx'
32 pid_t = 'l' 32 pid_t = 'l'
33 lockdata = struct.pack(off_t + off_t + pid_t + 'hh', 0, 0, 0, 33 lockdata = struct.pack(off_t + off_t + pid_t + 'hh', 0, 0, 0,
34 fcntl.F_WRLCK, 0) 34 fcntl.F_WRLCK, 0)
35 elif sys.platform.startswith('gnukfreebsd'): 35 elif sys.platform.startswith('gnukfreebsd'):
36 lockdata = struct.pack('qqihhi', 0, 0, 0, fcntl.F_WRLCK, 0, 0) 36 lockdata = struct.pack('qqihhi', 0, 0, 0, fcntl.F_WRLCK, 0, 0)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 import _testcapi 143 import _testcapi
144 self.assertRaises(OverflowError, fcntl.flock, _testcapi.INT_MAX+1, 144 self.assertRaises(OverflowError, fcntl.flock, _testcapi.INT_MAX+1,
145 fcntl.LOCK_SH) 145 fcntl.LOCK_SH)
146 146
147 147
148 def test_main(): 148 def test_main():
149 run_unittest(TestFcntl) 149 run_unittest(TestFcntl)
150 150
151 if __name__ == '__main__': 151 if __name__ == '__main__':
152 test_main() 152 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_faulthandler.py ('k') | Lib/test/test_file_eintr.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+