[英]How can I use GoogleMock in jenkins?
我在CentOS虚拟机上安装了Jenkins。 现在,我想使用模拟(Google模拟)运行unittests(谷歌测试)。 我尝试安装这里描述的框架。 (在我的lubuntu机器上,使用这些步骤,所有程序运行都没有问题)
当我尝试构建时:
g++ -O2 -pthread -Werror -Wall -o unitTest DriveTest.cpp Drive.cpp PWM.cpp -lgtest -lgtest_main -lgmock
我收到以下错误:
make unitTest
g++ -O2 -std=c++0x -pthread -Werror -Wall -o unitTest DriveTest.cpp Drive.cpp PWM.cpp -lgtest -lgtest_main -lgmock
In file included from /usr/include/gmock/gmock-spec-builders.h:75,
from /usr/include/gmock/gmock-generated-function-mockers.h:43,
from /usr/include/gmock/gmock.h:61,
from PWMMock.h:4,
from DriveTest.cpp:1:
/usr/include/gmock/gmock-matchers.h:1485: sorry, unimplemented: cannot expand ‘Tail ...’ into a fixed-length argument list
/usr/include/gmock/gmock-matchers.h:1486: error: ‘int’ is not a class type
/usr/include/gmock/gmock-matchers.h:1486: error: ‘ListType’ in class ‘int’ does not name a type
/usr/include/gmock/gmock-matchers.h:1486: error: template argument 2 is invalid
/usr/include/gmock/gmock-matchers.h:1486: error: expected ‘::’ before ‘ListType’
/usr/include/gmock/gmock-matchers.h: In static member function ‘static int testing::internal::MatcherList<kSize, Head,
Tail>::BuildList(const Head&, const Tail& ...)’:
/usr/include/gmock/gmock-matchers.h:1493: error: ‘int’ is not a class type
/usr/include/gmock/gmock-matchers.h:1493: error: ‘int’ is not a class type
/usr/include/gmock/gmock-matchers.h:1493: error: ‘int’ is not a class type
/usr/include/gmock/gmock-matchers.h:1493: error: ‘BuildList’ is not a member of ‘int’
/usr/include/gmock/gmock-matchers.h: In static member function ‘static testing::Matcher<T> testing::internal::MatcherList<kSize,
Head, Tail>::CreateMatcher(const int&)’:
/usr/include/gmock/gmock-matchers.h:1503: error: request for member ‘first’ in ‘matchers’, which is of non-class type ‘const int’
/usr/include/gmock/gmock-matchers.h:1504: error: ‘int’ is not a class type
/usr/include/gmock/gmock-matchers.h:1504: error: ‘int’ is not a class type
/usr/include/gmock/gmock-matchers.h:1504: error: ‘int’ is not a class type
/usr/include/gmock/gmock-matchers.h:1504: error: ‘int’ is not a class type
/usr/include/gmock/gmock-matchers.h:1504: error: ‘int’ is not a class type
/usr/include/gmock/gmock-matchers.h:1504: error: ‘CreateMatcher’ is not a member of ‘int’
...
我怎样才能解决这个问题?
您在CentOS上拥有的GCC版本似乎太旧了,无法处理这些可变参数模板。 我希望4.4.7可以使它们可用,因为状态页面似乎表明它们应该可用。 但是, 这个问题似乎可以证实这种情况。
我的建议是使用dev-toolset 2 repo升级编译器。 这将使您能够访问CentOS 6上的GCC 4.8(我猜您使用的是GCC版本),但具有修改过的stdlib,这意味着您的二进制文件仍将使用CentOS / RedHat 5中的运行时运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.