簡體   English   中英

如何在jenkins中使用GoogleMock?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM