Wine的测试方法

单元测试

wine中有许多单元测试模块,验证是否符合Windows API行为。

运行单元测试

cd dlls/advapi32/tests
make test
make services.ok

编写单元测试

Wine中的单元测试,也叫一致性测试,是为了保证API效果和Windows API效果一致。
单元测试框架基于CTEST测试框架(是CMake的一部分)。
新建一个.c文件,编写测试内容,并将文件添加到Makefile.in的C_SRCS环境变量中。
然后就可以使用ok进行单元测试了。

#include <wine/test.h>
#include <winbase.h>

//测试框架,paths 是在使用 START_TEST 宏时需要定义的一个参数,用于指定测试函数的名称。
START_TEST(paths)
{
    ATOM atom = GlobalAddAtomA( "foobar" );
    ok( GlobalFindAtomA( "foobar" ) == atom, "could not find atom foobar\n" );
    ok( GlobalFindAtomA( "FOOBAR" ) == atom, "could not find atom FOOBAR\n" );
}

回归测试

Sometimes old programs don’t compile on new systems. Sometimes old programs compile but don’t work on new systems. But what if you know that the old version of the program worked better than new one for a particular task? This is called a regression. The fastest way to find the cause of the regression is to do regression testing. But the usual regression testing procedure will fail to work in some cases: you cannot compile (or run) and test older versions!

有时候新版本会引发旧错误,如果知道在哪个旧版本上已经修复了这个错误,那么可以回溯到历史版本进行回归测试,定位到发生错误的commit-id。

# 设定搜索范围
git bisect start <终点commit-id> <起点commit-id>

# 设定有效
git bisect good

# 设定无效
git bisect bad

# 退出bisect
git bisect reset
git checkout master

详情参考:Reverse_Regression_Testing

参考链接

Regression_Testing
Conformance_Tests

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

多弗朗强哥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值