#============================================================================= # Copyright Kitware, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. #============================================================================= find_package(LibXml2 QUIET) macro(castxml_test_cmd test) set(command $ ${ARGN}) add_test( NAME cmd.${test} COMMAND ${CMAKE_COMMAND} "-Dcommand:STRING=${command}" "-Dtest=cmd.${test}" -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake ) endmacro() macro(castxml_test_gccxml_common prefix ext std test) set(command $ --castxml-gccxml --castxml-start start ${std} ${CMAKE_CURRENT_LIST_DIR}/input/${test}.${ext} -o ${prefix}.${test}.xml ) add_test( NAME ${prefix}.${test} COMMAND ${CMAKE_COMMAND} "-Dcommand:STRING=${command}" "-Dtest=${prefix}.${test}" "-Dxml=${prefix}.${test}.xml" "-Dxmllint=${LIBXML2_XMLLINT_EXECUTABLE}" -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake ) endmacro() macro(castxml_test_gccxml test) castxml_test_gccxml_common(gccxml cxx -std=c++98 ${test}) endmacro() macro(castxml_test_gccxml_broken test) castxml_test_gccxml_common(gccxml.broken cxx -std=c++98 ${test}) endmacro() macro(castxml_test_gccxml_c test) castxml_test_gccxml_common(gccxml.c c -std=c89 ${test}) endmacro() set(input ${CMAKE_CURRENT_LIST_DIR}/input) set(empty_c ${input}/empty.c) set(empty_cxx ${input}/empty.cxx) set(empty_m ${input}/empty.m) set(empty_mm ${input}/empty.mm) castxml_test_cmd(help1 -help) castxml_test_cmd(help2 --help) castxml_test_cmd(no-arguments) castxml_test_cmd(version --version) castxml_test_cmd(cc-missing --castxml-cc-gnu) castxml_test_cmd(cc-option --castxml-cc-gnu -) castxml_test_cmd(cc-paren-castxml --castxml-cc-gnu "(" --castxml-cc-msvc ")") castxml_test_cmd(cc-paren-nested --castxml-cc-gnu "(" "(" ")" ")") castxml_test_cmd(cc-paren-unbalanced --castxml-cc-gnu "(") castxml_test_cmd(cc-twice --castxml-cc-msvc cl --castxml-cc-gnu gcc) castxml_test_cmd(cc-unknown --castxml-cc-unknown cc) castxml_test_cmd(gccxml-and-E --castxml-gccxml -E) castxml_test_cmd(gccxml-twice --castxml-gccxml --castxml-gccxml) castxml_test_cmd(gccxml-and-c99 --castxml-gccxml -std=c99 ${empty_c}) castxml_test_cmd(gccxml-and-c11 --castxml-gccxml -std=c11 ${empty_c}) castxml_test_cmd(gccxml-and-c++11 --castxml-gccxml -std=c++11 ${empty_cxx}) castxml_test_cmd(gccxml-and-c++1y --castxml-gccxml -std=c++1y ${empty_cxx}) castxml_test_cmd(gccxml-and-objc1 --castxml-gccxml ${empty_m}) castxml_test_cmd(gccxml-and-objc2 --castxml-gccxml ${empty_mm}) castxml_test_cmd(gccxml-empty-c++98 --castxml-gccxml -std=c++98 ${empty_cxx}) castxml_test_cmd(o-missing -o) castxml_test_cmd(start-missing --castxml-start) castxml_test_cmd(rsp-empty @${input}/empty.rsp) castxml_test_cmd(rsp-missing @${input}/does-not-exist.rsp) castxml_test_cmd(rsp-o-missing @${input}/o-missing.rsp) castxml_test_gccxml(ArrayType) castxml_test_gccxml(ArrayType-incomplete) castxml_test_gccxml(Class) castxml_test_gccxml(Class-abstract) castxml_test_gccxml(Class-base-typedef) castxml_test_gccxml(Class-bases) castxml_test_gccxml(Class-forward) castxml_test_gccxml(Class-friends) castxml_test_gccxml(Class-implicit-member-access) castxml_test_gccxml(Class-implicit-member-access-mutable) castxml_test_gccxml(Class-implicit-member-array) castxml_test_gccxml(Class-implicit-member-const) castxml_test_gccxml(Class-implicit-member-reference) castxml_test_gccxml(Class-implicit-members) castxml_test_gccxml(Class-incomplete) castxml_test_gccxml(Class-incomplete-twice) castxml_test_gccxml(Class-member-template) castxml_test_gccxml(Class-template) castxml_test_gccxml(Class-template-Method-Argument-default) castxml_test_gccxml(Class-template-bases) castxml_test_gccxml(Class-template-friends) castxml_test_gccxml(Class-template-member-Typedef) castxml_test_gccxml(Class-template-member-template) castxml_test_gccxml(CvQualifiedType) castxml_test_gccxml(Enumeration) castxml_test_gccxml(Enumeration-anonymous) castxml_test_gccxml(Field) castxml_test_gccxml(Function) castxml_test_gccxml(Function-Argument-decay) castxml_test_gccxml(Function-Argument-default) castxml_test_gccxml(Function-template) castxml_test_gccxml(Function-throw) castxml_test_gccxml(Function-variadic) castxml_test_gccxml(FunctionType) castxml_test_gccxml(FunctionType-variadic) castxml_test_gccxml(FundamentalType) castxml_test_gccxml(FundamentalTypes) castxml_test_gccxml(Method) castxml_test_gccxml(MethodType) castxml_test_gccxml(MethodType-cv) castxml_test_gccxml(Namespace) castxml_test_gccxml(Namespace-Class-members) castxml_test_gccxml(Namespace-Class-template-members) castxml_test_gccxml(Namespace-Function-template-members) castxml_test_gccxml(Namespace-empty) castxml_test_gccxml(OffsetType) castxml_test_gccxml(OffsetType-cv) castxml_test_gccxml(OperatorFunction) castxml_test_gccxml(OperatorMethod) castxml_test_gccxml(PointerType) castxml_test_gccxml(ReferenceType) castxml_test_gccxml(Typedef-paren) castxml_test_gccxml(Typedef-to-Class-template) castxml_test_gccxml(Typedef-to-Enumeration) castxml_test_gccxml(Typedef-to-Enumeration-anonymous) castxml_test_gccxml(Typedef-to-FundamentalType-mode) castxml_test_gccxml(Typedef-to-extern-C-FundamentalType-mode) castxml_test_gccxml(Variable) castxml_test_gccxml(Variable-in-Class) castxml_test_gccxml(Variable-init) castxml_test_gccxml(qualified-type-name) castxml_test_gccxml(using-declaration-class) castxml_test_gccxml(using-declaration-ns) castxml_test_gccxml(using-declaration-start) castxml_test_gccxml(using-directive-ns) castxml_test_gccxml(using-directive-start) castxml_test_gccxml_c(FundamentalType) castxml_test_gccxml_c(Typedef-called-class) castxml_test_gccxml_c(invalid) castxml_test_gccxml_broken(Class-implicit-member-bad-base) castxml_test_gccxml_broken(Class-template-constructor-template) castxml_test_gccxml_broken(ReferenceType-to-Class-template)