- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个嵌入式系统项目,正在使用 Ceedling(=Unity 和 Cmock)进行测试。
在一个测试用例中,被测代码就是这么简单:
uint32_t zero = eeprom_read_dword((uint32_t*)&non_volatile_zero);
sprintf(output, "%lu", zero);
由于嵌入式系统是8位架构,因此在sprintf中必须使用%lu
来格式化32位unsigned int进行打印。但是,桌面环境(GCC)用于测试构建和测试运行(并且不能选择使用嵌入式构建进行测试)。这会导致下一个警告:
warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint32_t’ {aka ‘unsigned int’} [-Wformat=]
62 sprintf(output, "%lu", zero);
~~^ ~~~~
| |
| uint32_t {aka unsigned int}
long unsigned int
%u
警告本身在桌面环境中是正确的,但从嵌入式系统的角度来看是误报。
我的问题是如何为测试build设置 -Wno-format 编译器标志,因为我根本没有在 project.yml 中定义工具部分,因为使用了默认的 GCC?或者也许有一种方法可以告诉 ceedling 目标系统正在使用 8 位架构?
最佳答案
如果有人碰巧搜索原始问题的答案,这里有一个解决方案,如何为指定的源文件添加编译器标志,而无需在 project.yml
中定义整个工具部分:
# Adds -Wno-format for sourcefile.c
:flags:
:test:
:compile:
:sourcefile: # use :*: for all sources.
- -Wno-format
关于使用 Ceedling 定义编译器标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69460722/
我想使用 ceedling 对 STM32 系列的 C 代码进行单元测试。我按照他们在 GitHub Ceedling 上的页面所示安装了它并成功运行示例测试。 project.yml 文件我已经修改
我有一个嵌入式系统项目,正在使用 Ceedling(=Unity 和 Cmock)进行测试。 在一个测试用例中,被测代码就是这么简单: uint32_t zero = eeprom_read_dwor
我有一个嵌入式系统项目,正在使用 Ceedling(=Unity 和 Cmock)进行测试。 在一个测试用例中,被测代码就是这么简单: uint32_t zero = eeprom_read_dwor
我对使用 Ceedling/Unity 还很陌生。我有一个模块,我正在通过给它不同的输入测试点并检查输出值来测试它。但我需要这样做很多次。这与我尝试过的类似(使用“for”循环): /*Example
我正在为嵌入式应用程序开发一项功能,我正在使用 Ceedling(构建在 Unity 测试框架之上)对其进行测试。我遇到的一个问题是我需要在 C 源文件中使用 Ceedling 未编译/链接到我的单元
我在 Ubuntu 20.04 上使用 Jenkins 来自动化我的构建过程。有两个项目给了我,它们是高度耦合的。我将努力将两者分开,但首先我需要设置一些测试。这两个项目是 PNE 和 BLDC 供引
我正在尝试使用 Ceedling 为我的 C 项目创建单元测试。我在终端写道:-ceedling 新的 My_Project_NameCeedling 创建了一个名为“My_Project_Name”
我想在使用 Ceedling 时调试被测 C 源代码。我发现可以使用以下命令,但无法设置断点。似乎没有生成符号信息。我使用 project.yml 中的默认设置,并检查了 -g 选项在 default
我一直在为 STM32 设置 Ceedling。 howto 非常稀缺,到目前为止,我几乎什么都没用谷歌搜索。幸运的是,该框架相对于它的大小而言是相对透明的。 This是 PIC 配置。我设置了类似的
我正在使用 Throw The Switch's Ceedling 为 C 项目编写单元测试/Unity/CMock 组合作为单元测试框架。 在我的一个单元测试中使用 mqueue.h 时,我遇到了一
我正在尝试为嵌入式应用程序开发一项新功能,并且我想使用测试驱动的方法来实现。 该项目是用纯 C 语言编写的,正在使用 IAR Embedded Workbench 6.60.1.5104 进行开发。我
是否基本上可以模拟要测试的文件的功能? 例如我想测试由这些函数组成的文件 self_test.c: #include "self_test.h" uint8_t function_1(uint8_t
我是一名优秀的程序员,十分优秀!