Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2029

Port C++ tests to Windows



    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9
    • Fix Version/s: 0.9.2
    • Component/s: C++ - Library
    • Labels:
    • Environment:


    • Patch Info:
      Patch Available


      The attached patch makes the Thrift tests buildable with Visual Studio 2008 (msvc9) + Boost 1.50, and Visual Studio 2012 Update 1 (msvc11) + Boost 1.50. It will likely build with other versions of msvc and older boosts. I don't have usable project files, but the code changes that are attached should go a long way to making the project files easier for someone else.

      Tests addressed:

      • stress test
      • nonblocking stress test
      • fd transport test
      • piped transport test
      • debug proto test
      • json proto test
      • optional required test
      • specialization test
      • all protocol test
      • transport test (mostly)
      • zlib test
      • unit test
      • thread test
      • "TestClient" + "TestServer" over binary, json, buffered, framed, simple, thread-pool, threaded, and nonblocking+binary+framed.

      Tests not addressed:

      • Other variants of "TestClient" + "TestServer", notably "http". There are also some variations that the existing test.sh doesn't try, and I haven't tested those variations either.
      • TFileTransportTest. File transport isn't quite working on Windows right now, and I haven't the time to try and fix it.
      • processor_test and concurrency_test. Makefile.am says these tests are too strong, so I haven't attempted to port them yet.
      • FileTransport and FDTransport parts of the transport test. These aren't really working on Windows right now, so I left them mostly broken.

      General changes:

      • Lots of migration from snprintf to THRIFT_SNPRINTF.
      • Lots of min / max parenthisizing to be able to build without NOMINMAX.
      • #define of _USE_MATH_DEFINES to get access to _M_PI
      • assorted size_t issues.
      • No longer using getopt in the transport test or zlib test. The scripts didn't use the getopt functionality. The main loss is that you will no longer be able to manually set a seed.
      • Rewrote transport test's trigger / alarm facility to use threads instead of sigalarm.
      • tr1 -> thrift::stdcxx changes
      • lots of apache::thrift::transport::TWinsockSingleton::create();
      • Fixed a race in stress test where the client could try to connect before the server had started to listen.
      • removed lots of "using namespace boost" to address uint8_t ambiguities.
      • Shortened "simulated work" sleeps significantly to make "TestClient" + "TestServer" test iterations go lots faster.
      • Making it so that "TestServer" can be shut down in a way other than with "kill" or task manager. Now, hitting enter on the keyboard will stop the server. This shouldn't break existing scripts, but it makes it possible for new scripts to gracefully tear down a server and check the exit status.


        1. porting_tests.patch
          57 kB
          Ben Craig



            • Assignee:
              ben.craig Ben Craig
              ben.craig Ben Craig
            • Votes:
              0 Vote for this issue
              4 Start watching this issue


              • Created: