Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(836)

Side by Side Diff: third_party/pexpect/tests/platform_checks/check_read.py

Issue 1398903002: Add third_party/pexpect (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@end-to-end-test
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 import os
2
3 filename = os.tmpnam()
4 print 'filename:', filename
5
6 fd_out = os.open(filename, os.O_CREAT | os.O_WRONLY)
7 print 'fd_out:', fd_out
8 os.write (fd_out, 'This is a test.\n')
9 os.close(fd_out)
10 print
11 print 'testing read on good fd...'
12 fd_in = os.open (filename, os.O_RDONLY)
13 print 'fd_in:', fd_in
14 while 1:
15 data_in = os.read(fd_in, 1)
16 print 'data_in:', data_in
17 if data_in == '':
18 print 'data_in was empty'
19 break #sys.exit(1)
20 os.close(fd_in)
21 print
22 print
23 print 'testing read on closed fd...'
24 fd_in = os.open ('test_read.py', os.O_RDONLY)
25 print 'fd_in:', fd_in
26 while 1:
27 data_in = os.read(fd_in, 1)
28 print 'data_in:', data_in
29 if data_in == '':
30 print 'data_in was empty'
31 break
32 os.close(fd_in)
33 d = os.read(fd_in, 1) # fd_in should be closed now...
34 if s == '':
35 print 'd is empty. good.'
OLDNEW
« no previous file with comments | « third_party/pexpect/tests/platform_checks/check_handler.py ('k') | third_party/pexpect/tests/platform_checks/check_signals.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698