码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • CMake教程-第 6 步:添加对测试仪表板的支持


    CMake教程-第 6 步:添加对测试仪表板的支持

    • 1 CMake教程介绍
    • 2 学习步骤
      • [Step 1: A Basic Starting Point](https://blog.csdn.net/u014100559/article/details/133099915?spm=1001.2014.3001.5501)
      • [Step 2: Adding a Library](https://blog.csdn.net/u014100559/article/details/133149868?spm=1001.2014.3001.5501)
      • [Step 3: Adding Usage Requirements for a Library](https://blog.csdn.net/u014100559/article/details/133281152?spm=1001.2014.3001.5501)
      • [Step 4: Adding Generator Expressions](https://blog.csdn.net/u014100559/article/details/133324929?spm=1001.2014.3001.5501)
      • [Step 5: Installing and Testing](https://blog.csdn.net/u014100559/article/details/133799788?spm=1001.2014.3001.5501)
      • [Step 6: Adding Support for a Testing Dashboard](https://blog.csdn.net/u014100559/article/details/133849508?spm=1001.2014.3001.5501)
      • [Step 7: Adding System Introspection](https://blog.csdn.net/u014100559/article/details/133896075?spm=1001.2014.3001.5501)
      • [Step 8: Adding a Custom Command and Generated File](https://blog.csdn.net/u014100559/article/details/133935961?spm=1001.2014.3001.5501)
      • [Step 9: Packaging an Installer](https://blog.csdn.net/u014100559/article/details/134023057?spm=1001.2014.3001.5501)
      • [Step 10: Selecting Static or Shared Libraries](https://blog.csdn.net/u014100559/article/details/134066467?spm=1001.2014.3001.5501)
      • [Step 11: Adding Export Configuration](https://blog.csdn.net/u014100559/article/details/134130496?spm=1001.2014.3001.5501)
      • [Step 12: Packaging Debug and Release](https://blog.csdn.net/u014100559/article/details/134256645?spm=1001.2014.3001.5501)
    • 3 Step 6: Adding Support for a Testing Dashboard
      • 3.1 Exercise 1 - Send Results to a Testing Dashboard
        • 3.1.1 目标
        • 3.1.2 Helpful Resources(有用的资源)
        • 3.1.3 Files to Edit(需编辑的文件)
        • 3.1.4 Getting Started(入门指南)
        • 3.1.5 Build and Run(构建并运行)
        • 3.1.6 解决方案

    该文档是基于CMake的官方教程翻译而来,并稍微添加了自己的理解:

    cmake的官方网站为:CMake Tutorial

    1 CMake教程介绍

    The CMake tutorial provides a step-by-step guide that covers common build system issues that CMake helps address. Seeing how various topics all work together in an example project can be very helpful.
    CMake 教程提供了一个循序渐进的指南,涵盖了 CMake 可帮助解决的常见构建系统问题。在一个示例项目中了解各个主题是如何协同工作的,会非常有帮助。

    2 学习步骤

    The tutorial source code examples are available in this archive. Each step has its own subdirectory containing code that may be used as a starting point. The tutorial examples are progressive so that each step provides the complete solution for the previous step.
    本文档中提供了教程源代码示例。每个步骤都有自己的子目录,其中包含可用作起点的代码。教程示例是循序渐进的,因此每一步都提供了前一步的完整解决方案。

    Step 1: A Basic Starting Point

    • Exercise 1 - Building a Basic Project
    • Exercise 2 - Specifying the C++ Standard
    • Exercise 3 - Adding a Version Number and Configured Header File

    Step 2: Adding a Library

    • Exercise 1 - Creating a Library
    • Exercise 2 - Adding an Option

    Step 3: Adding Usage Requirements for a Library

    • Exercise 1 - Adding Usage Requirements for a Library
    • Exercise 2 - Setting the C++ Standard with Interface Libraries

    Step 4: Adding Generator Expressions

    • Exercise 1 - Adding Compiler Warning Flags with Generator Expressions

    Step 5: Installing and Testing

    • Exercise 1 - Install Rules
    • Exercise 2 - Testing Support

    Step 6: Adding Support for a Testing Dashboard

    • Exercise 1 - Send Results to a Testing Dashboard

    Step 7: Adding System Introspection

    • Exercise 1 - Assessing Dependency Availability

    Step 8: Adding a Custom Command and Generated File

    Step 9: Packaging an Installer

    Step 10: Selecting Static or Shared Libraries

    Step 11: Adding Export Configuration

    Step 12: Packaging Debug and Release

    3 Step 6: Adding Support for a Testing Dashboard

    Adding support for submitting our test results to a dashboard is simple. We already defined a number of tests for our project in Testing Support. Now we just have to run those tests and submit them to CDash.

    3.1 Exercise 1 - Send Results to a Testing Dashboard

    3.1.1 目标

    Display our CTest results with CDash.
    使用CDash显示我们的CTest结果

    3.1.2 Helpful Resources(有用的资源)

    • ctest(1)
    • include()
    • CTest

    3.1.3 Files to Edit(需编辑的文件)

    • CMakeLists.txt

    3.1.4 Getting Started(入门指南)

    For this exercise, complete TODO 1 in the top-level CMakeLists.txt by including the CTest module. This will enable testing with CTest as well as dashboard submissions to CDash, so we can safely remove the call to enable_testing().
    在本练习中,请完成顶层 CMakeLists.txt 的 TODO 1,加入 CTest 模块。这将启用 CTest 测试以及向 CDash 提交仪表板,因此我们可以放心地移除对 enable_testing() 的调用。

    We will also need to acquire a CTestConfig.cmake file to be placed in the top-level directory. When run, the ctest executable will read this file to gather information about the testing dashboard. It contains:
    我们还需要获取 CTestConfig.cmake 文件,并将其放置在顶层目录中。运行时,ctest 可执行文件将读取该文件,以收集有关测试仪表板的信息。该文件包含

    • The project name
    • 工程的名称
    • The project “Nightly” start time
    • 项目的每次启动时间
      • The time when a 24 hour “day” starts for this project.
      • 该项目在每天24小时的启动时间
    • The URL of the CDash instance where the submission’s generated documents will be sent
    • CDash 实例的 URL,提交生成的文件将被发送到该 URL

    For this tutorial, a public dashboard server is used and its corresponding CTestConfig.cmake file is provided for you in this step’s root directory. In practice, this file would be downloaded from a project’s Settings page on the CDash instance intended to host the test results. Once downloaded from CDash, the file should not be modified locally.
    本教程使用的是公共 dashboard 服务器,其相应的 CTestConfig.cmake 文件位于本步骤的根目录中。在实际操作中,该文件将从用于托管测试结果的 CDash 实例上的项目设置页面下载。从 CDash 下载后,不应在本地修改该文件。

    CTestConfig.cmake
    set(CTEST_PROJECT_NAME "CMakeTutorial")
    set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
    
    set(CTEST_DROP_METHOD "http")
    set(CTEST_DROP_SITE "my.cdash.org")
    set(CTEST_DROP_LOCATION "/submit.php?project=CMakeTutorial")
    set(CTEST_DROP_SITE_CDASH TRUE)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    3.1.5 Build and Run(构建并运行)

    Note that as part of the CDash submission some information about your development system (e.g. site name or full pathnames) may displayed publicly.
    请注意,作为 CDash 提交的一部分,您开发系统的某些信息(如站点名称或完整路径名)可能会公开显示。

    To create a simple test dashboard, run the cmake executable or the cmake-gui to configure the project but do not build it yet. Instead, navigate to the build directory and run:
    要创建一个简单的测试仪表板,请运行 cmake 可执行文件或 cmake-gui 配置项目,但先不要编译。相反,请导航至构建目录并运行:

    ctest [-VV] -D Experimental
    
    • 1

    Remember, for multi-config generators (e.g. Visual Studio), the configuration type must be specified:
    请记住,对于多配置生成器(如 Visual Studio),必须指定配置类型:

    ctest [-VV] -C Debug -D Experimental
    
    • 1

    Or, from an IDE, build the Experimental target.
    或者在继承开发环境中构建实验目标。

    The ctest executable will build the project, run any tests, and submit the results to Kitware’s public dashboard: https://my.cdash.org/index.php?project=CMakeTutorial.
    ctest 可执行程序将构建项目、运行任何测试,并将结果提交到 Kitware 的公共控制面板:https://my.cdash.org/index.php?project=CMakeTutorial。

    3.1.6 解决方案

    The only CMake code changed needed in this step was to enable dashboard submissions to CDash by including the CTest module in our top-level CMakeLists.txt:
    在这一步中,唯一需要修改的 CMake 代码是在顶层 CMakeLists.txt 中加入 CTest 模块,以启用向 CDash 提交仪表盘的功能:

    TODO 1: Click to show/hide answer

    TODO 1: CMakeLists.txt
    include(CTest)
    
    • 1
    • 2
  • 相关阅读:
    SpringBoot通过配置切换注册中心(多注册中心nacos和eureka)
    【服务器】ASUS ESC4000-E11 安装系统
    C陷阱与缺陷 第6章 预处理器 6.2 宏并不是函数
    【how2j练习题】HTML部分综合练习
    力扣45. 跳跃游戏 II
    【ASM】字节码操作 工具类与常用类 asm-utils 与 asm-commons
    DLP迈向NG DLP的进化之路
    神州数码交换机转中文
    婴幼儿蛋白质过敏怎么回事
    记一次排查:接口返回值写入excel后,从单元格copy出来的数据会带有多重引号的问题
  • 原文地址:https://blog.csdn.net/u014100559/article/details/133849508
  • 最新文章
  • 【JVM】编译执行与解释执行的区别是什么?JVM 使用哪种方式?
    用 Hashids 优雅解决 C 端自增 ID 暴露问题
    V8引擎 精品漫游指南--Ignition篇(上) 指令 栈帧 槽位 调用约定 内存布局 基础内容
    LLVM Pass快速入门(四):代码插桩
    milkup:桌面端 markdown AI续写和即时渲染
    基于项目工程构建SBOM(软件物料清单)的研究
    鸿蒙应用开发UI基础第二节:鸿蒙应用程序框架核心解析与实操
    .NET 中如何快速实现 List 集合去重?
    扣子Coze实战:从0到1打造抖音+小红书热点监控智能体
    浅谈数据访问层
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号