diff --git a/testsuites/unittest/BUILD.gn b/testsuites/unittest/BUILD.gn index 9ee2f17efda18eb14afde3570d824884c829e8f2..0bfbaf78731a0dd0dd8c3e71e1bf544923cffdba 100644 --- a/testsuites/unittest/BUILD.gn +++ b/testsuites/unittest/BUILD.gn @@ -113,10 +113,24 @@ group("unittest") { # libc test if (LOSCFG_USER_TEST_LIBC == true) { if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "libc:liteos_a_libc_unittest_door" ] + deps += [ + "libc/io:liteos_a_libc_io_unittest_door", + "libc/misc:liteos_a_libc_misc_unittest_door", + "libc/posix:liteos_a_libc_posix_unittest_door", + "libc/sys:liteos_a_libc_sys_unittest_door", + "libc/time:liteos_a_libc_time_unittest_door", + "libc/util:liteos_a_libc_util_unittest_door", + ] } if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "libc:liteos_a_libc_unittest" ] + deps += [ + "libc/io:liteos_a_libc_io_unittest", + "libc/misc:liteos_a_libc_misc_unittest", + "libc/posix:liteos_a_libc_posix_unittest", + "libc/sys:liteos_a_libc_sys_unittest", + "libc/time:liteos_a_libc_time_unittest", + "libc/util:liteos_a_libc_util_unittest", + ] } } @@ -133,8 +147,11 @@ group("unittest") { # process test if (LOSCFG_USER_TEST_PROCESS_THREAD == true) { if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "process/basic:liteos_a_process_basic_unittest_door" ] - deps += [ "process/lock:liteos_a_process_lock_unittest_door" ] + deps += [ + "process/basic/process:liteos_a_process_basic_process_unittest_door", + "process/basic/pthread:liteos_a_process_basic_pthread_unittest_door", + "process/lock:liteos_a_process_lock_unittest_door", + ] if (LOSCFG_USER_TEST_PROCESS_FS == true) { deps += [ "process/fs:liteos_a_process_fs_unittest_door" ] } @@ -143,8 +160,11 @@ group("unittest") { } } if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "process/basic:liteos_a_process_basic_unittest" ] - deps += [ "process/lock:liteos_a_process_lock_unittest" ] + deps += [ + "process/basic/process:liteos_a_process_basic_process_unittest", + "process/basic/pthread:liteos_a_process_basic_pthread_unittest", + "process/lock:liteos_a_process_lock_unittest", + ] if (LOSCFG_USER_TEST_PROCESS_FS == true) { deps += [ "process/fs:liteos_a_process_fs_unittest" ] } diff --git a/testsuites/unittest/basic/dynload/smoke/dynload_test_002.cpp b/testsuites/unittest/basic/dynload/smoke/dynload_test_002.cpp index f6fd26a5c45f2bff4411b4d8f9a8d44037d8b26f..717ca316b5ebf3855d5aa873c2bd48ff8cde6431 100644 --- a/testsuites/unittest/basic/dynload/smoke/dynload_test_002.cpp +++ b/testsuites/unittest/basic/dynload/smoke/dynload_test_002.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * Copyright (c) 2020-2023 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: @@ -42,40 +42,52 @@ static int Testcase(void) char *workingPath = "/usr/bin"; void *handle = nullptr; int (*func)(int); + char curPath[1024] = { 0 }; /* 1024, buffer size */ + + handle = getcwd(curPath, sizeof(curPath)); + ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle); ret = chdir(workingPath); ICUNIT_ASSERT_EQUAL(ret, 0, ret); handle = dlopen(NULL, RTLD_NOW | RTLD_LOCAL); - ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle); + ICUNIT_GOTO_NOT_EQUAL(handle, NULL, 1, EXIT1); /* 1, return value */ ret = dlclose(handle); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); + ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); handle = dlopen(LIBCSO_REAL_PATH, RTLD_NOW); - ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle); + ICUNIT_GOTO_NOT_EQUAL(handle, NULL, 1, EXIT1); /* 1, return value */ func = reinterpret_cast(dlsym(handle, SYMBOL_TO_FIND)); ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT); ICUNIT_GOTO_EQUAL(func, SYMBOL_TO_MATCH, func, EXIT); ret = dlclose(handle); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); + ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); handle = dlopen(LIBCSO_RELATIVE_PATH, RTLD_NOW); - ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle); + ICUNIT_GOTO_NOT_EQUAL(handle, NULL, 1, EXIT1); /* 1, return value */ func = reinterpret_cast(dlsym(handle, SYMBOL_TO_FIND)); ICUNIT_GOTO_NOT_EQUAL(func, NULL, func, EXIT); ret = dlclose(handle); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); + ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); + + ret = chdir(curPath); + ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); return 0; EXIT: dlclose(handle); - return 0; + +EXIT1: + ret = chdir(curPath); + ICUNIT_ASSERT_EQUAL(ret, 0, ret); + + return 1; /* 1, return value */ } void ItTestDynload002(void) diff --git a/testsuites/unittest/config.gni b/testsuites/unittest/config.gni index 284e0ae08c54248c5f524287b72fb566107804da..b7e6bf85e6dc518c45a5d7e84fcec2e3eeea5b84 100644 --- a/testsuites/unittest/config.gni +++ b/testsuites/unittest/config.gni @@ -1,5 +1,5 @@ # Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2020-2023 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: @@ -64,11 +64,11 @@ LOSCFG_USER_TEST_MEM_VM = true LOSCFG_USER_TEST_PROCESS_THREAD = true # Module list -LOSCFG_USER_TEST_MUTEX = true -LOSCFG_USER_TEST_PROCESS = true -LOSCFG_USER_TEST_PTHREAD = true -LOSCFG_USER_TEST_RWLOCK = true -LOSCFG_USER_TEST_SPINLOCK = true +LOSCFG_USER_TEST_PROCESS_BASIC_PROCESS = true +LOSCFG_USER_TEST_PROCESS_BASIC_PTHREAD = true +LOSCFG_USER_TEST_PROCESS_LOCK_MUTEX = true +LOSCFG_USER_TEST_PROCESS_LOCK_RWLOCK = true +LOSCFG_USER_TEST_PROCESS_LOCK_SPINLOCK = true ########## extended test ########## # Control switch for extended function test @@ -102,15 +102,15 @@ LOSCFG_USER_TEST_FS_VFAT = false LOSCFG_USER_TEST_LIBC = true # Module list -LOSCFG_USER_TEST_IO = true -LOSCFG_USER_TEST_MISC = true -LOSCFG_USER_TEST_POSIX_MEM = true -LOSCFG_USER_TEST_POSIX_MQUEUE = true -LOSCFG_USER_TEST_POSIX_PTHREAD = false -LOSCFG_USER_TEST_SYS = true -LOSCFG_USER_TEST_TIME_CLOCK = true -LOSCFG_USER_TEST_TIME_TIMER = true -LOSCFG_USER_TEST_UTIL = true +LOSCFG_USER_TEST_LIBC_IO = true +LOSCFG_USER_TEST_LIBC_MISC = true +LOSCFG_USER_TEST_LIBC_POSIX_MEM = true +LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE = true +LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD = false +LOSCFG_USER_TEST_LIBC_SYS = true +LOSCFG_USER_TEST_LIBC_TIME_CLOCK = true +LOSCFG_USER_TEST_LIBC_TIME_TIMER = true +LOSCFG_USER_TEST_LIBC_UTIL = true ########## net test ########## # Control switch for network function test diff --git a/testsuites/unittest/libc/config.gni b/testsuites/unittest/libc/config.gni deleted file mode 100644 index f9cef83822a867d51009dc7d2c5cfaf4fb1593da..0000000000000000000000000000000000000000 --- a/testsuites/unittest/libc/config.gni +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright (c) 2022-2022 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("//kernel/liteos_a/testsuites/unittest/config.gni") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../common/include", -] - -sources_entry = [ "../common/osTest.cpp" ] - -sources_smoke = [] - -sources_full = [] - -# io module -if (LOSCFG_USER_TEST_IO == true) { - import("./io/config.gni") - common_include_dirs += io_include_dirs - sources_entry += io_sources_entry - sources_smoke += io_sources_smoke - sources_full += io_sources_full -} - -# misc module -if (LOSCFG_USER_TEST_MISC == true) { - import("./misc/config.gni") - common_include_dirs += misc_include_dirs - sources_entry += misc_sources_entry - sources_smoke += misc_sources_smoke - sources_full += misc_sources_full -} - -# posix mem module -if (LOSCFG_USER_TEST_POSIX_MEM == true) { - import("./posix/mem/config.gni") - common_include_dirs += posix_mem_include_dirs - sources_entry += posix_mem_sources_entry - sources_smoke += posix_mem_sources_smoke - sources_full += posix_mem_sources_full -} - -# posix mqueue module -if (LOSCFG_USER_TEST_POSIX_MQUEUE == true) { - import("./posix/mqueue/config.gni") - common_include_dirs += posix_mqueue_include_dirs - sources_entry += posix_mqueue_sources_entry - sources_smoke += posix_mqueue_sources_smoke - sources_full += posix_mqueue_sources_full -} - -# posix pthread module -if (LOSCFG_USER_TEST_POSIX_PTHREAD == true) { - import("./posix/pthread/config.gni") - common_include_dirs += posix_pthread_include_dirs - sources_entry += posix_pthread_sources_entry - sources_smoke += posix_pthread_sources_smoke - sources_full += posix_pthread_sources_full -} - -# sys module -if (LOSCFG_USER_TEST_SYS == true) { - import("./sys/config.gni") - common_include_dirs += sys_include_dirs - sources_entry += sys_sources_entry - sources_smoke += sys_sources_smoke - sources_full += sys_sources_full -} - -# time module -if (LOSCFG_USER_TEST_TIME_CLOCK == true) { - import("./time/clock/config.gni") - common_include_dirs += time_clock_include_dirs - sources_entry += time_clock_sources_entry - sources_smoke += time_clock_sources_smoke - sources_full += time_clock_sources_full -} - -if (LOSCFG_USER_TEST_TIME_TIMER == true) { - import("./time/timer/config.gni") - common_include_dirs += time_timer_include_dirs - sources_entry += time_timer_sources_entry - sources_smoke += time_timer_sources_smoke - sources_full += time_timer_sources_full -} - -# util module -if (LOSCFG_USER_TEST_UTIL == true) { - import("./util/config.gni") - common_include_dirs += util_include_dirs - sources_entry += util_sources_entry - sources_smoke += util_sources_smoke - sources_full += util_sources_full -} diff --git a/testsuites/unittest/libc/BUILD.gn b/testsuites/unittest/libc/io/BUILD.gn similarity index 87% rename from testsuites/unittest/libc/BUILD.gn rename to testsuites/unittest/libc/io/BUILD.gn index bfb916e10d2067b0762f6dc3594c562499f38435..6f2978f3f0bb9cb6c814ec00ad7e30f4fb273533 100644 --- a/testsuites/unittest/libc/BUILD.gn +++ b/testsuites/unittest/libc/io/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -31,15 +31,15 @@ import("//kernel/liteos_a/testsuites/unittest/config.gni") import("./config.gni") config("libc_config") { - if (LOSCFG_USER_TEST_POSIX_MQUEUE == true || - LOSCFG_USER_TEST_POSIX_PTHREAD == true) { + if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true || + LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) { cflags = [ "-O1" ] cflags_cc = cflags } } if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_libc_unittest_door") { + unittest("liteos_a_libc_io_unittest_door") { output_extension = "bin" output_dir = "$root_out_dir/test/unittest/kernel" include_dirs = common_include_dirs @@ -47,21 +47,21 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { sources += sources_smoke sources_full = [] sources += sources_full - configs = [ "..:public_config_for_door" ] + configs = [ "../..:public_config_for_door" ] configs += [ ":libc_config" ] deps = [ "//third_party/bounds_checking_function:libsec_shared" ] } } if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_libc_unittest") { + unittest("liteos_a_libc_io_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 = [ "../..:public_config_for_all" ] configs += [ ":libc_config" ] deps = [ "//third_party/bounds_checking_function:libsec_shared" ] } diff --git a/testsuites/unittest/libc/io/config.gni b/testsuites/unittest/libc/io/config.gni index 54dacde199934a7ee546f8ec3efd66ddeef573b8..39508845529d0c3bc6eb2f1fe4d8f089add7aea5 100644 --- a/testsuites/unittest/libc/io/config.gni +++ b/testsuites/unittest/libc/io/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,20 +26,32 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -io_include_dirs = [ "$TEST_UNITTEST_DIR/libc/io" ] +common_include_dirs = [ + "//third_party/googletest/googletest/include", + "../../common/include", +] + +sources_entry = [ "../../common/osTest.cpp" ] + +sources_smoke = [] -io_sources_entry = [ "$TEST_UNITTEST_DIR/libc/io/io_test.cpp" ] +sources_full = [] -io_sources_smoke = [ +libc_io_include_dirs = [ "$TEST_UNITTEST_DIR/libc/io" ] + +libc_io_sources_entry = [ "$TEST_UNITTEST_DIR/libc/io/io_test.cpp" ] + +libc_io_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/io/smoke/IO_test_005.cpp", "$TEST_UNITTEST_DIR/libc/io/smoke/IO_test_008.cpp", "$TEST_UNITTEST_DIR/libc/io/smoke/IO_test_010.cpp", "$TEST_UNITTEST_DIR/libc/io/smoke/IO_test_013.cpp", ] -io_sources_full = [ +libc_io_sources_full = [ "$TEST_UNITTEST_DIR/libc/io/full/IO_test_confstr_001.cpp", "$TEST_UNITTEST_DIR/libc/io/full/IO_test_dcgettext_001.cpp", "$TEST_UNITTEST_DIR/libc/io/full/IO_test_dcgettext_002.cpp", @@ -82,3 +94,11 @@ io_sources_full = [ "$TEST_UNITTEST_DIR/libc/io/full/IO_test_epoll_001.cpp", "$TEST_UNITTEST_DIR/libc/io/full/IO_test_epoll_002.cpp", ] + +# libc io module +if (LOSCFG_USER_TEST_LIBC_IO == true) { + common_include_dirs += libc_io_include_dirs + sources_entry += libc_io_sources_entry + sources_smoke += libc_io_sources_smoke + sources_full += libc_io_sources_full +} diff --git a/testsuites/unittest/libc/misc/BUILD.gn b/testsuites/unittest/libc/misc/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..9fc35599f34e4209edf1e3ef53ca5cf30384b887 --- /dev/null +++ b/testsuites/unittest/libc/misc/BUILD.gn @@ -0,0 +1,68 @@ +# Copyright (c) 2023 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("//kernel/liteos_a/testsuites/unittest/config.gni") +import("./config.gni") + +config("libc_config") { + if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true || + LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) { + cflags = [ "-O1" ] + cflags_cc = cflags + } +} + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { + unittest("liteos_a_libc_misc_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 += [ ":libc_config" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { + unittest("liteos_a_libc_misc_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 += [ ":libc_config" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} diff --git a/testsuites/unittest/libc/misc/config.gni b/testsuites/unittest/libc/misc/config.gni index 7878596931fd1b703a6cd71c199aa4e397e67b41..6fdbc335b6b60a54b9a82d3ac4cc773040a7bb1f 100644 --- a/testsuites/unittest/libc/misc/config.gni +++ b/testsuites/unittest/libc/misc/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,13 +26,25 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -misc_include_dirs = [ "$TEST_UNITTEST_DIR/libc/misc" ] +common_include_dirs = [ + "//third_party/googletest/googletest/include", + "../../common/include", +] + +sources_entry = [ "../../common/osTest.cpp" ] + +sources_smoke = [] -misc_sources_entry = [ "$TEST_UNITTEST_DIR/libc/misc/misc_test.cpp" ] +sources_full = [] -misc_sources_smoke = [ +libc_misc_include_dirs = [ "$TEST_UNITTEST_DIR/libc/misc" ] + +libc_misc_sources_entry = [ "$TEST_UNITTEST_DIR/libc/misc/misc_test.cpp" ] + +libc_misc_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/misc/smoke/misc_test_001.cpp", "$TEST_UNITTEST_DIR/libc/misc/smoke/misc_test_002.cpp", "$TEST_UNITTEST_DIR/libc/misc/smoke/misc_test_003.cpp", @@ -41,7 +53,7 @@ misc_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/misc/smoke/misc_test_014.cpp", ] -misc_sources_full = [ +libc_misc_sources_full = [ "$TEST_UNITTEST_DIR/libc/misc/full/misc_test_006.cpp", "$TEST_UNITTEST_DIR/libc/misc/full/misc_test_007.cpp", "$TEST_UNITTEST_DIR/libc/misc/full/misc_test_008.cpp", @@ -51,3 +63,11 @@ misc_sources_full = [ "$TEST_UNITTEST_DIR/libc/misc/full/misc_test_012.cpp", "$TEST_UNITTEST_DIR/libc/misc/full/misc_test_013.cpp", ] + +# libc misc module +if (LOSCFG_USER_TEST_LIBC_MISC == true) { + common_include_dirs += libc_misc_include_dirs + sources_entry += libc_misc_sources_entry + sources_smoke += libc_misc_sources_smoke + sources_full += libc_misc_sources_full +} diff --git a/testsuites/unittest/libc/posix/BUILD.gn b/testsuites/unittest/libc/posix/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f75c7fca724eeefce97f4f2545455beb99d650d4 --- /dev/null +++ b/testsuites/unittest/libc/posix/BUILD.gn @@ -0,0 +1,68 @@ +# Copyright (c) 2023 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("//kernel/liteos_a/testsuites/unittest/config.gni") +import("./config.gni") + +config("libc_config") { + if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true || + LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) { + cflags = [ "-O1" ] + cflags_cc = cflags + } +} + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { + unittest("liteos_a_libc_posix_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 += [ ":libc_config" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { + unittest("liteos_a_libc_posix_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 += [ ":libc_config" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} diff --git a/testsuites/unittest/libc/posix/config.gni b/testsuites/unittest/libc/posix/config.gni new file mode 100644 index 0000000000000000000000000000000000000000..aa81379baad00f364c45ff964f8c8c4898afbb39 --- /dev/null +++ b/testsuites/unittest/libc/posix/config.gni @@ -0,0 +1,68 @@ +# Copyright (c) 2023 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("//kernel/liteos_a/testsuites/unittest/config.gni") + +common_include_dirs = [ + "//third_party/googletest/googletest/include", + "../../common/include", +] + +sources_entry = [ "../../common/osTest.cpp" ] + +sources_smoke = [] + +sources_full = [] + +# libc posix mem module +if (LOSCFG_USER_TEST_LIBC_POSIX_MEM == true) { + import("./mem/config.gni") + common_include_dirs += libc_posix_mem_include_dirs + sources_entry += libc_posix_mem_sources_entry + sources_smoke += libc_posix_mem_sources_smoke + sources_full += libc_posix_mem_sources_full +} + +# libc posix mqueue module +if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true) { + import("./mqueue/config.gni") + common_include_dirs += libc_posix_mqueue_include_dirs + sources_entry += libc_posix_mqueue_sources_entry + sources_smoke += libc_posix_mqueue_sources_smoke + sources_full += libc_posix_mqueue_sources_full +} + +# libc posix pthread module +if (LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) { + import("./pthread/config.gni") + common_include_dirs += libc_posix_pthread_include_dirs + sources_entry += libc_posix_pthread_sources_entry + sources_smoke += libc_posix_pthread_sources_smoke + sources_full += libc_posix_pthread_sources_full +} diff --git a/testsuites/unittest/libc/posix/mem/config.gni b/testsuites/unittest/libc/posix/mem/config.gni index 4b23f08943ceb2c060389ba088bc48adbbb774db..04322d7e8ee306cba0817c2242d47f0a9b8a2322 100644 --- a/testsuites/unittest/libc/posix/mem/config.gni +++ b/testsuites/unittest/libc/posix/mem/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,16 +26,17 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -posix_mem_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/mem" ] +libc_posix_mem_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/mem" ] -posix_mem_sources_entry = +libc_posix_mem_sources_entry = [ "$TEST_UNITTEST_DIR/libc/posix/mem/posix_mem_test.cpp" ] -posix_mem_sources_smoke = [ +libc_posix_mem_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/posix/mem/smoke/It_posix_mem_001.cpp", "$TEST_UNITTEST_DIR/libc/posix/mem/smoke/It_posix_mem_003.cpp", ] -posix_mem_sources_full = [] +libc_posix_mem_sources_full = [] diff --git a/testsuites/unittest/libc/posix/mqueue/config.gni b/testsuites/unittest/libc/posix/mqueue/config.gni index caa41ff52647d7db0c9861ce410014e2ec0b28d6..b272dd4336312b556a6c6dbf28d01959a54e8921 100644 --- a/testsuites/unittest/libc/posix/mqueue/config.gni +++ b/testsuites/unittest/libc/posix/mqueue/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,14 +26,15 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -posix_mqueue_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/mqueue" ] +libc_posix_mqueue_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/mqueue" ] -posix_mqueue_sources_entry = +libc_posix_mqueue_sources_entry = [ "$TEST_UNITTEST_DIR/libc/posix/mqueue/posix_mqueue_test.cpp" ] -posix_mqueue_sources_smoke = [ +libc_posix_mqueue_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/posix/mqueue/smoke/It_posix_queue_001.cpp", "$TEST_UNITTEST_DIR/libc/posix/mqueue/smoke/It_posix_queue_003.cpp", "$TEST_UNITTEST_DIR/libc/posix/mqueue/smoke/It_posix_queue_028.cpp", @@ -41,7 +42,7 @@ posix_mqueue_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/posix/mqueue/smoke/It_posix_queue_062.cpp", ] -posix_mqueue_sources_full = [ +libc_posix_mqueue_sources_full = [ "$TEST_UNITTEST_DIR/libc/posix/mqueue/full/It_posix_queue_002.cpp", "$TEST_UNITTEST_DIR/libc/posix/mqueue/full/It_posix_queue_005.cpp", "$TEST_UNITTEST_DIR/libc/posix/mqueue/full/It_posix_queue_008.cpp", diff --git a/testsuites/unittest/libc/posix/pthread/config.gni b/testsuites/unittest/libc/posix/pthread/config.gni index c88062a506052f23801194fdc70c550e617060b4..d09b57ad8891ffb9335c71b0fead7482a40cb915 100644 --- a/testsuites/unittest/libc/posix/pthread/config.gni +++ b/testsuites/unittest/libc/posix/pthread/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,14 +26,15 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -posix_pthread_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/pthread" ] +libc_posix_pthread_include_dirs = [ "$TEST_UNITTEST_DIR/libc/posix/pthread" ] -posix_pthread_sources_entry = +libc_posix_pthread_sources_entry = [ "$TEST_UNITTEST_DIR/libc/posix/pthread/posix_pthread_test.cpp" ] -posix_pthread_sources_smoke = [ +libc_posix_pthread_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/posix/pthread/smoke/It_posix_pthread_003.cpp", "$TEST_UNITTEST_DIR/libc/posix/pthread/smoke/It_posix_pthread_004.cpp", "$TEST_UNITTEST_DIR/libc/posix/pthread/smoke/It_posix_pthread_005.cpp", @@ -45,7 +46,7 @@ posix_pthread_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/posix/pthread/smoke/It_posix_pthread_022.cpp", ] -posix_pthread_sources_full = [ +libc_posix_pthread_sources_full = [ "$TEST_UNITTEST_DIR/libc/posix/pthread/full/It_posix_pthread_001.cpp", "$TEST_UNITTEST_DIR/libc/posix/pthread/full/It_posix_pthread_002.cpp", "$TEST_UNITTEST_DIR/libc/posix/pthread/full/It_posix_pthread_007.cpp", diff --git a/testsuites/unittest/libc/sys/BUILD.gn b/testsuites/unittest/libc/sys/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0e4a3ec780ebb32d38704e62686fbb37e3f99d9a --- /dev/null +++ b/testsuites/unittest/libc/sys/BUILD.gn @@ -0,0 +1,68 @@ +# Copyright (c) 2023 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("//kernel/liteos_a/testsuites/unittest/config.gni") +import("./config.gni") + +config("libc_config") { + if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true || + LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) { + cflags = [ "-O1" ] + cflags_cc = cflags + } +} + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { + unittest("liteos_a_libc_sys_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 += [ ":libc_config" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { + unittest("liteos_a_libc_sys_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 += [ ":libc_config" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} diff --git a/testsuites/unittest/libc/sys/config.gni b/testsuites/unittest/libc/sys/config.gni index e0a4bb7fa57a7103ff2a2c8ab4f0774e5e385936..a1e14c9ab15076dd6a17ea5912868d2e1fb26ac2 100644 --- a/testsuites/unittest/libc/sys/config.gni +++ b/testsuites/unittest/libc/sys/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,13 +26,25 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -sys_include_dirs = [ "$TEST_UNITTEST_DIR/libc/sys" ] +common_include_dirs = [ + "//third_party/googletest/googletest/include", + "../../common/include", +] + +sources_entry = [ "../../common/osTest.cpp" ] + +sources_smoke = [] -sys_sources_entry = [ "$TEST_UNITTEST_DIR/libc/sys/sys_unit_test.cpp" ] +sources_full = [] -sys_sources_smoke = [ +libc_sys_include_dirs = [ "$TEST_UNITTEST_DIR/libc/sys" ] + +libc_sys_sources_entry = [ "$TEST_UNITTEST_DIR/libc/sys/sys_unit_test.cpp" ] + +libc_sys_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/sys/smoke/sys_test_004.cpp", "$TEST_UNITTEST_DIR/libc/sys/smoke/sys_test_005.cpp", "$TEST_UNITTEST_DIR/libc/sys/smoke/sys_test_006.cpp", @@ -51,7 +63,7 @@ sys_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/sys/smoke/sys_test_031.cpp", ] -sys_sources_full = [ +libc_sys_sources_full = [ "$TEST_UNITTEST_DIR/libc/sys/full/sys_test_001.cpp", "$TEST_UNITTEST_DIR/libc/sys/full/sys_test_018.cpp", "$TEST_UNITTEST_DIR/libc/sys/full/sys_test_019.cpp", @@ -65,3 +77,11 @@ sys_sources_full = [ "$TEST_UNITTEST_DIR/libc/sys/full/sys_test_027.cpp", "$TEST_UNITTEST_DIR/libc/sys/full/sys_test_028.cpp", ] + +# libc sys module +if (LOSCFG_USER_TEST_LIBC_SYS == true) { + common_include_dirs += libc_sys_include_dirs + sources_entry += libc_sys_sources_entry + sources_smoke += libc_sys_sources_smoke + sources_full += libc_sys_sources_full +} diff --git a/testsuites/unittest/libc/time/BUILD.gn b/testsuites/unittest/libc/time/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..bf77ffaa3efabcc38c8271314208b48be1266f61 --- /dev/null +++ b/testsuites/unittest/libc/time/BUILD.gn @@ -0,0 +1,68 @@ +# Copyright (c) 2023 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("//kernel/liteos_a/testsuites/unittest/config.gni") +import("./config.gni") + +config("libc_config") { + if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true || + LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) { + cflags = [ "-O1" ] + cflags_cc = cflags + } +} + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { + unittest("liteos_a_libc_time_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 += [ ":libc_config" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { + unittest("liteos_a_libc_time_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 += [ ":libc_config" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} diff --git a/testsuites/unittest/libc/time/clock/config.gni b/testsuites/unittest/libc/time/clock/config.gni index de954e9539c46e8f3711d98115d447068467eb1f..bfca2c94be56564ccc64c2e9143597423ac7e93f 100644 --- a/testsuites/unittest/libc/time/clock/config.gni +++ b/testsuites/unittest/libc/time/clock/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,17 +26,18 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -time_clock_include_dirs = [ "$TEST_UNITTEST_DIR/libc/time/clock" ] +libc_time_clock_include_dirs = [ "$TEST_UNITTEST_DIR/libc/time/clock" ] -time_clock_sources_entry = +libc_time_clock_sources_entry = [ "$TEST_UNITTEST_DIR/libc/time/clock/time_clock_test.cpp" ] -time_clock_sources_smoke = +libc_time_clock_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/time/clock/smoke/clock_test_smoke.cpp" ] -time_clock_sources_full = [ +libc_time_clock_sources_full = [ "$TEST_UNITTEST_DIR/libc/time/clock/full/clock_test_001.cpp", "$TEST_UNITTEST_DIR/libc/time/clock/full/clock_test_002.cpp", "$TEST_UNITTEST_DIR/libc/time/clock/full/clock_test_003.cpp", diff --git a/testsuites/unittest/process/basic/config.gni b/testsuites/unittest/libc/time/config.gni similarity index 72% rename from testsuites/unittest/process/basic/config.gni rename to testsuites/unittest/libc/time/config.gni index b27261db300dcbad1eebcf8e44de03748b6d6250..d041fa9c0ed82f589a8071f8998bb28134ac74e8 100644 --- a/testsuites/unittest/process/basic/config.gni +++ b/testsuites/unittest/libc/time/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2023 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: @@ -40,19 +40,20 @@ sources_smoke = [] sources_full = [] -# basic module -if (LOSCFG_USER_TEST_PROCESS == true) { - import("./process/config.gni") - common_include_dirs += process_include_dirs - sources_entry += process_sources_entry - sources_smoke += process_sources_smoke - sources_full += process_sources_full +# libc time clock module +if (LOSCFG_USER_TEST_LIBC_TIME_CLOCK == true) { + import("./clock/config.gni") + common_include_dirs += libc_time_clock_include_dirs + sources_entry += libc_time_clock_sources_entry + sources_smoke += libc_time_clock_sources_smoke + sources_full += libc_time_clock_sources_full } -if (LOSCFG_USER_TEST_PTHREAD == true) { - import("./pthread/config.gni") - common_include_dirs += pthread_include_dirs - sources_entry += pthread_sources_entry - sources_smoke += pthread_sources_smoke - sources_full += pthread_sources_full +# libc time timer module +if (LOSCFG_USER_TEST_LIBC_TIME_TIMER == true) { + import("./timer/config.gni") + common_include_dirs += libc_time_timer_include_dirs + sources_entry += libc_time_timer_sources_entry + sources_smoke += libc_time_timer_sources_smoke + sources_full += libc_time_timer_sources_full } diff --git a/testsuites/unittest/libc/time/timer/config.gni b/testsuites/unittest/libc/time/timer/config.gni index 59b7d7c6a8054059a66de6d7e83d3bcc22889c2d..319427fa2f17ff3e43b9661069d6dce37df0a098 100644 --- a/testsuites/unittest/libc/time/timer/config.gni +++ b/testsuites/unittest/libc/time/timer/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,14 +26,15 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -time_timer_include_dirs = [ "$TEST_UNITTEST_DIR/libc/time/timer" ] +libc_time_timer_include_dirs = [ "$TEST_UNITTEST_DIR/libc/time/timer" ] -time_timer_sources_entry = +libc_time_timer_sources_entry = [ "$TEST_UNITTEST_DIR/libc/time/timer/time_timer_test.cpp" ] -time_timer_sources_smoke = [ +libc_time_timer_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/time/timer/smoke/timer_test_001.cpp", "$TEST_UNITTEST_DIR/libc/time/timer/smoke/timer_test_002.cpp", "$TEST_UNITTEST_DIR/libc/time/timer/smoke/timer_test_003.cpp", @@ -43,4 +44,4 @@ time_timer_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/time/timer/smoke/timer_test_tzset_002.cpp", ] -time_timer_sources_full = [] +libc_time_timer_sources_full = [] diff --git a/testsuites/unittest/libc/util/BUILD.gn b/testsuites/unittest/libc/util/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a820d67c2a9e343a3fb81057618baaba739b40e2 --- /dev/null +++ b/testsuites/unittest/libc/util/BUILD.gn @@ -0,0 +1,68 @@ +# Copyright (c) 2023 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("//kernel/liteos_a/testsuites/unittest/config.gni") +import("./config.gni") + +config("libc_config") { + if (LOSCFG_USER_TEST_LIBC_POSIX_MQUEUE == true || + LOSCFG_USER_TEST_LIBC_POSIX_PTHREAD == true) { + cflags = [ "-O1" ] + cflags_cc = cflags + } +} + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { + unittest("liteos_a_libc_util_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 += [ ":libc_config" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { + unittest("liteos_a_libc_util_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 += [ ":libc_config" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} diff --git a/testsuites/unittest/libc/util/config.gni b/testsuites/unittest/libc/util/config.gni index 5bdec23e01e8f7ca887769e6a0cba884eac5c261..c8880125ac887ce66737ec58b5c7ec999d3d26ee 100644 --- a/testsuites/unittest/libc/util/config.gni +++ b/testsuites/unittest/libc/util/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,16 +26,28 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -util_include_dirs = [ +common_include_dirs = [ + "//third_party/googletest/googletest/include", + "../../common/include", +] + +sources_entry = [ "../../common/osTest.cpp" ] + +sources_smoke = [] + +sources_full = [] + +libc_util_include_dirs = [ "$TEST_UNITTEST_DIR/libc/util", "$TEST_UNITTEST_DIR/libc/misc", ] -util_sources_entry = [ "$TEST_UNITTEST_DIR/libc/util/util_test.cpp" ] +libc_util_sources_entry = [ "$TEST_UNITTEST_DIR/libc/util/util_test.cpp" ] -util_sources_smoke = [ +libc_util_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/util/smoke/it_test_util_100.cpp", "$TEST_UNITTEST_DIR/libc/util/smoke/it_test_util_101.cpp", "$TEST_UNITTEST_DIR/libc/util/smoke/util_test_001.cpp", @@ -47,4 +59,12 @@ util_sources_smoke = [ "$TEST_UNITTEST_DIR/libc/util/smoke/util_test_007.cpp", ] -util_sources_full = [] +libc_util_sources_full = [] + +# libc util module +if (LOSCFG_USER_TEST_LIBC_UTIL == true) { + common_include_dirs += libc_util_include_dirs + sources_entry += libc_util_sources_entry + sources_smoke += libc_util_sources_smoke + sources_full += libc_util_sources_full +} diff --git a/testsuites/unittest/process/basic/BUILD.gn b/testsuites/unittest/process/basic/process/BUILD.gn similarity index 89% rename from testsuites/unittest/process/basic/BUILD.gn rename to testsuites/unittest/process/basic/process/BUILD.gn index e6a8ac2f857c12668fe936b99992e979337c5846..d7d0db4a7f704f25b36595b449a5176e27cb74e8 100644 --- a/testsuites/unittest/process/basic/BUILD.gn +++ b/testsuites/unittest/process/basic/process/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -31,7 +31,7 @@ import("//kernel/liteos_a/testsuites/unittest/config.gni") import("./config.gni") if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_process_basic_unittest_door") { + unittest("liteos_a_process_basic_process_unittest_door") { output_extension = "bin" output_dir = "$root_out_dir/test/unittest/kernel" include_dirs = common_include_dirs @@ -39,20 +39,20 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { sources += sources_smoke sources_full = [] sources += sources_full - configs = [ "../..:public_config_for_door" ] + configs = [ "../../..:public_config_for_door" ] deps = [ "//third_party/bounds_checking_function:libsec_shared" ] } } if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_process_basic_unittest") { + unittest("liteos_a_process_basic_process_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 = [ "../../..:public_config_for_all" ] deps = [ "//third_party/bounds_checking_function:libsec_shared" ] } } diff --git a/testsuites/unittest/process/basic/process/config.gni b/testsuites/unittest/process/basic/process/config.gni index a39668b73ff0fb365af992fddf31c1de3c7ecb7d..f28e4be02babead74017d1c1db3947133787930c 100644 --- a/testsuites/unittest/process/basic/process/config.gni +++ b/testsuites/unittest/process/basic/process/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,14 +26,27 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -process_include_dirs = [ "$TEST_UNITTEST_DIR/process/basic/process" ] +common_include_dirs = [ + "//third_party/googletest/googletest/include", + "../../../common/include", +] + +sources_entry = [ "../../../common/osTest.cpp" ] + +sources_smoke = [] -process_sources_entry = +sources_full = [] + +process_basic_process_include_dirs = + [ "$TEST_UNITTEST_DIR/process/basic/process" ] + +process_basic_process_sources_entry = [ "$TEST_UNITTEST_DIR/process/basic/process/process_process_test.cpp" ] -process_sources_smoke = [ +process_basic_process_sources_smoke = [ "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_001.cpp", "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_002.cpp", "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_004.cpp", @@ -81,7 +94,7 @@ process_sources_smoke = [ "$TEST_UNITTEST_DIR/process/basic/process/smp/process_test_smp_008.cpp", ] -process_sources_full = [ +process_basic_process_sources_full = [ "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_007.cpp", "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_031.cpp", "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_032.cpp", @@ -112,3 +125,11 @@ process_sources_full = [ "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_053.cpp", "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_062.cpp", ] + +# process basic process module +if (LOSCFG_USER_TEST_PROCESS_BASIC_PROCESS == true) { + common_include_dirs += process_basic_process_include_dirs + sources_entry += process_basic_process_sources_entry + sources_smoke += process_basic_process_sources_smoke + sources_full += process_basic_process_sources_full +} diff --git a/testsuites/unittest/process/basic/pthread/BUILD.gn b/testsuites/unittest/process/basic/pthread/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2baa4f7ee5d2e9ff0f7c6e6ce673d05a8336204e --- /dev/null +++ b/testsuites/unittest/process/basic/pthread/BUILD.gn @@ -0,0 +1,58 @@ +# Copyright (c) 2023 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("//kernel/liteos_a/testsuites/unittest/config.gni") +import("./config.gni") + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { + unittest("liteos_a_process_basic_pthread_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" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} + +if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { + unittest("liteos_a_process_basic_pthread_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" ] + deps = [ "//third_party/bounds_checking_function:libsec_shared" ] + } +} diff --git a/testsuites/unittest/process/basic/pthread/config.gni b/testsuites/unittest/process/basic/pthread/config.gni index 6b3265654b0eabdda7f4c894e67c189488e327e8..9906a63073effbd1c0690cd1c728620b96431ee2 100644 --- a/testsuites/unittest/process/basic/pthread/config.gni +++ b/testsuites/unittest/process/basic/pthread/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,14 +26,27 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -pthread_include_dirs = [ "$TEST_UNITTEST_DIR/process/basic/pthread" ] +common_include_dirs = [ + "//third_party/googletest/googletest/include", + "../../../common/include", +] + +sources_entry = [ "../../../common/osTest.cpp" ] + +sources_smoke = [] -pthread_sources_entry = +sources_full = [] + +process_basic_pthread_include_dirs = + [ "$TEST_UNITTEST_DIR/process/basic/pthread" ] + +process_basic_pthread_sources_entry = [ "$TEST_UNITTEST_DIR/process/basic/pthread/process_pthread_test.cpp" ] -pthread_sources_smoke = [ +process_basic_pthread_sources_smoke = [ "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_atfork_test_001.cpp", "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_atfork_test_002.cpp", "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_cond_test_001.cpp", @@ -65,10 +78,18 @@ pthread_sources_smoke = [ "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_027.cpp", ] -pthread_sources_full = [ +process_basic_pthread_sources_full = [ "$TEST_UNITTEST_DIR/process/basic/pthread/full/pthread_test_001.cpp", "$TEST_UNITTEST_DIR/process/basic/pthread/full/pthread_test_002.cpp", "$TEST_UNITTEST_DIR/process/basic/pthread/full/pthread_test_004.cpp", "$TEST_UNITTEST_DIR/process/basic/pthread/full/pthread_test_005.cpp", "$TEST_UNITTEST_DIR/process/basic/pthread/full/pthread_test_014.cpp", ] + +# process basic pthread module +if (LOSCFG_USER_TEST_PROCESS_BASIC_PTHREAD == true) { + common_include_dirs += process_basic_pthread_include_dirs + sources_entry += process_basic_pthread_sources_entry + sources_smoke += process_basic_pthread_sources_smoke + sources_full += process_basic_pthread_sources_full +} diff --git a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_020.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_020.cpp index 904d64f6865373618a8200138738c2d2da2ea583..1c63816c6cbbc487e2a61c1a6b1a281238980701 100644 --- a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_020.cpp +++ b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_020.cpp @@ -35,9 +35,9 @@ static int ChildProcess(void) volatile unsigned int count = 0; struct sched_param currSchedParam = { 0 }; struct sched_param param = { - .sched_deadline = 4000000, /* 4000000, 4s */ - .sched_runtime = 200000, /* 200000, 200ms */ - .sched_period = 5000000, /* 5000000, 5s */ + .sched_deadline = 1000000, /* 1000000, 1s */ + .sched_runtime = 20000, /* 20000, 20ms */ + .sched_period = 1000000, /* 1000000, 1s */ }; ret = sched_getparam(getpid(), &currSchedParam); @@ -58,23 +58,23 @@ static int ChildProcess(void) ret = sched_getparam(getpid(), &currSchedParam); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 4000000, LOS_NOK); /* 4000000, 4s */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */ - printf("--- 1 edf thread start ---\n\r"); + printf("--- 1 edf thread start --\n\r"); do { - for (volatile int i = 0; i < 100000; i++) { /* 100000, no special meaning */ - for (volatile int j = 0; j < 10; j++) { /* 10, no special meaning */ + for (volatile int i = 0; i < 10000; i++) { /* 10000, no special meaning */ + for (volatile int j = 0; j < 5; j++) { /* 5, no special meaning */ int tmp = i - j; } } - if (count % 20 == 0) { /* 20, no special meaning */ - printf("--- 2 edf thread running ---\n\r"); + if (count % 3 == 0) { /* 3, no special meaning */ + printf("--- 2 edf thread running --\n\r"); } count++; - } while (count <= 100); /* 100, no special meaning */ - printf("--- 3 edf thread end ---\n\r"); + } while (count <= 6); /* 6, no special meaning */ + printf("--- 3 edf thread end --\n\r"); return 0; } diff --git a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_021.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_021.cpp index 063168f30cd557d94f43458e563d6daed25c02de..e9a6354bc627a4b9713781ce6c915cf6f9a45adc 100644 --- a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_021.cpp +++ b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_021.cpp @@ -40,9 +40,9 @@ static void *ThreadFuncTest(void *args) ret = pthread_getschedparam(pthread_self(), & currPolicy, &currSchedParam); ICUNIT_GOTO_EQUAL(ret, 0, LOS_NOK, EXIT); ICUNIT_GOTO_EQUAL( currPolicy, SCHED_DEADLINE, LOS_NOK, EXIT); - ICUNIT_GOTO_EQUAL(currSchedParam.sched_deadline, 3000000, LOS_NOK, EXIT); /* 3000000, 3s */ - ICUNIT_GOTO_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK, EXIT); /* 200000, 200ms */ - ICUNIT_GOTO_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK, EXIT); /* 5000000, 5s */ + ICUNIT_GOTO_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK, EXIT); /* 1000000, 1s */ + ICUNIT_GOTO_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK, EXIT); /* 20000, 20ms */ + ICUNIT_GOTO_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK, EXIT); /* 1000000, 1s */ printf("--- 1 edf Tid[%d] PTid[%d] thread start ---\n\r", currTID, pt); do { @@ -51,11 +51,11 @@ static void *ThreadFuncTest(void *args) volatile int tmp = i - j; } } - if (count % 20 == 0) { /* 20, no special meaning */ + if (count % 3 == 0) { /* 3, no special meaning */ printf("--- 2 edf Tid[%d] PTid[%d] thread running ---\n\r", currTID, pt); } count++; - } while (count <= 100); /* 100, no special meaning */ + } while (count <= 6); /* 6, no special meaning */ printf("--- 3 edf Tid[%d] PTid[%d] thread end ---\n\r", currTID, pt); ret = LOS_OK; @@ -74,9 +74,9 @@ static int ChildProcess(void) struct sched_param currSchedParam = { 0 }; int currTID = Syscall(SYS_gettid, 0, 0, 0, 0); struct sched_param param = { - .sched_deadline = 3000000, /* 3000000, 3s */ - .sched_runtime = 200000, /* 200000, 200ms */ - .sched_period = 5000000, /* 5000000, 5s */ + .sched_deadline = 1000000, /* 1000000, 1s */ + .sched_runtime = 20000, /* 20000, 20ms */ + .sched_period = 1000000, /* 1000000, 1s */ }; ret = sched_setscheduler(getpid(), SCHED_DEADLINE, ¶m); @@ -85,25 +85,25 @@ static int ChildProcess(void) ret = pthread_getschedparam(pthread_self(), & currPolicy, &currSchedParam); ICUNIT_ASSERT_EQUAL(ret, 0, ret); ICUNIT_ASSERT_EQUAL(currPolicy, SCHED_DEADLINE, LOS_NOK); - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 3000000, LOS_NOK); /* 3000000, 3s */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */ ret = pthread_create(&newUserThread, NULL, ThreadFuncTest, (void *)currTID); ICUNIT_ASSERT_EQUAL(ret, 0, ret); printf("--- 1 edf Tid[%d] thread start ---\n\r", currTID); do { - for (volatile int i = 0; i < 100000; i++) { /* 100000, no special meaning */ + for (volatile int i = 0; i < 10000; i++) { /* 10000, no special meaning */ for (volatile int j = 0; j < 5; j++) { /* 5, no special meaning */ int tmp = i - j; } } - if (count % 20 == 0) { /* 20, no special meaning */ + if (count % 3 == 0) { /* 3, no special meaning */ printf("--- 2 edf Tid[%d] thread running ---\n\r", currTID); } count++; - } while (count <= 100); /* 100, no special meaning */ + } while (count <= 6); /* 6, no special meaning */ printf("--- 3 edf Tid[%d] thread end ---\n\r", currTID); ret = pthread_join(newUserThread, (void **)&childThreadRetval); diff --git a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_022.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_022.cpp index 90624467658bfa46bf888217443cc84495303891..db55fa5f7c0a37283a31bc907870ef3b4c656db2 100644 --- a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_022.cpp +++ b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_022.cpp @@ -40,22 +40,22 @@ static int EdfProcess(void) ret = pthread_getschedparam(pthread_self(), &currPolicy, &currSchedParam); ICUNIT_ASSERT_EQUAL(ret, 0, ret); ICUNIT_ASSERT_EQUAL(currPolicy, SCHED_DEADLINE, LOS_NOK); - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 3000000, LOS_NOK); /* 3000000, 3s */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */ printf("--- edf2 -- 1 -- Tid[%d] thread start ---\n\r", currTID); do { - for (volatile int i = 0; i < 100000; i++) { /* 100000, no special meaning */ + for (volatile int i = 0; i < 10000; i++) { /* 10000, no special meaning */ for (volatile int j = 0; j < 5; j++) { /* 5, no special meaning */ int tmp = i - j; } } - if (count % 20 == 0) { /* 20, no special meaning */ + if (count % 3 == 0) { /* 3, no special meaning */ printf("--- edf2 -- 2 -- Tid[%d] thread running ---\n\r", currTID); } count++; - } while (count <= 100); /* 100, no special meaning */ + } while (count <= 6); /* 6, no special meaning */ printf("--- edf2 -- 3 -- Tid[%d] thread end ---\n\r", currTID); return 0; @@ -71,9 +71,9 @@ static int ChildProcess(void) struct sched_param currSchedParam = { 0 }; int currTID = Syscall(SYS_gettid, 0, 0, 0, 0); struct sched_param param = { - .sched_deadline = 3000000, /* 3000000, 3s */ - .sched_runtime = 200000, /* 200000, 200ms */ - .sched_period = 5000000, /* 5000000, 5s */ + .sched_deadline = 1000000, /* 1000000, 1s */ + .sched_runtime = 20000, /* 20000, 20ms */ + .sched_period = 1000000, /* 1000000, 1s */ }; ret = sched_setscheduler(getpid(), SCHED_DEADLINE, ¶m); @@ -82,9 +82,9 @@ static int ChildProcess(void) ret = pthread_getschedparam(pthread_self(), &currPolicy, &currSchedParam); ICUNIT_ASSERT_EQUAL(ret, 0, ret); ICUNIT_ASSERT_EQUAL(currPolicy, SCHED_DEADLINE, LOS_NOK); - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 3000000, LOS_NOK); /* 3000000, 3s */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */ pid = fork(); if (pid == 0) { @@ -96,14 +96,14 @@ static int ChildProcess(void) } else if (pid > 0) { printf("--- edf1 -- 1 -- Tid[%d] thread start ---\n\r", currTID); do { - for (volatile int i = 0; i < 500000; i++) { /* 500000, no special meaning */ + for (volatile int i = 0; i < 50000; i++) { /* 50000, no special meaning */ int tmp = i + 1; } - if (count % 20 == 0) { /* 20, no special meaning */ + if (count % 5 == 0) { /* 5, no special meaning */ printf("--- edf1 -- 2 -- Tid[%d] thread running ---\n\r", currTID); } count++; - } while (count <= 100); /* 100, no special meaning */ + } while (count <= 10); /* 10, no special meaning */ printf("--- edf1 -- 3 -- Tid[%d] thread end ---\n\r", currTID); waitpid(pid, &status, 0); } else { diff --git a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_023.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_023.cpp index 9b6572d61dae42fda455d5b77951ce8f0e81d6e4..05ab3b997fa95eac239fcb0cdc724371bcbfc733 100644 --- a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_023.cpp +++ b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_023.cpp @@ -46,9 +46,9 @@ static int ChildProcess(void) struct sched_param currSchedParam = { 0 }; int currTID = Syscall(SYS_gettid, 0, 0, 0, 0); struct sched_param param = { - .sched_deadline = 3000000, /* 3000000, 3s */ - .sched_runtime = 200000, /* 200000, 200ms */ - .sched_period = 5000000, /* 5000000, 5s */ + .sched_deadline = 1000000, /* 1000000, 1s */ + .sched_runtime = 20000, /* 20000, 20ms */ + .sched_period = 1000000, /* 1000000, 1s */ }; ret = pthread_getschedparam(pthread_self(), &oldPolicy, &hpfparam); @@ -60,9 +60,9 @@ static int ChildProcess(void) ret = pthread_getschedparam(pthread_self(), &currPolicy, &currSchedParam); ICUNIT_ASSERT_EQUAL(ret, 0, ret); ICUNIT_ASSERT_EQUAL(currPolicy, SCHED_DEADLINE, LOS_NOK); - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 3000000, LOS_NOK); /* 3000000, 3s */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */ ret = pthread_attr_init(&a); pthread_attr_setschedpolicy(&a, SCHED_RR); diff --git a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_024.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_024.cpp index 9665294e0c3750b3fdf79d9a83fa47fce640575e..c3ca7f529be8479eb36e0a81d10adce0210e9302 100644 --- a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_024.cpp +++ b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_024.cpp @@ -45,9 +45,9 @@ static int ChildProcess(void) volatile unsigned int count = 0; int currTID = Syscall(SYS_gettid, 0, 0, 0, 0); struct sched_param param = { - .sched_deadline = 3000000, /* 3000000, 3s */ - .sched_runtime = 200000, /* 200000, 200ms */ - .sched_period = 5000000, /* 5000000, 5s */ + .sched_deadline = 1000000, /* 1000000, 1s */ + .sched_runtime = 20000, /* 20000, 20ms */ + .sched_period = 1000000, /* 1000000, 1s */ }; ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, &hpfparam); diff --git a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_025.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_025.cpp index 3c339b7887226a2ac5cc58ec802308359cd9d2e0..3366012e5c633f79616ed81ee072cde2fe1b1ec8 100644 --- a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_025.cpp +++ b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_025.cpp @@ -49,9 +49,9 @@ static int ChildProcess(void) struct sched_param currSchedParam = { 0 }; int currTID = Syscall(SYS_gettid, 0, 0, 0, 0); struct sched_param param = { - .sched_deadline = 3000000, /* 3000000, 3s */ - .sched_runtime = 200000, /* 200000, 200ms */ - .sched_period = 5000000, /* 5000000, 5s */ + .sched_deadline = 1000000, /* 1000000, 1s */ + .sched_runtime = 20000, /* 20000, 20ms */ + .sched_period = 1000000, /* 1000000, 1s */ }; ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, &hpfparam); diff --git a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_026.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_026.cpp index b733d86c4d587166a93f95bfb17facaa0a7ec149..a9b6b9db8a664299783a40e0087e6544d69efccd 100644 --- a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_026.cpp +++ b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_026.cpp @@ -36,9 +36,9 @@ static int ChildProcess(void) volatile unsigned int count = 0; struct sched_param currSchedParam = { 0 }; struct sched_param param = { - .sched_deadline = 4000000, /* 4000000, 4s */ - .sched_runtime = 200000, /* 200000, 200ms */ - .sched_period = 5000000, /* 5000000, 5s */ + .sched_deadline = 1000000, /* 1000000, 1s */ + .sched_runtime = 20000, /* 20000, 20ms */ + .sched_period = 1000000, /* 1000000, 1s */ }; ret = sched_getparam(getpid(), &currSchedParam); @@ -59,22 +59,22 @@ static int ChildProcess(void) ret = sched_getparam(getpid(), &currSchedParam); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 4000000, LOS_NOK); /* 4000000, 4s */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */ printf("--- 1 edf thread start ---\n\r"); do { - for (volatile int i = 0; i < 100000; i++) { /* 100000, no special meaning */ - for (volatile int j = 0; j < 10; j++) { /* 10, no special meaning */ + for (volatile int i = 0; i < 10000; i++) { /* 10000, no special meaning */ + for (volatile int j = 0; j < 5; j++) { /* 5, no special meaning */ int tmp = i - j; } } - if (count % 20 == 0) { /* 20, no special meaning */ + if (count % 3 == 0) { /* 3, no special meaning */ printf("--- 2 edf thread running ---\n\r"); } count++; - } while (count <= 100); /* 100, no special meaning */ + } while (count <= 6); /* 6, no special meaning */ printf("--- 3 edf thread end ---\n\r"); return 0; diff --git a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_027.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_027.cpp index 49ca891c11601dd0389c376f3923822173f0a738..a442c09066206a99c977a6912d2aeca555c27872 100644 --- a/testsuites/unittest/process/basic/pthread/smoke/pthread_test_027.cpp +++ b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_027.cpp @@ -36,9 +36,9 @@ static int ChildProcess(void) volatile unsigned int count = 0; struct sched_param currSchedParam = { 0 }; struct sched_param param = { - .sched_deadline = 4000000, /* 4000000, 4s */ - .sched_runtime = 200000, /* 200000, 200ms */ - .sched_period = 5000000, /* 5000000, 5s */ + .sched_deadline = 1000000, /* 1000000, 1s */ + .sched_runtime = 20000, /* 20000, 20ms */ + .sched_period = 1000000, /* 1000000, 1s */ }; ret = sched_getparam(getpid(), &currSchedParam); @@ -59,9 +59,9 @@ static int ChildProcess(void) ret = sched_getparam(getpid(), &currSchedParam); ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 4000000, LOS_NOK); /* 4000000, 4s */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 200000, LOS_NOK); /* 200000, 200ms */ - ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 5000000, LOS_NOK); /* 5000000, 5s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_deadline, 1000000, LOS_NOK); /* 1000000, 1s */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_runtime, 20000, LOS_NOK); /* 20000, 20ms */ + ICUNIT_ASSERT_EQUAL(currSchedParam.sched_period, 1000000, LOS_NOK); /* 1000000, 1s */ return 0; } diff --git a/testsuites/unittest/process/lock/BUILD.gn b/testsuites/unittest/process/lock/BUILD.gn index 18ada1f3dcb48c77f8718b69de96c791b39c6759..82ae8a953599f871a9b6b1a8c8cc645fdb31fdae 100644 --- a/testsuites/unittest/process/lock/BUILD.gn +++ b/testsuites/unittest/process/lock/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: diff --git a/testsuites/unittest/process/lock/config.gni b/testsuites/unittest/process/lock/config.gni index e44ac92fc9e266b3d5b825bc2cb27130807870e5..a1e270c27850113ceec157f28364371aafd38fae 100644 --- a/testsuites/unittest/process/lock/config.gni +++ b/testsuites/unittest/process/lock/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2023 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: @@ -40,27 +40,29 @@ sources_smoke = [] sources_full = [] -# lock module -if (LOSCFG_USER_TEST_MUTEX == true) { +# process lock mutex module +if (LOSCFG_USER_TEST_PROCESS_LOCK_MUTEX == true) { import("./mutex/config.gni") - common_include_dirs += mutex_include_dirs - sources_entry += mutex_sources_entry - sources_smoke += mutex_sources_smoke - sources_full += mutex_sources_full + common_include_dirs += process_lock_mutex_include_dirs + sources_entry += process_lock_mutex_sources_entry + sources_smoke += process_lock_mutex_sources_smoke + sources_full += process_lock_mutex_sources_full } -if (LOSCFG_USER_TEST_RWLOCK == true) { +# process lock rwlock module +if (LOSCFG_USER_TEST_PROCESS_LOCK_RWLOCK == true) { import("./rwlock/config.gni") - common_include_dirs += rwlock_include_dirs - sources_entry += rwlock_sources_entry - sources_smoke += rwlock_sources_smoke - sources_full += rwlock_sources_full + common_include_dirs += process_lock_rwlock_include_dirs + sources_entry += process_lock_rwlock_sources_entry + sources_smoke += process_lock_rwlock_sources_smoke + sources_full += process_lock_rwlock_sources_full } -if (LOSCFG_USER_TEST_SPINLOCK == true) { +# process lock spinlock module +if (LOSCFG_USER_TEST_PROCESS_LOCK_SPINLOCK == true) { import("./spinlock/config.gni") - common_include_dirs += spinlock_include_dirs - sources_entry += spinlock_sources_entry - sources_smoke += spinlock_sources_smoke - sources_full += spinlock_sources_full + common_include_dirs += process_lock_spinlock_include_dirs + sources_entry += process_lock_spinlock_sources_entry + sources_smoke += process_lock_spinlock_sources_smoke + sources_full += process_lock_spinlock_sources_full } diff --git a/testsuites/unittest/process/lock/mutex/config.gni b/testsuites/unittest/process/lock/mutex/config.gni index 641d039940bf6307c0e48b0a547b1e4fd787d7e8..6ff147dd202a9eecff571fde027264488b4e6fda 100644 --- a/testsuites/unittest/process/lock/mutex/config.gni +++ b/testsuites/unittest/process/lock/mutex/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,14 +26,15 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -mutex_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/mutex" ] +process_lock_mutex_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/mutex" ] -mutex_sources_entry = +process_lock_mutex_sources_entry = [ "$TEST_UNITTEST_DIR/process/lock/mutex/process_mutex_test.cpp" ] -mutex_sources_smoke = [ +process_lock_mutex_sources_smoke = [ "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_001.cpp", "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_002.cpp", "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_003.cpp", @@ -57,7 +58,7 @@ mutex_sources_smoke = [ "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_022.cpp", ] -mutex_sources_full = [ +process_lock_mutex_sources_full = [ "$TEST_UNITTEST_DIR/process/lock/mutex/full/pthread_mutex_test_018.cpp", "$TEST_UNITTEST_DIR/process/lock/mutex/full/pthread_mutex_test_023.cpp", "$TEST_UNITTEST_DIR/process/lock/mutex/full/pthread_mutex_test_024.cpp", diff --git a/testsuites/unittest/process/lock/rwlock/config.gni b/testsuites/unittest/process/lock/rwlock/config.gni index b34a605371c6e2d53f7f0bd8af232b557a5ebaf6..33b1e506ea6329c0d26b556d5ea02bd787581507 100644 --- a/testsuites/unittest/process/lock/rwlock/config.gni +++ b/testsuites/unittest/process/lock/rwlock/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,17 +26,18 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -rwlock_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/rwlock" ] +process_lock_rwlock_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/rwlock" ] -rwlock_sources_entry = +process_lock_rwlock_sources_entry = [ "$TEST_UNITTEST_DIR/process/lock/rwlock/process_rwlock_test.cpp" ] -rwlock_sources_smoke = [ +process_lock_rwlock_sources_smoke = [ "$TEST_UNITTEST_DIR/process/lock/rwlock/smoke/pthread_rwlock_test_001.cpp", ] -rwlock_sources_full = [ +process_lock_rwlock_sources_full = [ "$TEST_UNITTEST_DIR/process/lock/rwlock/full/pthread_rwlock_test_002.cpp", ] diff --git a/testsuites/unittest/process/lock/spinlock/config.gni b/testsuites/unittest/process/lock/spinlock/config.gni index 457673be9de5df8921a1717097c4c57b5205bfe4..8798d8732d31539b34fa221c841d698ebef55539 100644 --- a/testsuites/unittest/process/lock/spinlock/config.gni +++ b/testsuites/unittest/process/lock/spinlock/config.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2022 Huawei Device Co., Ltd. All rights reserved. +# Copyright (c) 2022-2023 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: @@ -26,13 +26,15 @@ # 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("//kernel/liteos_a/testsuites/unittest/config.gni") -spinlock_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/spinlock" ] +process_lock_spinlock_include_dirs = + [ "$TEST_UNITTEST_DIR/process/lock/spinlock" ] -spinlock_sources_entry = +process_lock_spinlock_sources_entry = [ "$TEST_UNITTEST_DIR/process/lock/spinlock/process_spinlock_test.cpp" ] -spinlock_sources_smoke = [ "$TEST_UNITTEST_DIR/process/lock/spinlock/smoke/pthread_spinlock_test_001.cpp" ] +process_lock_spinlock_sources_smoke = [ "$TEST_UNITTEST_DIR/process/lock/spinlock/smoke/pthread_spinlock_test_001.cpp" ] -spinlock_sources_full = [] +process_lock_spinlock_sources_full = []