Fix Harmony-707 test for CTS

Change the way Harmony-707 test works.
We cannot check timeouts equality, as timeout is approximated
by the Linux Kernel (see set_sock_timeout() in net/core/sock.c).

Previously, testing with the value provided to setSoTimout()
could fail, depending on the Kernel configuration:
- On a device running a kernel compiled with CONFIG_HZ=100,
  it would work
- On a device running a kernel compiled with CONFIG_HZ=250,
  it would not:
  * Kernel stored a timeout of 3 (3.49975 cast to long)
   *timeo_p = tv.tv_sec*HZ + (tv.tv_usec+(1000000/HZ-1))/(1000000/HZ)
   with tv.tv_sec=0, tv.tv_usec=10000 (10ms), and HZ=250
  * Kernel returned a timeout of 12ms
   v.tm.tv_usec = ((sk->sk_rcvtimeo % HZ) * 1000000) / HZ
   with sk->sk_rcvtimeo=3 and HZ=250

Instead, we have to ensure that the timeout is not reset to the
internal default timeout after calling accept():
 - set a timeout
 - immediately retrieve it and store it (this value may differ
   from the previously set value)
 - call accept()
 - retrieve and check the timeout with the previously stored
   timeout

Change-Id: I7f05c6843d9e48e6d696dca17173fce028a45a68
Signed-off-by: Samuel Rats <samuel.rats@gmail.com>
1 file changed