File: testing.cmake

package info (click to toggle)
onednn 3.7.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 87,776 kB
  • sloc: cpp: 1,016,013; lisp: 16,134; ansic: 12,564; python: 7,219; asm: 831; sh: 69; makefile: 41; javascript: 39
file content (81 lines) | stat: -rw-r--r-- 3,207 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#===============================================================================
# Copyright 2020-2024 Intel Corporation
#
# 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.
#===============================================================================

# Controls testing options values and behavior
#===============================================================================

if(testing_cmake_included)
    return()
endif()
set(testing_cmake_included true)
include("cmake/options.cmake")

# Transfer string literal into a number to support nested inclusions easier
set(DNNL_TEST_SET_SMOKE "1")
set(DNNL_TEST_SET_CI "2")
set(DNNL_TEST_SET_NIGHTLY "3")

set(DNNL_TEST_SET_COVERAGE "0")
set(DNNL_TEST_SET_COVERAGE_STR "")
set(DNNL_TEST_SET_HAS_NO_CORR "0")
set(DNNL_TEST_SET_HAS_ADD_BITWISE "0")

function(check_consistency entry)
    if(NOT DNNL_TEST_SET_COVERAGE EQUAL 0)
        message(FATAL_ERROR "Two different coverage types were specified: "
                "${DNNL_TEST_SET_COVERAGE_STR} and ${entry}. Only one can be used.")
    endif()
endfunction()

foreach(entry ${DNNL_TEST_SET})
    if(entry STREQUAL "NIGHTLY")
        check_consistency(${entry})
        set(DNNL_TEST_SET_COVERAGE ${DNNL_TEST_SET_NIGHTLY})
        set(DNNL_TEST_SET_COVERAGE_STR ${entry})
    elseif(entry STREQUAL "CI")
        check_consistency(${entry})
        set(DNNL_TEST_SET_COVERAGE ${DNNL_TEST_SET_CI})
        set(DNNL_TEST_SET_COVERAGE_STR ${entry})
    elseif(entry STREQUAL "SMOKE")
        check_consistency(${entry})
        set(DNNL_TEST_SET_COVERAGE ${DNNL_TEST_SET_SMOKE})
        set(DNNL_TEST_SET_COVERAGE_STR ${entry})
    elseif(entry STREQUAL "NO_CORR")
        set(DNNL_TEST_SET_HAS_NO_CORR "1")
    elseif(entry STREQUAL "ADD_BITWISE")
        set(DNNL_TEST_SET_HAS_ADD_BITWISE "1")
    elseif(entry STREQUAL "CI_NO_CORR") # Left here for compatibility till v4.0
        set(DNNL_TEST_SET_COVERAGE ${DNNL_TEST_SET_CI})
        set(DNNL_TEST_SET_COVERAGE_STR "CI")
        set(DNNL_TEST_SET_HAS_NO_CORR "1")
        message(WARNING
                "The 'CI_NO_CORR' value of DNNL_TEST_SET option is deprecated. "
                "Use 'CI;NO_CORR' instead.")
    else()
        message(FATAL_ERROR
                "The DNNL_TEST_SET entry ${entry} is not recognized. "
                "Supported values are:"
                "NIGHTLY, CI, SMOKE, NO_CORR, ADD_BITWISE.")
    endif()
endforeach()

message(STATUS "Enabled testing coverage: ${DNNL_TEST_SET_COVERAGE_STR}")
if(DNNL_TEST_SET_HAS_NO_CORR EQUAL 1)
    message(STATUS "Enabled testing modifier: No correctness")
endif()
if(DNNL_TEST_SET_HAS_ADD_BITWISE EQUAL 1)
    message(STATUS "Enabled testing modifier: Add bitwise validation")
endif()