[CMake] Get ctest -S script to pull from git branch other than 'master'?

Xavier Besseron xavier.besseron at uni.lu
Wed Jun 8 12:45:03 EDT 2016


Hi Ross,

Here is how I do it in my case:


...

# Initial checkout if no source directory
if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
  message("Initial checkout...")
  set(CTEST_CHECKOUT_COMMAND "git clone --branch ${GIT_BRANCH}
${REPOSITORY} ${SOURCE_DIR_NAME}")
endif()

# Initialize testing
message("Initialize ${CTEST_MODEL} testing...")
ctest_start(${CTEST_MODEL} TRACK "${CTEST_SUBMISSION_TRACK}")

message("Update source...")
set(CTEST_GIT_COMMAND "git")
ctest_update(RETURN_VALUE NB_CHANGED_FILES)
message("Found ${NB_CHANGED_FILES} changed file(s)")

...



I hope this helps.

Best regards,

Xavier


On Tue, Jun 7, 2016 at 11:04 PM, Bartlett, Roscoe A <rabartl at sandia.gov>
wrote:

> Hello,
>
>
>
> Is there a built-in way to get a ctest -S script to checkout and pull from
> a git branch other than ‘master’?  I can’t seem to find a way to so this
> and there is no mention of branches at all in the official documentation:
>
>
>
>
> https://cmake.org/cmake/help/v3.6/command/ctest_update.html?highlight=ctest_update
>
>
>
> and there is no mention of “branch” at:
>
>
>
>     https://cmake.org/Wiki/CMake/Testing_With_CTest
>
>
>
> Currently, I see code that people have written which is explicitly
> checking out and updating the desired branch after ctest_update() is called
> (e.g. this what TribitsCTestDriverCore.cmake does).  Therefore, this CTest
> code is really just using ctest_update() to do a `git fetch` on the
> external repo.  In this case, if the local branch is changed to a tracking
> branch, then will ctest_update() leave that tracking branch as is and just
> pull from the tracking branch the next time the ctest –S script is called?
> If that is the case, then I would expect CTest to report the correct list
> of “updated files”.  But if ctest_update() instead switches back to the
> ‘master’ branch and then does the pull, then it will likely report the
> wrong list of “updated files”.
>
>
>
> I can dig into the source code for CTest to see what it actually does but
> it would be nice to have direct support for choosing the branch or at the
> very least just documenting the current behavior and describe the best way
> to work around the issue.
>
>
>
> Thanks,
>
>
>
> -Ross
>
>
>
>
>
> Dr. Roscoe A. Bartlett, PhD
>
> Sandia National Laboratories
>
> Trilinos Software Engineering and Integration Technologies Lead
>
> Consortium for the Advanced Simulation of Light Water Reactors (CASL)
> Physics Integration Infrastructure Lead
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Dr Xavier BESSERON
Research associate
FSTC, University of Luxembourg
Campus Kirchberg, Office E-007
Phone: +352 46 66 44 5418
http://luxdem.uni.lu/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160608/f7a0eab6/attachment-0001.html>


More information about the CMake mailing list