BUILD.gn 3.3 KB
Newer Older
L
lnlan 已提交
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
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

30
import("//kernel/liteos_a/liteos.gni")
L
lnlan 已提交
31

32 33 34 35 36 37
declare_args() {
  LOSCFG_ENABLE_KERNEL_TEST = false
  LOSCFG_TEST_KERNEL_BASE = true
  LOSCFG_TEST_KERNEL_EXTEND_CPUP = false
  LOSCFG_TEST_POSIX = false
}
L
lnlan 已提交
38

39 40
config("liteos_kernel_test_public") {
  cflags = [ "-Wno-error" ]
A
arvinzzz 已提交
41
  include_dirs = [
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
    "//kernel/liteos_a/kernel/include",
    "//kernel/liteos_a/kernel/base/include",
    "//kernel/liteos_a/kernel/common",
    "//kernel/liteos_a/arch/arm/arm/include",
    "//kernel/liteos_a/arch/arm/include",
    "//kernel/liteos_a/extended/include",
    "//third_party/musl/porting/liteos_a/kernel/include",
    "//third_party/bounds_checking_function/include/",
    "//kernel/liteos_a/lib/libscrew/include",
    "//kernel/liteos_a/fs/vfs",
    "//kernel/liteos_a/fs/proc/include",
    "//kernel/liteos_a/fs/jffs2/include",
    "//kernel/liteos_a/fs/nfs/include",
    "//kernel/liteos_a/bsd/compat/linuxkpi/include",
    "//kernel/liteos_a/testsuites/kernel/include",
A
arvinzzz 已提交
57
  ]
L
lnlan 已提交
58

59 60
  if (LOSCFG_TEST_KERNEL_BASE) {
    cflags += [ "-DLOSCFG_TEST_KERNEL_BASE=1" ]
A
arvinzzz 已提交
61 62
  }
  if (LOSCFG_TEST_KERNEL_EXTEND_CPUP) {
63
    cflags += [ "-DLOSCFG_TEST_KERNEL_EXTEND_CPUP=1" ]
A
arvinzzz 已提交
64 65
  }
  if (LOSCFG_TEST_POSIX) {
66
    cflags += [ "-DLOSCFG_TEST_POSIX=1" ]
A
arvinzzz 已提交
67
  }
68
}
L
lnlan 已提交
69

70 71
group("kernel_test") {
  deps = []
L
lnlan 已提交
72

73 74
  if (LOSCFG_ENABLE_KERNEL_TEST) {
    deps += [ ":test_base" ]
L
lnlan 已提交
75

76 77 78
    if (LOSCFG_TEST_KERNEL_BASE) {
      deps += [ "sample/kernel_base:kernel_base" ]
    }
L
lnlan 已提交
79

80 81 82 83
    # KERNEL EXTEND TEST
    if (LOSCFG_TEST_KERNEL_EXTEND_CPUP) {
      deps += [ "sample/kernel_extend/cpup:test_cpup" ]
    }
L
lnlan 已提交
84

85 86 87 88
    # COMPAT TEST
    if (LOSCFG_TEST_POSIX) {
      deps += [ "sample/posix:test_posix" ]
    }
A
arvinzzz 已提交
89
  }
L
lnlan 已提交
90
}
91 92 93 94 95 96 97 98 99

kernel_module("test_base") {
  sources = [
    "src/iCunit.c",
    "src/osTest.c",
  ]

  public_configs = [ ":liteos_kernel_test_public" ]
}