本文介绍了使用Intel Compiler 15.0或16.0构建测试项目时未发现本机单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要清楚,这个问题专门针对NATIVE C ++单元测试,而不是托管单元测试.

我在Visual Studio 2013和2015中以及在Intel C ++ Compiler 16和15中都尝试了以下步骤.使用较旧版本的Microsoft Compiler构建似乎可以正常工作.以管理员身份运行Visual Studio对结果没有影响.

To be clear, this question is specifically about NATIVE C++ unit tests, not managed unit tests.

I've tried the following steps in both Visual Studio 2013 and 2015 and with Intel C++ Compiler 16 and 15. Building with older versions of the Microsoft Compiler seems to work fine. Running Visual Studio as administrator makes no difference to the results.

  • 创建一个新的单元测试项目-新建项目/测试/本机单元测试
  • 全部重建
  • 查看测试资源管理器"窗口-列出了单个示例测试
  • 更改项目的平台工具集以使用Intel Compiler 15或16构建(Intel编译器15仅使用Visual Studio 2013构建)
  • 全部重建
  • 查看测试资源管理器"窗口 -未列出测试.

如果我在DLL上运行dumpbin,它们将以相同的顺序导出具有相同名称的导出函数的相同列表.

我意识到这不是Intel C ++编译器的支持论坛,但是如果有人可以给我一些进一步诊断这个问题的指导,我将不胜感激.我不知道如何调试和逐步完成Visual Studio对本机的发现 单元测试何时填充测试资源管理器窗口.我猜测Visual Studio会查看命名入口点的列表,然后调用一些入口点以枚举DLL中的测试,例如我没有设法击中的功能 即使似乎在导出的函数列表中,也可以使用Intel编译器进行编译.

If I run dumpbin on the DLLs they export the same list of exported functions with the same names in the same order.

I realise this isn't the support forum for the Intel C++ compiler but would be grateful if someone could give me some pointers on how to diagnose this problem further. I can't figure out how to debug and step through Visual Studio's discovery of native unit tests when it's populating the test explorer window. I'm guessing Visual Studio looks at the list of named entry points and then calls some of the entry points to enumerate the tests in the DLL e.g. the function below which I haven't managed to hit when building with the Intel compiler even though it seems to be present in the list of exported functions.

如果Intel C ++编译器确实与Microsoft的单元测试框架不兼容,因为该框架依赖于Microsoft特定的编译器功能,那么有人可以建议另一种可以很好地与之兼容的NATIVE单元测试框架. Visual Studio.

If the Intel C++ Compiler is truly incompatible with Microsoft's unit testing framework because the framework relies on Microsoft specific compiler features can anyone suggest an alternative NATIVE unit testing framework that works really well with Visual Studio.

谢谢,

推荐答案

1> unittest1.obj:警告LNK4078:发现多个具有不同属性的测试者"部分(40301040)

1>unittest1.obj : warning LNK4078: multiple 'testvers' sections found with different attributes (40301040)

我可以看到的对本节的引用全部在下面的CppUnitTest.h中.

The references to this section that I can see are all in CppUnitTest.h below.

这里是否存在问题,因为testvers节被声明为只读,而s_version变量未声明为const?英特尔编译器会生成与Microsoft编译器不同的代码吗?这足以改变行为 代码?另一个__declspec(分配声明的变量都是const,不会生成链接器警告.

Is there a problem here because the testvers section is declared as read only but the s_version variable is not declared as const? Would the Intel compiler generate different code from the Microsoft compiler? Could this be enough to change the behaviour of the code? The other __declspec(allocate declared variables are all const and don't generate linker warnings.

修改标头以将const添加到变量中并不能解决警告.


#pragma section("testvers




这篇关于使用Intel Compiler 15.0或16.0构建测试项目时未发现本机单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 16:49