• 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.5.2 FATAL_ERROR)
15
16project(cts_coverage_tool)
17
18# Coverage reports generation
19
20# Source files:
21set(ISA_FILE "${CMAKE_BINARY_DIR}/isa/isa.yaml")
22set(NON_TESTABLE "${PROJECT_SOURCE_DIR}/config/non_testable.yaml")
23set(TESTS_DIR "${PROJECT_BINARY_DIR}/../cts-generator/cts-generated")
24set(TESTS_GLOB_GENERATED "**/*.pa")
25
26# Generated files:
27set(UNCOVERED "${PROJECT_BINARY_DIR}/uncovered.yaml")
28set(UNCOVERED_MD "${PROJECT_BINARY_DIR}/uncovered.md")
29set(ORPHANED "${PROJECT_BINARY_DIR}/orphaned.yaml")
30set(ORPHANED_MD "${PROJECT_BINARY_DIR}/orphaned.md")
31set(FULL "${PROJECT_BINARY_DIR}/full.yaml")
32set(FULL_MD "${PROJECT_BINARY_DIR}/full.md")
33set(REPORT "${PROJECT_BINARY_DIR}/report.yaml")
34set(OUTPUT_FILES ${UNCOVERED} ${UNCOVERED_MD} ${ORPHANED} ${ORPHANED_MD} ${FULL} ${FULL_MD} ${REPORT} ALWAYS_REBUILD)
35
36# Coverage tool:
37set(SPECTRAC "${PROJECT_SOURCE_DIR}/bin/spectrac.rb")
38
39add_custom_command(OUTPUT ${OUTPUT_FILES}
40    COMMENT "Compute ISA spec coverage by CTS tests"
41    COMMAND ${SPECTRAC} --spec ${ISA_FILE} --testglob ${TESTS_GLOB_GENERATED} --testdir ${TESTS_DIR} --non_testable ${NON_TESTABLE} --uncovered ${UNCOVERED} --uncovered_md ${UNCOVERED_MD} --orphaned ${ORPHANED} --orphaned_md ${ORPHANED_MD} --full ${FULL} --full_md ${FULL_MD} --report ${REPORT}
42)
43
44add_custom_target(isa_coverage DEPENDS cts-generator-build ${OUTPUT_FILES})
45