Changeset 5548

Show
Ignore:
Timestamp:
07/12/12 11:00:00 (7 years ago)
Author:
monzum
Message:

Made small modifications to one of the semantic unit tests.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • seattle/branches/repy_v2/shims/semantic_tests/ut_shimsemantics_setsockopt_after_close.py

    r5163 r5548  
    33<Purpose> 
    44  The purpose of this test is to test what happens when the  
    5   client sends data multiple times without having the server 
    6   receiver receive any data. The big buffer at the OS level 
    7   should buffer all the data. According to: 
    8   http://twistedmatrix.com/pipermail/twisted-python/2004-August/008461.html 
    9   apparently Windows does not append new data to the buffer, instead 
    10   it waits for the buffer to be completely empty. 
     5  client tries to set a socket option after the socket has  
     6  been closed from the server side. We check to see if the 
     7  client raises any error, or is able to set the option on  
     8  a closed socket. 
    119""" 
    1210 
     
    3735        time.sleep(0.1) 
    3836 
     37    time.sleep(1) 
     38 
    3939    sock_server.close() 
    4040    print "[Server] Closed socket from server thread." 
     
    6464sock_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
    6565sock_client.connect((host, port)) 
     66print "[Client] Client made connection to server." 
    6667 
    67 time.sleep(3) 
     68time.sleep(5) 
    6869 
    6970# Attempt to set a socket option after socket has been closed. 
     
    7778  print "[Client] No error raised." 
    7879 
     80try: 
     81  sock_client.send("HelloWorld") 
     82except socket.error, err: 
     83  print "[Client] Client unable to send msg after socket closed." 
     84else: 
     85  print "[Client] Client still sent msg after socket was closed from server side!" 
     86 
     87print "[Client] Setting socket option after socket has been closed from" +\ 
     88    " a different thread a second time" 
     89 
     90try: 
     91  sock_client.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 
     92except socket.error, err: 
     93  print "[Client] Error raised second time: " + str(err) 
     94else: 
     95  print "[Client] No error raised second time."