여러 구성 요소 (버전 2.10)과 네이티브 응용 프로그램을 테스트 Cunit의 사용 방법 :여러 구성 요소로 만들어진 내가 Gradle을 네이티브 C 응용 프로그램에 대한 Gradle을 프로젝트를
components {
component_1(NativeLibrarySpec)
component_2(NativeLibrarySpec)
...
component_n(NativeLibrarySpec)
main_component(NativeExecutableSpec){
sources {
c.lib library: "component_1", linkage: "static"
c.lib library: "component_2", linkage: "static"
...
c.lib library: "component_n", linkage: "static"
}
}
}
응용 프로그램을 갖는 주요 아이디어 이 양식에서 개별 구성 요소를 더 쉽게 테스트 할 수있게되었습니다. 그러나 두 가지 큰 문제가 있습니다.
main_component
은 응용 프로그램이므로 주 기능이 있으며 multiple definition of 'main'
... gradle_cunit_main.c:(.text+0x0): first defined here
오류가 발생합니다. 이것은 뭔가 기대하고 설명서에 언급되어 있지만, 예를 들어,이 문제를 피할 수있는 방법이 있다면, 주요 구성 요소가 테스트에 포함되지 않도록하는 것이 궁금합니다.
testSuites {
component_1Test(CUnitTestSuiteSpec){
testing $.components.component_1
}
}
}
Gradle을 불평 :
이것은 내가 다음과 같이 테스트 할 구성 요소를 정의 할 때 불평 (버전 Gradle을 2.10 현재) 다음 질문으로Cannot create 'testSuites.component_1Test' using creation rule 'component_1Test(org.gradle.nativeplatform.test.cunit.CUnitTestSuiteSpec) { ... } @ build.gradle line 68, column 9' as the rule 'CUnitPlugin.Rules#createCUnitTestSuitePerComponent > create(component_1Test)' is already registered to create this model element
Cunit의 플러그인 관련
요약하면, 나는 일부 구성 요소 만 테스트하고 주 구성 요소 (주 기능 포함)가 테스트 용으로 컴파일되지 않도록 cunit 플러그인에 지시하고 싶습니다. 다시 한번 말하지만, 저는 gradle 2.10을 사용하고 있으며 최신 버전으로 업그레이드 할 수 없으므로 CI 도구 체인을 손상시킬 수 있습니다.
미리 의견을 보내 주셔서 감사합니다.