[CMake] CDash to report Peforce update

Dominique Ledit Dominique.Ledit at PDGM.com
Tue Apr 24 10:19:34 EDT 2018


Hi

I've tried for some time now, to figure out how to configure properly my CDash project to get in the "Update" column of the Dashboard something else than 0, using P4Web as Repository Viewer.
First let me give you some details.
Our build system is based on cmake 3.9.4. We use ctest to run a set of unit tests (on Both Linux and Windows platforms) in our Continuous Integration system.
Our SCM is Perforce
I installed some time ago a CDash 2.5.0 Linux server to display the results of the Update, configure, build steps of our Continuous integration.

A CtestConfig.cmake is generated in the build directory.
## The following are required to uses Dart and the Cdash dashboard.
set(CTEST_PROJECT_NAME "<our_project_name>")
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "<our cdash server>")
set(CTEST_DROP_LOCATION "/submit.php?project=<our_project_name>")
set(CTEST_DROP_SITE_CDASH TRUE)
# Maximum time allowed before CTest will kill the test.
set(CTEST_TEST_TIMEOUT 600)

A CTestTestfile.cmake contains the list of Unit Tests to run

Finally the ctest script I passed to ctest using the -S option to proceed with the update, the build and run the tests:

ctest -D Continuous -S MyCtest.cmake,Continuous --verbose --output-on-failure --timeout 900 -C Release

Set:

  *   CTEST_SITE
  *   CTEST_BUILD_NAME
  *   CTEST_PROJECT_NAME
  *   CTEST_NOTES_FILE
  *   CTEST_P4_CLIENT
  *   CTEST_P4_COMMAND to the full path of the p4 command
  *   CTEST_UPDATE_COMMAND to ${ CTEST_P4_COMMAND}
  *   CTEST_SOURCE_DIRECTORY
  *   CTEST_BINARY_DIRECTORY
  *   CTEST_BUILD_COMMAND
And run

  *   ctest_start (${CTEST_SCRIPT_ARG})
  *   ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE update_code)
  *   ctest_build (BUILD "${CTEST_SOURCE_DIRECTORY}/library" RETURN_VALUE build_code)
  *   ctest_test  (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE test_code)
  *   ctest_submit ()

I got all what I wish in the CDash Dashboard for my Project excepted for the "Update" "Files" column that systematically contains "0"

Clicking on the "0" link open a page containing:
Files changed on <ctest_site>  (Build_name ) as of <date>
Revision:  (<URL of the P4Web server>/@md=d&cd=<Perforce depot path>&rt=s&thv=d&c=igy@/epos/?ac=43&mx=50&sr=<Perforce ChangeList number>
Prior Revision: (<URL of the P4Web server>/@md=d&cd=<Perforce depot path>&rt=s&thv=d&c=igy@/epos/?ac=43&mx=50&sr=<Perforce ChangeList number>

Show Activity Graph
Expand All | Collapse all
[http://vm-pau-cdash/img/Minus.gif][http://vm-pau-cdash/img/Open.gif]<javascript:reload()>  DMP Updated files (0)
[http://vm-pau-cdash/img/Minus.gif][http://vm-pau-cdash/img/Open.gif]<javascript:reload()>  Modified files (0)
[http://vm-pau-cdash/img/Minus.gif][http://vm-pau-cdash/img/Open.gif]<javascript:reload()>  Conflicting files (0)

Expand All | Collapse All

But to get this result I had to modify the <CDash_Install_dir>/include/repository.php file
to make the two "Revision" and "Prior Revision" html links open a page on the P4Web.
I modified the get_p4web_revision_url function (use the action code 43 instead of the 64 one and set a max number of CL to 50)
function get_p4web_revision_url($projecturl, $revision, $priorrevision)
{
    //$revision_url = $projecturl . '?ac=64&sr=' . $revision;
    $revision_url = $projecturl . '?ac=43&mx=50&sr=' . $revision;
    return make_cdash_url($revision_url);
}
And
The  get_p4web_diff_url function where the action code 207 leads to an incorrect link
function get_p4web_diff_url($projecturl, $directory, $file, $revision)
{
    $diff_url = rtrim($projecturl, '/') . ($directory ? ('/' . $directory) : '') . '/' . $file;

    if ($revision != '') {
        $prev_revision = get_previous_revision($revision);
        if ($prev_revision != $revision) {
            //$diff_url .= '?ac=207&sr1=' . $prev_revision . '&sr2=' . $revision;
            $diff_url .= '?ac=64&sr=' . $prev_revision . '&sr2=' . $revision;
        } else {
            $diff_url .= '?ac=64&sr=' . $revision;
        }
    }
    return make_cdash_url($diff_url);
}

I really would like to succeed in setting correctly my CDash project, but still don't find how to set properly for a P4Web Repository Viewer, the  following text fields:

  *   Repository Viewer URL
  *   The Repository
  *   The branch
  *   The Username
  *   Password
And to fix this always "0" result in the Update column

This will be great if someone could give me some advices or tell me what I miss to correctly set the Update column in CDash and have access to the modified files when clicking on the number in the Update column

Thank you

Dominique

Dominique Ledit | Sr. DevOps, Paradigm | Exploration and Production Software
Emerson Automation Solutions | 2 av. Président Pierre Angot | 64000 | Pau | France
T 011-33-(0)5-59-72-79-14
dominique.ledit at pdgm.com<mailto:dominique.ledit at pdgm.com>
[cid:image001.jpg at 01D374EE.E75BD4F0]<http://www.pdgm.com/>

------------------- This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180424/93501dde/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 2426 bytes
Desc: image001.jpg
URL: <https://cmake.org/pipermail/cmake/attachments/20180424/93501dde/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 70 bytes
Desc: image002.gif
URL: <https://cmake.org/pipermail/cmake/attachments/20180424/93501dde/attachment-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 787 bytes
Desc: image005.png
URL: <https://cmake.org/pipermail/cmake/attachments/20180424/93501dde/attachment-0001.png>


More information about the CMake mailing list