CDash is a comprehensive web-based dashboard designed to facilitate continuous integration (CI) and monitoring of software projects. It provides a centralized location for tracking and visualizing the results of automated testing and code analysis. LC now supports CDash!
How to Use CDash
1. Accessing CDash
CDash is accessible through a web browser. Navigate to CDash at https://lc.llnl.gov/cdash in the CZ or https://rzlc.llnl.gov/cdash in the RZ. You can log in with LC OAuth.
2. My CDash Overview
Upon logging in, you can navigate to the My CDash page. On this page, you can create a new project, as well as Authentication Tokens.
3. Project and Build Configuration
CDash organizes information by projects, each containing specific build configurations. A project corresponds to a software application or library, and each project may have multiple build configurations representing different platforms or build options.
4. Submitting Test Rest Via GitLab Pipelines
CDash is integrated with continuous integration pipelines, automating the process of testing, integrating, and deploying code changes. To integrate CDash into your GitLab GI/CD pipeline:
- Create a project in CDash
- Navigate to MyCDash → Start a new project → Name your project → Create your project
- Create a token in CDash
- Navigate to MyCDash → Name the token → Click "Generate Token"
- Save the value of the token create and store it in a GitLab environment variable (Settings → CICD → Variables → Add Variable)
- Note: We recommend masking this environment variable for security purposes. When configuring your variable's key and value, simply check the "Mask variable" option.
- In the example files below, our token is stored in a GitLab environment variable named LC_CDASH_TOKEN.
- In your Git repository, you will need 3 main files (An example file is shown for each one)
- CMakeLists.txt
- Here, you can add in your CTests with the add_test function
-
cmake_minimum_required(VERSION 3.10) project(DummyProject) enable_testing() add_test(NAME DummyTest COMMAND ${CMAKE_COMMAND} -E echo "Dummy Test Ran")
- CTestConfig.cmake
- In this file, set your CDash configurations, ie: the URL for your CDash, the project you wish to submit to
- EX: set _auth_token to the GitLab environment variable you created earlier
-
set(CTEST_PROJECT_NAME "test") set(CTEST_NIGHTLY_START_TIME "00:00:00 UTC") set(CTEST_DROP_METHOD "https") set(CTEST_DROP_SITE "lc.llnl.gov/cdash") set(CTEST_DROP_LOCATION "/submit.php?project=test") set(CTEST_DROP_SITE_CDASH TRUE) set(CTEST_USE_LAUNCHERS 1) set(CTEST_SOURCE_DIRECTORY <your_project_path> ) set(CTEST_BINARY_DIRECTORY <your_build_path>) set(CTEST_COMMAND "/usr/tce/bin/ctest") set(_auth_token "$ENV{LC_CDASH_TOKEN}")
- CTestScript.cmake
- In this file, run the CTests and submit them to CDash using the appropriate commands shown below
-
set(CTEST_SOURCE_DIRECTORY <your_project_path>) set(CTEST_BINARY_DIRECTORY <your_build_path>) ctest_start("Experimental") ctest_test() ctest_submit(HTTPHEADER "Authorization: Bearer ${_auth_token}")
- CMakeLists.txt
- In your gitlab-ci.yml file include:
-
ctest -S ../CTestScript.cmake --verbose
- Note that: ../CTestScript.cmake should be the file path to your CMake script and may vary from the example depending on how your Git repository is set up
-
For more detailed information about CDash terminology and features, refer to the official CDash documentation. For further details on how to use CMake and CTest with CDash, please refer to this page.
Troubleshooting
- If you are having trouble configuring your CTEST_SOURCE_DIRECTORY and CTEST_BINARY_DIRECTORY environment variables, run cmake .. in your GitLab CI pipeline. The output of this command will specify where the build files have been written to, for example
cmake .. -- The C compiler identification is GNU 8.5.0 -- The CXX compiler identification is GNU 8.5.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/lib64/ccache/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/lib64/ccache/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /g/g20/mir2/.jacamar-ci/builds/CRK1Z47S/000/gitlab/doit/cdashci/build
- Thus, in this example we would set CTEST_SOURCE_DIRECTORY to /g/g20/mir2/.jacamar-ci/builds/CRK1Z47S/000/gitlab/doit/cdashci and set CTEST_BINARY_DIRECTORY to /g/g20/mir2/.jacamar-ci/builds/CRK1Z47S/000/gitlab/doit/cdashci/build