Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-79573

add IWYU export pragmas to unittest.h

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • Service Arch

    Description

      I just noticed a test (itoa_test.cpp in this case) was modified from its include of

      #include "mongo/unittest/unittest.h"

      to now use the granular includes of the components of the unittest library:

      #include "mongo/unittest/assert.h"
      #include "mongo/unittest/framework.h"

      This is a downgrade, as the unittest.h header is designed as an umbrella header for the API.
      These smaller more granular headers are basically implementation details designed to break dependency cycles when necessary.
      But unit tests without special dependency considerations should be using the unittest/unittest.h header and not the subcomponents.

      The unit tests affected by this migration should have their includes of unittest/unittest.h restored.

      There's an IWYU pragma that can be added to unittest.h to prevent future IWYU passes from doing this again.

      https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUPragmas.md#iwyu-pragma-begin_exportsend_exports

      We'd make unittest/unittest.h look like this:

      #pragma once
      // IWYU pragma: begin_exports
      #include "mongo/unittest/assert.h"
      #include "mongo/unittest/assert_that.h"
      #include "mongo/unittest/bson_test_util.h"
      #include "mongo/unittest/framework.h"
      // IWYU pragma: end_exports
      

      Attachments

        Activity

          People

            backlog-server-servicearch Backlog - Service Architecture
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: