Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unittest check #14765

Merged
merged 5 commits into from
Jun 14, 2021
Merged

Fix unittest check #14765

merged 5 commits into from
Jun 14, 2021

Commits on Jun 10, 2021

  1. Configuration menu
    Copy the full SHA
    eb73392 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c761049 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    314d224 View commit details
    Browse the repository at this point in the history
  4. CMake: unit-tests: Fetch googletest master

    googletest now follows the "Abseil Live at HEAD" philosophy, which means
    they recommend using the latest commit on the master branch and always
    compiling from source. They recommend this to avoid version mismatch
    issues and "diamond dependency" problems which are common in dependency
    graphs with pinned versions. Google make the "promise" that future
    changes won't break downstream code if it follows the "Abseil
    compatability guidelines".
    
    Upping the version to master also fixes some CMake configure time
    warnings that were present with the older tagged releases of googletest:
    
    CMake Deprecation Warning at __build/_deps/googletest-src/CMakeLists.txt:4 (cmake_minimum_required):
      Compatibility with CMake < 2.8.12 will be removed from a future version of
      CMake.
    
      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.
    
    CMake Deprecation Warning at __build/_deps/googletest-src/googlemock/CMakeLists.txt:45 (cmake_minimum_required):
      Compatibility with CMake < 2.8.12 will be removed from a future version of
      CMake.
    
      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.
    
    CMake Deprecation Warning at __build/_deps/googletest-src/googletest/CMakeLists.txt:56 (cmake_minimum_required):
      Compatibility with CMake < 2.8.12 will be removed from a future version of
      CMake.
    
      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.
    rwalton-arm committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    d4f0181 View commit details
    Browse the repository at this point in the history
  5. CMake: Only build unit tests if Mbed OS is the current project

    Typically when adding a unit test directory to a CMake project a check
    will be used to ensure the subdirectory is added only if the following
    are true:
    
    * The BUILD_TESTING option is set to ON.
    * The current CMake project is the top-level project.
    
    The reason being, if a downstream project includes our project they
    generally don't want to build our unit tests.
    
    In mbed-os, we do correctly specify the above condition before adding
    the central UNITTEST subdirectory, which fetches googletest and adds the
    "stub" libraries the unit tests depend on. However, we only check if
    CMAKE_CROSSCOMPILING is OFF (or undefined) before actually adding the
    unit tests. This mismatched logic would lead to unexpected build
    failures in various scenarios. One likely case could be: a downstream
    project including mbed-os happens to set CMAKE_CROSSCOMPILING to
    OFF/undefined for any reason (possibly to build its own unit tests).
    mbed-os would go ahead and attempt to build its tests without fetching
    googletest or adding the required stub targets.
    
    To fix the issue replace the check for CMAKE_CROSSCOMPILING in the unit
    tests with the same BUILD_TESTING idiom we use for adding the central
    UNITTESTS subdirectory.
    rwalton-arm committed Jun 10, 2021
    Configuration menu
    Copy the full SHA
    a0befae View commit details
    Browse the repository at this point in the history