# 第14章 测试面板

本章的主要内容有：

* 将测试部署到CDash面板
* CDash面板显示测试覆盖率
* 使用AddressSanifier向CDash报告内存缺陷
* 使用ThreadSaniiser向CDash报告数据争用

CDash是一个web服务，用于汇集CTest在测试运行期间、夜间测试期间或在持续集成中的测试结果。面板报告就是我们所说的**CDash时**，如下图所示：

![](/files/-LmKs9Mq3NYlLAVC0eH6)

本章中，我们将向CDash报告测试结果。将讨论报告测试覆盖率的策略，以及分别使用AddressSanifier和ThreadSanifier等工具，收集的内存缺陷和数据争用问题。

有两种方法向CDash报告结果：

1. 通过构建的测试目标
2. 使用CTest脚本

在前两个示例中使用建立测试目标的方式，在后两个示例中使用CTest脚本。

## CDash环境

CDash的安装需要使用PHP和SSL的web服务器(Apache、NGINX或IIS)，并访问MySQL或PostgreSQL数据库服务器。详细讨论CDash web服务的设置超出了本书的范围，读者们可以参考官方文档：<https://public.kitware.com/Wiki/CDash:Installation>

Kitware提供了两个面板(<https://my.cdash.org> 和 <https://open.cdash.org> )，因此本章中的示例并不需要安装CDash。我们将在示例中参考已经提供的面板。

对于想要自己安装CDash的读者，我们建议使用MySQL作为后端，因为这是 <https://my.cdash.org> 和 <https://open.cdash.org> 的配置方式，而且社区也对这种搭配方式进行了测试。

**NOTE**:*也可以使用Docker来安装CDash。官方镜像的请求在CDash的跟踪器上处于打开状态，网址是*<https://github.com/Kitware/CDash/issues/562>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chenxiaowei.gitbook.io/cmake-cookbook/14.0-chinese.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
