• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
15
16include(${PANDA_ROOT}/verification/Verification.cmake)
17project(pandaverification)
18
19set(ABS_INT_EXTRA_HEADERS)
20set(ABS_INT_TEMPLATES
21    abs_int_inl_compat_checks
22)
23foreach(TEMPLATE_NAME ${ABS_INT_TEMPLATES})
24    set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/gen/include/${TEMPLATE_NAME}.h")
25    panda_gen_file(
26        DATAFILE "${PANDA_ROOT}/verification/verification.yaml"
27        REQUIRES "${PANDA_ROOT}/verification/verification.rb"
28        TEMPLATE "${CMAKE_CURRENT_SOURCE_DIR}/gen/templates/${TEMPLATE_NAME}.h.erb"
29        OUTPUTFILE ${OUTPUT}
30    )
31    list(APPEND ABS_INT_EXTRA_HEADERS ${OUTPUT})
32endforeach()
33
34set(ISA_TEMPLATES
35    cflow_iterate_inl_gen.h.erb
36    abs_int_inl_gen.h.erb
37    job_fill_gen.h.erb
38)
39set(GEN_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/gen/include")
40file(MAKE_DIRECTORY ${GEN_INCLUDE_DIR})
41panda_isa_gen(
42    TEMPLATES ${ISA_TEMPLATES}
43    SOURCE ${CMAKE_CURRENT_LIST_DIR}/gen/templates
44    DESTINATION ${GEN_INCLUDE_DIR}
45    EXTRA_DEPENDENCIES ${ABS_INT_EXTRA_HEADERS}
46)
47
48panda_gen_messages(
49    YAML_FILE ${PANDA_ROOT}/verification/messages.yaml
50    GENERATED_HEADER ${GEN_INCLUDE_DIR}/verifier_messages.h
51)
52
53if ((PANDA_TARGET_X86 OR PANDA_TARGET_AMD64) AND PANDA_WITH_TESTS)
54    panda_add_gtest(
55        NO_CORES
56        NAME arkverification_tests
57        SOURCES
58            ${VERIFIER_TESTS_SOURCES}
59        LIBRARIES
60            arkruntime
61            arkbase
62        SANITIZERS
63            ${PANDA_SANITIZERS_LIST}
64    )
65    if(TARGET arkverification_tests)
66        target_include_directories(arkverification_tests PUBLIC ${PANDA_ROOT})
67        target_compile_options(arkverification_tests PUBLIC "-Wno-ignored-attributes")
68        panda_add_sanitizers(TARGET arkverification_tests SANITIZERS ${PANDA_SANITIZERS_LIST})
69    endif()
70
71    panda_add_gtest(
72        RAPIDCHECK_ON
73        NO_CORES
74        USE_CATCH2
75        NAME pandaverification_rapidcheck_catch2_tests
76        SOURCES
77            ${VERIFIER_RAPIDCHECK_TESTS_SOURCES}
78        INCLUDE_DIRS
79            "${PANDA_THIRD_PARTY_SOURCES_DIR}/rapidcheck/extras/catch/include"
80        LIBRARIES
81            arkbase
82        SANITIZERS
83            ${PANDA_SANITIZERS_LIST}
84    )
85    if(TARGET pandaverification_rapidcheck_catch2_tests)
86        target_include_directories(pandaverification_rapidcheck_catch2_tests PUBLIC ${PANDA_ROOT}
87            ${PANDA_ROOT}/libpandabase)
88        add_verification_includes(TARGET pandaverification_rapidcheck_catch2_tests)
89        target_compile_options(pandaverification_rapidcheck_catch2_tests PUBLIC "-Wno-ignored-attributes")
90        panda_add_sanitizers(TARGET pandaverification_rapidcheck_catch2_tests SANITIZERS ${PANDA_SANITIZERS_LIST})
91    endif()
92endif()
93
94add_check_style(".")
95