# 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("pthread_config") {
  cflags = [ "-O1" ]
  cflags_cc = cflags
}

unittest("liteos_a_posix_pthread_unittest") {
  output_extension = "bin"
  output_dir = "$root_out_dir/test/unittest/kernel"
  include_dirs = [
    "../../common/include",
    "../../posix/pthread",
  ]
  sources = [
    "../../common/osTest.cpp",
    "posix_pthread_test.cpp",
  ]
  if (LOSCFG_USER_TEST_SMOKE == true) {
    sources_smoke = [
      "smoke/It_posix_pthread_003.cpp",
      "smoke/It_posix_pthread_004.cpp",
      "smoke/It_posix_pthread_005.cpp",
      "smoke/It_posix_pthread_006.cpp",
      "smoke/It_posix_pthread_018.cpp",
      "smoke/It_posix_pthread_019.cpp",
      "smoke/It_posix_pthread_020.cpp",
      "smoke/It_posix_pthread_021.cpp",
      "smoke/It_posix_pthread_022.cpp",
      "smoke/It_posix_pthread_203.cpp",
    ]
    sources += sources_smoke
  }
  if (LOSCFG_USER_TEST_FULL == true) {
    sources_full = [
      "full/It_posix_pthread_001.cpp",
      "full/It_posix_pthread_002.cpp",
      "full/It_posix_pthread_007.cpp",
      "full/It_posix_pthread_010.cpp",
      "full/It_posix_pthread_011.cpp",
      "full/It_posix_pthread_013.cpp",
      "full/It_posix_pthread_023.cpp",
      "full/It_posix_pthread_025.cpp",
      "full/It_posix_pthread_026.cpp",
      "full/It_posix_pthread_027.cpp",
      "full/It_posix_pthread_028.cpp",
      "full/It_posix_pthread_029.cpp",
      "full/It_posix_pthread_030.cpp",
      "full/It_posix_pthread_031.cpp",
      "full/It_posix_pthread_034.cpp",
      "full/It_posix_pthread_035.cpp",
      "full/It_posix_pthread_039.cpp",
      "full/It_posix_pthread_040.cpp",
      "full/It_posix_pthread_042.cpp",
      "full/It_posix_pthread_044.cpp",
      "full/It_posix_pthread_045.cpp",
      "full/It_posix_pthread_046.cpp",
      "full/It_posix_pthread_051.cpp",
      "full/It_posix_pthread_052.cpp",
      "full/It_posix_pthread_053.cpp",
      "full/It_posix_pthread_054.cpp",
      "full/It_posix_pthread_055.cpp",
      "full/It_posix_pthread_057.cpp",
      "full/It_posix_pthread_059.cpp",
      "full/It_posix_pthread_060.cpp",
      "full/It_posix_pthread_061.cpp",
      "full/It_posix_pthread_062.cpp",
      "full/It_posix_pthread_063.cpp",
      "full/It_posix_pthread_064.cpp",
      "full/It_posix_pthread_066.cpp",
      "full/It_posix_pthread_069.cpp",
      "full/It_posix_pthread_070.cpp",
      "full/It_posix_pthread_071.cpp",
      "full/It_posix_pthread_072.cpp",
      "full/It_posix_pthread_073.cpp",
      "full/It_posix_pthread_074.cpp",
      "full/It_posix_pthread_078.cpp",
      "full/It_posix_pthread_079.cpp",
      "full/It_posix_pthread_080.cpp",
      "full/It_posix_pthread_081.cpp",
      "full/It_posix_pthread_082.cpp",
      "full/It_posix_pthread_083.cpp",
      "full/It_posix_pthread_084.cpp",
      "full/It_posix_pthread_085.cpp",
      "full/It_posix_pthread_087.cpp",
      "full/It_posix_pthread_088.cpp",
      "full/It_posix_pthread_089.cpp",
      "full/It_posix_pthread_090.cpp",
      "full/It_posix_pthread_091.cpp",
      "full/It_posix_pthread_092.cpp",
      "full/It_posix_pthread_094.cpp",
      "full/It_posix_pthread_095.cpp",
      "full/It_posix_pthread_106.cpp",
      "full/It_posix_pthread_107.cpp",
      "full/It_posix_pthread_116.cpp",
      "full/It_posix_pthread_123.cpp",
      "full/It_posix_pthread_124.cpp",
      "full/It_posix_pthread_125.cpp",
      "full/It_posix_pthread_127.cpp",
      "full/It_posix_pthread_129.cpp",
      "full/It_posix_pthread_132.cpp",
      "full/It_posix_pthread_133.cpp",
      "full/It_posix_pthread_134.cpp",
      "full/It_posix_pthread_136.cpp",
      "full/It_posix_pthread_138.cpp",
      "full/It_posix_pthread_141.cpp",
      "full/It_posix_pthread_142.cpp",
      "full/It_posix_pthread_144.cpp",
      "full/It_posix_pthread_152.cpp",
      "full/It_posix_pthread_154.cpp",
      "full/It_posix_pthread_166.cpp",
      "full/It_posix_pthread_167.cpp",
      "full/It_posix_pthread_173.cpp",
      "full/It_posix_pthread_175.cpp",
      "full/It_posix_pthread_176.cpp",
      "full/It_posix_pthread_177.cpp",
      "full/It_posix_pthread_182.cpp",
      "full/It_posix_pthread_185.cpp",
      "full/It_posix_pthread_186.cpp",
      "full/It_posix_pthread_187.cpp",
      "full/It_posix_pthread_188.cpp",
      "full/It_posix_pthread_193.cpp",
      "full/It_posix_pthread_194.cpp",
      "full/It_posix_pthread_200.cpp",
      "full/It_posix_pthread_204.cpp",
      "full/It_posix_pthread_205.cpp",
      "full/It_posix_pthread_206.cpp",
      "full/It_posix_pthread_209.cpp",
      "full/It_posix_pthread_213.cpp",
      "full/It_posix_pthread_217.cpp",
      "full/It_posix_pthread_218.cpp",
      "full/It_posix_pthread_219.cpp",
      "full/It_posix_pthread_221.cpp",
      "full/It_posix_pthread_224.cpp",
      "full/It_posix_pthread_226.cpp",
      "full/It_posix_pthread_233.cpp",
      "full/It_posix_pthread_238.cpp",
      "full/It_posix_pthread_239.cpp",
      "full/It_posix_pthread_240.cpp",
      "full/It_posix_pthread_241.cpp",
    ]
    sources += sources_full
  }
  deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
  configs = [ "../..:public_config" ]
  configs += [ ":pthread_config" ]
}
