[CMake] How do you test partial rebuilds?

Jaymie Strecker jstrecker-cmake at kosada.com
Wed Jun 12 14:43:08 EDT 2019


The solution we arrived at was to write a https://behat.org/ <https://behat.org/> backend to perform automated tests of our incremental builds.  The Behat backend copies the project's source tree to a temporary folder, then runs a scripted test suite on it, which looks like this:

   Feature: Incremental builds
   Check that modifying certain source files causes certain build steps to be performed (or not performed).

      Scenario: Editing a core type header
         Given a completed build
         When  I edit type/integer.h
         And   I build

         Then  it should update lib/MyFramework.framework/Headers/integer.h
         And   it should update lib/MyFramework.framework/MyFramework
         And   it should update bin/MyApp.app/Contents/Frameworks/MyFramework.framework/Headers/integer.h
         And   it should update bin/MyApp.app/Contents/Frameworks/MyFramework.framework/MyFramework
         And   it should update the compiler's cache

      Scenario: …

   Feature: Compiler developer mode
   Check that compiler developer mode properly reduces build dependencies,
   to reduce edit-compile-run cycle time when working on the compiler.

      Scenario: Enabling compiler developer mode
         Given a completed build
         When  I run CMake with arguments "-DCOMPILER_DEVELOPER=ON"
         And   I build
         Then  it shouldn't do anything

      Scenario: Editing a compiler source file when in compiler developer mode
         Given a completed build
         When  I edit compiler/compiler.cc <http://compiler.cc/>
         And   I build

         Then  it should update lib/libMyCompiler.a
         And   it should update bin/my-compiler

         But   it shouldn't update the compiler's cache
         And   it shouldn't update bin/something-compiled-using-my-compiler

      Scenario: …

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190612/3c1eb8c9/attachment.html>


More information about the CMake mailing list