1. 07 9月, 2018 13 次提交
  2. 06 9月, 2018 14 次提交
  3. 05 9月, 2018 12 次提交
  4. 04 9月, 2018 1 次提交
    • D
      tests: rewrite socket to do something sensible and reliable · 39015a6f
      Daniel P. Berrangé 提交于
      The current socket test is rather crazy in that it sets up a server
      listening for sockets and then runs a client connect call, relying on
      the fact that the kernel will accept this despite the application
      not having called accept() yet. It then closes the client socket and
      calls accept() on the server. On Linux accept() will always see that
      the client has gone and so skip the rest of the code. On FreeBSD,
      however, the accept sometimes succeeds, causing us to then go into
      code that attempts to read and write to the client which will fail
      aborting the test. The accept() never succeeds on FreeBSD guests
      with a single CPU, but as you add more CPUs, accept() becomes more and
      more likely to succeed, giving a 100% failure rate for the test when
      using 8 CPUs.
      
      This completely rewrites the test so that it is avoids this designed in
      race condition. We simply spawn a background thread to act as the
      client, which will read a byte from the server and write it back again.
      The main thread can now properly listen and accept the client in a
      synchronous manner avoiding any races.
      Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      39015a6f