Browse Source

fix test

1.4
clowwindy 11 years ago
parent
commit
e113479a80
  1. 14
      test.py

14
test.py

@ -92,7 +92,8 @@ p3 = None
print 'encryption test passed' print 'encryption test passed'
try: try:
ready_count = 0 local_ready = False
server_ready = False
fdset = [p1.stdout, p2.stdout, p1.stderr, p2.stderr] fdset = [p1.stdout, p2.stdout, p1.stderr, p2.stderr]
while True: while True:
r, w, e = select.select(fdset, [], fdset) r, w, e = select.select(fdset, [], fdset)
@ -102,10 +103,13 @@ try:
for fd in r: for fd in r:
line = fd.readline() line = fd.readline()
sys.stdout.write(line) sys.stdout.write(line)
if line.find('starting') >= 0: if line.find('starting local') >= 0:
ready_count += 1 local_ready = True
if line.find('starting server') >= 0:
if ready_count == 2 and p3 is None: server_ready = True
if local_ready and server_ready and p3 is None:
time.sleep(1)
p3 = Popen(['curl', 'http://www.example.com/', '-v', '-L', p3 = Popen(['curl', 'http://www.example.com/', '-v', '-L',
'--socks5-hostname', '127.0.0.1:1080'], shell=False, '--socks5-hostname', '127.0.0.1:1080'], shell=False,
bufsize=0, close_fds=True) bufsize=0, close_fds=True)

Loading…
Cancel
Save