Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1103

bsoncxx test binary doesn't return test status in exit code

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.3
    • Affects Version/s: None
    • Component/s: Testing
    • Labels:
      None

      The src/bsoncxx/test/new_tests.cpp file with main doesn't return the catch test result as the exit status. To the build system it will always appear to succeed even when bsoncxx tests are failing.

      Here is an example from work-in-progress test-driven development:

      $ ninja test
      [0/1] Running tests...
      Test project /Users/david/git/mongo/cxx-driver/build
          Start 1: bson
      1/3 Test #1: bson .............................   Passed    0.12 sec
          Start 2: driver
      2/3 Test #2: driver ...........................   Passed    1.11 sec
          Start 3: instance
      3/3 Test #3: instance .........................   Passed    0.02 sec
      
      100% tests passed, 0 tests failed out of 3
      
      Total Test time (real) =   1.24 sec
      
      $ ./src/bsoncxx/test/test_bson
      
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      test_bson is a Catch v1.0 b53 host application.
      Run with -? for options
      
      -------------------------------------------------------------------------------
      [] can reach into mixed nested arrays and documents
        throws on invalid
      -------------------------------------------------------------------------------
      ../src/bsoncxx/test/bson_get_values.cpp:129
      ...............................................................................
      
      ../src/bsoncxx/test/bson_get_values.cpp:177: FAILED:
        REQUIRE_THROWS( doc["ints"]["badKey"]["anything"] )
      because no exception was thrown where one was expected:
      
      ===============================================================================
      test cases:    59 |    58 passed | 1 failed
      assertions: 22543 | 22542 passed | 1 failed
      

      The bsoncxx test CMakeLists.txt should be modified to match the mongocxx test CMakeLists.txt file which links the main.cpp file in the catch directory.

            Assignee:
            david.golden@mongodb.com David Golden
            Reporter:
            david.golden@mongodb.com David Golden
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: