# 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.

import("//build/lite/config/test.gni")
import("../../config.gni")

config("mqueue_config") {
  cflags = [ "-O1" ]
  cflags_cc = cflags
}

common_include_dirs = [
  "//third_party/googletest/googletest/include",
  "../../common/include",
  "./",
]

sources_entry = [
  "../../common/osTest.cpp",
  "posix_mqueue_test.cpp",
]

sources_smoke = [
  "smoke/It_posix_queue_001.cpp",
  "smoke/It_posix_queue_003.cpp",
  "smoke/It_posix_queue_028.cpp",
  "smoke/It_posix_queue_053.cpp",
  "smoke/It_posix_queue_062.cpp",
]

sources_full = [
  "full/It_posix_queue_002.cpp",
  "full/It_posix_queue_005.cpp",
  "full/It_posix_queue_008.cpp",
  "full/It_posix_queue_011.cpp",
  "full/It_posix_queue_013.cpp",
  "full/It_posix_queue_014.cpp",
  "full/It_posix_queue_015.cpp",
  "full/It_posix_queue_016.cpp",
  "full/It_posix_queue_018.cpp",
  "full/It_posix_queue_019.cpp",
  "full/It_posix_queue_020.cpp",
  "full/It_posix_queue_021.cpp",
  "full/It_posix_queue_025.cpp",
  "full/It_posix_queue_026.cpp",
  "full/It_posix_queue_027.cpp",
  "full/It_posix_queue_030.cpp",
  "full/It_posix_queue_031.cpp",
  "full/It_posix_queue_032.cpp",
  "full/It_posix_queue_033.cpp",
  "full/It_posix_queue_036.cpp",
  "full/It_posix_queue_038.cpp",
  "full/It_posix_queue_040.cpp",
  "full/It_posix_queue_041.cpp",
  "full/It_posix_queue_042.cpp",
  "full/It_posix_queue_043.cpp",
  "full/It_posix_queue_044.cpp",
  "full/It_posix_queue_046.cpp",
  "full/It_posix_queue_047.cpp",
  "full/It_posix_queue_048.cpp",
  "full/It_posix_queue_049.cpp",
  "full/It_posix_queue_050.cpp",
  "full/It_posix_queue_052.cpp",
  "full/It_posix_queue_054.cpp",
  "full/It_posix_queue_055.cpp",
  "full/It_posix_queue_056.cpp",
  "full/It_posix_queue_057.cpp",
  "full/It_posix_queue_058.cpp",
  "full/It_posix_queue_060.cpp",
  "full/It_posix_queue_061.cpp",
  "full/It_posix_queue_063.cpp",
  "full/It_posix_queue_064.cpp",
  "full/It_posix_queue_065.cpp",
  "full/It_posix_queue_066.cpp",
  "full/It_posix_queue_067.cpp",
  "full/It_posix_queue_069.cpp",
  "full/It_posix_queue_070.cpp",
  "full/It_posix_queue_071.cpp",
  "full/It_posix_queue_072.cpp",
  "full/It_posix_queue_073.cpp",
  "full/It_posix_queue_074.cpp",
  "full/It_posix_queue_075.cpp",
  "full/It_posix_queue_076.cpp",
  "full/It_posix_queue_077.cpp",
  "full/It_posix_queue_078.cpp",
  "full/It_posix_queue_079.cpp",
  "full/It_posix_queue_080.cpp",
  "full/It_posix_queue_081.cpp",
  "full/It_posix_queue_082.cpp",
  "full/It_posix_queue_083.cpp",
  "full/It_posix_queue_084.cpp",
  "full/It_posix_queue_085.cpp",
  "full/It_posix_queue_086.cpp",
  "full/It_posix_queue_087.cpp",
  "full/It_posix_queue_088.cpp",
  "full/It_posix_queue_089.cpp",
  "full/It_posix_queue_090.cpp",
  "full/It_posix_queue_091.cpp",
  "full/It_posix_queue_093.cpp",
  "full/It_posix_queue_094.cpp",
  "full/It_posix_queue_095.cpp",
  "full/It_posix_queue_096.cpp",
  "full/It_posix_queue_097.cpp",
  "full/It_posix_queue_098.cpp",
  "full/It_posix_queue_100.cpp",
  "full/It_posix_queue_101.cpp",
  "full/It_posix_queue_102.cpp",
  "full/It_posix_queue_103.cpp",
  "full/It_posix_queue_104.cpp",
  "full/It_posix_queue_106.cpp",
  "full/It_posix_queue_108.cpp",
  "full/It_posix_queue_109.cpp",
  "full/It_posix_queue_110.cpp",
  "full/It_posix_queue_111.cpp",
  "full/It_posix_queue_112.cpp",
  "full/It_posix_queue_113.cpp",
  "full/It_posix_queue_114.cpp",
  "full/It_posix_queue_115.cpp",
  "full/It_posix_queue_116.cpp",
  "full/It_posix_queue_117.cpp",
  "full/It_posix_queue_118.cpp",
  "full/It_posix_queue_119.cpp",
  "full/It_posix_queue_120.cpp",
  "full/It_posix_queue_121.cpp",
  "full/It_posix_queue_122.cpp",
  "full/It_posix_queue_123.cpp",
  "full/It_posix_queue_124.cpp",
  "full/It_posix_queue_125.cpp",
  "full/It_posix_queue_126.cpp",
  "full/It_posix_queue_127.cpp",
  "full/It_posix_queue_128.cpp",
  "full/It_posix_queue_129.cpp",
  "full/It_posix_queue_130.cpp",
  "full/It_posix_queue_133.cpp",
  "full/It_posix_queue_134.cpp",
  "full/It_posix_queue_136.cpp",
  "full/It_posix_queue_143.cpp",
  "full/It_posix_queue_144.cpp",
  "full/It_posix_queue_145.cpp",
  "full/It_posix_queue_146.cpp",
  "full/It_posix_queue_147.cpp",
  "full/It_posix_queue_148.cpp",
  "full/It_posix_queue_149.cpp",
  "full/It_posix_queue_150.cpp",
  "full/It_posix_queue_151.cpp",
  "full/It_posix_queue_152.cpp",
  "full/It_posix_queue_153.cpp",
  "full/It_posix_queue_154.cpp",
  "full/It_posix_queue_155.cpp",
  "full/It_posix_queue_156.cpp",
  "full/It_posix_queue_157.cpp",
  "full/It_posix_queue_159.cpp",
  "full/It_posix_queue_160.cpp",
  "full/It_posix_queue_161.cpp",
  "full/It_posix_queue_162.cpp",
  "full/It_posix_queue_163.cpp",
  "full/It_posix_queue_164.cpp",
  "full/It_posix_queue_165.cpp",
  "full/It_posix_queue_166.cpp",
  "full/It_posix_queue_168.cpp",
  "full/It_posix_queue_169.cpp",
  "full/It_posix_queue_173.cpp",
  "full/It_posix_queue_175.cpp",
  "full/It_posix_queue_176.cpp",
  "full/It_posix_queue_177.cpp",
  "full/It_posix_queue_187.cpp",
  "full/It_posix_queue_200.cpp",
  "full/It_posix_queue_201.cpp",
  "full/It_posix_queue_202.cpp",
  "full/It_posix_queue_203.cpp",
  "full/It_posix_queue_204.cpp",
  "full/It_posix_queue_205.cpp",
  "full/It_posix_queue_206.cpp",
  "full/It_posix_queue_207.cpp",
  "full/It_posix_queue_208.cpp",
  "full/It_posix_queue_209.cpp",
]

if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
  unittest("liteos_a_posix_mqueue_unittest_door") {
    output_extension = "bin"
    output_dir = "$root_out_dir/test/unittest/kernel"
    include_dirs = common_include_dirs
    sources = sources_entry
    sources += sources_smoke
    sources_full = []
    sources += sources_full
    configs = [ "../..:public_config_for_door" ]
    configs += [ ":mqueue_config" ]
    deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
  }
}

if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
  unittest("liteos_a_posix_mqueue_unittest") {
    output_extension = "bin"
    output_dir = "$root_out_dir/test/unittest/kernel"
    include_dirs = common_include_dirs
    sources = sources_entry
    sources += sources_smoke
    sources += sources_full
    configs = [ "../..:public_config_for_all" ]
    configs += [ ":mqueue_config" ]
    deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
  }
}
