[cmake-developers] Perforce Patch for CTest

Pedro Navarro pnavarro at netflix.com
Thu Oct 24 15:57:07 EDT 2013


That's right, p4 usually doesn't create a .p4 file so there's no way to
tell by looking at the file system if a directory is under p4 control or
not. Some people set a P4CONFIG variable that points to a .p4 or .p4config
file and that's what DetectVCS looks for to identify the VCS as perforce.
The only way whould be to issue the p4 fstat <file> or p4 where <directory>
to see if p4 replies with a success, but it didn't feel right to rely on
executing a third party executable from within CTest.

In the test it felt like "cheating" to create a zero length .p4 file -in
almost all p4 installations there won't be such a file- just so I could
trigger ctest's automatic detection so I had to set CTEST_UPDATE_COMMAND to
mark the source directory as being controlled by P4. Do you think there is
a better way? Ideally each VCS implementation could have a way to tell
CTest if a directory it's under that specific VCS control or not, that way
we could execute whatever p4 commands we wanted inside cmCTestP4 and return
true if the source directory is being managed by p4.

Pedro



On Thu, Oct 24, 2013 at 5:59 AM, Brad King <brad.king at kitware.com> wrote:

> On 10/23/2013 08:43 PM, Pedro Navarro wrote:
> > Thanks a lot! Glad we could contribute.
> >
> > What's the process for changes? :) Adding support for P4Web
> > in CDash made me realize that maybe we need to change how
> > revisions are reported in Update.xml (file revisions instead
> > of changelists), I'm looking into that right now.
>
> Okay.  Please attach the next patch here as before.
>
> Also, while fixing the CTest.UpdateP4 test to work without p4
> in the PATH I noticed that the reason the test needs to set
> CTEST_UPDATE_COMMAND/UpdateCommand instead of
> CTEST_P4_COMMAND/P4Command is because the test is not set up
> to trigger cmCTestUpdateHandler::DetectVCS's detection of
> .p4 or .p4client in the source tree.  Therefore CTest cannot
> tell from the source tree which VCS tool manages it.  I'm not
> a regular Perforce user, but is it common to not have any .p4*
> files in a checkout?  Should the test use them?
>
> Thanks,
> -Brad
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20131024/375cc83a/attachment.html>


More information about the cmake-developers mailing list