diff --git a/testsuites/BUILD.gn b/testsuites/BUILD.gn index 5d7538ea..17bddbfe 100644 --- a/testsuites/BUILD.gn +++ b/testsuites/BUILD.gn @@ -33,6 +33,5 @@ group("testsuites") { deps = [ #"kernel", "unittest", - "unittest_old", ] } diff --git a/testsuites/unittest/BUILD.gn b/testsuites/unittest/BUILD.gn index 6f6d2a07..77ee85ac 100644 --- a/testsuites/unittest/BUILD.gn +++ b/testsuites/unittest/BUILD.gn @@ -63,6 +63,7 @@ config("public_config_for_pressure") { cflags_cc = cflags } +# Note: The execution time of a single XXX_door.bin cannot exceed 90 seconds. group("unittest") { deps = [] if (ohos_build_type == "debug") { @@ -129,6 +130,18 @@ 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" ] + } + if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { + deps += [ "process/basic:liteos_a_process_basic_unittest" ] + deps += [ "process/lock:liteos_a_process_lock_unittest" ] + } + } + # security test if (LOSCFG_USER_TEST_SECURITY == true) { if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { diff --git a/testsuites/unittest/basic/config.gni b/testsuites/unittest/basic/config.gni index 8ba3eac7..4b18bbde 100644 --- a/testsuites/unittest/basic/config.gni +++ b/testsuites/unittest/basic/config.gni @@ -74,44 +74,3 @@ if (LOSCFG_USER_TEST_MEM_VM == true) { sources_smoke += mem_vm_sources_smoke sources_full += mem_vm_sources_full } - -# process module -if (LOSCFG_USER_TEST_MUTEX == true) { - import("./process/mutex/config.gni") - common_include_dirs += mutex_include_dirs - sources_entry += mutex_sources_entry - sources_smoke += mutex_sources_smoke - sources_full += mutex_sources_full -} - -if (LOSCFG_USER_TEST_PROCESS == true) { - import("./process/process/config.gni") - common_include_dirs += process_include_dirs - sources_entry += process_sources_entry - sources_smoke += process_sources_smoke - sources_full += process_sources_full -} - -if (LOSCFG_USER_TEST_PTHREAD == true) { - import("./process/pthread/config.gni") - common_include_dirs += pthread_include_dirs - sources_entry += pthread_sources_entry - sources_smoke += pthread_sources_smoke - sources_full += pthread_sources_full -} - -if (LOSCFG_USER_TEST_RWLOCK == true) { - import("./process/rwlock/config.gni") - common_include_dirs += rwlock_include_dirs - sources_entry += rwlock_sources_entry - sources_smoke += rwlock_sources_smoke - sources_full += rwlock_sources_full -} - -if (LOSCFG_USER_TEST_SPINLOCK == true) { - import("./process/spinlock/config.gni") - common_include_dirs += spinlock_include_dirs - sources_entry += spinlock_sources_entry - sources_smoke += spinlock_sources_smoke - sources_full += spinlock_sources_full -} diff --git a/testsuites/unittest/basic/process/mutex/config.gni b/testsuites/unittest/basic/process/mutex/config.gni deleted file mode 100644 index f2e1c2c4..00000000 --- a/testsuites/unittest/basic/process/mutex/config.gni +++ /dev/null @@ -1,65 +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("//kernel/liteos_a/testsuites/unittest/config.gni") - -mutex_include_dirs = [ "$TEST_UNITTEST_DIR/basic/process/mutex" ] - -mutex_sources_entry = - [ "$TEST_UNITTEST_DIR/basic/process/mutex/process_mutex_test.cpp" ] - -mutex_sources_smoke = [ - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_001.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_002.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_003.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_004.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_005.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_006.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_007.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_008.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_009.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_010.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_011.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_012.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_013.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_014.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_015.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_016.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_017.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_019.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_020.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_021.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/smoke/pthread_mutex_test_022.cpp", -] - -mutex_sources_full = [ - "$TEST_UNITTEST_DIR/basic/process/mutex/full/pthread_mutex_test_018.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/full/pthread_mutex_test_023.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/full/pthread_mutex_test_024.cpp", - "$TEST_UNITTEST_DIR/basic/process/mutex/full/pthread_mutex_test_025.cpp", -] diff --git a/testsuites/unittest/basic/process/process/config.gni b/testsuites/unittest/basic/process/process/config.gni deleted file mode 100644 index fae7c3c0..00000000 --- a/testsuites/unittest/basic/process/process/config.gni +++ /dev/null @@ -1,114 +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("//kernel/liteos_a/testsuites/unittest/config.gni") - -process_include_dirs = [ "$TEST_UNITTEST_DIR/basic/process/process" ] - -process_sources_entry = - [ "$TEST_UNITTEST_DIR/basic/process/process/process_process_test.cpp" ] - -process_sources_smoke = [ - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_001.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_002.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_004.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_005.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_006.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_008.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_009.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_010.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_011.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_012.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_013.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_014.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_015.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_016.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_017.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_018.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_019.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_020.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_021.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_022.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_023.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_024.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_025.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_026.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_027.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_029.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_030.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_038.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_039.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_043.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_044.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_045.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_046.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_047.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_048.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_054.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smoke/process_test_061.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smp/process_test_smp_001.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smp/process_test_smp_002.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smp/process_test_smp_003.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smp/process_test_smp_004.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smp/process_test_smp_005.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smp/process_test_smp_006.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smp/process_test_smp_007.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/smp/process_test_smp_008.cpp", -] - -process_sources_full = [ - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_007.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_031.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_032.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_033.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_034.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_035.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_036.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_037.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_040.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_041.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_042.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_049.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_050.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_051.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_055.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_056.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_057.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_058.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_059.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_060.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_063.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_064.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_065.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_066.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_067.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_068.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_069.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_053.cpp", - "$TEST_UNITTEST_DIR/basic/process/process/full/process_test_062.cpp", -] diff --git a/testsuites/unittest/config.gni b/testsuites/unittest/config.gni index 9447401b..f429e251 100644 --- a/testsuites/unittest/config.gni +++ b/testsuites/unittest/config.gni @@ -53,6 +53,12 @@ LOSCFG_USER_TEST_DYNLOAD = true LOSCFG_USER_TEST_EXC = true LOSCFG_USER_TEST_MEM_SHM = true LOSCFG_USER_TEST_MEM_VM = true + +########## process test ########## +# Control switch for process&pthread function test +LOSCFG_USER_TEST_PROCESS_THREAD = true + +# Module list LOSCFG_USER_TEST_MUTEX = true LOSCFG_USER_TEST_PROCESS = true LOSCFG_USER_TEST_PTHREAD = true diff --git a/testsuites/unittest_old/security/vid/BUILD.gn b/testsuites/unittest/process/basic/BUILD.gn similarity index 81% rename from testsuites/unittest_old/security/vid/BUILD.gn rename to testsuites/unittest/process/basic/BUILD.gn index da2f3d5b..e6a8ac2f 100644 --- a/testsuites/unittest_old/security/vid/BUILD.gn +++ b/testsuites/unittest/process/basic/BUILD.gn @@ -1,5 +1,4 @@ -# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# 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: @@ -28,25 +27,11 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//build/lite/config/test.gni") -import("../../config.gni") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "security_vid_test.cpp", -] - -sources_smoke = [ "smoke/vid_test_001.cpp" ] - -sources_full = [] +import("//kernel/liteos_a/testsuites/unittest/config.gni") +import("./config.gni") if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_security_vid_unittest_door") { + unittest("liteos_a_process_basic_unittest_door") { output_extension = "bin" output_dir = "$root_out_dir/test/unittest/kernel" include_dirs = common_include_dirs @@ -60,7 +45,7 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { } if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_security_vid_unittest") { + unittest("liteos_a_process_basic_unittest") { output_extension = "bin" output_dir = "$root_out_dir/test/unittest/kernel" include_dirs = common_include_dirs diff --git a/testsuites/unittest/process/basic/config.gni b/testsuites/unittest/process/basic/config.gni new file mode 100644 index 00000000..b27261db --- /dev/null +++ b/testsuites/unittest/process/basic/config.gni @@ -0,0 +1,58 @@ +# 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 = [] + +# 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 +} + +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 +} diff --git a/testsuites/unittest/process/basic/process/config.gni b/testsuites/unittest/process/basic/process/config.gni new file mode 100644 index 00000000..a39668b7 --- /dev/null +++ b/testsuites/unittest/process/basic/process/config.gni @@ -0,0 +1,114 @@ +# 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("//kernel/liteos_a/testsuites/unittest/config.gni") + +process_include_dirs = [ "$TEST_UNITTEST_DIR/process/basic/process" ] + +process_sources_entry = + [ "$TEST_UNITTEST_DIR/process/basic/process/process_process_test.cpp" ] + +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", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_005.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_006.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_008.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_009.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_010.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_011.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_012.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_013.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_014.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_015.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_016.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_017.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_018.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_019.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_020.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_021.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_022.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_023.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_024.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_025.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_026.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_027.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_029.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_030.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_038.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_039.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_043.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_044.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_045.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_046.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_047.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_048.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_054.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smoke/process_test_061.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smp/process_test_smp_001.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smp/process_test_smp_002.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smp/process_test_smp_003.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smp/process_test_smp_004.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smp/process_test_smp_005.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smp/process_test_smp_006.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smp/process_test_smp_007.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/smp/process_test_smp_008.cpp", +] + +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", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_033.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_034.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_035.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_036.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_037.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_040.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_041.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_042.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_049.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_050.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_051.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_055.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_056.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_057.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_058.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_059.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_060.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_063.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_064.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_065.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_066.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_067.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_068.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_069.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_053.cpp", + "$TEST_UNITTEST_DIR/process/basic/process/full/process_test_062.cpp", +] diff --git a/testsuites/unittest/basic/process/process/full/process_test_007.cpp b/testsuites/unittest/process/basic/process/full/process_test_007.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_007.cpp rename to testsuites/unittest/process/basic/process/full/process_test_007.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_031.cpp b/testsuites/unittest/process/basic/process/full/process_test_031.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_031.cpp rename to testsuites/unittest/process/basic/process/full/process_test_031.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_032.cpp b/testsuites/unittest/process/basic/process/full/process_test_032.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_032.cpp rename to testsuites/unittest/process/basic/process/full/process_test_032.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_033.cpp b/testsuites/unittest/process/basic/process/full/process_test_033.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_033.cpp rename to testsuites/unittest/process/basic/process/full/process_test_033.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_034.cpp b/testsuites/unittest/process/basic/process/full/process_test_034.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_034.cpp rename to testsuites/unittest/process/basic/process/full/process_test_034.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_035.cpp b/testsuites/unittest/process/basic/process/full/process_test_035.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_035.cpp rename to testsuites/unittest/process/basic/process/full/process_test_035.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_036.cpp b/testsuites/unittest/process/basic/process/full/process_test_036.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_036.cpp rename to testsuites/unittest/process/basic/process/full/process_test_036.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_037.cpp b/testsuites/unittest/process/basic/process/full/process_test_037.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_037.cpp rename to testsuites/unittest/process/basic/process/full/process_test_037.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_040.cpp b/testsuites/unittest/process/basic/process/full/process_test_040.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_040.cpp rename to testsuites/unittest/process/basic/process/full/process_test_040.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_041.cpp b/testsuites/unittest/process/basic/process/full/process_test_041.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_041.cpp rename to testsuites/unittest/process/basic/process/full/process_test_041.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_042.cpp b/testsuites/unittest/process/basic/process/full/process_test_042.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_042.cpp rename to testsuites/unittest/process/basic/process/full/process_test_042.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_049.cpp b/testsuites/unittest/process/basic/process/full/process_test_049.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_049.cpp rename to testsuites/unittest/process/basic/process/full/process_test_049.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_050.cpp b/testsuites/unittest/process/basic/process/full/process_test_050.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_050.cpp rename to testsuites/unittest/process/basic/process/full/process_test_050.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_051.cpp b/testsuites/unittest/process/basic/process/full/process_test_051.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_051.cpp rename to testsuites/unittest/process/basic/process/full/process_test_051.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_052.cpp b/testsuites/unittest/process/basic/process/full/process_test_052.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_052.cpp rename to testsuites/unittest/process/basic/process/full/process_test_052.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_053.cpp b/testsuites/unittest/process/basic/process/full/process_test_053.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_053.cpp rename to testsuites/unittest/process/basic/process/full/process_test_053.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_055.cpp b/testsuites/unittest/process/basic/process/full/process_test_055.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_055.cpp rename to testsuites/unittest/process/basic/process/full/process_test_055.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_056.cpp b/testsuites/unittest/process/basic/process/full/process_test_056.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_056.cpp rename to testsuites/unittest/process/basic/process/full/process_test_056.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_057.cpp b/testsuites/unittest/process/basic/process/full/process_test_057.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_057.cpp rename to testsuites/unittest/process/basic/process/full/process_test_057.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_058.cpp b/testsuites/unittest/process/basic/process/full/process_test_058.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_058.cpp rename to testsuites/unittest/process/basic/process/full/process_test_058.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_059.cpp b/testsuites/unittest/process/basic/process/full/process_test_059.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_059.cpp rename to testsuites/unittest/process/basic/process/full/process_test_059.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_060.cpp b/testsuites/unittest/process/basic/process/full/process_test_060.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_060.cpp rename to testsuites/unittest/process/basic/process/full/process_test_060.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_062.cpp b/testsuites/unittest/process/basic/process/full/process_test_062.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_062.cpp rename to testsuites/unittest/process/basic/process/full/process_test_062.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_063.cpp b/testsuites/unittest/process/basic/process/full/process_test_063.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_063.cpp rename to testsuites/unittest/process/basic/process/full/process_test_063.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_064.cpp b/testsuites/unittest/process/basic/process/full/process_test_064.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_064.cpp rename to testsuites/unittest/process/basic/process/full/process_test_064.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_065.cpp b/testsuites/unittest/process/basic/process/full/process_test_065.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_065.cpp rename to testsuites/unittest/process/basic/process/full/process_test_065.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_066.cpp b/testsuites/unittest/process/basic/process/full/process_test_066.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_066.cpp rename to testsuites/unittest/process/basic/process/full/process_test_066.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_067.cpp b/testsuites/unittest/process/basic/process/full/process_test_067.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_067.cpp rename to testsuites/unittest/process/basic/process/full/process_test_067.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_068.cpp b/testsuites/unittest/process/basic/process/full/process_test_068.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_068.cpp rename to testsuites/unittest/process/basic/process/full/process_test_068.cpp diff --git a/testsuites/unittest/basic/process/process/full/process_test_069.cpp b/testsuites/unittest/process/basic/process/full/process_test_069.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/full/process_test_069.cpp rename to testsuites/unittest/process/basic/process/full/process_test_069.cpp diff --git a/testsuites/unittest/basic/process/process/it_test_process.h b/testsuites/unittest/process/basic/process/it_test_process.h similarity index 100% rename from testsuites/unittest/basic/process/process/it_test_process.h rename to testsuites/unittest/process/basic/process/it_test_process.h diff --git a/testsuites/unittest/basic/process/process/process_process_test.cpp b/testsuites/unittest/process/basic/process/process_process_test.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/process_process_test.cpp rename to testsuites/unittest/process/basic/process/process_process_test.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_001.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_001.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_001.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_001.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_002.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_002.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_002.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_002.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_004.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_004.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_004.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_004.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_005.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_005.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_005.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_005.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_006.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_006.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_006.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_006.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_008.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_008.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_008.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_008.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_009.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_009.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_009.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_009.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_010.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_010.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_010.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_010.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_011.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_011.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_011.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_011.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_012.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_012.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_012.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_012.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_013.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_013.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_013.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_013.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_014.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_014.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_014.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_014.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_015.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_015.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_015.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_015.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_016.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_016.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_016.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_016.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_017.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_017.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_017.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_017.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_018.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_018.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_018.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_018.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_019.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_019.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_019.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_019.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_020.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_020.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_020.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_020.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_021.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_021.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_021.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_021.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_022.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_022.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_022.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_022.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_023.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_023.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_023.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_023.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_024.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_024.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_024.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_024.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_025.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_025.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_025.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_025.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_026.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_026.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_026.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_026.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_027.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_027.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_027.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_027.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_029.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_029.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_029.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_029.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_030.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_030.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_030.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_030.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_038.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_038.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_038.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_038.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_039.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_039.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_039.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_039.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_043.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_043.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_043.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_043.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_044.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_044.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_044.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_044.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_045.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_045.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_045.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_045.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_046.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_046.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_046.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_046.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_047.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_047.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_047.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_047.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_048.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_048.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_048.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_048.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_054.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_054.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_054.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_054.cpp diff --git a/testsuites/unittest/basic/process/process/smoke/process_test_061.cpp b/testsuites/unittest/process/basic/process/smoke/process_test_061.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smoke/process_test_061.cpp rename to testsuites/unittest/process/basic/process/smoke/process_test_061.cpp diff --git a/testsuites/unittest/basic/process/process/smp/process_test_smp_001.cpp b/testsuites/unittest/process/basic/process/smp/process_test_smp_001.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smp/process_test_smp_001.cpp rename to testsuites/unittest/process/basic/process/smp/process_test_smp_001.cpp diff --git a/testsuites/unittest/basic/process/process/smp/process_test_smp_002.cpp b/testsuites/unittest/process/basic/process/smp/process_test_smp_002.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smp/process_test_smp_002.cpp rename to testsuites/unittest/process/basic/process/smp/process_test_smp_002.cpp diff --git a/testsuites/unittest/basic/process/process/smp/process_test_smp_003.cpp b/testsuites/unittest/process/basic/process/smp/process_test_smp_003.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smp/process_test_smp_003.cpp rename to testsuites/unittest/process/basic/process/smp/process_test_smp_003.cpp diff --git a/testsuites/unittest/basic/process/process/smp/process_test_smp_004.cpp b/testsuites/unittest/process/basic/process/smp/process_test_smp_004.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smp/process_test_smp_004.cpp rename to testsuites/unittest/process/basic/process/smp/process_test_smp_004.cpp diff --git a/testsuites/unittest/basic/process/process/smp/process_test_smp_005.cpp b/testsuites/unittest/process/basic/process/smp/process_test_smp_005.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smp/process_test_smp_005.cpp rename to testsuites/unittest/process/basic/process/smp/process_test_smp_005.cpp diff --git a/testsuites/unittest/basic/process/process/smp/process_test_smp_006.cpp b/testsuites/unittest/process/basic/process/smp/process_test_smp_006.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smp/process_test_smp_006.cpp rename to testsuites/unittest/process/basic/process/smp/process_test_smp_006.cpp diff --git a/testsuites/unittest/basic/process/process/smp/process_test_smp_007.cpp b/testsuites/unittest/process/basic/process/smp/process_test_smp_007.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smp/process_test_smp_007.cpp rename to testsuites/unittest/process/basic/process/smp/process_test_smp_007.cpp diff --git a/testsuites/unittest/basic/process/process/smp/process_test_smp_008.cpp b/testsuites/unittest/process/basic/process/smp/process_test_smp_008.cpp similarity index 100% rename from testsuites/unittest/basic/process/process/smp/process_test_smp_008.cpp rename to testsuites/unittest/process/basic/process/smp/process_test_smp_008.cpp diff --git a/testsuites/unittest/basic/process/pthread/config.gni b/testsuites/unittest/process/basic/pthread/config.gni similarity index 52% rename from testsuites/unittest/basic/process/pthread/config.gni rename to testsuites/unittest/process/basic/pthread/config.gni index 44f75ae6..1dbba3eb 100644 --- a/testsuites/unittest/basic/process/pthread/config.gni +++ b/testsuites/unittest/process/basic/pthread/config.gni @@ -28,39 +28,39 @@ import("//kernel/liteos_a/testsuites/unittest/config.gni") -pthread_include_dirs = [ "$TEST_UNITTEST_DIR/basic/process/pthread" ] +pthread_include_dirs = [ "$TEST_UNITTEST_DIR/process/basic/pthread" ] pthread_sources_entry = - [ "$TEST_UNITTEST_DIR/basic/process/pthread/process_pthread_test.cpp" ] + [ "$TEST_UNITTEST_DIR/process/basic/pthread/process_pthread_test.cpp" ] pthread_sources_smoke = [ - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_atfork_test_001.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_atfork_test_002.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_cond_test_001.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_cond_test_002.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_cond_test_003.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_cond_test_004.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_once_test_001.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_003.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_006.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_007.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_008.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_009.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_010.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_011.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_012.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_013.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_015.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_016.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_017.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_018.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/smoke/pthread_test_019.cpp", + "$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", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_cond_test_002.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_cond_test_003.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_cond_test_004.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_once_test_001.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_003.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_006.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_007.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_008.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_009.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_010.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_011.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_012.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_013.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_015.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_016.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_017.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_018.cpp", + "$TEST_UNITTEST_DIR/process/basic/pthread/smoke/pthread_test_019.cpp", ] pthread_sources_full = [ - "$TEST_UNITTEST_DIR/basic/process/pthread/full/pthread_test_001.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/full/pthread_test_002.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/full/pthread_test_004.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/full/pthread_test_005.cpp", - "$TEST_UNITTEST_DIR/basic/process/pthread/full/pthread_test_014.cpp", + "$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", ] diff --git a/testsuites/unittest/basic/process/pthread/full/pthread_test_001.cpp b/testsuites/unittest/process/basic/pthread/full/pthread_test_001.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/full/pthread_test_001.cpp rename to testsuites/unittest/process/basic/pthread/full/pthread_test_001.cpp diff --git a/testsuites/unittest/basic/process/pthread/full/pthread_test_002.cpp b/testsuites/unittest/process/basic/pthread/full/pthread_test_002.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/full/pthread_test_002.cpp rename to testsuites/unittest/process/basic/pthread/full/pthread_test_002.cpp diff --git a/testsuites/unittest/basic/process/pthread/full/pthread_test_004.cpp b/testsuites/unittest/process/basic/pthread/full/pthread_test_004.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/full/pthread_test_004.cpp rename to testsuites/unittest/process/basic/pthread/full/pthread_test_004.cpp diff --git a/testsuites/unittest/basic/process/pthread/full/pthread_test_005.cpp b/testsuites/unittest/process/basic/pthread/full/pthread_test_005.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/full/pthread_test_005.cpp rename to testsuites/unittest/process/basic/pthread/full/pthread_test_005.cpp diff --git a/testsuites/unittest/basic/process/pthread/full/pthread_test_014.cpp b/testsuites/unittest/process/basic/pthread/full/pthread_test_014.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/full/pthread_test_014.cpp rename to testsuites/unittest/process/basic/pthread/full/pthread_test_014.cpp diff --git a/testsuites/unittest/basic/process/pthread/it_pthread_test.h b/testsuites/unittest/process/basic/pthread/it_pthread_test.h similarity index 100% rename from testsuites/unittest/basic/process/pthread/it_pthread_test.h rename to testsuites/unittest/process/basic/pthread/it_pthread_test.h diff --git a/testsuites/unittest/basic/process/pthread/process_pthread_test.cpp b/testsuites/unittest/process/basic/pthread/process_pthread_test.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/process_pthread_test.cpp rename to testsuites/unittest/process/basic/pthread/process_pthread_test.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_atfork_test_001.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_atfork_test_001.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_atfork_test_001.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_atfork_test_001.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_atfork_test_002.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_atfork_test_002.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_atfork_test_002.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_atfork_test_002.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_cond_test_001.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_cond_test_001.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_cond_test_001.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_cond_test_001.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_cond_test_002.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_cond_test_002.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_cond_test_002.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_cond_test_002.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_cond_test_003.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_cond_test_003.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_cond_test_003.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_cond_test_003.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_cond_test_004.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_cond_test_004.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_cond_test_004.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_cond_test_004.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_once_test_001.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_once_test_001.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_once_test_001.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_once_test_001.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_003.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_003.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_003.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_003.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_006.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_006.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_006.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_006.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_007.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_007.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_007.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_007.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_008.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_008.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_008.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_008.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_009.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_009.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_009.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_009.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_010.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_010.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_010.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_010.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_011.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_011.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_011.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_011.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_012.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_012.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_012.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_012.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_013.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_013.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_013.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_013.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_015.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_015.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_015.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_015.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_016.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_016.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_016.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_016.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_017.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_017.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_017.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_017.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_018.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_018.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_018.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_018.cpp diff --git a/testsuites/unittest/basic/process/pthread/smoke/pthread_test_019.cpp b/testsuites/unittest/process/basic/pthread/smoke/pthread_test_019.cpp similarity index 100% rename from testsuites/unittest/basic/process/pthread/smoke/pthread_test_019.cpp rename to testsuites/unittest/process/basic/pthread/smoke/pthread_test_019.cpp diff --git a/testsuites/unittest_old/process/spinlock/BUILD.gn b/testsuites/unittest/process/lock/BUILD.gn similarity index 81% rename from testsuites/unittest_old/process/spinlock/BUILD.gn rename to testsuites/unittest/process/lock/BUILD.gn index 22e2061b..18ada1f3 100644 --- a/testsuites/unittest_old/process/spinlock/BUILD.gn +++ b/testsuites/unittest/process/lock/BUILD.gn @@ -1,5 +1,4 @@ -# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# 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: @@ -28,25 +27,11 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//build/lite/config/test.gni") -import("../../config.gni") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "process_spinlock_test.cpp", -] - -sources_smoke = [ "smoke/pthread_spinlock_test_001.cpp" ] - -sources_full = [] +import("//kernel/liteos_a/testsuites/unittest/config.gni") +import("./config.gni") if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_spinlock_unittest_door") { + unittest("liteos_a_process_lock_unittest_door") { output_extension = "bin" output_dir = "$root_out_dir/test/unittest/kernel" include_dirs = common_include_dirs @@ -60,7 +45,7 @@ if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { } if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_spinlock_unittest") { + unittest("liteos_a_process_lock_unittest") { output_extension = "bin" output_dir = "$root_out_dir/test/unittest/kernel" include_dirs = common_include_dirs diff --git a/testsuites/unittest/process/lock/config.gni b/testsuites/unittest/process/lock/config.gni new file mode 100644 index 00000000..e44ac92f --- /dev/null +++ b/testsuites/unittest/process/lock/config.gni @@ -0,0 +1,66 @@ +# 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 = [] + +# lock module +if (LOSCFG_USER_TEST_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 +} + +if (LOSCFG_USER_TEST_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 +} + +if (LOSCFG_USER_TEST_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 +} diff --git a/testsuites/unittest/process/lock/mutex/config.gni b/testsuites/unittest/process/lock/mutex/config.gni new file mode 100644 index 00000000..641d0399 --- /dev/null +++ b/testsuites/unittest/process/lock/mutex/config.gni @@ -0,0 +1,65 @@ +# 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("//kernel/liteos_a/testsuites/unittest/config.gni") + +mutex_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/mutex" ] + +mutex_sources_entry = + [ "$TEST_UNITTEST_DIR/process/lock/mutex/process_mutex_test.cpp" ] + +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", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_004.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_005.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_006.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_007.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_008.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_009.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_010.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_011.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_012.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_013.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_014.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_015.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_016.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_017.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_019.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_020.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_021.cpp", + "$TEST_UNITTEST_DIR/process/lock/mutex/smoke/pthread_mutex_test_022.cpp", +] + +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", + "$TEST_UNITTEST_DIR/process/lock/mutex/full/pthread_mutex_test_025.cpp", +] diff --git a/testsuites/unittest/basic/process/mutex/full/pthread_mutex_test_018.cpp b/testsuites/unittest/process/lock/mutex/full/pthread_mutex_test_018.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/full/pthread_mutex_test_018.cpp rename to testsuites/unittest/process/lock/mutex/full/pthread_mutex_test_018.cpp diff --git a/testsuites/unittest/basic/process/mutex/full/pthread_mutex_test_023.cpp b/testsuites/unittest/process/lock/mutex/full/pthread_mutex_test_023.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/full/pthread_mutex_test_023.cpp rename to testsuites/unittest/process/lock/mutex/full/pthread_mutex_test_023.cpp diff --git a/testsuites/unittest/basic/process/mutex/full/pthread_mutex_test_024.cpp b/testsuites/unittest/process/lock/mutex/full/pthread_mutex_test_024.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/full/pthread_mutex_test_024.cpp rename to testsuites/unittest/process/lock/mutex/full/pthread_mutex_test_024.cpp diff --git a/testsuites/unittest/basic/process/mutex/full/pthread_mutex_test_025.cpp b/testsuites/unittest/process/lock/mutex/full/pthread_mutex_test_025.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/full/pthread_mutex_test_025.cpp rename to testsuites/unittest/process/lock/mutex/full/pthread_mutex_test_025.cpp diff --git a/testsuites/unittest/basic/process/mutex/it_mutex_test.h b/testsuites/unittest/process/lock/mutex/it_mutex_test.h similarity index 100% rename from testsuites/unittest/basic/process/mutex/it_mutex_test.h rename to testsuites/unittest/process/lock/mutex/it_mutex_test.h diff --git a/testsuites/unittest/basic/process/mutex/process_mutex_test.cpp b/testsuites/unittest/process/lock/mutex/process_mutex_test.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/process_mutex_test.cpp rename to testsuites/unittest/process/lock/mutex/process_mutex_test.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_001.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_001.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_001.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_001.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_002.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_002.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_002.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_002.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_003.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_003.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_003.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_003.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_004.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_004.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_004.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_004.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_005.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_005.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_005.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_005.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_006.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_006.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_006.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_006.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_007.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_007.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_007.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_007.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_008.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_008.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_008.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_008.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_009.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_009.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_009.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_009.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_010.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_010.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_010.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_010.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_011.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_011.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_011.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_011.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_012.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_012.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_012.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_012.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_013.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_013.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_013.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_013.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_014.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_014.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_014.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_014.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_015.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_015.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_015.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_015.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_016.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_016.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_016.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_016.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_017.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_017.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_017.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_017.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_019.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_019.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_019.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_019.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_020.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_020.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_020.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_020.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_021.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_021.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_021.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_021.cpp diff --git a/testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_022.cpp b/testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_022.cpp similarity index 100% rename from testsuites/unittest/basic/process/mutex/smoke/pthread_mutex_test_022.cpp rename to testsuites/unittest/process/lock/mutex/smoke/pthread_mutex_test_022.cpp diff --git a/testsuites/unittest/basic/process/rwlock/config.gni b/testsuites/unittest/process/lock/rwlock/config.gni similarity index 85% rename from testsuites/unittest/basic/process/rwlock/config.gni rename to testsuites/unittest/process/lock/rwlock/config.gni index 9802487b..b34a6053 100644 --- a/testsuites/unittest/basic/process/rwlock/config.gni +++ b/testsuites/unittest/process/lock/rwlock/config.gni @@ -28,15 +28,15 @@ import("//kernel/liteos_a/testsuites/unittest/config.gni") -rwlock_include_dirs = [ "$TEST_UNITTEST_DIR/basic/process/rwlock" ] +rwlock_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/rwlock" ] rwlock_sources_entry = - [ "$TEST_UNITTEST_DIR/basic/process/rwlock/process_rwlock_test.cpp" ] + [ "$TEST_UNITTEST_DIR/process/lock/rwlock/process_rwlock_test.cpp" ] rwlock_sources_smoke = [ - "$TEST_UNITTEST_DIR/basic/process/rwlock/smoke/pthread_rwlock_test_001.cpp", + "$TEST_UNITTEST_DIR/process/lock/rwlock/smoke/pthread_rwlock_test_001.cpp", ] rwlock_sources_full = [ - "$TEST_UNITTEST_DIR/basic/process/rwlock/full/pthread_rwlock_test_002.cpp", + "$TEST_UNITTEST_DIR/process/lock/rwlock/full/pthread_rwlock_test_002.cpp", ] diff --git a/testsuites/unittest/basic/process/rwlock/full/pthread_rwlock_test_002.cpp b/testsuites/unittest/process/lock/rwlock/full/pthread_rwlock_test_002.cpp similarity index 100% rename from testsuites/unittest/basic/process/rwlock/full/pthread_rwlock_test_002.cpp rename to testsuites/unittest/process/lock/rwlock/full/pthread_rwlock_test_002.cpp diff --git a/testsuites/unittest/basic/process/rwlock/it_rwlock_test.h b/testsuites/unittest/process/lock/rwlock/it_rwlock_test.h similarity index 100% rename from testsuites/unittest/basic/process/rwlock/it_rwlock_test.h rename to testsuites/unittest/process/lock/rwlock/it_rwlock_test.h diff --git a/testsuites/unittest/basic/process/rwlock/process_rwlock_test.cpp b/testsuites/unittest/process/lock/rwlock/process_rwlock_test.cpp similarity index 100% rename from testsuites/unittest/basic/process/rwlock/process_rwlock_test.cpp rename to testsuites/unittest/process/lock/rwlock/process_rwlock_test.cpp diff --git a/testsuites/unittest/basic/process/rwlock/smoke/pthread_rwlock_test_001.cpp b/testsuites/unittest/process/lock/rwlock/smoke/pthread_rwlock_test_001.cpp similarity index 100% rename from testsuites/unittest/basic/process/rwlock/smoke/pthread_rwlock_test_001.cpp rename to testsuites/unittest/process/lock/rwlock/smoke/pthread_rwlock_test_001.cpp diff --git a/testsuites/unittest/basic/process/spinlock/config.gni b/testsuites/unittest/process/lock/spinlock/config.gni similarity index 86% rename from testsuites/unittest/basic/process/spinlock/config.gni rename to testsuites/unittest/process/lock/spinlock/config.gni index 48c05fd0..457673be 100644 --- a/testsuites/unittest/basic/process/spinlock/config.gni +++ b/testsuites/unittest/process/lock/spinlock/config.gni @@ -28,11 +28,11 @@ import("//kernel/liteos_a/testsuites/unittest/config.gni") -spinlock_include_dirs = [ "$TEST_UNITTEST_DIR/basic/process/spinlock" ] +spinlock_include_dirs = [ "$TEST_UNITTEST_DIR/process/lock/spinlock" ] spinlock_sources_entry = - [ "$TEST_UNITTEST_DIR/basic/process/spinlock/process_spinlock_test.cpp" ] + [ "$TEST_UNITTEST_DIR/process/lock/spinlock/process_spinlock_test.cpp" ] -spinlock_sources_smoke = [ "$TEST_UNITTEST_DIR/basic/process/spinlock/smoke/pthread_spinlock_test_001.cpp" ] +spinlock_sources_smoke = [ "$TEST_UNITTEST_DIR/process/lock/spinlock/smoke/pthread_spinlock_test_001.cpp" ] spinlock_sources_full = [] diff --git a/testsuites/unittest/basic/process/spinlock/it_spinlock_test.h b/testsuites/unittest/process/lock/spinlock/it_spinlock_test.h similarity index 100% rename from testsuites/unittest/basic/process/spinlock/it_spinlock_test.h rename to testsuites/unittest/process/lock/spinlock/it_spinlock_test.h diff --git a/testsuites/unittest/basic/process/spinlock/process_spinlock_test.cpp b/testsuites/unittest/process/lock/spinlock/process_spinlock_test.cpp similarity index 100% rename from testsuites/unittest/basic/process/spinlock/process_spinlock_test.cpp rename to testsuites/unittest/process/lock/spinlock/process_spinlock_test.cpp diff --git a/testsuites/unittest/basic/process/spinlock/smoke/pthread_spinlock_test_001.cpp b/testsuites/unittest/process/lock/spinlock/smoke/pthread_spinlock_test_001.cpp similarity index 100% rename from testsuites/unittest/basic/process/spinlock/smoke/pthread_spinlock_test_001.cpp rename to testsuites/unittest/process/lock/spinlock/smoke/pthread_spinlock_test_001.cpp diff --git a/testsuites/unittest_old/BUILD.gn b/testsuites/unittest_old/BUILD.gn deleted file mode 100644 index 7ef998ad..00000000 --- a/testsuites/unittest_old/BUILD.gn +++ /dev/null @@ -1,341 +0,0 @@ -# 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("config.gni") - -local_flags = [ - "-fpermissive", - "-O2", - "-fbuiltin", - "-Wno-narrowing", - "-fPIE", - "-Wno-error", -] -if (LOSCFG_USER_TEST_SMP == "enable" || - (LOSCFG_USER_TEST_SMP == "default" && board_name == "hispark_taurus")) { - local_flags += [ "-DLOSCFG_USER_TEST_SMP" ] -} - -config("public_config_for_door") { - cflags = [ "-DLOSCFG_USER_TEST_SMOKE" ] - cflags += local_flags - cflags_cc = cflags -} - -config("public_config_for_all") { - cflags = [ - "-DLOSCFG_USER_TEST_SMOKE", - "-DLOSCFG_USER_TEST_FULL", - ] - cflags += local_flags - cflags_cc = cflags -} - -config("public_config_for_pressure") { - cflags = [ "-DLOSCFG_USER_TEST_PRESSURE" ] - cflags += local_flags - cflags_cc = cflags -} - -group("unittest_old") { - deps = [] - if (ohos_build_type == "debug") { - if (LOSCFG_USER_TEST_FS_JFFS == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "fs:liteos_a_fs_unittest_door_old" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "fs:liteos_a_fs_unittest_old" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) { - deps += [ "fs:liteos_a_fs_unittest_pressure_old" ] - } - } - if (LOSCFG_USER_TEST_FS_VFAT == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "fs/vfat:liteos_a_fs_vfat_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "fs/vfat:liteos_a_fs_vfat_unittest" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) { - deps += [ "fs/vfat:liteos_a_fs_vfat_unittest_pressure" ] - } - } - if (LOSCFG_USER_TEST_FS_PROC == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "fs/proc:liteos_a_fs_procfs_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "fs/proc:liteos_a_fs_procfs_unittest" ] - } - } - if (LOSCFG_USER_TEST_MISC == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "misc:liteos_a_misc_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "misc:liteos_a_misc_unittest" ] - } - } - if (LOSCFG_USER_TEST_DRIVERS_HID == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "drivers/hid:liteos_a_drivers_hid_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "drivers/hid:liteos_a_drivers_hid_unittest" ] - } - } - if (LOSCFG_USER_TEST_DRIVERS_STORAGE == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "drivers/storage:liteos_a_drivers_storage_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "drivers/storage:liteos_a_drivers_storage_unittest" ] - } - } - if (LOSCFG_USER_TEST_DYNLOAD == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "dynload:liteos_a_dynload_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "dynload:liteos_a_dynload_unittest" ] - } - } - if (LOSCFG_USER_TEST_EXC == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "exc:liteos_a_exc_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "exc:liteos_a_exc_unittest" ] - } - } - if (LOSCFG_USER_TEST_IO == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "IO:liteos_a_io_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "IO:liteos_a_io_unittest" ] - } - } - if (LOSCFG_USER_TEST_IPC == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "IPC:liteos_a_ipc_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "IPC:liteos_a_ipc_unittest" ] - } - } - if (LOSCFG_USER_TEST_LITEIPC == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "liteipc:liteos_a_liteipc_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "liteipc:liteos_a_liteipc_unittest" ] - } - } - if (LOSCFG_USER_TEST_MEM_SHM == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "mem/shm:liteos_a_mem_shm_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "mem/shm:liteos_a_mem_shm_unittest" ] - } - } - if (LOSCFG_USER_TEST_MEM_VM == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "mem/vm:liteos_a_mem_vm_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "mem/vm:liteos_a_mem_vm_unittest" ] - } - } - if (LOSCFG_USER_TEST_NET_NETDB == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "net/netdb:liteos_a_net_netdb_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "net/netdb:liteos_a_net_netdb_unittest" ] - } - } - if (LOSCFG_USER_TEST_NET_RESOLV == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "net/resolv:liteos_a_net_resolv_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "net/resolv:liteos_a_net_resolv_unittest" ] - } - } - if (LOSCFG_USER_TEST_NET_SOCKET == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "net/socket:liteos_a_net_socket_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "net/socket:liteos_a_net_socket_unittest" ] - } - } - if (LOSCFG_USER_TEST_POSIX_MEM == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "posix/mem:liteos_a_posix_mem_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "posix/mem:liteos_a_posix_mem_unittest" ] - } - } - if (LOSCFG_USER_TEST_POSIX_MQUEUE == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "posix/mqueue:liteos_a_posix_mqueue_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "posix/mqueue:liteos_a_posix_mqueue_unittest" ] - } - } - if (LOSCFG_USER_TEST_POSIX_PTHREAD == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "posix/pthread:liteos_a_posix_pthread_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "posix/pthread:liteos_a_posix_pthread_unittest" ] - } - } - if (LOSCFG_USER_TEST_MUTEX == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "process/mutex:liteos_a_mutex_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "process/mutex:liteos_a_mutex_unittest" ] - } - } - if (LOSCFG_USER_TEST_PROCESS == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "process/process:liteos_a_process_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "process/process:liteos_a_process_unittest" ] - } - } - if (LOSCFG_USER_TEST_PTHREAD == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "process/pthread:liteos_a_pthread_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "process/pthread:liteos_a_pthread_unittest" ] - } - } - if (LOSCFG_USER_TEST_RWLOCK == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "process/rwlock:liteos_a_rwlock_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "process/rwlock:liteos_a_rwlock_unittest" ] - } - } - if (LOSCFG_USER_TEST_SPINLOCK == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "process/spinlock:liteos_a_spinlock_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "process/spinlock:liteos_a_spinlock_unittest" ] - } - } - if (LOSCFG_USER_TEST_SECURITY_REUGID == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "security/reugid:liteos_a_security_reugid_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "security/reugid:liteos_a_security_reugid_unittest" ] - } - } - if (LOSCFG_USER_TEST_SECURITY_CAPABILITY == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += - [ "security/capability:liteos_a_security_capability_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "security/capability:liteos_a_security_capability_unittest" ] - } - } - if (LOSCFG_USER_TEST_SECURITY_VID == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "security/vid:liteos_a_security_vid_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "security/vid:liteos_a_security_vid_unittest" ] - } - } - if (LOSCFG_USER_TEST_UTIL == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "util:liteos_a_util_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "util:liteos_a_util_unittest" ] - } - } - if (LOSCFG_USER_TEST_TIME_TIMER == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "time/timer:liteos_a_time_timer_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "time/timer:liteos_a_time_timer_unittest" ] - } - } - if (LOSCFG_USER_TEST_TIME_CLOCK == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "time/clock:liteos_a_time_clock_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "time/clock:liteos_a_time_clock_unittest" ] - } - } - if (LOSCFG_USER_TEST_SYS == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "sys:liteos_a_sys_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "sys:liteos_a_sys_unittest" ] - } - } - if (LOSCFG_USER_TEST_SIGNAL == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "signal:liteos_a_signal_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "signal:liteos_a_signal_unittest" ] - } - } - if (LOSCFG_USER_TEST_TRACE == true) { - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - deps += [ "trace:liteos_a_trace_unittest_door" ] - } - if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - deps += [ "trace:liteos_a_trace_unittest" ] - } - } - } -} diff --git a/testsuites/unittest_old/IO/BUILD.gn b/testsuites/unittest_old/IO/BUILD.gn deleted file mode 100644 index 0fafbf09..00000000 --- a/testsuites/unittest_old/IO/BUILD.gn +++ /dev/null @@ -1,120 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../common/include", - "../IO", -] - -sources_entry = [ - "../common/osTest.cpp", - "io_test.cpp", -] - -sources_smoke = [ - "smoke/IO_test_005.cpp", - "smoke/IO_test_008.cpp", - "smoke/IO_test_010.cpp", - "smoke/IO_test_013.cpp", -] - -sources_full = [ - "full/IO_test_confstr_001.cpp", - "full/IO_test_dcgettext_001.cpp", - "full/IO_test_dcgettext_002.cpp", - "full/IO_test_dcngettext_001.cpp", - "full/IO_test_dcngettext_002.cpp", - "full/IO_test_dngettext_001.cpp", - "full/IO_test_dngettext_002.cpp", - "full/IO_test_duplocale_001.cpp", - "full/IO_test_locale_001.cpp", - "full/IO_test_locale_002.cpp", - "full/IO_test_ngettext_001.cpp", - "full/IO_test_nl_langinfo_001.cpp", - "full/IO_test_nl_langinfo_l_001.cpp", - "full/IO_test_strcasecmp_l_001.cpp", - "full/IO_test_strcasecmp_l_002.cpp", - "full/IO_test_strfmon_l_001.cpp", - "full/IO_test_strfmon_l_002.cpp", - "full/It_locale_localeconv_001.cpp", - "full/It_stdio_fputws_001.cpp", - "full/It_stdio_fwprintf_001.cpp", - "full/It_stdio_getc_unlocked_001.cpp", - "full/It_stdio_hasmntopt_001.cpp", - "full/It_stdio_mblen_001.cpp", - "full/It_stdio_mbrlen_001.cpp", - "full/It_stdio_putwc_001.cpp", - "full/It_stdio_readv_001.cpp", - "full/It_stdio_rindex_001.cpp", - "full/It_stdio_setlogmask_001.cpp", - "full/It_stdlib_gcvt_001.cpp", - "full/It_stdlib_poll_002.cpp", - "full/It_stdlib_poll_003.cpp", - "full/IO_test_gettext_001.cpp", - "full/IO_test_strncasecmp_l_001.cpp", - "full/IO_test_strncasecmp_l_002.cpp", - "full/IO_test_ppoll_001.cpp", - "full/IO_test_ppoll_002.cpp", - "full/IO_test_ppoll_003.cpp", - "full/IO_test_pselect_001.cpp", - "full/IO_test_pselect_002.cpp", - "full/IO_test_epoll_001.cpp", - "full/IO_test_epoll_002.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_io_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_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" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} diff --git a/testsuites/unittest_old/IO/It_test_IO.h b/testsuites/unittest_old/IO/It_test_IO.h deleted file mode 100644 index 422531de..00000000 --- a/testsuites/unittest_old/IO/It_test_IO.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_IO_H -#define _IT_TEST_IO_H - -#include "osTest.h" -#include "stdio.h" -#include "stdlib.h" -#include "unistd.h" -#include "string.h" -#include "termios.h" -#include "sys/types.h" -#include "sys/stat.h" -#include "fcntl.h" -#include "locale.h" -#include "wctype.h" -#include "wchar.h" -#include "stdarg.h" -#include "semaphore.h" -#include "ftw.h" -#include "aio.h" -#include "shadow.h" -#include "pty.h" -#include "dirent.h" -#include "poll.h" -#include "grp.h" -#include "pwd.h" -#include "sys/uio.h" -#include "syslog.h" -#include "sys/epoll.h" - -extern int CloseRmAllFile(int fd[], char filePathName[][50], int cnt); -extern char *g_ioTestPath; - -extern VOID ItTestIo001(VOID); -extern VOID ItTestIo002(VOID); -extern VOID ItTestIo003(VOID); -extern VOID ItTestIo004(VOID); -extern VOID ItTestIo005(VOID); -extern VOID ItTestIo006(VOID); -extern VOID ItTestIo007(VOID); -extern VOID ItTestIo008(VOID); -extern VOID ItTestIo009(VOID); -extern VOID ItTestIo010(VOID); -extern VOID ItTestIo011(VOID); -extern VOID ItTestIo012(VOID); -extern VOID ItTestIo013(VOID); - -extern VOID ItLocaleFreelocale001(void); -extern VOID ItLocaleLocaleconv001(void); -extern VOID ItStdioFputws001(void); -extern VOID ItStdioFwprintf001(void); -extern VOID ItStdioFtruncate001(void); -extern VOID ItStdioFtw001(void); -extern VOID ItStdlibOpenpty001(void); -extern VOID ItStdlibPtsname001(void); -extern VOID ItStdioGetcUnlocked001(void); -extern VOID ItStdioGetcharUnlocked001(void); -extern VOID ItStdioGetw001(void); -extern VOID ItStdioGetwchar001(void); -extern VOID ItStdioLioListio001(void); // linux erro -extern VOID ItStdioMblen001(void); -extern VOID ItStdioMbrlen001(void); -extern VOID ItStdioMbstowcs001(void); -extern VOID ItStdioMbsnrtowcs001(void); -extern VOID ItStdioPutcUnlocked001(void); -extern VOID ItStdioPutcharUnlocked001(void); -extern VOID ItStdioPutgrent001(void); -extern VOID ItStdioPutpwent001(void); -extern VOID ItStdioPutspent001(void); -extern VOID ItStdioPutwc001(void); -extern VOID ItStdioPutwchar001(void); -extern VOID ItStdioReadv001(void); -extern VOID ItStdioRindex001(void); -extern VOID ItStdioSelect002(void); -extern VOID ItStdioSetgrent001(void); -extern VOID ItStdioSetlogmask001(void); -extern VOID ItStdioSetmntent001(void); -extern VOID ItStdlibGcvt001(void); -extern VOID ItStdlibOpenpty001(void); -extern VOID ItStdlibPoll001(void); -extern VOID ItStdlibPoll002(void); -extern VOID ItStdlibPoll003(void); -extern VOID ItStdlibPtsname001(void); -extern VOID IT_STDIO_HASMNTOPT_001(void); -extern VOID IO_TEST_NGETTEXT_001(void); -extern VOID IO_TEST_EPOLL_001(void); -extern VOID IO_TEST_LOCALE_001(void); -extern VOID IO_TEST_LOCALE_002(void); -extern VOID IO_TEST_CONFSTR_001(void); -extern VOID IO_TEST_NL_LANGINFO_001(VOID); -extern VOID IO_TEST_STRCASECMP_L_001(VOID); -extern VOID IO_TEST_STRCASECMP_L_002(VOID); -extern VOID IO_TEST_STRNCASECMP_L_001(VOID); -extern VOID IO_TEST_STRNCASECMP_L_002(VOID); -extern VOID IO_TEST_DUPLOCALE_001(void); -extern VOID IO_TEST_NL_LANGINFO_l_001(VOID); -extern VOID IO_TEST_DNGETTEXT_001(VOID); -extern VOID IO_TEST_DNGETTEXT_002(VOID); -extern VOID IO_TEST_DCNGETTEXT_001(VOID); -extern VOID IO_TEST_DCNGETTEXT_002(VOID); -extern VOID IO_TEST_DCGETTEXT_001(VOID); -extern VOID IO_TEST_DCGETTEXT_002(VOID); -extern VOID IO_TEST_GETTEXT_001(VOID); -extern VOID IO_TEST_PSELECT_001(void); -extern VOID IO_TEST_PSELECT_002(void); -extern VOID IO_TEST_STRFMON_L_001(VOID); -extern VOID IO_TEST_STRFMON_L_002(VOID); -extern VOID IO_TEST_PPOLL_001(VOID); -extern VOID IO_TEST_PPOLL_002(VOID); -extern VOID IO_TEST_PPOLL_003(VOID); -extern VOID IO_TEST_EPOLL_001(VOID); -extern VOID IO_TEST_EPOLL_002(VOID); - -#endif diff --git a/testsuites/unittest_old/IO/full/IO_test_confstr_001.cpp b/testsuites/unittest_old/IO/full/IO_test_confstr_001.cpp deleted file mode 100644 index ee364b4c..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_confstr_001.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - -static UINT32 testcase(VOID) -{ - char *pathbuf = nullptr; - char *gun_libpthread_version_buf = nullptr; - char *gun_libc_version_buf = nullptr; - size_t n = 0; - - n = confstr(_CS_PATH, NULL, (size_t) 0); - ICUNIT_ASSERT_WITHIN_EQUAL(n, 0, UINT_MAX, n); - pathbuf = (char *)malloc(n); - if (pathbuf == NULL) { - return LOS_NOK; - } - confstr(_CS_PATH, pathbuf, n); - ICUNIT_ASSERT_NOT_EQUAL_NULL(pathbuf, NULL, -1); - free(pathbuf); - pathbuf = NULL; - - n = confstr(_CS_GNU_LIBPTHREAD_VERSION, NULL, (size_t) 0); - ICUNIT_ASSERT_WITHIN_EQUAL(n, 0, UINT_MAX, n); - if (n > 0) { - gun_libpthread_version_buf = (char *)malloc(n); - } - if (gun_libpthread_version_buf == NULL) { - return LOS_NOK; - } - confstr(_CS_GNU_LIBPTHREAD_VERSION, gun_libpthread_version_buf, n); - ICUNIT_ASSERT_NOT_EQUAL_NULL(gun_libpthread_version_buf, NULL, -1); - free(gun_libpthread_version_buf); - gun_libpthread_version_buf = NULL; - - n = confstr(_CS_GNU_LIBC_VERSION, NULL, (size_t) 0); - ICUNIT_ASSERT_WITHIN_EQUAL(n, 0, UINT_MAX, n); - if (n > 0) { - gun_libc_version_buf = (char *)malloc(n); - } - if (gun_libc_version_buf == NULL) { - return LOS_NOK; - } - confstr(_CS_GNU_LIBC_VERSION, gun_libc_version_buf, n); - ICUNIT_ASSERT_NOT_EQUAL_NULL(gun_libc_version_buf, NULL, -1); - free(gun_libc_version_buf); - gun_libc_version_buf = NULL; - - return LOS_OK; -} - -VOID IO_TEST_CONFSTR_001(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_dcgettext_001.cpp b/testsuites/unittest_old/IO/full/IO_test_dcgettext_001.cpp deleted file mode 100644 index e51a27ad..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_dcgettext_001.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include - -static UINT32 testcase(VOID) -{ - char *s = ""; - - setlocale(LC_ALL, ""); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - printf(dcgettext("www.huawei.com", "TestString1\n", LC_MESSAGES)); - - s = dcgettext("www.huawei.com", "TestString1\n", LC_MESSAGES); - printf("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString1\n", s); - - return LOS_OK; -} - -VOID IO_TEST_DCGETTEXT_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_dcgettext_002.cpp b/testsuites/unittest_old/IO/full/IO_test_dcgettext_002.cpp deleted file mode 100644 index 8ffb46b8..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_dcgettext_002.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include - -static UINT32 testcase1(VOID) -{ - char *s = ""; - - setlocale(LC_ALL, ""); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - errno = 0; - s = dcgettext("www.huawei.com", "TestString1\n", LC_MESSAGES); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_GOTO_STRING_EQUAL(s, "TestString1\n", -1, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase2(VOID) -{ - char *s = ""; - - setlocale(LC_ALL, ""); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - errno = 0; - s = dcgettext(nullptr, "Hello World!\n", LC_MESSAGES); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_GOTO_STRING_EQUAL(s, "Hello World!\n", -1, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase3(VOID) -{ - char *s = ""; - char *domain = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\ -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\ -12345678901234567890123456789012345678901234567890123456"; - char *string = "Domain is NAME_MAX+1 256 characters long!\n"; - - setlocale(LC_ALL, ""); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - errno = 0; - s = dcgettext(domain, string, LC_MESSAGES); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_GOTO_STRING_EQUAL(s, string, -1, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase4(VOID) -{ - char *s = ""; - char *domain = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\ -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\ -123456789012345678901234567890123456789012345678901234567"; - char *string = "Domain is more than NAME_MAX+1(256) 257 characters long!\n"; - - setlocale(LC_ALL, ""); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - errno = 0; - s = dcgettext(domain, string, LC_MESSAGES); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_GOTO_STRING_EQUAL(s, string, -1, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} -static UINT32 testcase(VOID) -{ - errno = 0; - - testcase1(); - testcase2(); - testcase3(); - testcase4(); - - return LOS_OK; -} - -VOID IO_TEST_DCGETTEXT_002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_dcngettext_001.cpp b/testsuites/unittest_old/IO/full/IO_test_dcngettext_001.cpp deleted file mode 100644 index 5d9ee5ef..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_dcngettext_001.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include - -static UINT32 testcase(VOID) -{ - char *s = ""; - - setlocale(LC_ALL, ""); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - printf(dcngettext("www.huawei.com", "TestString1\n", "TestString2\n", 1, LC_MESSAGES)); - printf(dcngettext("www.huawei.com", "TestString1\n", "TestString2\n", 2, LC_MESSAGES)); - - s = dcngettext("www.huawei.com", "TestString1\n", "TestString2\n", 1, LC_MESSAGES); - printf("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString1\n", s); - - s = dcngettext("www.huawei.com", "TestString1\n", "TestString2\n", 2, LC_MESSAGES); - printf("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString2\n", s); - - return LOS_OK; -} - -VOID IO_TEST_DCNGETTEXT_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_dcngettext_002.cpp b/testsuites/unittest_old/IO/full/IO_test_dcngettext_002.cpp deleted file mode 100644 index 4253cb43..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_dcngettext_002.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include - -static UINT32 testcase1(VOID) -{ - char *s = ""; - - setlocale(LC_ALL, "zh_CN.UTF-8"); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - errno = 0; - s = dcngettext("", "TestString1:Hello world!\n", "TestString2\n", 1, LC_MESSAGES); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString1:Hello world!\n", s); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - errno = 0; - s = dcngettext("", "TestString1\n", "TestString2:Hello world!\n", 2, LC_MESSAGES); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString2:Hello world!\n", s); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase2(VOID) -{ - char *s = ""; - - setlocale(LC_ALL, "zh_CN.UTF-8"); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - errno = 0; - s = dcngettext("en_US.UTF-8", "TestString1:Hello world!\n", "TestString2:Hello world!\n", 1, LC_MESSAGES); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString1:Hello world!\n", s); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - errno = 0; - s = dcngettext("en_US.UTF-8", "TestString1\n", "TestString2:Hello world!\n", 2, LC_MESSAGES); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString2:Hello world!\n", s); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); - testcase2(); - - return LOS_OK; -} - -VOID IO_TEST_DCNGETTEXT_002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_dngettext_001.cpp b/testsuites/unittest_old/IO/full/IO_test_dngettext_001.cpp deleted file mode 100644 index dea72b5f..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_dngettext_001.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include - -static UINT32 testcase(VOID) -{ - char *s = ""; - - setlocale(LC_ALL, ""); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - printf(dngettext("www.huawei.com", "TestString1\n", "TestString2\n", 1)); - printf(dngettext("www.huawei.com", "TestString1\n", "TestString2\n", 2)); - - s = dngettext("www.huawei.com", "TestString1\n", "TestString2\n", 1); - printf("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString1\n", s); - - s = dngettext("www.huawei.com", "TestString1\n", "TestString2\n", 2); - printf("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString2\n", s); - - return LOS_OK; -} - -VOID IO_TEST_DNGETTEXT_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_dngettext_002.cpp b/testsuites/unittest_old/IO/full/IO_test_dngettext_002.cpp deleted file mode 100644 index 0e6753de..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_dngettext_002.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include - -static UINT32 testcase1(VOID) -{ - char *s = ""; - - setlocale(LC_ALL, "zh_CN.UTF-8"); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - errno = 0; - s = dngettext("", "TestString1:Hello world!\n", "TestString2\n", 1); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString1:Hello world!\n", s); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - errno = 0; - s = dngettext("", "TestString1\n", "TestString2:Hello world!\n", 2); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString2:Hello world!\n", s); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase2(VOID) -{ - char *s = ""; - - setlocale(LC_ALL, "zh_CN.UTF-8"); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - errno = 0; - s = dngettext("en_US.UTF-8", "TestString1:Hello world!\n", "TestString2\n", 1); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString1:Hello world!\n", s); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - errno = 0; - s = dngettext("en_US.UTF-8", "TestString1\n", "TestString2:Hello world!\n", 2); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_ASSERT_STRING_EQUAL(s, "TestString2:Hello world!\n", s); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase3(VOID) -{ - char *s = ""; - - setlocale(LC_ALL, "zh_CN.UTF-8"); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - errno = 0; - s = dngettext("en_US.UTF-8", "TestString1:Hello world!\n", "TestString2!\n", 5); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_GOTO_STRING_EQUAL(s, "TestString2!\n", -1, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - errno = 0; - s = dngettext("en_US.UTF-8", "TestString1\n", "TestString2:Hello world!\n", 3); - TEST_PRINT("[INFO]%s:%d,%s,s=%s\n", __FILE__, __LINE__, __func__, s); - TEST_PRINT("[INFO]%s:%d,%s,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, errno, strerror(errno)); - ICUNIT_GOTO_STRING_EQUAL(s, "TestString2:Hello world!\n", -1, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); /* test the domain is NULL */ - testcase2(); /* test the domain is different with the setlocale */ - testcase3(); /* if n != 1,then dngettext will choose msgid2's string */ - - return LOS_OK; -} - -VOID IO_TEST_DNGETTEXT_002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_duplocale_001.cpp b/testsuites/unittest_old/IO/full/IO_test_duplocale_001.cpp deleted file mode 100644 index 85157281..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_duplocale_001.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include "It_test_IO.h" - -/* Zh_cn.utf-8 File content */ -int fileWords[] = { - 0x950412de, 0x0, 0x3, 0x1c, 0x34, 0x5, - 0x4c, 0x0, 0x60, 0x3, 0x61, 0x3, - 0x65, 0x14f, 0x69, 0x9, 0x1b9, 0x6, - 0x1c3, 0x1, 0x3, 0x0, 0x0, 0x2, - 0x69724600, 0x6e614a00, 0x6f725000, 0x7463656a, 0x2d64492d, 0x73726556, - 0x3a6e6f69, 0x6d695620, 0x6d695328, 0x66696c70, 0x20646569, 0x6e696843, - 0x29657365, 0x7065520a, 0x2d74726f, 0x6967734d, 0x75422d64, 0x542d7367, - 0xa203a6f, 0x522d4f50, 0x73697665, 0x2d6e6f69, 0x65746144, 0x3032203a, - 0x302d3630, 0x31322d34, 0x3a343120, 0x302b3030, 0xa303038, 0x7473614c, - 0x6172542d, 0x616c736e, 0x3a726f74, 0x68755920, 0x20676e65, 0xa656958, - 0x676e614c, 0x65676175, 0x6165542d, 0x53203a6d, 0x6c706d69, 0x65696669, - 0x68432064, 0x73656e69, 0x494d0a65, 0x562d454d, 0x69737265, 0x203a6e6f, - 0xa302e31, 0x746e6f43, 0x2d746e65, 0x65707954, 0x6574203a, 0x702f7478, - 0x6e69616c, 0x6863203b, 0x65737261, 0x54553d74, 0xa382d46, 0x746e6f43, - 0x2d746e65, 0x6e617254, 0x72656673, 0x636e452d, 0x6e69646f, 0x38203a67, - 0xa746962, 0x72756c50, 0x462d6c61, 0x736d726f, 0x706e203a, 0x6172756c, - 0x313d736c, 0x6c70203b, 0x6c617275, 0xa3b303d, 0x676e614c, 0x65676175, - 0x687a203a, 0xa4e435f, 0x65472d58, 0x6172656e, 0x3a726f74, 0x656f5020, - 0x20746964, 0xa302e33, 0x9f98e600, 0xe49f9ce6, 0xe40094ba, 0x9ce680b8, - 0x88 -}; - -UINT32 SonFunc(VOID) -{ - int ret; - struct tm timer_; - struct tm *timer = &timer_; - char buffer[80]; /* 80, The number of characters returned by strftime */ - char *retptr = nullptr; - - /* set timer as 'Thu Jan 1 23:48:56 1970'" */ - timer->tm_sec = 32; /* 32, example */ - timer->tm_min = 3; /* 3, example */ - timer->tm_hour = 1; - timer->tm_mday = 2; - timer->tm_mon = 0; - timer->tm_year = 70; /* 70, example */ - timer->tm_wday = 5; /* 5, example */ - timer->tm_yday = 1; - timer->tm_isdst = 0; - timer->__tm_gmtoff = 0; - timer->__tm_zone = nullptr; - - ret = setenv("MUSL_LOCPATH", "/storage", 1); - ICUNIT_ASSERT_EQUAL(ret, 0, -1); - retptr = getenv("MUSL_LOCPATH"); - ICUNIT_ASSERT_NOT_EQUAL(retptr, NULL, -1); - ICUNIT_ASSERT_STRING_EQUAL(retptr, "/storage", -1); - - retptr = setlocale(LC_TIME, "en_US.UTF-8"); - ICUNIT_ASSERT_NOT_EQUAL(retptr, NULL, -1); - ICUNIT_ASSERT_STRING_EQUAL(retptr, "en_US.UTF-8", -1); - - ret = strftime(buffer, 80, "%c", timer); /* 80, The maximum number of characters in the string str */ - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, -1); - ICUNIT_ASSERT_STRING_EQUAL(buffer, "Fri Jan 2 01:03:32 1970", -1); - - retptr = setlocale(LC_TIME, "zh_CN.UTF-8"); - ICUNIT_ASSERT_NOT_EQUAL(retptr, NULL, -1); - ICUNIT_ASSERT_STRING_EQUAL(retptr, "zh_CN.UTF-8", -1); - - ret = strftime(buffer, 80, "%c", timer); /* 80, The maximum number of characters in the string str */ - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, -1); - ICUNIT_ASSERT_STRING_EQUAL(buffer, "星期五 一月 2 01:03:32 1970", -1); - - retptr = setlocale(LC_TIME, ""); - ICUNIT_ASSERT_NOT_EQUAL(retptr, NULL, -1); - ICUNIT_ASSERT_STRING_EQUAL(retptr, "C", -1); - - ret = strftime(buffer, 80, "%c", timer); /* 80, The maximum number of characters in the string str */ - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, -1); - ICUNIT_ASSERT_STRING_EQUAL(buffer, "Fri Jan 2 01:03:32 1970", -1); - - return 0; -} - -static UINT32 testcase(VOID) -{ - int ret, status; - locale_t oldloc = LC_GLOBAL_LOCALE; - locale_t newloc = nullptr; - - char *pathList[] = {"/storage/zh_CN.UTF-8"}; - char *streamList[] = {(char *)fileWords}; - int streamLen[] = {sizeof(fileWords) - 2}; - - newloc = duplocale(oldloc); - ICUNIT_ASSERT_NOT_EQUAL(newloc, nullptr, -1); - free(newloc); - - ret = PrepareFileEnv(pathList, streamList, streamLen, 1); - if (ret != 0) { - printf("error: need some env file, but prepare is not ok"); - (VOID)RecoveryFileEnv(pathList, 1); - return -1; - } - - pid_t pid = fork(); - if (pid == 0) { - ret = SonFunc(); - exit(ret); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - (VOID)RecoveryFileEnv(pathList, 1); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 0, status); - - return LOS_OK; -} - -VOID IO_TEST_DUPLOCALE_001(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_epoll_001.cpp b/testsuites/unittest_old/IO/full/IO_test_epoll_001.cpp deleted file mode 100644 index ecdca93a..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_epoll_001.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ - -#include "It_test_IO.h" -#include -#include "signal.h" -#include "pthread.h" -#include -#include -#include - -static UINT32 testcase(VOID) -{ - fd_set rfds; - int retval; - pid_t pid; - int pipeFd[2]; /* 2, pipe id num */ - char buffer[40]; /* 40, buffer size */ - int i = 0; - int status; - - int epFd; - sigset_t mask; - struct epoll_event ev; - struct epoll_event evWait[2]; /* 2, evs num */ - - retval = pipe(pipeFd); - ICUNIT_GOTO_EQUAL(retval, 0, retval, OUT); - - /* Watch fd to see when it has input. */ - FD_ZERO(&rfds); - FD_SET(pipeFd[0], &rfds); - - /* Wait up to three seconds. */ - epFd = epoll_create1(100); /* 100, cretae input, */ - ICUNIT_GOTO_NOT_EQUAL(epFd, -1, epFd, OUT); - - ev.events = EPOLLIN | EPOLLOUT | EPOLLRDNORM | EPOLLWRNORM; - retval = epoll_ctl(epFd, EPOLL_CTL_ADD, pipeFd[0], &ev); - ICUNIT_GOTO_NOT_EQUAL(retval, -1, retval, OUT); - - pid = fork(); - if (pid == 0) { - close(pipeFd[1]); - - memset(evWait, 0, sizeof(struct epoll_event) * 2); /* 2, evs num */ - retval = epoll_wait(epFd, evWait, 2, 3000); /* 2, num of wait fd. 3000, wait time */ - close(pipeFd[0]); - - if (retval) { - exit(LOS_OK); - } else { - exit(LOS_NOK); - } - } else { - sleep(1); - close(pipeFd[0]); - retval = write(pipeFd[1], "0123456789012345678901234567890123456789", 40); /* write 40 bytes to stdin(fd 0) */ - ICUNIT_GOTO_EQUAL(retval, 40, retval, OUT); - close(pipeFd[1]); - - wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, LOS_OK, status); - } - - return LOS_OK; -OUT: - close(pipeFd[0]); - close(pipeFd[1]); - close(epFd); - return LOS_NOK; -} - - -VOID IO_TEST_EPOLL_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_epoll_002.cpp b/testsuites/unittest_old/IO/full/IO_test_epoll_002.cpp deleted file mode 100644 index 8b54bdcd..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_epoll_002.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ - -#include "It_test_IO.h" -#include -#include "signal.h" -#include "pthread.h" -#include -#include -#include - -static void SigPrint(int sig) -{ - return; -} - -static UINT32 testcase(VOID) -{ - fd_set rfds; - struct timespec tv; - int retval; - pid_t pid; - int pipeFd[2]; /* 2, pipe id num */ - char buffer[40]; /* 40, buffer size */ - int i = 0; - int status; - - int epFd; - sigset_t mask; - void (*retSig)(int); - struct epoll_event ev; - struct epoll_event evWait[2]; - - retSig = signal(SIGALRM, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - - retSig = signal(SIGUSR1, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - - retval = sigemptyset(&mask); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - - retval = sigaddset(&mask, SIGALRM); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - - retval = sigaddset(&mask, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - - retval = pipe(pipeFd); - ICUNIT_GOTO_EQUAL(retval, 0, retval, OUT); - - /* Watch fd to see when it has input. */ - FD_ZERO(&rfds); - FD_SET(pipeFd[0], &rfds); - - /* Wait up to three seconds. */ - tv.tv_sec = 3; /* 3, wait timer, second */ - tv.tv_nsec = 5; /* 5, wait timer, nano second */ - - epFd = epoll_create1(100); /* 100, cretae input, */ - ICUNIT_GOTO_NOT_EQUAL(epFd, -1, epFd, OUT); - - ev.events = EPOLLRDNORM; - retval = epoll_ctl(epFd, EPOLL_CTL_ADD, pipeFd[0], &ev); - - ICUNIT_GOTO_NOT_EQUAL(retval, -1, retval, OUT); - - pid = fork(); - if (pid == 0) { - close(pipeFd[1]); - - memset(evWait, 0, sizeof(struct epoll_event) * 2); /* 2, evs num */ - evWait[0].data.fd = pipeFd[0]; - - retval = epoll_pwait(epFd, evWait, 2, 3000, &mask); /* 2, num of wait fd. 3000, wait time */ - close(pipeFd[0]); - - if (retval) { - exit(LOS_OK); - } else { - exit(LOS_NOK); - } - } else { - sleep(1); - close(pipeFd[0]); - - retval = kill(pid, SIGALRM); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - - retval = kill(pid, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - close(pipeFd[1]); - - wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, LOS_OK, status); - } - - return LOS_OK; -OUT: - close(pipeFd[0]); - close(pipeFd[1]); - close(epFd); - return LOS_NOK; -} - - -VOID IO_TEST_EPOLL_002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_gettext_001.cpp b/testsuites/unittest_old/IO/full/IO_test_gettext_001.cpp deleted file mode 100644 index fb3c91d0..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_gettext_001.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include - -static UINT32 testcase1(VOID) -{ - char *s = nullptr; - char *tmp = nullptr; - - /* set the locale. */ - setlocale(LC_ALL, "zh_CN.UTF-8"); - setenv("MUSL_LOCPATH", "/storage", 1); - TEST_PRINT("[INFO]%s:%d,%s,getenv MUSL_LOCPATH=%s\n", __FILE__, __LINE__, __func__, getenv("MUSL_LOCPATH")); - tmp = setlocale(LC_TIME, "zh_CN.UTF-8"); - TEST_PRINT("[INFO]%s:%d,%s,Locale is: %s\n", __FILE__, __LINE__, __func__, tmp); - ICUNIT_GOTO_STRING_EQUAL(tmp, "zh_CN.UTF-8", -1, OUT); - - /* choose a domain for your program. */ - tmp = textdomain("messages"); - /* bind a directory,use PWD here. */ - bindtextdomain("messages", "."); - /* set the output codeset.It is not needed usually */ - bind_textdomain_codeset("messages", "UTF-8"); - - /* test gettext. */ - s = gettext("Monday/n\n"); - - ICUNIT_ASSERT_STRING_EQUAL(s, "Monday/n\n", s); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); - - return LOS_OK; -} - -VOID IO_TEST_GETTEXT_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_locale_001.cpp b/testsuites/unittest_old/IO/full/IO_test_locale_001.cpp deleted file mode 100644 index 4282ce17..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_locale_001.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include - -static UINT32 testcase(VOID) -{ - time_t currtime; - struct tm *timer = {nullptr}; - char buffer[80]; - - time(&currtime); - timer = localtime(&currtime); - - setenv("MUSL_LOCPATH", "/storage", 1); - printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH")); - - printf("Locale is: %s\n", setlocale(LC_TIME, "en_US.UTF-8")); - strftime(buffer, 80, "%c", timer); - printf("Date is: %s\n", buffer); - ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); - - printf("Locale is: %s\n", setlocale(LC_TIME, "zh_CN.UTF-8")); - strftime(buffer, 80, "%c", timer); - printf("Date is: %s\n", buffer); - ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); - - printf("Locale is: %s\n", setlocale(LC_TIME, "")); - strftime(buffer, 80, "%c", timer); - printf("Date is: %s\n", buffer); - ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); - - return LOS_OK; -} - -VOID IO_TEST_LOCALE_001(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_locale_002.cpp b/testsuites/unittest_old/IO/full/IO_test_locale_002.cpp deleted file mode 100644 index 000508d2..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_locale_002.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include - -static UINT32 testcase(VOID) -{ - time_t currtime; - struct tm *timer = {nullptr}; - char buffer[80]; - //locale_t loc = malloc(sizeof(locale_t); - - time(&currtime); - timer = localtime(&currtime); - - setenv("MUSL_LOCPATH", "/storage", 1); - printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH")); - - printf("Locale is: %s\n", setlocale(LC_TIME, "en_US.UTF-8")); - strftime(buffer, 80, "%c", timer); - printf("Date is: %s\n", buffer); - ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); - - printf("Locale is: %s\n", setlocale(LC_TIME, "zh_CN.UTF-8")); - strftime(buffer, 80, "%c", timer); - printf("Date is: %s\n", buffer); - ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); - - printf("Locale is: %s\n", setlocale(LC_TIME, "")); - strftime(buffer, 80, "%c", timer); - printf("Date is: %s\n", buffer); - ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1); - - return LOS_OK; -} - -VOID IO_TEST_LOCALE_002(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_ngettext_001.cpp b/testsuites/unittest_old/IO/full/IO_test_ngettext_001.cpp deleted file mode 100644 index 18f3858b..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_ngettext_001.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include - -static UINT32 testcase(VOID) -{ - char *s = ""; - - setlocale(LC_ALL, ""); - textdomain("gettext_demo"); - bindtextdomain("gettext_demo", "."); - bind_textdomain_codeset("gettext_demo", "UTF-8"); - - printf(ngettext("Delete the selected file?\n", "Delete the selected files?\n", 1)); - printf(ngettext("Delete the selected file?\n", "Delete the selected files?\n", 2)); - - s = ngettext("0123456789", "0123456789", 2); - ICUNIT_ASSERT_STRING_EQUAL(s, "0123456789", s); - - return LOS_OK; -} - -VOID IO_TEST_NGETTEXT_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_nl_langinfo_001.cpp b/testsuites/unittest_old/IO/full/IO_test_nl_langinfo_001.cpp deleted file mode 100644 index 8e8bd44b..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_nl_langinfo_001.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include - -static UINT32 testcase(VOID) -{ - /* set the locale info */ - setenv("MUSL_LOCPATH", "/storage", 1); - printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH")); - printf("Locale is: %s\n", setlocale(LC_TIME, "zh_CN.UTF-8")); - - setlocale(LC_CTYPE, ""); - setlocale(LC_NUMERIC, ""); - - /* echo the nl_langinfo */ - printf("%s\n", nl_langinfo(CODESET)); - printf("%s\n", nl_langinfo(RADIXCHAR)); - printf("%s\n", nl_langinfo(D_T_FMT)); - printf("%s\n", nl_langinfo(D_FMT)); - printf("%s\n", nl_langinfo(T_FMT)); - printf("%s\n", nl_langinfo(DAY_1)); - printf("%s\n", nl_langinfo(DAY_7)); - printf("%s\n", nl_langinfo(ABDAY_1)); - printf("%s\n", nl_langinfo(ABDAY_7)); - printf("%s\n", nl_langinfo(MON_1)); - printf("%s\n", nl_langinfo(MON_12)); - printf("%s\n", nl_langinfo(ABMON_1)); - printf("%s\n", nl_langinfo(ABMON_12)); - printf("%s\n", nl_langinfo(THOUSEP)); - printf("%s\n", nl_langinfo(YESEXPR)); - printf("%s\n", nl_langinfo(NOEXPR)); - printf("%s\n", nl_langinfo(CRNCYSTR)); - - /* set the locale info */ - setenv("MUSL_LOCPATH", "/storage", 1); - printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH")); - printf("Locale is: %s\n", setlocale(LC_TIME, "en_US.UTF-8")); - - setlocale(LC_CTYPE, ""); - setlocale(LC_NUMERIC, ""); - - /* echo the nl_langinfo */ - printf("%s\n", nl_langinfo(CODESET)); - printf("%s\n", nl_langinfo(RADIXCHAR)); - printf("%s\n", nl_langinfo(D_T_FMT)); - printf("%s\n", nl_langinfo(D_FMT)); - printf("%s\n", nl_langinfo(T_FMT)); - printf("%s\n", nl_langinfo(DAY_1)); - printf("%s\n", nl_langinfo(DAY_7)); - printf("%s\n", nl_langinfo(ABDAY_1)); - printf("%s\n", nl_langinfo(ABDAY_7)); - printf("%s\n", nl_langinfo(MON_1)); - printf("%s\n", nl_langinfo(MON_12)); - printf("%s\n", nl_langinfo(ABMON_1)); - printf("%s\n", nl_langinfo(ABMON_12)); - printf("%s\n", nl_langinfo(THOUSEP)); - printf("%s\n", nl_langinfo(YESEXPR)); - printf("%s\n", nl_langinfo(NOEXPR)); - printf("%s\n", nl_langinfo(CRNCYSTR)); - - char *string = nl_langinfo(CRNCYSTR); - ICUNIT_ASSERT_NOT_EQUAL_NULL(string, NULL, string); - - return LOS_OK; -} - -VOID IO_TEST_NL_LANGINFO_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_nl_langinfo_l_001.cpp b/testsuites/unittest_old/IO/full/IO_test_nl_langinfo_l_001.cpp deleted file mode 100644 index 8adb4f8f..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_nl_langinfo_l_001.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include -static UINT32 testcase(VOID) { - /* set the locale info */ - setenv("MUSL_LOCPATH", "/storage", 1); - printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH")); - printf("Locale is: %s\n", setlocale(LC_TIME, "en_US.UTF-8")); - - setlocale(LC_CTYPE, ""); - setlocale(LC_NUMERIC, ""); - - /* echo the nl_langinfo_l */ - printf("%s\n", nl_langinfo_l(CODESET, (locale_t)"en_US.UTF-8")); - printf("%s\n", nl_langinfo_l(RADIXCHAR, (locale_t)"en_US.UTF-8")); - - /* set the locale info */ - setenv("MUSL_LOCPATH", "/storage", 1); - printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH")); - printf("Locale is: %s\n", setlocale(LC_TIME, "zh_CN.UTF-8")); - - setlocale(LC_CTYPE, ""); - setlocale(LC_NUMERIC, ""); - - /* echo the nl_langinfo */ - printf("%s\n", nl_langinfo_l(CODESET, (locale_t)"zh_CN.UTF-8")); - printf("%s\n", nl_langinfo_l(RADIXCHAR, (locale_t)"zh_CN.UTF-8")); - - char *string = nl_langinfo_l(CRNCYSTR, (locale_t)"zh_CN.UTF-8"); - ICUNIT_ASSERT_NOT_EQUAL_NULL(string, NULL, string); - - return LOS_OK; -} - -VOID IO_TEST_NL_LANGINFO_l_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_ppoll_001.cpp b/testsuites/unittest_old/IO/full/IO_test_ppoll_001.cpp deleted file mode 100644 index e80b1858..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_ppoll_001.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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. - */ - -#include "It_test_IO.h" -#include "pthread.h" - -const int BUF_SIZE = 128; -const int DELAY_TIME = 200; - -static INT32 pipeFdPpoll[2]; -static INT32 g_step = 1; -static CHAR strBuf[] = "hello world."; -static struct pollfd pfd; - -static void *pthread_01(void *arg) -{ - INT32 retVal; - CHAR buf[BUF_SIZE]; - - /* 执行ppoll监视文件æ述符 */ - while (g_step < 3) { /* 3, 3rd step */ - usleep(DELAY_TIME); - } - g_step++; - retVal = ppoll(&pfd, 1, NULL, NULL); - ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal); - - while (g_step < 5) { /* 5, 5th step */ - usleep(DELAY_TIME); - } - g_step++; - - /* 判断revents */ - if (pfd.revents & POLLIN) { - memset_s(buf, sizeof(buf), 0, sizeof(buf)); - retVal = read(pfd.fd, buf, BUF_SIZE); - ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal); - - retVal = strcmp(strBuf, buf); - ICUNIT_ASSERT_EQUAL_NULL(retVal, 0, retVal); - } - - while (g_step < 6) { /* 6, 6th step */ - usleep(DELAY_TIME); - } - pthread_exit(NULL); -} - -STATIC UINT32 testcase(VOID) -{ - INT32 retVal; - pthread_t tid; - - /* å»ºç«‹ç®¡é“ */ - while (g_step < 1) { /* 1, 1st step */ - usleep(DELAY_TIME); - } - retVal = pipe(pipeFdPpoll); - ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal); - g_step++; - - /* 设置pfd */ - pfd.fd = pipeFdPpoll[0]; - pfd.events = POLLIN; - - /* 开辟线程执行 ppoll */ - while (g_step < 2) { /* 2, 2nd step */ - usleep(DELAY_TIME); - } - retVal = pthread_create(&tid, NULL, pthread_01, NULL); - ICUNIT_ASSERT_EQUAL(retVal, 0, retVal); - g_step++; - - /* å‘管é“å†™å…¥æ•°æ® */ - while (g_step < 4) { /* 4, 4th step */ - usleep(DELAY_TIME); - } - sleep(1); - - retVal = write(pipeFdPpoll[1], "hello world.", sizeof(strBuf)); - ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal); - g_step++; - - pthread_join(tid, NULL); - - return LOS_OK; -} - -VOID IO_TEST_PPOLL_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/IO/full/IO_test_ppoll_002.cpp b/testsuites/unittest_old/IO/full/IO_test_ppoll_002.cpp deleted file mode 100644 index 9f121a79..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_ppoll_002.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ - -#include "It_test_IO.h" -#include "signal.h" -#include "pthread.h" - -const int BUF_SIZE = 128; -const int DELAY_TIME = 200; - -static int pipeFdPpoll[2]; -static int g_step = 1; -static char strBuf[] = "hello world."; -static struct pollfd pfd; - -static void *pthread_01(void *arg) -{ - int retVal; - char buf[BUF_SIZE]; - const struct timespec timeout = {10000, 0}; - - /* 执行ppoll监视文件æ述符 */ - while (g_step < 4) { /* 4, 4th step */ - usleep(DELAY_TIME); - } - g_step++; - retVal = ppoll(&pfd, 1, &timeout, NULL); - ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal); - - /* 判断revents */ - if (pfd.revents & POLLIN) { - memset_s(buf, sizeof(buf), 0, sizeof(buf)); - retVal = read(pfd.fd, buf, BUF_SIZE); - ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal); - retVal = strcmp(strBuf, buf); - ICUNIT_ASSERT_EQUAL_NULL(retVal, 0, retVal); - } - - while (g_step < 5) { /* 5, 5th step */ - usleep(DELAY_TIME); - } - pthread_exit(NULL); -} - -static UINT32 testcase(VOID) -{ - int retVal; - pthread_t tid; - - /* å»ºç«‹ç®¡é“ */ - while (g_step < 1) { - usleep(DELAY_TIME); - } - retVal = pipe(pipeFdPpoll); - ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal); - g_step++; - - /* 设置pfd */ - pfd.fd = pipeFdPpoll[0]; - pfd.events = POLLIN; - - /* å‘管é“å†™å…¥æ•°æ® */ - while (g_step < 2) { /* 2, 2nd step */ - usleep(DELAY_TIME); - } - sleep(1); - - retVal = write(pipeFdPpoll[1], "hello world.", sizeof(strBuf)); - ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal); - g_step++; - - /* 开辟线程执行 ppoll */ - while (g_step < 3) { /* 3, 3rd step */ - usleep(DELAY_TIME); - } - retVal = pthread_create(&tid, NULL, pthread_01, NULL); - ICUNIT_ASSERT_EQUAL(retVal, 0, retVal); - g_step++; - - pthread_join(tid, NULL); - - return LOS_OK; -} - -VOID IO_TEST_PPOLL_002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/IO/full/IO_test_ppoll_003.cpp b/testsuites/unittest_old/IO/full/IO_test_ppoll_003.cpp deleted file mode 100644 index ea0852f4..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_ppoll_003.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* - * 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. - */ - -#include "It_test_IO.h" -#include "pthread.h" -#include "signal.h" - -const int BUF_SIZE = 128; -const int DELAY_TIME = 200; - -static INT32 pipeFdPpoll[2]; -static INT32 g_step = 1; -static CHAR strBuf[] = "hello world."; -static struct pollfd pfd; -static sigset_t sigMask; -static UINT32 count = 0; - -static void signalHandle(INT32 sigNum) -{ - g_step++; - return; -} - -static void *pthread_01(void *arg) -{ - INT32 retVal; - CHAR buf[BUF_SIZE]; - - (void)signal(SIGUSR1, signalHandle); - - while (1) { - /* 执行ppoll监视文件æ述符 */ - while (g_step < 2) { /* 2, 2nd step */ - usleep(DELAY_TIME); - } - g_step++; - retVal = ppoll(&pfd, 1, NULL, &sigMask); - - ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal); - - /* 判断revents */ - if (pfd.revents & POLLIN) { - memset_s(buf, sizeof(buf), 0, sizeof(buf)); - retVal = read(pfd.fd, buf, BUF_SIZE); - ICUNIT_ASSERT_NOT_EQUAL_NULL(retVal, -1, retVal); - - retVal = strcmp(strBuf, buf); - ICUNIT_ASSERT_EQUAL_NULL(retVal, 0, retVal); - - count++; - } else { - ICUNIT_ASSERT_NOT_EQUAL_NULL(pfd.revents & POLLIN, 0, pfd.revents & POLLIN); - } - g_step++; - - if (g_step >= 7) { /* 7, 7th step */ - ICUNIT_ASSERT_EQUAL_NULL(count, 2, count); /* 2, 2nd step */ - pthread_exit(NULL); - } - } - - return LOS_OK; -} - -static UINT32 testcase(VOID) -{ - INT32 retVal; - pthread_t tid; - - /* å»ºç«‹ç®¡é“ */ - while (g_step < 1) { - usleep(DELAY_TIME); - } - retVal = pipe(pipeFdPpoll); - ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal); - - /* 设置pfd sigmask */ - pfd.fd = pipeFdPpoll[0]; - pfd.events = POLLIN; - pfd.revents = 0x0; - - sigemptyset(&sigMask); - sigaddset(&sigMask, SIGUSR1); - - /* 开辟线程执行 ppoll */ - retVal = pthread_create(&tid, NULL, pthread_01, NULL); - ICUNIT_ASSERT_EQUAL(retVal, 0, retVal); - g_step++; - - /* å‘管é“å†™å…¥æ•°æ® */ - while (g_step < 3) { /* 3, 3ed step */ - usleep(DELAY_TIME); - } - sleep(1); /* ä¿è¯å…ˆæŒ‚èµ·å†å†™å…¥æ•°æ® */ - retVal = write(pipeFdPpoll[1], "hello world.", sizeof(strBuf)); - ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal); - - /* å‘线程å‘é€ä¿¡å· */ - while (g_step < 5) { /* 5, 5th step */ - usleep(DELAY_TIME); - } - sleep(1); /* ä¿è¯å…ˆæŒ‚èµ·å†å‘é€ä¿¡å· */ - retVal = pthread_kill(tid, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retVal, 0, retVal); - - /* 继续å‘管é“å†™å…¥æ•°æ® */ - ICUNIT_ASSERT_EQUAL(g_step, 5, g_step); /* 5, sth。判断挂起解除之å‰ä¿¡å·æ²¡æœ‰è¢«å¤„ç† */ - retVal = write(pipeFdPpoll[1], "hello world.", sizeof(strBuf)); - ICUNIT_ASSERT_NOT_EQUAL(retVal, -1, retVal); - - while (g_step < 7) { /* 7, 7th step */ - usleep(DELAY_TIME); - } - ICUNIT_ASSERT_EQUAL(count, 2, count); /* 2, 2nd step */ - /* 等待退出 */ - pthread_join(tid, NULL); - - return LOS_OK; -} - -VOID IO_TEST_PPOLL_003(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/IO/full/IO_test_pselect_001.cpp b/testsuites/unittest_old/IO/full/IO_test_pselect_001.cpp deleted file mode 100644 index d6cfa95d..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_pselect_001.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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. - */ - -#include "It_test_IO.h" -#include -#include -#include -#include -#include "sys/select.h" - -static UINT32 Testcase1(VOID) -{ - static const int TAR_STR_LEN = 12; /* 12, str len */ - int pipeFd[2], ret; /* 2, pipe return 2 file descirpter */ - fd_set reads; - ret = pipe(pipeFd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ret = write(pipeFd[1], "Hello World", TAR_STR_LEN); - ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); - FD_ZERO(&reads); - FD_SET(pipeFd[0], &reads); - ret = select(pipeFd[0] + 1, &reads, nullptr, nullptr, nullptr); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - ret = FD_ISSET(pipeFd[0], &reads); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - close(pipeFd[0]); - close(pipeFd[1]); - return LOS_OK; -EXIT: - close(pipeFd[0]); - close(pipeFd[1]); - return LOS_NOK; -} - -#define V_SIGMASK 0x5555 -static UINT32 testcase(VOID) -{ - fd_set rfds; - struct timespec tv; - int retval; - pid_t pid; - int pipeFd[2]; /* 2, pipe id num */ - char buffer[40]; /* 40, buffer size */ - int i = 0; - int status; - - sigset_t mask; - - retval = Testcase1(); /* first check select works */ - ICUNIT_GOTO_EQUAL(retval, 0, retval, OUT); - - retval = pipe(pipeFd); - ICUNIT_GOTO_EQUAL(retval, 0, retval, OUT); - - /* Watch fd to see when it has input. */ - FD_ZERO(&rfds); - FD_SET(pipeFd[0], &rfds); - - /* Wait up to three seconds. */ - tv.tv_sec = 3; /* 3, wait timer, second */ - tv.tv_nsec = 5; /* 5, wait timer, nano second */ - - pid = fork(); - if (pid == 0) { - close(pipeFd[1]); - - retval = pselect(pipeFd[0] + 1, &rfds, nullptr, nullptr, &tv, &mask); - close(pipeFd[0]); - - if (retval) { - exit(LOS_OK); - } else { - exit(LOS_NOK); - } - } else { - sleep(1); - close(pipeFd[0]); - retval = write(pipeFd[1], "0123456789012345678901234567890123456789", 40); /* write 40 bytes to stdin(fd 0) */ - ICUNIT_GOTO_EQUAL(retval, 40, retval, OUT); - close(pipeFd[1]); - - wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, LOS_OK, status); - } - - return LOS_OK; -OUT: - return LOS_NOK; -} - -VOID IO_TEST_PSELECT_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_pselect_002.cpp b/testsuites/unittest_old/IO/full/IO_test_pselect_002.cpp deleted file mode 100644 index bf2148b8..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_pselect_002.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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. - */ - -#include "It_test_IO.h" -#include -#include -#include -#include -#include "sys/select.h" - -static void SigPrint(int sig) -{ - return; -} - -static UINT32 testcase(VOID) -{ - fd_set rfds; - struct timespec tv; - int retval; - pid_t pid; - int pipeFd[2]; /* 2, pipe id num */ - char buffer[40]; /* 40, buffer size */ - - int i = 0; - int status; - - void (*retSig)(int); - sigset_t mask; - - retSig = signal(SIGALRM, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - - retSig = signal(SIGUSR1, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - - retval = sigemptyset(&mask); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - - retval = sigaddset(&mask, SIGALRM); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - - retval = sigaddset(&mask, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - - retval = pipe(pipeFd); - ICUNIT_GOTO_EQUAL(retval, 0, retval, OUT); - - /* Watch fd to see when it has input. */ - FD_ZERO(&rfds); - FD_SET(pipeFd[0], &rfds); - - /* Wait up to three seconds. */ - tv.tv_sec = 3; /* 3, wait timer, second */ - tv.tv_nsec = 5; /* 5, wait timer, nano second */ - - pid = fork(); - if (pid == 0) { - close(pipeFd[1]); - - retval = pselect(pipeFd[0] + 1, &rfds, nullptr, nullptr, &tv, &mask); - - close(pipeFd[0]); - - if (retval != 0) { - exit(LOS_OK); - } else { - exit(LOS_NOK); - } - } else { - sleep(1); - close(pipeFd[0]); - - retval = kill(pid, SIGALRM); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - - retval = kill(pid, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - close(pipeFd[1]); - - wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, LOS_OK, status); - } - - return LOS_OK; -OUT: - return LOS_NOK; -} - -VOID IO_TEST_PSELECT_002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/IO/full/IO_test_strcasecmp_l_001.cpp b/testsuites/unittest_old/IO/full/IO_test_strcasecmp_l_001.cpp deleted file mode 100644 index 7c9acb69..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_strcasecmp_l_001.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include "locale.h" - -static UINT32 testcase(VOID) -{ - char *a = "aBcDeF"; - char *b = "AbCdEf"; - locale_t loc; - - printf("Strings:a=%s,b=%s,doing if(!strcasecmp(a, b))printf(\"\%s=\%s\\n\", a, b);", a, b, a, b); - if (!strcasecmp_l(a, b, loc)) { - printf("%s=%s\n", a, b); - } - ICUNIT_ASSERT_EQUAL(strcasecmp_l(a, b, loc), 0, strcasecmp_l(a, b, loc)); - - return LOS_OK; -} - -VOID IO_TEST_STRCASECMP_L_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_strcasecmp_l_002.cpp b/testsuites/unittest_old/IO/full/IO_test_strcasecmp_l_002.cpp deleted file mode 100644 index 4312816e..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_strcasecmp_l_002.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include - -static UINT32 testcase1(VOID) -{ - char *a = "aBcDeF"; - char *b = "AbCEf"; - int ret = 0; - locale_t loc; - errno = 0; - - ret = strcasecmp_l(a, b, loc); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase2(VOID) -{ - char *a = "aBcDfF"; - char *b = "AbCEe"; - int ret = 0; - locale_t loc; - errno = 0; - - ret = strcasecmp_l(a, b, loc); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); - testcase2(); - - return LOS_OK; -} - -VOID IO_TEST_STRCASECMP_L_002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_strfmon_l_001.cpp b/testsuites/unittest_old/IO/full/IO_test_strfmon_l_001.cpp deleted file mode 100644 index 2d4ab5fa..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_strfmon_l_001.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include "locale.h" - -static UINT32 testcase(VOID) -{ - char buf[100] = {0}; - int ret = 0; - locale_t loc; - - ret = strfmon_l(buf, sizeof(buf), loc, "[%^=*#6n] [%=*#6i]", 1234.567, 1234.567); - ICUNIT_ASSERT_EQUAL(ret, 23, ret); - - ret = strfmon_l(buf, sizeof(buf), loc, "[%^=*#6n] [%=*#6i]", 134.567, 1234.567); - ICUNIT_ASSERT_EQUAL(ret, 23, ret); - - ret = strfmon_l(buf, sizeof(buf), loc, "[%^=*#6n] [%=*#6i]", 1234.567, 134.567); - ICUNIT_ASSERT_EQUAL(ret, 23, ret); - - return LOS_OK; -} - -VOID IO_TEST_STRFMON_L_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_strfmon_l_002.cpp b/testsuites/unittest_old/IO/full/IO_test_strfmon_l_002.cpp deleted file mode 100644 index 4b658239..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_strfmon_l_002.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include "locale.h" - -static UINT32 testcase1(VOID) -{ - char buf[100] = {0}; - int ret = 0; - locale_t loc; - errno = 0; - - setenv("MUSL_LOCPATH", "/storage", 1); - TEST_PRINT("[INFO]%s:%d,%s,Locale is: %s\n", __FILE__, __LINE__, __func__,setlocale(LC_TIME, "zh_CN.UTF-8")); - - errno = 0; - ret = strfmon_l(buf, 2, loc, "[%^=*#6n] [%=*#6i]", 1234.567, 1234.567); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,buf=%s\n", __FILE__, __LINE__, __func__, ret, buf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, E2BIG, errno, OUT); - - errno = 0; - ret = strfmon_l(buf, 3, loc, "[%^=*#6n] [%=*#6i]", 134.567, 1234.567); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,buf=%s\n", __FILE__, __LINE__, __func__, ret, buf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, E2BIG, errno, OUT); - - errno = 0; - ret = strfmon_l(buf, 22, loc, "[%^=*#6n] [%=*#6i]", 1234.567, 134.567); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,buf=%s\n", __FILE__, __LINE__, __func__, ret, buf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, E2BIG, errno, OUT); - - errno = 0; - ret = strfmon_l(buf, 23, loc, "[%^=*#6n] [%=*#6i]", 1234.567, 134.567); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,buf=%s\n", __FILE__, __LINE__, __func__, ret, buf); - ICUNIT_GOTO_EQUAL(ret, 23, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); - - return LOS_OK; -} - -VOID IO_TEST_STRFMON_L_002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_strncasecmp_l_001.cpp b/testsuites/unittest_old/IO/full/IO_test_strncasecmp_l_001.cpp deleted file mode 100644 index 57ada71c..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_strncasecmp_l_001.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include -#include "locale.h" - -static UINT32 testcase(VOID) -{ - char *a = "aBcDeF"; - char *b = "AbCdEf"; - int n = 5; - locale_t loc; - - printf("Strings:a=%s,b=%s,doing if(!strncasecmp(a, b, %d))printf(\"\%s=\%s\\n\", a, b);", a, b, n, a, b); - if (!strncasecmp_l(a, b, n, loc)) { - printf("%s=%s in first %d characters.\n", a, b, n); - } - ICUNIT_ASSERT_EQUAL(strncasecmp_l(a, b, n, loc), 0, strncasecmp_l(a, b, n, loc)); - - return LOS_OK; -} - -VOID IO_TEST_STRNCASECMP_L_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/IO_test_strncasecmp_l_002.cpp b/testsuites/unittest_old/IO/full/IO_test_strncasecmp_l_002.cpp deleted file mode 100644 index 285088bd..00000000 --- a/testsuites/unittest_old/IO/full/IO_test_strncasecmp_l_002.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" -#include - -static UINT32 testcase1(VOID) -{ - char *a = "aBcDeF"; - char *b = "AbCdEf"; - int n = 600; - int ret = 0; - locale_t loc; - errno = 0; - - setenv("MUSL_LOCPATH", "/storage", 1); - TEST_PRINT("[INFO]%s:%d,%s,Locale is: %s\n", __FILE__, __LINE__, __func__,setlocale(LC_TIME, "zh_CN.UTF-8")); - - errno = 0; - ret = strncasecmp_l(a, b, n, loc); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase2(VOID) -{ - char *a = "aBcDeF"; - char *b = "AbCdEi"; - int n = -6; - int ret = 0; - locale_t loc; - errno = 0; - - setenv("MUSL_LOCPATH", "/storage", 1); - TEST_PRINT("[INFO]%s:%d,%s,Locale is: %s\n", __FILE__, __LINE__, __func__,setlocale(LC_TIME, "zh_CN.UTF-8")); - - errno = 0; - ret = strncasecmp_l(a, b, n, loc); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -3, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase3(VOID) -{ - char *a = "aBcDeF"; - char *b = "AbCdAx"; - int n = 0; - int ret = 0; - locale_t loc; - errno = 0; - - setenv("MUSL_LOCPATH", "/storage", 1); - TEST_PRINT("[INFO]%s:%d,%s,Locale is: %s\n", __FILE__, __LINE__, __func__,setlocale(LC_TIME, "zh_CN.UTF-8")); - - errno = 0; - ret = strncasecmp_l(a, b, n, loc); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase4(VOID) -{ - char *a = "34342aBcDeF"; - char *b = "AbCdAx"; - int n = 4; - int ret = 0; - locale_t loc; - errno = 0; - - setenv("MUSL_LOCPATH", "/storage", 1); - TEST_PRINT("[INFO]%s:%d,%s,Locale is: %s\n", __FILE__, __LINE__, __func__,setlocale(LC_TIME, "zh_CN.UTF-8")); - - errno = 0; - ret = strncasecmp_l(a, b, n, loc); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -46, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); - testcase2(); - testcase3(); - testcase4(); - - return LOS_OK; -} - -VOID IO_TEST_STRNCASECMP_L_002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_locale_localeconv_001.cpp b/testsuites/unittest_old/IO/full/It_locale_localeconv_001.cpp deleted file mode 100644 index e9e5ab65..00000000 --- a/testsuites/unittest_old/IO/full/It_locale_localeconv_001.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - - -static UINT32 Testcase(VOID) -{ - struct lconv *newloc = localeconv(); - ICUNIT_ASSERT_NOT_EQUAL(newloc, NULL, newloc); - - return LOS_OK; -} - -VOID ItLocaleLocaleconv001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdio_fputws_001.cpp b/testsuites/unittest_old/IO/full/It_stdio_fputws_001.cpp deleted file mode 100644 index 3a2a9620..00000000 --- a/testsuites/unittest_old/IO/full/It_stdio_fputws_001.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - - -static UINT32 Testcase(VOID) -{ - wchar_t *srcStr = L"hello"; - wchar_t tarStr[20] = {0}; // 20, target buffer size - int nRet; - unsigned int nPos; - int nType; - char pathname[50]; // 50, path name buffer size - FILE *testFile; - strncpy(pathname, g_ioTestPath, 50); // 50, path name buffer size - char *filename = "/crtfputwstest1"; - strcat(pathname, filename); - for (nType = 0; nType < 6; nType++) { // 6, test loop num - testFile = fopen(pathname, "a"); - - ICUNIT_GOTO_NOT_EQUAL(testFile, NULL, testFile, EXIT); - fseek(testFile, 0, SEEK_END); - nPos = (unsigned int)ftell(testFile); - - nRet = fputws(srcStr, testFile); - - ICUNIT_GOTO_NOT_EQUAL(nRet, -1, nRet, EXIT); - if ((nPos + 5) != (unsigned int)ftell(testFile)) { // 5, expect position offset - ICUNIT_GOTO_EQUAL(1, 0, 1, EXIT); - } - fclose(testFile); - - testFile = fopen(pathname, "r"); - ICUNIT_GOTO_NOT_EQUAL(testFile, NULL, testFile, EXIT); - wchar_t *p = fgetws(tarStr, 6, testFile); // 6, "hello" length and '\0' - ICUNIT_GOTO_EQUAL(p, tarStr, p, EXIT); - nRet = wcscmp(srcStr, tarStr); - ICUNIT_GOTO_EQUAL(nRet, 0, nRet, EXIT); - fclose(testFile); - } - - remove(pathname); - return LOS_OK; -EXIT: - if (testFile != NULL) { - fclose(testFile); - remove(pathname); - } - return LOS_NOK; -} - -VOID ItStdioFputws001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdio_fwprintf_001.cpp b/testsuites/unittest_old/IO/full/It_stdio_fwprintf_001.cpp deleted file mode 100644 index 6cda97ad..00000000 --- a/testsuites/unittest_old/IO/full/It_stdio_fwprintf_001.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - - -static UINT32 Testcase(VOID) -{ - wchar_t tarStr[20] = {0}; // 20, buffer size - wchar_t *p; - int nRet; - unsigned int nPos; - int nType; - char pathname[50]; // 50, path name buffer size - strncpy(pathname, g_ioTestPath, 50); // 50, path name buffer size - char *filename = "/crtfwprintftest1"; - FILE *testFile = NULL; - - strcat(pathname, filename); - - for (nType = 0; nType < 6; nType++) { // 6, loop test num - testFile = fopen(pathname, "w+"); - ICUNIT_GOTO_NOT_EQUAL(testFile, NULL, testFile, EXIT); - - nPos = (unsigned int)ftell(testFile); - - nRet = fwprintf(testFile, L"hello world %d", 666); // 666, for test, print to testFile - ICUNIT_GOTO_EQUAL(nRet, 15, nRet, EXIT); // 15, total write size - - if ((nPos + 15) != (unsigned int)ftell(testFile)) { // 15, total write size - ICUNIT_GOTO_EQUAL(1, 0, 1, EXIT); - } - fclose(testFile); - - testFile = fopen(pathname, "r"); - p = fgetws(tarStr, 16, testFile); // 16, read size,total write and '\0' - nRet = wcscmp(L"hello world 666", tarStr); - ICUNIT_GOTO_EQUAL(nRet, 0, nRet, EXIT); - - fclose(testFile); - } - - remove(pathname); - return LOS_OK; -EXIT: - if (testFile != NULL) { - fclose(testFile); - remove(pathname); - } - return LOS_NOK; -} - -VOID ItStdioFwprintf001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdio_getc_unlocked_001.cpp b/testsuites/unittest_old/IO/full/It_stdio_getc_unlocked_001.cpp deleted file mode 100644 index 5f437c0b..00000000 --- a/testsuites/unittest_old/IO/full/It_stdio_getc_unlocked_001.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - - -static UINT32 Testcase(VOID) -{ - char ch; - unsigned int nPos; - int ret; - char pathname[50]; // 50, enough space. - strncpy(pathname, g_ioTestPath, sizeof(pathname)); - char *filename = "/crt_getc_unlocked_test1"; - FILE *testFile = NULL; - - strcat(pathname, filename); - testFile = fopen(pathname, "w+"); - ICUNIT_ASSERT_NOT_EQUAL(testFile, NULL, LOS_NOK); - ret = fputs("0123456789abcdefghijklmnopqrstuvwxyz", testFile); - ICUNIT_GOTO_NOT_EQUAL(ret, EOF, ret, EXIT); - fclose(testFile); - - testFile = fopen(pathname, "r"); - ICUNIT_GOTO_NOT_EQUAL(testFile, NULL, testFile, EXIT); - - nPos = ftell(testFile); - - ch = getc_unlocked(testFile); - ICUNIT_GOTO_EQUAL(ch, '0', ch, EXIT); - - if ((nPos + sizeof(char)) != (unsigned int)ftell(testFile)) { - ICUNIT_GOTO_EQUAL(1, 0, 1, EXIT); - } - - fclose(testFile); - remove(pathname); - return LOS_OK; -EXIT: - if (testFile != NULL) { - fclose(testFile); - remove(pathname); - } - return LOS_NOK; -} - -VOID ItStdioGetcUnlocked001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdio_hasmntopt_001.cpp b/testsuites/unittest_old/IO/full/It_stdio_hasmntopt_001.cpp deleted file mode 100644 index 2169f01c..00000000 --- a/testsuites/unittest_old/IO/full/It_stdio_hasmntopt_001.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - -static UINT32 testcase(VOID) -{ - struct mntent* mnt = nullptr; - struct mntent* mnt_new = nullptr; - FILE *fp = nullptr; - char *argv[2] = {nullptr}; - argv[0] = "/etc/fstab"; - argv[1] = "errors"; - char *opt = argv[1]; - char *ret = nullptr; - - char fileWords[] = "/dev/disk/by-uuid/c4992556-a86e-45e8-ba5f-190b16a9073x /usr1 ext3 errors=remount-ro,nofail 0 1"; - char *pathList[] = {"/etc/fstab"}; - char *streamList[] = {(char *)fileWords}; - int streamLen[] = {sizeof(fileWords)}; - - int flag = PrepareFileEnv(pathList, streamList, streamLen, 1); - if (flag != 0) { - printf("error: need some env file, but prepare is not ok"); - (VOID)RecoveryFileEnv(pathList, 1); - return -1; - } - - mnt_new = (struct mntent *)malloc(sizeof(struct mntent)); - mnt_new->mnt_fsname = "UUID=c4992556-a86e-45e8-ba5f-190b16a9073x"; - mnt_new->mnt_dir = "/usr1"; - mnt_new->mnt_type = "ext3"; - mnt_new->mnt_opts = "errors=remount-ro,nofail"; - mnt_new->mnt_freq = 0; - mnt_new->mnt_passno = 1; - - fp = setmntent("/etc/fstab", "r"); - if (!fp) { - printf("fp=0x%x\n", fp); - return LOS_NOK; - } - - mnt = getmntent(fp); - if (mnt && !(feof(fp) || ferror(fp))) { - ret = hasmntopt(mnt, opt); - printf("hasmntopt=%s\n", ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, NULL, -1); - mnt = getmntent(fp); - } - - if (fp != NULL) { - endmntent(fp); - } - - /* test the addmntent below */ - fp = setmntent(argv[0], "a"); - if (fopen("/lib/libc.so", "r")) { - printf("aha I found you are OHOS!!!\n"); - if (addmntent(fp, mnt_new)) { - printf("a new mnt is added to %s\n", argv[0]); - } - } - - if (fp != NULL) { - endmntent(fp); - } - (VOID)RecoveryFileEnv(pathList, 1); - return LOS_OK; -} - -VOID IT_STDIO_HASMNTOPT_001(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdio_mblen_001.cpp b/testsuites/unittest_old/IO/full/It_stdio_mblen_001.cpp deleted file mode 100644 index 7667ce6c..00000000 --- a/testsuites/unittest_old/IO/full/It_stdio_mblen_001.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - - -static UINT32 Testcase(VOID) -{ - setlocale(LC_ALL, "en_US.utf8"); - size_t result = 0; - const char *str = "z\u00df\u6c34\U0001f34c"; - const char *end = str + strlen(str); - - mblen(NULL, 0); - while (str < end) { - int next = mblen(str, end - str); - if (next == -1) { - perror("strlen_mb"); - break; - } - str += next; - ++result; - } - ICUNIT_GOTO_EQUAL(result, 4, result, EXIT); // 4, except value - - return LOS_OK; -EXIT: - return LOS_NOK; -} - -VOID ItStdioMblen001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdio_mbrlen_001.cpp b/testsuites/unittest_old/IO/full/It_stdio_mbrlen_001.cpp deleted file mode 100644 index 39ee9f4a..00000000 --- a/testsuites/unittest_old/IO/full/It_stdio_mbrlen_001.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - - -static UINT32 Testcase(VOID) -{ - // allow mbrlen() to work with UTF-8 multibyte encoding - setlocale(LC_ALL, "en_US.utf8"); - const char *str = "æ°´"; - size_t sz = strlen(str); - int len1, len2, len3; - - mbstate_t mb; - memset(&mb, 0, sizeof(mb)); - len1 = mbrlen(str, 1, &mb); - ICUNIT_GOTO_EQUAL(len1, -2, len1, EXIT); // -2, except return value - - len2 = mbrlen(str + 1, sz - 1, &mb); - ICUNIT_GOTO_EQUAL(len2, 2, len2, EXIT); // 2, except return value - - len3 = mbrlen(str + 1, sz - 1, &mb); - ICUNIT_GOTO_EQUAL(len3, -1, len3, EXIT); - - return LOS_OK; -EXIT: - return LOS_NOK; -} - -VOID ItStdioMbrlen001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdio_putwc_001.cpp b/testsuites/unittest_old/IO/full/It_stdio_putwc_001.cpp deleted file mode 100644 index 6c122743..00000000 --- a/testsuites/unittest_old/IO/full/It_stdio_putwc_001.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - - -static UINT32 Testcase(VOID) -{ - wchar_t srcWc = L'H'; - int tarWc, nRet; - long nPos; - int nType, i; - FILE *putwcFile = NULL; - char pathname[50]; // 50, pathname size - strncpy(pathname, g_ioTestPath, 50); // 50, pathname size - char *filename = "/crtputwctest1"; - - strcat(pathname, filename); - - for (nType = 0; nType < 6; nType++) { // 6, loop test num - putwcFile = fopen(pathname, "w+"); - ICUNIT_GOTO_NOT_EQUAL(putwcFile, NULL, putwcFile, EXIT); - - nPos = ftell(putwcFile); - - nRet = putwc(srcWc, putwcFile); - ICUNIT_GOTO_EQUAL(nRet, L'H', nRet, EXIT); - fclose(putwcFile); - - putwcFile = fopen(pathname, "r"); - tarWc = getwc(putwcFile); - ICUNIT_GOTO_EQUAL(tarWc, L'H', tarWc, EXIT); - - if ((nPos + 1) != ftell(putwcFile)) { - ICUNIT_GOTO_EQUAL(1, 0, 1, EXIT); - } - - fclose(putwcFile); - } - - remove(pathname); - return LOS_OK; -EXIT: - if (putwcFile != NULL) { - fclose(putwcFile); - remove(pathname); - } - return LOS_NOK; -} - -VOID ItStdioPutwc001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdio_readv_001.cpp b/testsuites/unittest_old/IO/full/It_stdio_readv_001.cpp deleted file mode 100644 index 78eebb91..00000000 --- a/testsuites/unittest_old/IO/full/It_stdio_readv_001.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - -static UINT32 Testcase(VOID) -{ - char *srcStr = "helloworld"; - int nRet, fd; - char pathname[50]; // 50, path name size - char *filename = "/crtreadvtest1"; - char buf1[6] = { 0 }; - char buf2[6] = { 0 }; - struct iovec iov[2]; // 2, read 2 block - ssize_t nread; - const int testStrLen = 10; - - iov[0].iov_base = buf1; - iov[0].iov_len = sizeof(buf1) - 1; - iov[1].iov_base = buf2; - iov[1].iov_len = sizeof(buf2) - 1; - - strncpy(pathname, g_ioTestPath, 50); // 50, path name size - strcat(pathname, filename); - fd = open(pathname, O_CREAT | O_RDWR | O_TRUNC, 0666); // 0666, file authority - if (fd < 0) { - printf("error: can`t open file\n"); - } - nRet = write(fd, srcStr, testStrLen); - ICUNIT_GOTO_EQUAL(nRet, testStrLen, nRet, EXIT); - close(fd); - - fd = open(pathname, O_RDWR); - if (fd < 0) { - printf("error: can`t open file\n"); - } - nread = readv(fd, iov, 2); // 2, read 2 block - ICUNIT_GOTO_EQUAL(nread, testStrLen, nread, EXIT); - nRet = strcmp(buf2, "world"); - ICUNIT_GOTO_EQUAL(nRet, 0, nRet, EXIT); - nRet = strcmp(buf1, "hello"); - ICUNIT_GOTO_EQUAL(nRet, 0, nRet, EXIT); - - close(fd); - remove(pathname); - return LOS_OK; -EXIT: - close(fd); - remove(pathname); - return LOS_NOK; -} - -VOID ItStdioReadv001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdio_rindex_001.cpp b/testsuites/unittest_old/IO/full/It_stdio_rindex_001.cpp deleted file mode 100644 index b69df021..00000000 --- a/testsuites/unittest_old/IO/full/It_stdio_rindex_001.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - - -static UINT32 Testcase(VOID) -{ - int ret; - char *s = "abcdef123456abcdef"; - char *p = NULL; - p = rindex(s, 'b'); - ret = strcmp(p, "bcdef"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return LOS_OK; -EXIT: - return LOS_NOK; -} - -VOID ItStdioRindex001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdio_setlogmask_001.cpp b/testsuites/unittest_old/IO/full/It_stdio_setlogmask_001.cpp deleted file mode 100644 index 9fa4f469..00000000 --- a/testsuites/unittest_old/IO/full/It_stdio_setlogmask_001.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - - -static UINT32 Testcase(VOID) -{ - int oldmask; - int newmask = 0xff; - oldmask = setlogmask(newmask); - newmask = setlogmask(oldmask); - ICUNIT_ASSERT_EQUAL(newmask, 0xff, newmask); - - return LOS_OK; -} - -VOID ItStdioSetlogmask001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdlib_gcvt_001.cpp b/testsuites/unittest_old/IO/full/It_stdlib_gcvt_001.cpp deleted file mode 100644 index 9894425e..00000000 --- a/testsuites/unittest_old/IO/full/It_stdlib_gcvt_001.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - - -static UINT32 Testcase(VOID) -{ - double a = 12345678.12549; - double b = 0.1234567; - char ptr[128] = {0}; // 128, target buffer size - int ret; - gcvt(a, 10, ptr); // 10, convert significant value setting - ret = strcmp(ptr, "12345678.13"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gcvt(b, 6, ptr); // 6, convert significant value setting - ret = strcmp(ptr, "0.123457"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -VOID ItStdlibGcvt001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdlib_poll_002.cpp b/testsuites/unittest_old/IO/full/It_stdlib_poll_002.cpp deleted file mode 100644 index 58eb521c..00000000 --- a/testsuites/unittest_old/IO/full/It_stdlib_poll_002.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - -int g_pipeFd[10][2]; // 2, read and write; 10, listen fd number. -static pthread_t g_tid = -1; -static const int LISTEN_FD_NUM = 10; - -static void *Pthread01(void *arg) -{ - int totalNum = 0; - int times = 3; // 3, loop number for test. - int i, ret; - struct pollfd fds[LISTEN_FD_NUM] = {0}; - char buffer[20]; // 20, enough space for test. - const int pollEvents = 1; - - for (i = 0; i < LISTEN_FD_NUM; i++) { - fds[i].fd = g_pipeFd[i][0]; - fds[i].events = pollEvents; - } - - while (times--) { - ret = poll(fds, LISTEN_FD_NUM, 1000); // 1000, wait time. - totalNum += ((ret > 0) ? ret : 0); - - if (ret <= 0) { - continue; - } - - for (i = 0; i < LISTEN_FD_NUM; i++) { - if (fds[i].revents & pollEvents) { - ret = read(fds[i].fd, buffer, 12); // 12, "hello world" length and '\0' - ICUNIT_GOTO_EQUAL(ret, 12, ret, EXIT); // 12, "hello world" length and '\0' - ret = strcmp(buffer, "hello world"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - } - - if (totalNum == LISTEN_FD_NUM) { - break; - } - } - - ICUNIT_GOTO_EQUAL(totalNum, LISTEN_FD_NUM, -1, EXIT); - -EXIT: - return NULL; -} - -static UINT32 Testcase(VOID) -{ - int i; - int ret; - - for (i = 0; i < LISTEN_FD_NUM; i++) { - ret = pipe(g_pipeFd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - ret = pthread_create(&g_tid, NULL, Pthread01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - for (i = 0; i < LISTEN_FD_NUM; i++) { - ret = write(g_pipeFd[i][1], "hello world", 12); // 12, "hello world" length and '\0' - ICUNIT_GOTO_EQUAL(ret, 12, ret, EXIT); // 12, "hello world" length and '\0' - } - - pthread_join(g_tid, NULL); - - for (i = 0; i < LISTEN_FD_NUM; i++) { - close(g_pipeFd[i][0]); - close(g_pipeFd[i][1]); - } - - return LOS_OK; - -EXIT: - for (i = 0; i < LISTEN_FD_NUM; i++) { - close(g_pipeFd[i][0]); - close(g_pipeFd[i][1]); - } - return LOS_NOK; -} - -VOID ItStdlibPoll002(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/full/It_stdlib_poll_003.cpp b/testsuites/unittest_old/IO/full/It_stdlib_poll_003.cpp deleted file mode 100644 index d1a99db8..00000000 --- a/testsuites/unittest_old/IO/full/It_stdlib_poll_003.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - -struct PollParam { - int nfds; - int timeout; - int ret; - int err; -}; - -static UINT32 Testcase(VOID) -{ - const int TEST_STR_LEN = 12; - int pipeFd[2], ret, err; // 2, pipe return 2 file descirpter - struct pollfd pollFd; - struct PollParam pollParam[4] = { /* nfds timeout ret err */ - { 0, 100, -1, EINVAL}, - { 4096, 10, -1, EINVAL}, - { 4095, 10, -1, EFAULT}, - { 1, -1, 1, 0} - }; - - ret = pipe(pipeFd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = write(pipeFd[1], "hello world", TEST_STR_LEN); - printf("write first status: %d\n", ret); - ICUNIT_GOTO_EQUAL(ret, TEST_STR_LEN, ret, EXIT); - - pollFd.fd = pipeFd[0]; - pollFd.events = POLLIN; - - for (int i = 0; i < sizeof(pollParam) / sizeof(pollParam[0]); i++) { - ret = poll(&pollFd, pollParam[i].nfds, pollParam[i].timeout); - ICUNIT_GOTO_EQUAL(ret, pollParam[i].ret, ret, EXIT); - if (ret == -1) { - printf("i = %d\n", i); - if (i == 2) { // 2, pollParam[2]. - ICUNIT_GOTO_TWO_EQUAL(errno, EFAULT, EBADF, errno, EXIT); - } else { - ICUNIT_GOTO_EQUAL(errno, pollParam[i].err, errno, EXIT); - } - } - } - - close(pipeFd[0]); - close(pipeFd[1]); - return LOS_OK; -EXIT: - close(pipeFd[0]); - close(pipeFd[1]); - return LOS_NOK; -} - -VOID ItStdlibPoll003(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/io_test.cpp b/testsuites/unittest_old/IO/io_test.cpp deleted file mode 100644 index 186effd3..00000000 --- a/testsuites/unittest_old/IO/io_test.cpp +++ /dev/null @@ -1,537 +0,0 @@ -/* - * 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. - */ -#include -#include - -#include "It_test_IO.h" - -char *g_ioTestPath = "/storage"; - -using namespace testing::ext; -namespace OHOS { -class IoTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: IT_TEST_IO_005 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItTestIo005, TestSize.Level0) -{ - ItTestIo005(); -} - -#ifdef LOSCFG_USER_TEST_FS_JFFS -/* * - * @tc.name: IT_TEST_IO_008 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItTestIo008, TestSize.Level0) -{ - ItTestIo008(); -} -#endif - - -/* * - * @tc.name: IT_TEST_IO_010 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItTestIo010, TestSize.Level0) -{ - ItTestIo010(); -} - -/* * - * @tc.name: IT_TEST_IO_013 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItTestIo013, TestSize.Level0) -{ - ItTestIo013(); -} -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: IO_TEST_PSELECT_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_PSELECT_001, TestSize.Level0) -{ - IO_TEST_PSELECT_001(); -} - -/* * - * @tc.name: IO_TEST_PSELECT_002 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_PSELECT_002, TestSize.Level0) -{ - IO_TEST_PSELECT_002(); -} - -/* * - * @tc.name: IO_TEST_PPOLL_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_PPOLL_001, TestSize.Level0) -{ - IO_TEST_PPOLL_001(); -} - -/* * - * @tc.name: IO_TEST_PPOLL_002 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_PPOLL_002, TestSize.Level0) -{ - IO_TEST_PPOLL_002(); -} - -/* * - * @tc.name: IO_TEST_PPOLL_003 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_PPOLL_003, TestSize.Level0) -{ - IO_TEST_PPOLL_003(); -} - -/* * - * @tc.name: IO_TEST_EPOLL_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ - -HWTEST_F(IoTest, IO_TEST_EPOLL_001, TestSize.Level0) -{ - IO_TEST_EPOLL_001(); -} - -/* * - * @tc.name: IO_TEST_EPOLL_002 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_EPOLL_002, TestSize.Level0) -{ - IO_TEST_EPOLL_002(); -} - -/* * - * @tc.name: IT_STDLIB_POLL_002 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdlibPoll002, TestSize.Level0) -{ - ItStdlibPoll002(); -} - -/* * - * @tc.name: IT_STDLIB_POLL_003 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdlibPoll003, TestSize.Level0) -{ - ItStdlibPoll003(); -} - -/* * - * @tc.name: IT_STDIO_PUTWC_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdioPutwc001, TestSize.Level0) -{ - ItStdioPutwc001(); -} - -/* * - * @tc.name: IT_STDIO_READV_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdioReadv001, TestSize.Level0) -{ - ItStdioReadv001(); -} - -/* * - * @tc.name: IT_STDIO_RINDEX_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdioRindex001, TestSize.Level0) -{ - ItStdioRindex001(); -} - -/* * - * @tc.name: IT_STDIO_SETLOGMASK_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdioSetlogmask001, TestSize.Level0) -{ - ItStdioSetlogmask001(); -} - -/* * - * @tc.name: IT_STDLIB_GCVT_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdlibGcvt001, TestSize.Level0) -{ - ItStdlibGcvt001(); -} - -/* * - * @tc.name: IT_LOCALE_LOCALECONV_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItLocaleLocaleconv001, TestSize.Level0) -{ - ItLocaleLocaleconv001(); -} - -/* * - * @tc.name: IT_STDIO_FPUTWS_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdioFputws001, TestSize.Level0) -{ - ItStdioFputws001(); -} - -/* * - * @tc.name: IT_STDIO_FWPRINTF_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdioFwprintf001, TestSize.Level0) -{ - ItStdioFwprintf001(); -} - -/* * - * @tc.name: IT_STDIO_GETC_UNLOCKED_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdioGetcUnlocked001, TestSize.Level0) -{ - ItStdioGetcUnlocked001(); -} - -/* * - * @tc.name: IT_STDIO_MBLEN_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdioMblen001, TestSize.Level0) -{ - ItStdioMblen001(); -} - -/* * - * @tc.name: IT_STDIO_MBRLEN_001 - * @tc.desc: function for IoTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, ItStdioMbrlen001, TestSize.Level0) -{ - ItStdioMbrlen001(); -} - -/* * - * @tc.name: IT_STDIO_HASMNTOPT_001 - * @tc.desc: function for IoTest-normal testcase - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IT_STDIO_HASMNTOPT_001, TestSize.Level0) -{ - IT_STDIO_HASMNTOPT_001(); -} - -/* * - * @tc.name: IO_TEST_DUPLOCALE_001 - * @tc.desc: function for IoTest-dup the locale global pointer - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_DUPLOCALE_001, TestSize.Level0) -{ - IO_TEST_DUPLOCALE_001(); -} - -/* * - * @tc.name: IO_TEST_NL_LANGINFO_001 - * @tc.desc: function for IoTest-normal testcase - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_NL_LANGINFO_001, TestSize.Level0) -{ - IO_TEST_NL_LANGINFO_001(); -} - -/* * - * @tc.name: IO_TEST_STRCASECMP_L_001 - * @tc.desc: function for IoTest-normal testcase - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_STRCASECMP_L_001, TestSize.Level0) -{ - IO_TEST_STRCASECMP_L_001(); -} - -/* * - * @tc.name: IO_TEST_STRCASECMP_L_002 - * @tc.desc: function for IoTest-normal testcase - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_STRCASECMP_L_002, TestSize.Level0) -{ - IO_TEST_STRCASECMP_L_002(); -} - -/* * - * @tc.name: IO_TEST_STRNCASECMP_L_001 - * @tc.desc: function for IoTest-normal testcase - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_STRNCASECMP_L_001, TestSize.Level0) -{ - IO_TEST_STRNCASECMP_L_001(); -} - -/* * - * @tc.name: IO_TEST_STRNCASECMP_L_002 - * @tc.desc: function for IoTest-normal testcase - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_STRNCASECMP_L_002, TestSize.Level0) -{ - IO_TEST_STRNCASECMP_L_002(); -} - -/* * - * @tc.name: IO_TEST_NL_LANGINFO_l_001 - * @tc.desc: function for IoTest-query language and locale information - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_NL_LANGINFO_l_001, TestSize.Level0) -{ - IO_TEST_NL_LANGINFO_l_001(); -} - -/* * - * @tc.name: IO_TEST_DNGETTEXT_001 - * @tc.desc: function for IoTest-print the translated string1 or string2 - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_DNGETTEXT_001, TestSize.Level0) -{ - IO_TEST_DNGETTEXT_001(); -} - -/* * - * @tc.name: IO_TEST_DNGETTEXT_002 - * @tc.desc: function for IoTest-innormal testcases - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_DNGETTEXT_002, TestSize.Level0) -{ - IO_TEST_DNGETTEXT_002(); -} - -/* * - * @tc.name: IO_TEST_DCNGETTEXT_001 - * @tc.desc: function for IoTest-print the translated string1 or string2 with locale parameter - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_DCNGETTEXT_001, TestSize.Level0) -{ - IO_TEST_DCNGETTEXT_001(); -} - -/* * - * @tc.name: IO_TEST_DCNGETTEXT_002 - * @tc.desc: function for IoTest-innormal testcases - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_DCNGETTEXT_002, TestSize.Level0) -{ - IO_TEST_DCNGETTEXT_002(); -} -/* * - * @tc.name: IO_TEST_DCGETTEXT_001 - * @tc.desc: function for IoTest-print the translated string with locale parameter - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_DCGETTEXT_001, TestSize.Level0) -{ - IO_TEST_DCGETTEXT_001(); -} - -/* * - * @tc.name: IO_TEST_DCGETTEXT_002 - * @tc.desc: function for IoTest-innormal testcases - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_DCGETTEXT_002, TestSize.Level0) -{ - IO_TEST_DCGETTEXT_002(); -} - -/* * - * @tc.name: IO_TEST_GETTEXT_001 - * @tc.desc: function for IoTest-normal testcases - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_GETTEXT_001, TestSize.Level0) -{ - IO_TEST_GETTEXT_001(); -} - -/* * - * @tc.name: IO_TEST_LOCALE_001 - * @tc.desc: function for IoTest-normal testcases - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_LOCALE_001, TestSize.Level0) -{ - IO_TEST_LOCALE_001(); -} - -/* * - * @tc.name: IO_TEST_LOCALE_002 - * @tc.desc: function for IoTest-innormal testcases - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_LOCALE_002, TestSize.Level0) -{ - IO_TEST_LOCALE_002(); -} - -/* * - * @tc.name: IO_TEST_STRFMON_L_001 - * @tc.desc: function for IoTest-normal testcases - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_STRFMON_L_001, TestSize.Level0) -{ - IO_TEST_STRFMON_L_001(); -} - -/* * - * @tc.name: IO_TEST_STRFMON_L_002 - * @tc.desc: function for IoTest-innormal testcases - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_STRFMON_L_002, TestSize.Level0) -{ - IO_TEST_STRFMON_L_002(); -} - -/* * - * @tc.name: IO_TEST_NGETTEXT_001 - * @tc.desc: function for IoTest-normal testcases - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(IoTest, IO_TEST_NGETTEXT_001, TestSize.Level0) -{ - IO_TEST_NGETTEXT_001(); -} - -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/IO/smoke/IO_test_005.cpp b/testsuites/unittest_old/IO/smoke/IO_test_005.cpp deleted file mode 100644 index 9ba58578..00000000 --- a/testsuites/unittest_old/IO/smoke/IO_test_005.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - -static UINT32 Testcase(VOID) -{ - INT32 i = 0; - wchar_t str[] = L"ABCDEFG"; - wchar_t str2[] = L"abcdefg"; - wchar_t c[20]; - - wctype_t check = wctype("upper"); - wctrans_t trans = wctrans("tolower"); - - while (str[i]) { - c[i] = str[i]; - if (iswctype(c[i], check)) { - c[i] = towctrans(c[i], trans); - } - if (c[i] != str2[i]) { - goto EXIT; - } - i++; - } - - return 0; -EXIT: - return -1; -} - - -VOID ItTestIo005(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/smoke/IO_test_008.cpp b/testsuites/unittest_old/IO/smoke/IO_test_008.cpp deleted file mode 100644 index ed785892..00000000 --- a/testsuites/unittest_old/IO/smoke/IO_test_008.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - -static INT32 Vdpfunc(int fd, char *format, ...) -{ - va_list aptr; - INT32 ret; - - va_start(aptr, format); - ret = vdprintf(fd, format, aptr); - va_end(aptr); - - return ret; -} - -static UINT32 Testcase(VOID) -{ - CHAR file[30] = "/jffs0/vdprintf"; - CHAR *str1 = "123456789"; - CHAR buffer[20]; - INT32 ret, fd; - CHAR str[20] = "789"; - const int testBufLen = 20; - - fd = open(file, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = Vdpfunc(fd, "%s%s", "123456", str); - if (ret < 0) { - goto EXIT1; - } - - ret = close(fd); - - fd = open(file, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - read(fd, buffer, testBufLen); - close(fd); - - ICUNIT_GOTO_STRING_EQUAL(buffer, str1, buffer, EXIT2); - - unlink(file); - return (0); -EXIT1: - close(fd); -EXIT2: - unlink(file); -EXIT: - return -1; -} - -VOID ItTestIo008(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/smoke/IO_test_010.cpp b/testsuites/unittest_old/IO/smoke/IO_test_010.cpp deleted file mode 100644 index b9189faf..00000000 --- a/testsuites/unittest_old/IO/smoke/IO_test_010.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - - -static VOID GetWideMatches(const wchar_t *str, const wchar_t *format, ...) -{ - va_list args; - - va_start(args, format); - vswscanf(str, format, args); - va_end(args); -} - -static UINT32 Testcase(VOID) -{ - INT32 val, ret; - wchar_t buf[100]; // 100, buffer size - wchar_t *str = L"bottles"; - - GetWideMatches(L"99 bottles of beer on the wall", L" %d %ls ", &val, buf); - ret = wcscmp(buf, str); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return -1; -} - -VOID ItTestIo010(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IO/smoke/IO_test_013.cpp b/testsuites/unittest_old/IO/smoke/IO_test_013.cpp deleted file mode 100644 index 9b2763c4..00000000 --- a/testsuites/unittest_old/IO/smoke/IO_test_013.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ -#include "It_test_IO.h" - -static UINT32 Testcase(VOID) -{ - INT32 val, ret, result; - wchar_t buf[200]; - wchar_t *str = L"helloworld"; - - swscanf(str, L"%ls", buf); - - ret = wcscmp(buf, str); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return -1; -} - -VOID ItTestIo013(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IPC/BUILD.gn b/testsuites/unittest_old/IPC/BUILD.gn deleted file mode 100644 index 7c7dbfa8..00000000 --- a/testsuites/unittest_old/IPC/BUILD.gn +++ /dev/null @@ -1,76 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../common/include", - "../IPC", -] - -sources_entry = [ - "../common/osTest.cpp", - "ipc_test.cpp", -] - -sources_smoke = [] - -sources_full = [ - "full/IPC_test_mkfifoat_001.cpp", - "full/IPC_test_mkfifoat_002.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_ipc_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_ipc_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_old/IPC/It_test_IPC.h b/testsuites/unittest_old/IPC/It_test_IPC.h deleted file mode 100644 index c9fd393f..00000000 --- a/testsuites/unittest_old/IPC/It_test_IPC.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_IPC_H -#define _IT_TEST_IPC_H - -#include "osTest.h" -#include "stdio.h" -#include "stdlib.h" -#include "unistd.h" -#include "string.h" -#include "termios.h" -#include "sys/types.h" -#include "sys/stat.h" -#include "fcntl.h" -#include "locale.h" -#include "wctype.h" -#include "wchar.h" -#include "stdarg.h" -#include "semaphore.h" -#include "ftw.h" -#include "aio.h" -#include "shadow.h" -#include "pty.h" -#include "dirent.h" -#include "poll.h" -#include "grp.h" -#include "pwd.h" -#include "sys/uio.h" -#include "syslog.h" - -extern int CloseRmAllFile(int fd[], char filePathName[][50], int cnt); -extern char *g_IoTestPath; - -extern VOID IPC_TEST_MKFIFOAT_001(VOID); -extern VOID IPC_TEST_MKFIFOAT_002(VOID); - -#endif diff --git a/testsuites/unittest_old/IPC/full/IPC_test_mkfifoat_001.cpp b/testsuites/unittest_old/IPC/full/IPC_test_mkfifoat_001.cpp deleted file mode 100644 index ae69b882..00000000 --- a/testsuites/unittest_old/IPC/full/IPC_test_mkfifoat_001.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ -#include "It_test_IPC.h" -#include -#include - -#define PATHNAME_FIFO "./fifo.test" -#define PATHNAME_FIFO_FULL "/dev/fifo.test" - -static UINT32 testcase1(VOID) -{ - int ret = 0; - char *dirname = "/dev"; - DIR *dir = NULL; - int fdDir = 0; - - errno = 0; - dir = opendir(dirname); - fdDir = dirfd(dir); - TEST_PRINT("[INFO]%s:%d,%s,fdDir=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fdDir, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fdDir, -1, fdDir, OUT); - - errno = 0; - ret = mkfifoat(fdDir, PATHNAME_FIFO, 0777); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - /* remove the pipe file created in order to ensure to run the testcase again. */ - errno = 0; - ret = remove(PATHNAME_FIFO_FULL); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - close(fdDir); - return LOS_OK; -OUT: - close(fdDir); - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); - - return LOS_OK; -} - -VOID IPC_TEST_MKFIFOAT_001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IPC/full/IPC_test_mkfifoat_002.cpp b/testsuites/unittest_old/IPC/full/IPC_test_mkfifoat_002.cpp deleted file mode 100644 index 8432e140..00000000 --- a/testsuites/unittest_old/IPC/full/IPC_test_mkfifoat_002.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -#include "It_test_IPC.h" -#include -#include - -#define PATHNAME_FIFO "./fifo.test" -#define PATHNAME_FIFO_FULL "/dev/fifo.test" -#define PATHNAME_ENOTDIR FILEPATH_775 - -static UINT32 testcase1(VOID) -{ - int ret = 0; - int fdDir = 0; - - errno = 0; - fdDir = open(PATHNAME_ENOTDIR, O_RDWR, 0666); - TEST_PRINT("[INFO]%s:%d,%s,fdDir=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fdDir, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fdDir, -1, fdDir, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - errno = 0; - ret = mkfifoat(fdDir, PATHNAME_FIFO, 0777); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, ENOTDIR, errno, OUT); - - close(fdDir); - return LOS_OK; -OUT: - close(fdDir); - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); - - return LOS_OK; -} - -VOID IPC_TEST_MKFIFOAT_002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/IPC/ipc_test.cpp b/testsuites/unittest_old/IPC/ipc_test.cpp deleted file mode 100644 index 95b89e56..00000000 --- a/testsuites/unittest_old/IPC/ipc_test.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ -#include -#include - -#include "It_test_IPC.h" - -using namespace testing::ext; -namespace OHOS { -class IoTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: IPC_TEST_MKFIFOAT_001 - * @tc.desc: function for IoTest:mkfifoat-normal test - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -#if 0 -HWTEST_F(IoTest, IPC_TEST_MKFIFOAT_001, TestSize.Level0) -{ - IPC_TEST_MKFIFOAT_001(); -} -#endif - -/* * - * @tc.name: IPC_TEST_MKFIFOAT_002 - * @tc.desc: function for IoTest:mkfifoat-innormal test - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -#if 0 -HWTEST_F(IoTest, IPC_TEST_MKFIFOAT_002, TestSize.Level0) -{ - IPC_TEST_MKFIFOAT_002(); -} -#endif -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/common/include/iCunit.h b/testsuites/unittest_old/common/include/iCunit.h deleted file mode 100644 index a8fa009c..00000000 --- a/testsuites/unittest_old/common/include/iCunit.h +++ /dev/null @@ -1,401 +0,0 @@ -/* - * 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. - */ -#ifndef _UNI_ICUNIT_H -#define _UNI_ICUNIT_H - -#include -#include -#include "los_typedef.h" -#include -#include - -typedef unsigned short iUINT16; -typedef unsigned int iUINT32; -typedef signed short iINT16; -typedef signed long iINT32; -typedef char iCHAR; -typedef void iVOID; - -typedef unsigned long iiUINT32; - - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -#define ICUNIT_SUCCESS 0x00000000 - -#define FUNCTION_TEST (1 << 0) - -#define PRESSURE_TEST (1 << 1) - -#define PERFORMANCE_TEST (1 << 2) - -#define TEST_MODE (FUNCTION_TEST) - -#define TEST_LESSER_MEM 0 - -#define TEST_ADD_CASE(string, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION) \ - do { \ - UINT32 ret; \ - ret = TestCase(); \ - ASSERT_EQ(ret, LOS_OK); \ - } while (0) - -#if 1 -/* * - * 跟踪paramå’Œvalueä¸åŒï¼Œä¸åšä»»ä½•å¤„ç† - */ -#define ICUNIT_TRACK_EQUAL(param, value, retcode) \ - do { \ - if ((param) != (value)) { \ - EXPECT_EQ((long)(value), (long)(param)); \ - } \ - } while (0) - -/* * - * 跟踪paramå’Œvalue相åŒï¼Œä¸åšä»»ä½•å¤„ç† - */ -#define ICUNIT_TRACK_NOT_EQUAL(param, value, retcode) \ - do { \ - if ((param) == (value)) { \ - EXPECT_NE((long)(value), (long)(param)); \ - } \ - } while (0) - - -#define ICUNIT_ASSERT_NOT_EQUAL_NULL(param, value, retcode) \ - do { \ - if ((param) == (value)) { \ - EXPECT_NE((long)(value), (long)(param)); \ - return NULL; \ - } \ - } while (0) - - -#define ICUNIT_ASSERT_EQUAL_NULL(param, value, retcode) \ - do { \ - if ((param) != (value)) { \ - EXPECT_EQ((long)(value), (long)(param)); \ - return NULL; \ - } \ - } while (0) - - -/* * - * 断言paramå’Œvalue相åŒï¼Œä¸åŒåˆ™return - */ -#define ICUNIT_ASSERT_EQUAL_VOID(param, value, retcode) \ - do { \ - if ((param) != (value)) { \ - EXPECT_EQ((long)(value), (long)(param)); \ - return; \ - } \ - } while (0) - - -/* * - * 断言paramå’Œvalueä¸åŒï¼Œç›¸åŒåˆ™return - */ -#define ICUNIT_ASSERT_NOT_EQUAL_VOID(param, value, retcode) \ - do { \ - if ((param) == (value)) { \ - EXPECT_NE((long)(value), (long)(param)); \ - return; \ - } \ - } while (0) - -#define ICUNIT_ASSERT_EQUAL(param, value, retcode) \ - do { \ - if ((param) != (value)) { \ - EXPECT_EQ((long)(param), (long)(value)); \ - return 1; \ - } \ - } while (0) - - -#define ICUNIT_ASSERT_TWO_EQUAL(param, value1, value2, retcode) \ - do { \ - if (((param) != (value1)) && ((param) != (value2))) { \ - EXPECT_EQ((long)(value1), (long)(param)); \ - EXPECT_EQ((long)(value2), (long)(param)); \ - return 1; \ - } \ - } while (0) - -/* * - * 判断param等于value1或value2,ä¸ç­‰åˆ™è·³è½¬åˆ°label处 - */ -#define ICUNIT_GOTO_TWO_EQUAL(param, value1, value2, retcode, label) \ - do { \ - if (((param) != (value1)) && ((param) != (value2))) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - goto label; \ - } \ - } while (0) - -/* * - * 断言paramå’Œvalueä¸åŒï¼Œç›¸åŒåˆ™return - */ -#define ICUNIT_ASSERT_NOT_EQUAL(param, value, retcode) \ - do { \ - if ((param) == (value)) { \ - EXPECT_NE(retcode, retcode); \ - return 1; \ - } \ - } while (0) -/* * - * 断言paramä¸åœ¨value1å’Œvalue2之间就return - */ -#define ICUNIT_ASSERT_WITHIN_EQUAL(param, value1, value2, retcode) \ - do { \ - if ((param) < (value1) || (param) > (value2)) { \ - EXPECT_GE((long)(param), (long)(value1)); \ - EXPECT_LE((long)(param), (long)(value2)); \ - return 1; \ - } \ - } while (0) - - -/* * - * 断言param是å¦åœ¨ä¸€å®šèŒƒå›´å†…,ä¸åœ¨åˆ™return - */ -#define ICUNIT_ASSERT_WITHIN_EQUAL_VOID(param, value1, value2, retcode) \ - do { \ - if ((param) < (value1) || (param) > (value2)) { \ - EXPECT_GE((long)(param), (long)(value1)); \ - EXPECT_LE((long)(param), (long)(value2)); \ - return; \ - } \ - } while (0) - - -/* * - * 断言param是å¦åœ¨ä¸€å®šèŒƒå›´å†…,ä¸åœ¨åˆ™return - */ -#define ICUNIT_ASSERT_WITHIN_EQUAL_NULL(param, value1, value2, retcode) \ - do { \ - if ((param) < (value1) || (param) > (value2)) { \ - EXPECT_GE((long)(param), (long)(value1)); \ - EXPECT_LE((long)(param), (long)(value2)); \ - return NULL; \ - } \ - } while (0) - - -/* * - * 断言指定个数str1å’Œstr2字符串内容相åŒï¼Œä¸åŒåˆ™return - */ - -#define ICUNIT_ASSERT_SIZE_STRING_EQUAL(str1, str2, strsize, retcode) \ - do { \ - if (strncmp((str1), (str2), (strsize)) != 0) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - return 1; \ - } \ - } while (0) - - -/* * - * 判断paramå’Œvalue是å¦ç›¸åŒï¼Œä¸åŒåˆ™è·³è½¬åˆ°label处 - */ -#define ICUNIT_ASSERT_EQUAL_TIME(param, value, retcode, label) \ - do { \ - if ((param) < (value - 1) || (param) > (value + 1)) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - goto label; \ - } \ - } while (0) - - -#if 1 -/* * - * 断言指定个数str1å’Œstr2字符串内容相åŒï¼Œä¸åŒåˆ™return - */ -#define ICUNIT_ASSERT_SIZE_STRING_EQUAL_VOID(str1, str2, size, retcode) \ - do { \ - if (strncmp(str1, str2, size) != 0) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - return; \ - } \ - } while (0) - -/* * - * 断言指定个数str1å’Œstr2字符串内容ä¸åŒï¼Œç›¸åŒåˆ™return - */ -#define ICUNIT_ASSERT_SIZE_STRING_NOT_EQUAL(str1, str2, size, retcode) \ - do { \ - if (strncmp(str1, str2, size) == 0) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - return 1; \ - } \ - } while (0) -#endif - -/* * - * 断言str1å’Œstr2字符串内容相åŒï¼Œä¸åŒåˆ™return - */ -#define ICUNIT_ASSERT_STRING_EQUAL(str1, str2, retcode) \ - do { \ - if (strcmp(str1, str2) != 0) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - return 1; \ - } \ - } while (0) - -/* * - * 断言str1å’Œstr2字符串内容相åŒï¼Œä¸åŒåˆ™return - */ -#define ICUNIT_ASSERT_STRING_EQUAL_VOID(str1, str2, retcode) \ - do { \ - if (strcmp(str1, str2) != 0) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - return; \ - } \ - } while (0) - -#define ICUNIT_ASSERT_STRING_EQUAL_RET(str1, str2, retcode, ret) \ - do { \ - if (strcmp(str1, str2) != 0) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - return (ret); \ - } \ - } while (0) - -/* * - * 断言str1å’Œstr2字符串内容ä¸åŒï¼Œç›¸åŒåˆ™return - */ -#define ICUNIT_ASSERT_STRING_NOT_EQUAL(str1, str2, retcode) \ - do { \ - if (strcmp(str1, str2) == 0) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - return 1; \ - } \ - } while (0) - -/* * - * 判断paramå’Œvalue是å¦ç›¸åŒï¼Œä¸åŒåˆ™è·³è½¬åˆ°label处 - */ -#define ICUNIT_GOTO_EQUAL(param, value, retcode, label) \ - do { \ - if ((param) != (value)) { \ - EXPECT_EQ((long)(value), (long)(param)); \ - goto label; \ - } \ - } while (0) - - -#define ICUNIT_GOTO_EQUAL_IN(param, value1, value2, retcode, label) \ - do { \ - if (((param) != (value1)) && ((param) != (value2))) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - goto label; \ - } \ - } while (0) - -/* * - * 判断paramå’Œvalue是å¦ä¸åŒï¼Œç›¸åŒåˆ™è·³è½¬åˆ°label处 - */ -#define ICUNIT_GOTO_NOT_EQUAL(param, value, retcode, label) \ - do { \ - if ((param) == (value)) { \ - EXPECT_NE((long)(value), (long)(param)); \ - goto label; \ - } \ - } while (0) - - -#define ICUNIT_GOTO_WITHIN_EQUAL(param, value1, value2, retcode, label) \ - do { \ - if ((param) < (value1) || (param) > (value2)) { \ - EXPECT_GE((long)(param), (long)(value1)); \ - EXPECT_LE((long)(param), (long)(value2)); \ - goto label; \ - } \ - } while (0) - - -/* * - * 判断str1å’Œstr2是å¦ç›¸åŒï¼Œä¸åŒåˆ™è·³è½¬åˆ°label处 - */ -#define ICUNIT_GOTO_STRING_EQUAL(str1, str2, retcode, label) \ - do { \ - if (strcmp(str1, str2) != 0) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - goto label; \ - } \ - } while (0) - - -/* * - * 判断str1å’Œstr2是å¦ä¸åŒï¼Œç›¸åŒåˆ™è·³è½¬åˆ°label处 - */ -#define ICUNIT_GOTO_STRING_NOT_EQUAL(str1, str2, retcode, label) \ - do { \ - if (strcmp(str1, str2) == 0) { \ - EXPECT_NE((long)(retcode), (long)(retcode)); \ - goto label; \ - } \ - } while (0) - -/* * - * 跟踪paramå’Œvalueä¸åŒï¼Œä¸åšä»»ä½•å¤„ç† - */ -#define ICUNIT_ASSERT_EQUAL_EXIT(param, value, exitcode) \ - do { \ - if ((param) != (value)) { \ - EXPECT_EQ((long)(value), (long)(param)); \ - exit(exitcode); \ - } \ - } while (0) - -#define ICUNIT_ASSERT_NOT_EQUAL_NULL_VOID(param, value, retcode) \ - do { \ - if ((param) == (value)) { \ - EXPECT_NE((long)(value), (long)(param)); \ - return NULL; \ - } \ - } while (0) - -#define ICUNIT_ASSERT_EQUAL_NULL_VOID(param, value, retcode) \ - do { \ - if ((param) != (value)) { \ - EXPECT_EQ((long)(value), (long)(param)); \ - return NULL; \ - } \ - } while (0) - -#endif - -#endif /* _UNI_ICUNIT_H */ diff --git a/testsuites/unittest_old/common/include/los_typedef.h b/testsuites/unittest_old/common/include/los_typedef.h deleted file mode 100644 index 44ab2d8e..00000000 --- a/testsuites/unittest_old/common/include/los_typedef.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * 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. - */ - -/* * - * @defgroup los_typedef Type define - * @ingroup kernel - */ - -#ifndef _LOS_TYPEDEF_H -#define _LOS_TYPEDEF_H - -#include "stddef.h" -#include "stdbool.h" -#include "stdint.h" - - -#define OS_STRING(x) #x -#define X_STRING(x) OS_STRING(x) - -/* type definitions */ -typedef unsigned char UINT8; -typedef unsigned short UINT16; -typedef unsigned int UINT32; -typedef signed char INT8; -typedef signed short INT16; -typedef signed int INT32; -typedef float FLOAT; -typedef double DOUBLE; -typedef char CHAR; -typedef unsigned long u_long; -typedef u_long ULong; -typedef long Long; - -#ifdef __LP64__ -typedef long unsigned int UINT64; -typedef long signed int INT64; -typedef unsigned long UINTPTR; -typedef signed long INTPTR; -#else -typedef unsigned long long UINT64; -typedef signed long long INT64; -typedef unsigned int UINTPTR; -typedef signed int INTPTR; -#endif - -#ifdef __LP64__ -typedef __uint128_t UINT128; -typedef INT64 ssize_t; -typedef UINT64 size_t; -#define LOSCFG_AARCH64 -#else -typedef INT32 ssize_t; -typedef UINT32 size_t; -#endif - -typedef UINTPTR AARCHPTR; -typedef size_t BOOL; - -#define VOID void -#define STATIC static - -#ifndef FALSE -#define FALSE 0U -#endif - -#ifndef TRUE -#define TRUE 1U -#endif - -#ifndef NULL -#define NULL ((VOID *)0) -#endif - -#define OS_NULL_BYTE ((UINT8)0xFF) -#define OS_NULL_SHORT ((UINT16)0xFFFF) -#define OS_NULL_INT ((UINT32)0xFFFFFFFF) - -#ifndef USER -#define USER -#endif - -#ifndef LOS_OK -#define LOS_OK 0 -#endif - -#ifndef LOS_NOK -#define LOS_NOK 1 -#endif - -#ifndef LOS_EPERM -#define LOS_EPERM 1 -#endif - -#ifndef LOS_ESRCH -#define LOS_ESRCH 3 -#endif - -#ifndef LOS_ECHILD -#define LOS_ECHILD 10 -#endif - -#ifndef LOS_EINVAL -#define LOS_EINVAL 22 -#endif - -#ifndef LOS_EOPNOTSUPP -#define LOS_EOPNOTSUPP 95 -#endif - -#define OS_FAIL 1 -#define OS_ERROR (UINT32)(-1) -#define OS_INVALID (UINT32)(-1) -#define OS_INVALID_VALUE ((UINT32)0xFFFFFFFF) - -#define asm __asm -#ifdef typeof -#undef typeof -#endif -#define typeof __typeof__ - -#ifndef LOS_LABEL_DEFN -#define LOS_LABEL_DEFN(label) label -#endif - -#ifndef LOSARC_ALIGNMENT -#define LOSARC_ALIGNMENT 8 -#endif -/* And corresponding power of two alignment */ -#ifndef LOSARC_P2ALIGNMENT -#ifdef LOSCFG_AARCH64 -#define LOSARC_P2ALIGNMENT 3 -#else -#define LOSARC_P2ALIGNMENT 2 -#endif -#endif - -#define PAGE_SIZE_SHIFT (12) - -#ifndef PAGE_SIZE -#define PAGE_SIZE (1UL << PAGE_SIZE_SHIFT) -#endif -#define USER_PAGE_SIZE (1UL << 12) - -#if ARM64_CPU_CORTEX_A53 || ARM64_CPU_CORTEX_A57 || ARM64_CPU_CORTEX_A72 -#define CACHE_LINE 64 -#else -#define CACHE_LINE 32 -#endif - -typedef int status_t; -typedef unsigned long vaddr_t; -typedef unsigned long paddr_t; -typedef unsigned int uint; -typedef unsigned long pte_t; - -/* Give a type or object explicit minimum alignment */ -#if !defined(LOSBLD_ATTRIB_ALIGN) -#define LOSBLD_ATTRIB_ALIGN(__align__) __attribute__((aligned(__align__))) -#endif - -/* Assign a defined variable to a specific section */ -#if !defined(LOSBLD_ATTRIB_SECTION) -#define LOSBLD_ATTRIB_SECTION(__sect__) __attribute__((section(__sect__))) -#endif - -/* - * Tell the compiler not to throw away a variable or function. Only known - * available on 3.3.2 or above. Old version's didn't throw them away, - * but using the unused attribute should stop warnings. - */ -#define LOSBLD_ATTRIB_USED __attribute__((used)) - - -#endif /* _LOS_TYPEDEF_H */ diff --git a/testsuites/unittest_old/common/include/osTest.h b/testsuites/unittest_old/common/include/osTest.h deleted file mode 100644 index f9c037e2..00000000 --- a/testsuites/unittest_old/common/include/osTest.h +++ /dev/null @@ -1,498 +0,0 @@ -/* - * 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. - */ - -#ifndef _OSTEST_H -#define _OSTEST_H - -#ifndef SWTMR_TEST -#define SWTMR_TEST -#endif -#include "iCunit.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "los_typedef.h" -#include "sys/wait.h" -#include "glob.h" -#include "mntent.h" -#include "securectype.h" -#include "securec.h" -#include -#include -#include -#include -#include - -#ifndef OK -#define OK 0 -#endif - -#define dprintf printf -#define ENOERR OK -#define LOSCFG_BASE_CORE_TSK_CONFIG 1024 - -#define USER_PROCESS_PRIORITY_HIGHEST 10 -#define USER_PROCESS_PRIORITY_LOWEST 31 -#define TEST_TASK_PARAM_INIT(stTestTask, task_name, entry, prio) \ - do { \ - (void)memset_s(&stTestTask, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S)); \ - stTestTask.pfnTaskEntry = (TSK_ENTRY_FUNC)entry; \ - stTestTask.uwStackSize = LOS_TASK_MIN_STACK_SIZE; \ - stTestTask.pcName = task_name; \ - stTestTask.usTaskPrio = prio; \ - stTestTask.uwResved = LOS_TASK_STATUS_DETACHED; \ - } while (0) - -#ifdef LOSCFG_KERNEL_SMP -#define TEST_TASK_PARAM_INIT_AFFI(stTestTask, task_name, entry, prio, affi) \ - TEST_TASK_PARAM_INIT(stTestTask, task_name, entry, prio) \ - stTestTask.usCpuAffiMask = affi; -#else -#define TEST_TASK_PARAM_INIT_AFFI(stTestTask, task_name, entry, prio, affi) \ - TEST_TASK_PARAM_INIT(stTestTask, task_name, entry, prio) -#endif -#define JFFS_BASE_MTD_ADDR 0x100000 -#define JFFS_BASE_MTD_LEN 0x600000 - -#define LOS_TASK_MIN_STACK_SIZE 2048 -#define TASK_PRIO_TEST 20 -#ifdef LOSCFG_AARCH64 -#define TASK_STACK_SIZE_TEST (LOS_TASK_MIN_STACK_SIZE * 3) -#else -#define TASK_STACK_SIZE_TEST LOS_TASK_MIN_STACK_SIZE -#endif -#define LOS_MS_PER_TICK (OS_SYS_MS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND) - -#define HWI_NUM_INTVALID OS_HWI_MAX_NUM -#define writel(value, address) WRITE_UINT32(value, address) - -extern UINT32 PrepareFileEnv(CHAR *pathList[], CHAR *streamList[], INT32 streamLen[], INT32 listCnt); -extern UINT32 RecoveryFileEnv(CHAR *pathList[], INT32 listCnt); -extern UINT32 PosixPthreadInit(pthread_attr_t *attr, int pri); -extern UINT32 PosixPthreadDestroy(pthread_attr_t *attr, pthread_t thread); - -extern VOID TaskHold(UINT64 sec); - -extern UINT32 TaskCountGetTest(VOID); -extern UINT32 Sem_Count_Get_Test(VOID); -extern UINT32 QueueCountGetTest(VOID); -extern UINT32 Swtmr_Count_Get_Test(VOID); -extern void hal_interrupt_set_affinity(uint32_t irq, uint32_t cpuMask); - -#define TASK_EXISTED_NUM (TaskCountGetTest()) -#define QUEUE_EXISTED_NUM (QueueCountGetTest()) -#define SWTMR_EXISTED_NUM (Swtmr_Count_Get_Test()) -#define SEM_EXISTED_NUM (Sem_Count_Get_Test()) - -extern void TEST_TEST_HwiDelete(unsigned int irq, void *dev_id); -extern void TEST_HwiTrigger(unsigned int irq); -extern void TestExtraTaskDelay(UINT32 tick); -extern UINT64 TestTickCountGet(void); -extern UINT64 TestTickCountByCurrCpuid(void); -extern void TestBusyTaskDelay(UINT32 tick); -extern void *malloc(size_t size); -extern void TEST_DumpCpuid(void); -extern u_long T_random(void); -extern VOID TestAssertWaitDelay(UINT32 *testCount, UINT32 flag); - -UINT32 LosTaskDelay(UINT32 tick); -#define TEST_HwiDelete(ID) TEST_TEST_HwiDelete(ID, NULL) -#define TEST_HwiClear(ID) HalIrqMask(ID) -#define TEST_HwiTriggerDelay LosTaskDelay(200 * LOSCFG_BASE_CORE_TICK_PER_SECOND / 1000) -#define TEST_HwiCreate(ID, prio, mode, Func, arg) LOS_HwiCreate(ID, prio, mode, Func, arg) - -#if HUAWEI_ENV_NFS -#define NFS_MOUNT_DIR "/nfs" -#define NFS_MAIN_DIR NFS_MOUNT_DIR -#define NFS_PATH_NAME "/nfs/test" -#else -#define NFS_MOUNT_DIR "/nfs" -#define NFS_MAIN_DIR NFS_MOUNT_DIR -#define NFS_PATH_NAME "/nfs/test" -#endif - -#define WIN_MOUNT_PATH "/nfs" -#define WIN_NFS_MOUNT_DIR WIN_MOUNT_PATH -#define WIN_NFS_MAIN_DIR WIN_NFS_MOUNT_DIR -#define WIN_NFS_PATH_NAME "/nfs/test" - -#define HWI_NUM_INT0 0 -#define HWI_NUM_INT1 1 -#define HWI_NUM_INT2 2 -#define HWI_NUM_INT3 3 -#define HWI_NUM_INT4 4 -#define HWI_NUM_INT5 5 -#define HWI_NUM_INT6 6 -#define HWI_NUM_INT7 7 -#define HWI_NUM_INT11 11 -#define HWI_NUM_INT12 12 -#define HWI_NUM_INT13 13 -#define HWI_NUM_INT14 14 -#define HWI_NUM_INT15 15 -#define HWI_NUM_INT16 16 -#define HWI_NUM_INT17 17 -#define HWI_NUM_INT18 18 -#define HWI_NUM_INT19 19 -#define HWI_NUM_INT21 21 -#define HWI_NUM_INT22 22 -#define HWI_NUM_INT23 23 -#define HWI_NUM_INT24 24 -#define HWI_NUM_INT25 25 -#define HWI_NUM_INT26 26 -#define HWI_NUM_INT27 27 -#define HWI_NUM_INT28 28 -#define HWI_NUM_INT30 30 -#define HWI_NUM_INT31 31 -#define HWI_NUM_INT32 32 -#define HWI_NUM_INT33 33 -#define HWI_NUM_INT34 34 -#define HWI_NUM_INT35 35 -#define HWI_NUM_INT42 42 -#define HWI_NUM_INT45 45 -#define HWI_NUM_INT46 46 -#define HWI_NUM_INT50 50 -#define HWI_NUM_INT55 55 -#define HWI_NUM_INT56 56 -#define HWI_NUM_INT57 57 -#define HWI_NUM_INT58 58 -#define HWI_NUM_INT59 59 -#define HWI_NUM_INT60 60 -#define HWI_NUM_INT61 61 -#define HWI_NUM_INT63 63 -#define HWI_NUM_INT62 62 -#define HWI_NUM_INT68 68 -#define HWI_NUM_INT69 69 - -#define HWI_NUM_INT95 95 -#define HWI_NUM_INT114 114 -#define HWI_NUM_INT169 169 - -#if defined TESTPBXA9 -#define HWI_NUM_TEST HWI_NUM_INT56 -#define HWI_NUM_TEST1 HWI_NUM_INT57 -#define HWI_NUM_TEST0 HWI_NUM_INT58 -#define HWI_NUM_TEST2 HWI_NUM_INT59 -#define HWI_NUM_TEST3 HWI_NUM_INT60 -#elif defined TEST3518EV300 -#define HWI_NUM_TEST0 HWI_NUM_INT58 -#define HWI_NUM_TEST HWI_NUM_INT59 -#define HWI_NUM_TEST1 HWI_NUM_INT60 -#define HWI_NUM_TEST2 HWI_NUM_INT61 -#define HWI_NUM_TEST3 HWI_NUM_INT68 -#elif defined TEST3516DV300 -#define HWI_NUM_TEST HWI_NUM_INT56 -#define HWI_NUM_TEST1 HWI_NUM_INT57 -#define HWI_NUM_TEST0 HWI_NUM_INT58 -#define HWI_NUM_TEST2 HWI_NUM_INT59 -#define HWI_NUM_TEST3 HWI_NUM_INT60 -#endif - -#define TEST_TASKDELAY_1TICK 1 -#define TEST_TASKDELAY_2TICK 2 -#define TEST_TASKDELAY_4TICK 4 -#define TEST_TASKDELAY_10TICK 10 -#define TEST_TASKDELAY_20TICK 20 -#define TEST_TASKDELAY_50TICK 50 - -#define uart_printf_func printf - -#ifndef VFS_STAT_PRINTF -#define VFS_STAT_PRINTF 0 -#endif - -#ifndef VFS_STATFS_PRINTF -#define VFS_STATFS_PRINTF 0 -#endif - -#define OPEN_FILE_MAX 20 - -#define HUAWEI_ENV_NFS 0 - -#ifndef TEST_RESOURCELEAK_CHECK -#define TEST_RESOURCELEAK_CHECK 1 -#endif - -#ifndef TEST_MODULE_CHECK -#define TEST_MODULE_CHECK 1 -#endif - -extern UINT32 g_shellTestQueueID; -extern UINT32 g_testCount; -extern UINT32 g_testCount1; -extern UINT32 g_testCount2; -extern UINT32 g_testCount3; -extern UINT32 g_flowcheck; -extern UINT32 g_failResult; -extern UINT32 g_passResult; -extern UINT32 g_testTskHandle; -extern UINT32 g_testTaskID01; -extern UINT32 g_testTaskID02; -extern UINT32 g_testTaskID03; -extern UINT32 g_testTaskID04; -extern UINT32 g_hwiNum1; -extern UINT32 g_hwiNum2; -extern UINT32 g_semID; -extern UINT32 g_semID2; -extern UINT32 g_mutexTest; -extern UINT32 g_cpupTestCount; -extern UINT16 g_swTmrID; -extern UINT32 g_semID; -extern UINT32 g_testQueueID01; -extern UINT32 g_testQueueID02; -extern UINT32 g_testQueueID03; -extern UINT32 g_testTskHandle; -extern UINT32 g_leavingTaskNum; -extern UINT32 g_mAuwTestTaskID[32]; -extern UINT8 g_mUsIndex; -extern UINT32 g_usSemID3[]; -extern UINT32 g_testPeriod; -extern BOOL g_isAddArray; -extern BOOL g_isSpinorInit; -extern BOOL g_isSdInit; -extern UINT32 g_getTickConsume; -extern UINT32 g_waitTestCount; -extern INT32 g_libFilesystem; - -extern UINT32 GetTimer2Value(VOID); -extern int hinand_erase(unsigned long start, unsigned long size); -#define hispinor_erase(start, size) \ - do { \ - struct erase_info opts; \ - struct mtd_info *pstMtd; \ - pstMtd = get_mtd("spinor"); \ - (void)memset_s(&opts, sizeof(opts), 0, sizeof(opts)); \ - opts.addr = start; \ - opts.len = size; \ - pstMtd->erase(pstMtd, &opts); \ - } while (0) -extern void ipc_gmac_init(void); - -extern UINT32 Mem_Consume_Show(void); -extern VOID shell_cmd_register(void); -extern INT32 OsShellCmdSystemInfo(INT32 argc, const CHAR **argv); -extern UINT32 OsShellCmdDumpTask(INT32 argc, const CHAR **argv); -extern UINT32 OsShellCmdTaskCntGet(VOID); -extern UINT32 OsShellCmdSwtmrCntGet(VOID); -extern void msleep(unsigned int msecs); -extern unsigned int sleep(unsigned int seconds); -extern int usleep(unsigned useconds); - -extern VOID ipc_network_init(void); -#ifdef LOSCFG_DRIVERS_MMC -extern INT32 SD_MMC_Host_init(void); -#endif -extern VOID rdk_fs_init(void); -extern VOID jffs2_fs_init(void); -extern VOID ProcFsInit(void); - -extern UINT32 LOS_MemTotalUsedGet(VOID *pool); -extern VOID ptestTickConsume(VOID); -extern UINT32 TEST_TskDelete(UINT32 taskID); -extern UINT32 TEST_SemDelete(UINT32 semHandle); -extern VOID irq_trigger(unsigned int irq); -extern VOID TestPartInit(char *type, UINT32 startAddr, UINT32 length); -extern VOID TestPartDelete(char *type); - -extern VOID TestRunShell(VOID); - -extern VOID It_Usb_AutoTest(VOID); -extern VOID Test_hid_dev_mode(VOID); - -extern UINT32 usbshell_cmd_reg(VOID); -extern void usbshell_queue_control(VOID); -extern UINT32 OsTestInit(VOID); - -extern void TEST_DT_COMMON(void); - -extern void it_process_testcase(void); -extern void it_pthread_testcase(void); -extern void it_mutex_test(void); -extern void it_rwlock_test(void); -extern void it_spinlock_test(void); - -/* Format options (3rd argument of f_mkfs) */ -#define TEST_FM_FAT 0x01 -#define TEST_FM_FAT32 0x02 -#define TEST_FM_EXFAT 0x04 -#define TEST_FM_ANY 0x07 -#define TEST_FM_SFD 0x08 - -#define BIG_FD 512 -typedef struct testrunParam { - CHAR testcase_sequence[16]; - CHAR testcase_num[16]; - CHAR testcase_layer[32]; - CHAR testcase_module[32]; - CHAR testcase_level[16]; - CHAR testcase_type[16]; - CHAR testcase_id[128]; -} TEST_RUN_PARAM; - -typedef enum test_type { - HOST_U, // USB U PERFORMANCE - HOST_MUTIL, // MUTIL - HOST_DISK, // USB DISKPARTION - HOST_HUB, // USB HUB - HOST_ETH, // USB HOST ETH - USB_SMP, - HOST_UVC, // USB HOST UVC - HOST_NULL -} usb_test_type; - - -#define SHELLTEST_QUEUE_BUFSIZE sizeof(TEST_RUN_PARAM) -#ifdef LOSCFG_DRIVERS_USB - -void Test_usb_shellcmd(controller_type ctype, device_type dtype, usb_test_type typetest); -#endif - -extern int Gettid(void); - -/* like the ctime/asctime api, use static buffer, though not thread-safe. */ -static inline const char *Curtime() -{ - struct timespec ts; - struct tm t; - static char buf[32]; - (void)clock_gettime(CLOCK_REALTIME, &ts); - (void)localtime_r(&ts.tv_sec, &t); - (void)sprintf_s(buf, sizeof(buf), "%d-%02d-%02d %02d:%02d:%02d.%06ld", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, - t.tm_min, t.tm_sec, ts.tv_nsec / 1000); - return buf; -} - -#define LogPrintln(fmt, ...) \ - printf("%s [%d] %s:%d " fmt "%c", Curtime(), Gettid(), __FILE__, __LINE__, ##__VA_ARGS__, \ - ('\n' == " " fmt[sizeof(" " fmt) - 2]) ? '\0' : '\n') // trailing newline is auto appended - -#if !_REDIR_TIME64 || defined(__LP64__) -#define TIME_F "ld" -#else -#define TIME_F "lld" -#endif - -static void noprintf (...) -{ - return; -} -#define TEST_PRINT printf - -/* the files with different access privilege used in testcases are define below */ -#define FILEPATH_ENOENT "/storage/test_nosuchfile.txt" -#define FILEPATHLEN_ENOENT (strlen(FILEPATH_ENOENT) +1U) - -#define FILEPATH_NOACCESS "noaccessssssssssssssssssssssssssssssssssssssssssss" -#define FILEPATHLEN_NOACCESS (strlen(FILEPATH_NOACCESS) +1U) - -#define FILEPATH_000 "/storage/test_000.txt" -#define FILEPATHLEN_000 (strlen(FILEPATH_000) +1U) - -#define FILEPATH_775 "/storage/test_775.txt" -#define FILEPATHLEN_775 (strlen(FILEPATH_775) +1U) - -#define FILEPATH_755 "/storage/test_775.txt" -#define FILEPATHLEN_755 (strlen(FILEPATH_755) +1U) - -#define FILEPATH_RELATIVE "./1.txt" -#define FILEPATHLEN_RELATIVE (strlen(FILEPATH_RELATIVE) +1U) - -#define DIRPATH_775 "/storage" - -#define FD_EBADF 513 -#define FD_EFAULT -1000 - -#define PATHNAME_ENAMETOOLONG "ENAMETOOLONG12345678912345678912345678912345678912345678912345678912345678911111\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789\ -12345678912345678912345678913245678912345678912345678913245678913456789123456789" - -#endif /* _OSTEST_H */ diff --git a/testsuites/unittest_old/common/osTest.cpp b/testsuites/unittest_old/common/osTest.cpp deleted file mode 100644 index 3b0ca940..00000000 --- a/testsuites/unittest_old/common/osTest.cpp +++ /dev/null @@ -1,474 +0,0 @@ -/* - * 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. - */ - -#include "osTest.h" -#include -#include - -UINT32 g_shellTestQueueID; -INT32 g_iCunitErrCode = 0; -INT32 g_iCunitErrLineNo = 0; - -UINT32 g_testTskHandle; -UINT32 g_testCount; -UINT32 g_flowcheck = 0; -UINT32 g_failResult = 0; -UINT32 g_passResult = 0; - -#ifdef TEST1980 -UINT32 g_testhwiFlag; -UINT32 g_testCpuMask; -#endif - -UINT32 g_testCount1; -UINT32 g_testCount2; -UINT32 g_testCount3; -UINT32 g_testTaskID01; -UINT32 g_testTaskID02; -UINT32 g_testTaskID03; -UINT32 g_testTaskID04; -UINT32 g_hwiNum1; -UINT32 g_hwiNum2; -UINT32 g_semID; -UINT32 g_semID2; -UINT32 g_mutexTest; -UINT32 g_cpupTestCount; -UINT32 g_waitTestCount; -UINT32 g_testPeriod; - -UINT16 g_swTmrID; -UINT32 g_testQueueID01; -UINT32 g_testQueueID02; -UINT32 g_testQueueID03; -UINT32 g_leavingTaskNum; -UINT32 g_mAuwTestTaskID[32] = {0}; -UINT32 g_getTickConsume = 0; -CHAR g_libcPathname[50] = "/usr/jffs0"; -UINT32 g_testCircleCount = 0; - -UINT32 g_fatFilesystem; -UINT8 g_mUsIndex; - -#if TEST_MODULE_CHECK == 1 - -extern UINT32 g_FailModelResult[]; -extern UINT32 g_PassModelResult[]; -extern UINT32 g_ExecutModelNum[]; -#endif -extern char *StrLayer[]; -extern char *StrLevel[]; -extern char *StrType[]; - -extern char *StrModule[]; -extern UINT32 g_ModelNum; - -#ifdef LOSCFG_USER_TEST_FS_FAT -#define TEST_FAT32 0x02 -#define TEST_EXFAT 0x04 -#endif - -BOOL g_isSpinorInit = FALSE; -BOOL g_isSdInit = FALSE; -BOOL g_isUartDevInit = FALSE; -BOOL g_isTcpipInit = FALSE; -BOOL g_isInitSerial = FALSE; -UINT32 g_vfsCyclesCount = 0; -INT32 g_serialInitFlag = -1; -BOOL g_isAddArray = TRUE; -BOOL g_isUsbInit = FALSE; -BOOL g_isIpcGmacInit = FALSE; - -BOOL g_isDriversRandomInit = FALSE; - -BOOL g_isHisiEthSetPhyModeInit = FALSE; - -BOOL g_isVfsInit = FALSE; -BOOL g_isProcInit = FALSE; - -INT32 g_libFilesystem = -1; -enum { - LIB_USE_FAT = 1, - LIB_USE_JFFS2, -}; -#ifdef LOSCFG_DRIVERS_USB -VOID test_init_usb(controller_type ctype, device_type dtype); -#endif -VOID test_init_ipc_gmac(VOID); -VOID test_init_proc(VOID); -VOID test_init_sd(VOID); -VOID TestInitVfs(VOID); -VOID test_init_spinor(VOID); -VOID test_deinit_jffs(VOID); -VOID test_mtd_jffs(VOID); - -UINT32 PrepareFileEnv(CHAR *pathList[], CHAR *streamList[], INT32 streamLen[], INT32 listCnt) -{ - CHAR nameBuf[256] = {0}; - for (UINT32 i = 0; i < listCnt; i++) { - UINT32 ret = access(pathList[i], 0); - if (ret == 0) { - ret = memcpy_s(nameBuf, sizeof(nameBuf), pathList[i], strlen(pathList[i]) + 1); - if (ret != 0) { - return -1; - } - ret = strcat_s(nameBuf, sizeof(nameBuf), "_bak_for_test"); - if (ret != 0) { - return -1; - } - ret = rename(pathList[i], nameBuf); - if (ret != 0) { - return -1; - } - } - FILE *fp = fopen(pathList[i], "w"); - if (fp == NULL) { - return -1; - } - ret = fwrite(streamList[i], 1, streamLen[i], fp); - if (ret != streamLen[i]) { - (VOID)fclose(fp); - return -1; - } - ret = fclose(fp); - if (ret != 0) { - printf("%d\n", errno); - } - } - return 0; -} - -UINT32 RecoveryFileEnv(CHAR *pathList[], INT32 listCnt) -{ - UINT32 ret; - CHAR nameBuf[256] = {0}; - for (UINT32 i = 0; i < listCnt; i++) { - ret = remove(pathList[i]); - if (ret != 0) { - printf("ret = %d, err = %d\n", ret, errno); - } - ret = memcpy_s(nameBuf, sizeof(nameBuf), pathList[i], strlen(pathList[i]) + 1); - if (ret != 0) { - return -1; - } - ret = strcat_s(nameBuf, sizeof(nameBuf), "_bak_for_test"); - if (ret != 0) { - return -1; - } - ret = access(nameBuf, 0); - if (ret == 0) { - ret = rename(nameBuf, pathList[i]); - if (ret != 0) { - return -1; - } - } - } - return 0; -} - -VOID Wfi(VOID) -{ - __asm__ __volatile__("wfi" : : : "memory"); -} - -VOID Dmb(VOID) -{ - __asm__ __volatile__("dmb" : : : "memory"); -} - -VOID Dsb(VOID) -{ - __asm__ __volatile__("dsb" : : : "memory"); -} - -__attribute__((weak)) int Gettid() -{ - return syscall(SYS_gettid); -} - -UINT32 LosCurTaskIDGet() -{ - return Gettid(); -} - - -UINT32 LosTaskDelay(UINT32 tick) -{ - return usleep(10 * tick * 1000); -} - -VOID TestExtraTaskDelay(UINT32 uwTick) -{ -#ifdef LOSCFG_KERNEL_SMP - // trigger task schedule may occor on another core - // needs adding delay and checking status later - LosTaskDelay(uwTick); -#else - // do nothing -#endif -} - -extern volatile UINT64 g_tickCount[]; -UINT64 TestTickCountGet(VOID) -{ - /* not use LOS_TickCountGet for now, - cause every timer is not match with others. - use cpu0 timer instead. */ - return clock(); -} - -UINT64 TestTickCountByCurrCpuid(VOID) -{ - return clock(); -} - -/* - * different from calling LOS_TaskDelay, - * this func will not yeild this task to another one. - */ -VOID TestBusyTaskDelay(UINT32 tick) -{ - UINT64 runtime = 0; - - runtime = TestTickCountByCurrCpuid() + tick; - while (1) { - if (runtime <= TestTickCountByCurrCpuid()) { - break; - } - Wfi(); - } -} - -VOID TestAssertBusyTaskDelay(UINT32 timeout, UINT32 flag) -{ - UINT64 runtime = 0; - - runtime = TestTickCountGet() + timeout; - while (1) { - if ((runtime <= TestTickCountGet()) || (g_testCount == flag)) { - break; - } - Wfi(); - } -} - -VOID TestAssertWaitDelay(UINT32 *testCount, UINT32 flag) -{ - while (*testCount != flag) { - usleep(1); - } -} - -UINT32 PosixPthreadInit(pthread_attr_t *attr, int pri) -{ - UINT32 uwRet = 0; - struct sched_param sp; - - uwRet = pthread_attr_init(attr); - ICUNIT_GOTO_EQUAL(uwRet, 0, uwRet, NOK); - - uwRet = pthread_attr_setinheritsched(attr, PTHREAD_EXPLICIT_SCHED); - ICUNIT_GOTO_EQUAL(uwRet, 0, uwRet, NOK); - - sp.sched_priority = pri; - uwRet = pthread_attr_setschedparam(attr, &sp); - ICUNIT_GOTO_EQUAL(uwRet, 0, uwRet, NOK); - - return LOS_OK; -NOK: - return LOS_NOK; -} - -UINT32 PosixPthreadDestroy(pthread_attr_t *attr, pthread_t thread) -{ - UINT32 uwRet = 0; - - uwRet = pthread_join(thread, NULL); - ICUNIT_GOTO_EQUAL(uwRet, 0, uwRet, NOK); - - uwRet = pthread_attr_destroy(attr); - ICUNIT_GOTO_EQUAL(uwRet, 0, uwRet, NOK); - - return LOS_OK; -NOK: - return LOS_NOK; -} - -VOID TestInitVfs(VOID) -{ -#if defined(LOSCFG_FS_VFS) - if (g_isVfsInit) { - return; - } - - extern VOID los_vfs_init(VOID); - los_vfs_init(); - g_isVfsInit = TRUE; - -#endif -} - -VOID TestInitDriversRandom(VOID) -{ - if (g_isDriversRandomInit) { - return; - } - -#if defined(LOSCFG_DRIVERS_RANDOM) - - printf("random init ...\n"); - extern int ran_dev_register(VOID); - ran_dev_register(); - -#endif - -#if defined(LOSCFG_HW_RANDOM_ENABLE) - - extern int random_hw_dev_register(VOID); - printf("random_hw init ...\n"); - if (random_hw_dev_register() != 0) { - printf("Failed!\n"); - } - -#endif - - g_isDriversRandomInit = TRUE; -} - -VOID TestInitUartDev(VOID) {} - -/* **************************************** -Function:Test_PartInit -Description: creat a partition for testing,partition num is 0,mount point is jffs0 -Input: - [1]type: "spinor" - [2]start_addr: the partition start address - [3]length: the partition length -Output: None -Return: None -***************************************** */ -VOID TestPartInit(char *type, UINT32 start_addr, UINT32 length) -{ -#if defined(LOSCFG_FS_JFFS) - int uwRet = 0; - - if ((uwRet = add_mtd_partition(type, start_addr, length, 0)) != 0) - PRINT_ERR("add %s partition failed, return %d\n", type, uwRet); - else { - printf("[OK] add %s partition successful\n", type); - if (strcmp(type, "spinor") == 0) { - if ((uwRet = mount("/dev/spinorblk0", "/jffs0", "jffs", 0, NULL)) != 0) - PRINT_ERR("mount jffs0 failed,err %d\n", uwRet); - else - printf("[OK] mount jffs0 successful\n"); - } - } -#endif - return; -} - -/* **************************************** -Function:Test_PartDelete -Description: delete the partition for test -Input: - [1]type: "spinor" -Output: None -Return: None -***************************************** */ -VOID TestPartDelete(char *type) -{ -#if defined(LOSCFG_FS_JFFS) - - int uwRet = 0; - char *point = ""; - - if (strcmp(type, "spinor") == 0) { - point = "/jffs0"; - } - - if ((uwRet = umount(point)) != 0) { - PRINT_ERR("umount %s failed,err %d.\n", point, uwRet); - } else { - printf("[OK] umount %s OK.\n", point); - if ((uwRet = delete_mtd_partition(0, type)) != 0) - PRINT_ERR("delete %s partition failed, return %d\n", type, uwRet); - else - printf("[OK] delete %s partition OK.\n", type); - } -#endif - return; -} - -/* * - * dir: what you want to delete force - */ -int RemoveDir(const char *dir) -{ - char cur_dir[] = "."; - char up_dir[] = ".."; - char dir_name[128] = { 0 }; - DIR *dirp = NULL; - struct dirent *dp = NULL; - struct stat dir_stat; - int ret; - - if (access(dir, F_OK) != 0) { - return 0; - } - - if (stat(dir, &dir_stat) < 0) { - perror("get directory stat error"); - return -1; - } - - if (S_ISREG(dir_stat.st_mode)) { - remove(dir); - } else if (S_ISDIR(dir_stat.st_mode)) { - dirp = opendir(dir); - while ((dp = readdir(dirp)) != NULL) { - if ((strcmp(cur_dir, dp->d_name) == 0) || (strcmp(up_dir, dp->d_name) == 0)) { - continue; - } - - ret = sprintf_s(dir_name, sizeof(dir_name), "%s/%s", dir, dp->d_name); - if (ret < 0) { - perror("sprintf dir_name error"); - return -1; - } - RemoveDir(dir_name); - } - closedir(dirp); - - rmdir(dir); /* now dir is empty */ - } else { - perror("unknow file type!"); - } - return 0; -} diff --git a/testsuites/unittest_old/config.gni b/testsuites/unittest_old/config.gni deleted file mode 100644 index 9a5139eb..00000000 --- a/testsuites/unittest_old/config.gni +++ /dev/null @@ -1,77 +0,0 @@ -# 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. - -TEST_LEVEL_LOW = 1 -TEST_LEVEL_MIDDLE = 3 -TEST_LEVEL_HIGH = 5 - -# 0: don`t generate -# TEST_LEVEL_LOW: only generate xxx_unittest_door.bin (smoke) -# TEST_LEVEL_MIDDLE: generate xxx_unittest_door.bin (smoke) & xxx_unittest.bin (smoke + full) -# TEST_LEVEL_HIGH: generate xxx_unittest_door.bin (smoke) & xxx_unittest.bin (smoke + full) & xxx_unittest_pressure.bin (pressure) -LOSCFG_USER_TEST_LEVEL = TEST_LEVEL_HIGH - -# "default": depend on board_name -# "enable": those testsuites testing for SMP is enable -# "disable": those testsuites is disable -LOSCFG_USER_TEST_SMP = "default" - -LOSCFG_USER_TEST_MISC = true -LOSCFG_USER_TEST_DRIVERS_HID = true -LOSCFG_USER_TEST_DRIVERS_STORAGE = true -LOSCFG_USER_TEST_DYNLOAD = true -LOSCFG_USER_TEST_EXC = true -LOSCFG_USER_TEST_FS_JFFS = false -LOSCFG_USER_TEST_FS_PROC = false -LOSCFG_USER_TEST_FS_VFAT = false -LOSCFG_USER_TEST_IO = true -LOSCFG_USER_TEST_IPC = false -LOSCFG_USER_TEST_LITEIPC = false -LOSCFG_USER_TEST_MEM_VM = true -LOSCFG_USER_TEST_MEM_SHM = true -LOSCFG_USER_TEST_NET_NETDB = true -LOSCFG_USER_TEST_NET_RESOLV = true -LOSCFG_USER_TEST_NET_SOCKET = true -LOSCFG_USER_TEST_POSIX_PTHREAD = false -LOSCFG_USER_TEST_POSIX_MQUEUE = true -LOSCFG_USER_TEST_POSIX_MEM = true -LOSCFG_USER_TEST_SPINLOCK = true -LOSCFG_USER_TEST_RWLOCK = true -LOSCFG_USER_TEST_PTHREAD = true -LOSCFG_USER_TEST_PROCESS = true -LOSCFG_USER_TEST_MUTEX = true -LOSCFG_USER_TEST_SECURITY_CAPABILITY = true -LOSCFG_USER_TEST_SECURITY_VID = true -LOSCFG_USER_TEST_SECURITY_REUGID = true -LOSCFG_USER_TEST_SIGNAL = true -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_TRACE = false diff --git a/testsuites/unittest_old/drivers/hid/BUILD.gn b/testsuites/unittest_old/drivers/hid/BUILD.gn deleted file mode 100644 index 43efc9dc..00000000 --- a/testsuites/unittest_old/drivers/hid/BUILD.gn +++ /dev/null @@ -1,73 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "../../drivers/hid", -] - -sources_entry = [ - "../../common/osTest.cpp", - "drivers_hid_test.cpp", -] - -sources_smoke = [ "smoke/hid_test_001.cpp" ] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_drivers_hid_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_drivers_hid_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_old/drivers/hid/drivers_hid_test.cpp b/testsuites/unittest_old/drivers/hid/drivers_hid_test.cpp deleted file mode 100644 index 1120011d..00000000 --- a/testsuites/unittest_old/drivers/hid/drivers_hid_test.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -#include -#include -#include "it_test_hid.h" - -using namespace testing::ext; -namespace OHOS { -class DriversHidTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: it_test_hid_001 - * @tc.desc: function for drivers hid - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(DriversHidTest, ItTestHid001, TestSize.Level0) -{ - ItTestHid001(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/drivers/hid/it_test_hid.h b/testsuites/unittest_old/drivers/hid/it_test_hid.h deleted file mode 100644 index e948b349..00000000 --- a/testsuites/unittest_old/drivers/hid/it_test_hid.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_DRIVERS_HID_H -#define _IT_TEST_DRIVERS_HID_H - -#include "osTest.h" -#include "poll.h" - -extern void ItTestHid001(void); - -#endif diff --git a/testsuites/unittest_old/drivers/hid/smoke/hid_test_001.cpp b/testsuites/unittest_old/drivers/hid/smoke/hid_test_001.cpp deleted file mode 100644 index d7884710..00000000 --- a/testsuites/unittest_old/drivers/hid/smoke/hid_test_001.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ -#include "it_test_hid.h" -#include "fcntl.h" -#include "sys/ioctl.h" - -#define MOUSE_DEV_PATH "/dev/usb/uhid0" -#define MOUSE_DATA_LEN 5 -#define MOUSE_TEST_COUNT 20 -#define MOUSE_WAIT_TIME 1000 - -#define USB_GET_REPORT_ID _IOR('U', 25, int) - -static int Testcase(VOID) -{ - int ret; - int fd = -1; - int i; - struct pollfd pfds[1]; - char *buf = NULL; - int id = -1; - - ret = access(MOUSE_DEV_PATH, 0); - if (!ret) { - fd = open(MOUSE_DEV_PATH, O_RDWR, 0666); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - - buf = (char *)malloc(MOUSE_DATA_LEN); - ICUNIT_ASSERT_NOT_EQUAL(buf, NULL, buf); - (void)memset_s(buf, MOUSE_DATA_LEN, 0, MOUSE_DATA_LEN); - - ret = ioctl(fd, USB_GET_REPORT_ID, &id); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(id, 0, id); - - printf("Reading mouse data ... \n"); - for (i = 0; i < MOUSE_TEST_COUNT; i++) { - pfds[0].fd = fd; - pfds[0].events = POLLIN; - - ret = poll(pfds, 1, MOUSE_WAIT_TIME); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - if (ret == 0) { - continue; - } else { - printf("read ...\n"); - read(fd, buf, MOUSE_DATA_LEN); - printf("mouse data [%#x %#x %#x %#x]\n", buf[0], buf[1], buf[2], buf[3]); - } - } - ret = close(fd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - free(buf); - } - - return 0; -} - -void ItTestHid001(void) -{ - TEST_ADD_CASE("IT_DRIVERS_HID_001", Testcase, TEST_LOS, TEST_DRIVERBASE, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/drivers/storage/BUILD.gn b/testsuites/unittest_old/drivers/storage/BUILD.gn deleted file mode 100644 index 47e4193a..00000000 --- a/testsuites/unittest_old/drivers/storage/BUILD.gn +++ /dev/null @@ -1,73 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "../../drivers/storage", -] - -sources_entry = [ - "../../common/osTest.cpp", - "drivers_storage_test.cpp", -] - -sources_smoke = [ "smoke/storage_test_001.cpp" ] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_drivers_storage_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_drivers_storage_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_old/drivers/storage/drivers_storage_test.cpp b/testsuites/unittest_old/drivers/storage/drivers_storage_test.cpp deleted file mode 100644 index fe69c0e5..00000000 --- a/testsuites/unittest_old/drivers/storage/drivers_storage_test.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -#include -#include -#include "it_test_storage.h" - -using namespace testing::ext; -namespace OHOS { -class DriversStorageTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: it_test_storage_001 - * @tc.desc: function for drivers storage - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(DriversStorageTest, ItTestStorage001, TestSize.Level0) -{ - ItTestStorage001(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/drivers/storage/it_test_storage.h b/testsuites/unittest_old/drivers/storage/it_test_storage.h deleted file mode 100644 index 5c1ab777..00000000 --- a/testsuites/unittest_old/drivers/storage/it_test_storage.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_DRIVERS_STORAGE_H -#define _IT_TEST_DRIVERS_STORAGE_H - -#include "osTest.h" -#include "poll.h" - -extern void ItTestStorage001(void); - -#endif diff --git a/testsuites/unittest_old/drivers/storage/smoke/storage_test_001.cpp b/testsuites/unittest_old/drivers/storage/smoke/storage_test_001.cpp deleted file mode 100644 index 9e35c78f..00000000 --- a/testsuites/unittest_old/drivers/storage/smoke/storage_test_001.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "it_test_storage.h" -#include "fcntl.h" -#include "sys/ioctl.h" - -#define STORAGE_DEV_PATH "/dev/sdap0" -#define STORAGE_DATA_LEN 32 -#define DIOC_GETPRIV 0x1000 -#define INVALID_PTR 0x11111111 - -static int Testcase(VOID) -{ - int ret; - int fd = -1; - int i; - ssize_t n; - char *buf = NULL; - void *bch = NULL; - - ret = access(STORAGE_DEV_PATH, 0); - if (!ret) { - fd = open(STORAGE_DEV_PATH, O_RDWR, 0666); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - - buf = (char *)malloc(STORAGE_DATA_LEN); - ICUNIT_ASSERT_NOT_EQUAL(buf, NULL, buf); - (void)memset_s(buf, STORAGE_DATA_LEN, 0, STORAGE_DATA_LEN); - - ret = ioctl(fd, DIOC_GETPRIV, &bch); - printf("bch = %#x, &bch = %#x, errno = %d\n", bch, &bch, errno); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - - printf("Reading storage data ... \n"); - n = read(fd, buf, STORAGE_DATA_LEN); - ICUNIT_ASSERT_EQUAL(n, STORAGE_DATA_LEN, n); - printf("storage data [%#x %#x %#x %#x]\n", buf[0], buf[1], buf[2], buf[3]); - - n = read(fd, (void *)INVALID_PTR, STORAGE_DATA_LEN); - ICUNIT_ASSERT_NOT_EQUAL(n, STORAGE_DATA_LEN, n); - - ret = close(fd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - free(buf); - } - - return 0; -} - -void ItTestStorage001(void) -{ - TEST_ADD_CASE("IT_DRIVERS_STORAGE_001", Testcase, TEST_LOS, TEST_DRIVERBASE, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/dynload/BUILD.gn b/testsuites/unittest_old/dynload/BUILD.gn deleted file mode 100644 index 0b0b4ed6..00000000 --- a/testsuites/unittest_old/dynload/BUILD.gn +++ /dev/null @@ -1,76 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../common/include", - "../dynload", -] - -sources_entry = [ - "../common/osTest.cpp", - "dynload_test.cpp", -] - -sources_smoke = [ - "smoke/dynload_test_002.cpp", - "smoke/dynload_test_004.cpp", -] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_dynload_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_dynload_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_old/dynload/dynload_test.cpp b/testsuites/unittest_old/dynload/dynload_test.cpp deleted file mode 100644 index 937c109b..00000000 --- a/testsuites/unittest_old/dynload/dynload_test.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ -#include -#include - -#include "it_test_dynload.h" - -using namespace testing::ext; -namespace OHOS { -class DynloadTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: it_test_dynload_002 - * @tc.desc: function for DynloadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(DynloadTest, ItTestDynload002, TestSize.Level0) -{ - ItTestDynload002(); -} - -/* * - * @tc.name: it_test_dynload_004 - * @tc.desc: function for DynloadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(DynloadTest, ItTestDynload004, TestSize.Level0) -{ - ItTestDynload004(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/dynload/it_test_dynload.h b/testsuites/unittest_old/dynload/it_test_dynload.h deleted file mode 100644 index 50f33c37..00000000 --- a/testsuites/unittest_old/dynload/it_test_dynload.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_DYNLOAD_H -#define _IT_TEST_DYNLOAD_H - -#include "osTest.h" -#include -#include - -extern void ItTestDynload002(void); -extern void it_test_dynload_003(void); -extern void ItTestDynload004(void); -#endif diff --git a/testsuites/unittest_old/dynload/smoke/dynload_test_002.cpp b/testsuites/unittest_old/dynload/smoke/dynload_test_002.cpp deleted file mode 100644 index 0c2e5f5a..00000000 --- a/testsuites/unittest_old/dynload/smoke/dynload_test_002.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ -#include "it_test_dynload.h" -#include - -#define LIBCSO_REAL_PATH "/lib/libc.so" -#define LIBCSO_RELATIVE_PATH "../../lib/libc.so" -#define SYMBOL_TO_FIND "printf" -#define SYMBOL_TO_MATCH (void *)printf - -static int Testcase(void) -{ - int ret; - char *workingPath = "/usr/bin"; - void *handle = nullptr; - int (*func)(int); - - ret = chdir(workingPath); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - handle = dlopen(NULL, RTLD_NOW | RTLD_LOCAL); - ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle); - - ret = dlclose(handle); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - handle = dlopen(LIBCSO_REAL_PATH, RTLD_NOW); - ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle); - - func = (int (*)(int))dlsym(handle, SYMBOL_TO_FIND); - ICUNIT_ASSERT_NOT_EQUAL(func, NULL, func); - ICUNIT_ASSERT_EQUAL(func, SYMBOL_TO_MATCH, func); - - ret = dlclose(handle); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - handle = dlopen(LIBCSO_RELATIVE_PATH, RTLD_NOW); - ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle); - - func = (int (*)(int))dlsym(handle, SYMBOL_TO_FIND); - ICUNIT_ASSERT_NOT_EQUAL(func, NULL, func); - - ret = dlclose(handle); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestDynload002(void) -{ - TEST_ADD_CASE("IT_TEST_DYNLOAD_002", Testcase, TEST_EXTEND, TEST_DYNLOAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/dynload/smoke/dynload_test_004.cpp b/testsuites/unittest_old/dynload/smoke/dynload_test_004.cpp deleted file mode 100644 index 9ff3ab7f..00000000 --- a/testsuites/unittest_old/dynload/smoke/dynload_test_004.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "it_test_dynload.h" -#include - -#define LIBCSO_REAL_PATH "/lib/libc.so" -#define INVALID_MODE (-1) -#define MODE_WITHOUT_NOW_AND_LAZY (RTLD_NOLOAD | RTLD_GLOBAL | RTLD_LOCAL | RTLD_NODELETE) -#define INVALID_FILENAME (char *)((void *)0) - -static int Testcase(void) -{ - int ret; - void *handle = nullptr; - - handle = dlopen(LIBCSO_REAL_PATH, 0); - ICUNIT_ASSERT_EQUAL(handle, NULL, handle); - - handle = dlopen(LIBCSO_REAL_PATH, INVALID_MODE); - ICUNIT_ASSERT_EQUAL(handle, NULL, handle); - - handle = dlopen(LIBCSO_REAL_PATH, MODE_WITHOUT_NOW_AND_LAZY); - ICUNIT_ASSERT_EQUAL(handle, NULL, handle); - - handle = dlopen(INVALID_FILENAME, 0); - ICUNIT_ASSERT_EQUAL(handle, NULL, handle); - - handle = dlopen(INVALID_FILENAME, INVALID_MODE); - ICUNIT_ASSERT_EQUAL(handle, NULL, handle); - - handle = dlopen(INVALID_FILENAME, MODE_WITHOUT_NOW_AND_LAZY); - ICUNIT_ASSERT_EQUAL(handle, NULL, handle); - - handle = dlopen(INVALID_FILENAME, RTLD_NOW); - ICUNIT_ASSERT_NOT_EQUAL(handle, NULL, handle); - - ret = dlclose(handle); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestDynload004(void) -{ - TEST_ADD_CASE("IT_TEST_DYNLOAD_004", Testcase, TEST_EXTEND, TEST_DYNLOAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/exc/BUILD.gn b/testsuites/unittest_old/exc/BUILD.gn deleted file mode 100644 index 331706ea..00000000 --- a/testsuites/unittest_old/exc/BUILD.gn +++ /dev/null @@ -1,79 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../common/include", - "../exc", -] - -sources_entry = [ - "../common/osTest.cpp", - "exc_test.cpp", -] - -sources_smoke = [ - "smoke/it_test_exc_001.cpp", - "smoke/it_test_exc_002.cpp", - "smoke/it_test_exc_003.cpp", - "smoke/it_test_exc_004.cpp", - "smoke/it_test_exc_005.cpp", -] - -sources_full = [ "full/it_test_fexecve_001.cpp" ] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_exc_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_exc_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_old/exc/exc_test.cpp b/testsuites/unittest_old/exc/exc_test.cpp deleted file mode 100644 index 9e88916f..00000000 --- a/testsuites/unittest_old/exc/exc_test.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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. - */ -#include -#include - -#include "it_test_exc.h" - -using namespace testing::ext; -namespace OHOS { -class ExcTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: ItTestExc005 - * @tc.desc: function for ExcTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ExcTest, ItTestExc005, TestSize.Level0) -{ - ItTestExc005(); -} - -/* * - * @tc.name: ItTestExc001 - * @tc.desc: function for ExcTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ExcTest, ItTestExc001, TestSize.Level0) -{ - ItTestExc001(); -} - -/* * - * @tc.name: ItTestExc002 - * @tc.desc: function for ExcTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ExcTest, ItTestExc002, TestSize.Level0) -{ - ItTestExc002(); -} - -/* * - * @tc.name: ItTestExc003 - * @tc.desc: function for ExcTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ExcTest, ItTestExc003, TestSize.Level0) -{ - ItTestExc003(); -} - -/* * - * @tc.name: ItTestExc004 - * @tc.desc: function for ExcTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ExcTest, ItTestExc004, TestSize.Level0) -{ - ItTestExc004(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/exc/full/it_test_fexecve_001.cpp b/testsuites/unittest_old/exc/full/it_test_fexecve_001.cpp deleted file mode 100644 index e4cfa5eb..00000000 --- a/testsuites/unittest_old/exc/full/it_test_fexecve_001.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ -#define __USE_GUN -#include "it_test_exc.h" -#include -#include -#include -#include -#include -#include - -static char *g_args[] = { - "hic et nunc", - "-l", - "/dev/shm", - nullptr -}; - -static int TestCase(void) -{ - struct stat st = {0}; - void *p = nullptr; - int fd = 0; - int shmFd = 0; - int rc = 0; - int ret = 0; - - shmFd = shm_open("wurstverschwendung", O_RDWR | O_CREAT, 0777); - if (shmFd == -1) { - perror("shm_open"); - return -1; - } - - rc = stat("/bin/shell", &st); - if (rc == -1) { - perror("stat"); - return -1; - } - - printf("shm_fd=%d,st.st_size=%lld\n", shmFd, st.st_size); - rc = ftruncate(shmFd, st.st_size); - if (rc == -1) { - perror("ftruncate"); - return -1; - } - - p = mmap(nullptr, st.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, shmFd, 0); - if (p == MAP_FAILED) { - perror("mmap"); - return -1; - } - - fd = open("/bin/shell", O_RDONLY, 0); - printf("fd=%d\n", fd); - if (fd == -1) { - perror("openls"); - return -1; - } - - rc = read(fd, p, st.st_size); - if (rc == -1) { - perror("read"); - return -1; - } - if (rc != st.st_size) { - fputs("Strange situation!\n", stderr); - return -1; - } - - munmap(p, st.st_size); - close(shmFd); - - shmFd = shm_open("wurstverschwendung", O_RDONLY, 0); - ret = fexecve(shmFd, g_args, environ); - perror("fexecve"); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - return LOS_OK; -} - -void ItTestFexecve001(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/exc/it_test_exc.h b/testsuites/unittest_old/exc/it_test_exc.h deleted file mode 100644 index e204898e..00000000 --- a/testsuites/unittest_old/exc/it_test_exc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_EXC_H -#define _IT_TEST_EXC_H - -#include "osTest.h" - -#define INVALID_PROCESS_ID 100000 -extern void ItTestExc001(void); -extern void ItTestExc002(void); -extern void ItTestExc003(void); -extern void ItTestExc004(void); -extern void ItTestExc005(void); -extern void ItTestFexecve001(void); - -#endif diff --git a/testsuites/unittest_old/exc/smoke/it_test_exc_001.cpp b/testsuites/unittest_old/exc/smoke/it_test_exc_001.cpp deleted file mode 100644 index b7330789..00000000 --- a/testsuites/unittest_old/exc/smoke/it_test_exc_001.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -#include "it_test_exc.h" - -static int TestCase(void) -{ - int ret; - int *test = NULL; - int status = 0; - pid_t pid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid); - if (pid == 0) { - *test = 0x1; - exit(0); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ret = WIFEXITED(status); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = WIFSIGNALED(status); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - ret = WTERMSIG(status); - ICUNIT_ASSERT_EQUAL(ret, SIGUSR2, ret); - - pid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid); - if (pid == 0) { - *test = 0x1; - exit(0); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ret = WIFEXITED(status); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = WIFSIGNALED(status); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - ret = WTERMSIG(status); - ICUNIT_ASSERT_EQUAL(ret, SIGUSR2, ret); - - return 0; -} - -void ItTestExc001(void) -{ - TEST_ADD_CASE("IT_TEST_EXC_001", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/exc/smoke/it_test_exc_002.cpp b/testsuites/unittest_old/exc/smoke/it_test_exc_002.cpp deleted file mode 100644 index 45b941f1..00000000 --- a/testsuites/unittest_old/exc/smoke/it_test_exc_002.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ -#include "it_test_exc.h" -#include "pthread.h" - -static void *ThreadFunc2(void *arg) -{ - while (1) { - } - - return nullptr; -} - -static void *ThreadFunc1(void *arg) -{ - int *test = nullptr; - *test = 0x1; - - while (1) { - } - return nullptr; -} - -static int TestThread(void) -{ - pthread_t newThread; - int ret; - int currThreadPolicy = 3; - int currThreadPri; - pthread_attr_t a = { 0 }; - struct sched_param param = { 0 }; - int count = 5; - while (count > 0) { - ret = pthread_create(&newThread, nullptr, ThreadFunc2, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - count--; - } - - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - currThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - param.sched_priority = currThreadPri - 1; - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newThread, &a, ThreadFunc1, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -static int TestCase(void) -{ - int *test = nullptr; - int count = 5; - int status = 0; - int ret; - pid_t pid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid); - if (pid == 0) { - (void)TestThread(); - while (1) { - } - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ret = WIFEXITED(status); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = WIFSIGNALED(status); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - ret = WTERMSIG(status); - ICUNIT_ASSERT_EQUAL(ret, SIGUSR2, ret); - - return 0; -} - -void ItTestExc002(void) -{ - TEST_ADD_CASE("IT_TEST_EXC_002", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/exc/smoke/it_test_exc_003.cpp b/testsuites/unittest_old/exc/smoke/it_test_exc_003.cpp deleted file mode 100644 index c275cd65..00000000 --- a/testsuites/unittest_old/exc/smoke/it_test_exc_003.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. - */ -#include "it_test_exc.h" -#include "pthread.h" - -#define TEST_THREAD_COUNT 5 -static volatile int g_testCondFlag; -static int g_count[TEST_THREAD_COUNT]; -static void *ThreadFunc2(void *arg) -{ - int count = *(int *)arg; - int *test = nullptr; - - g_testCondFlag++; - - while (g_testCondFlag < 2) { - } - - *test = 0x1; - - while (1) { - } - - return nullptr; -} - -static int TestThread(void) -{ - pthread_t newThread; - int ret; - int currThreadPolicy = 3; - int currThreadPri; - pthread_attr_t a = { 0 }; - struct sched_param param = { 0 }; - int count = 0; - - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - currThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - param.sched_priority = currThreadPri + 1; - pthread_attr_setschedparam(&a, ¶m); - - while (count < TEST_THREAD_COUNT) { - g_count[count] = count; - ret = pthread_create(&newThread, &a, ThreadFunc2, &g_count[count]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - count++; - } - - ret = pthread_join(newThread, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -static int TestCase(void) -{ - int *test = nullptr; - int count = 5; - int status = 0; - int ret; - - g_testCondFlag = 0; - - pid_t pid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid); - if (pid == 0) { - (void)TestThread(); - while (1) { - } - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ret = WIFEXITED(status); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = WIFSIGNALED(status); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - ret = WTERMSIG(status); - ICUNIT_ASSERT_EQUAL(ret, SIGUSR2, ret); - return 0; -} - -void ItTestExc003(void) -{ - TEST_ADD_CASE("IT_TEST_EXC_003", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/exc/smoke/it_test_exc_004.cpp b/testsuites/unittest_old/exc/smoke/it_test_exc_004.cpp deleted file mode 100644 index 6ad1462a..00000000 --- a/testsuites/unittest_old/exc/smoke/it_test_exc_004.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "it_test_exc.h" -#include "pthread.h" - -#define TEST_THREAD_COUNT 5 - -static int TestThread(void) -{ - int *test = nullptr; - int ret; - - pid_t pid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid); - if (pid == 0) { - *test = 0x1; - while (1) { - } - } - - *test = 0x1; - - ret = waitpid(pid, NULL, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - - return 0; -} - -static int TestCase(void) -{ - int *test = nullptr; - int count = 5; - int status = 0; - int ret; - - pid_t pid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid); - if (pid == 0) { - (void)TestThread(); - while (1) { - } - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ret = WIFEXITED(status); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = WIFSIGNALED(status); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - ret = WTERMSIG(status); - ICUNIT_ASSERT_EQUAL(ret, SIGUSR2, ret); - return 0; -} - -void ItTestExc004(void) -{ - TEST_ADD_CASE("IT_TEST_EXC_004", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/exc/smoke/it_test_exc_005.cpp b/testsuites/unittest_old/exc/smoke/it_test_exc_005.cpp deleted file mode 100644 index 64c66472..00000000 --- a/testsuites/unittest_old/exc/smoke/it_test_exc_005.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -#include "it_test_exc.h" - -static void Child(void) -{ - while (1) { - printf("@@@@@@@@@@@@@ pid : %d getppid : %d @@@@@@@@@@@@@@@@\n", getpid(), getppid()); - } -} -static void TestKill(int sig) -{ - exit(0); -} - -static int TestCase(void) -{ - int ret; - void (*retptr)(int) = NULL; - int *test = NULL; - int status = 0; - pid_t pid1; - - retptr = signal(SIGTERM, TestKill); - ICUNIT_ASSERT_NOT_EQUAL(retptr, NULL, retptr); - - pid_t pid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid); - if (pid == 0) { - Child(); - exit(0); - } - - for (int i = 0; i < 2; i++) { - pid1 = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(pid1, 0, INVALID_PROCESS_ID, pid1); - if (pid1 == 0) { - *test = 0x1; - exit(0); - } else { - ret = waitpid(pid1, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid1, ret); - } - } - - kill(pid, SIGTERM); - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - - return 0; -} - -void ItTestExc005(void) -{ - TEST_ADD_CASE("IT_TEST_EXC_005", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/BUILD.gn b/testsuites/unittest_old/fs/BUILD.gn deleted file mode 100644 index 784e1a70..00000000 --- a/testsuites/unittest_old/fs/BUILD.gn +++ /dev/null @@ -1,858 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "//kernel/liteos_a/testsuites/unittest/fs/vfs", - "//kernel/liteos_a/testsuites/unittest/fs/jffs", - "../common/include", -] - -sources_entry = [ - "../common/osTest.cpp", - "jffs/vfs_jffs_test.cpp", -] - -sources_smoke = [ - "jffs/smoke/It_vfs_jffs_001.cpp", - "jffs/smoke/It_vfs_jffs_002.cpp", - "jffs/smoke/It_vfs_jffs_003.cpp", - "jffs/smoke/It_vfs_jffs_005.cpp", - "jffs/smoke/It_vfs_jffs_021.cpp", - "jffs/smoke/It_vfs_jffs_022.cpp", - "jffs/smoke/It_vfs_jffs_026.cpp", - "jffs/smoke/It_vfs_jffs_027.cpp", - "jffs/smoke/It_vfs_jffs_034.cpp", - "jffs/smoke/It_vfs_jffs_035.cpp", - "jffs/smoke/It_vfs_jffs_094.cpp", - "jffs/smoke/It_vfs_jffs_095.cpp", - "jffs/smoke/It_vfs_jffs_103.cpp", - "jffs/smoke/It_vfs_jffs_535.cpp", - "jffs/smoke/It_vfs_jffs_Dac_001.cpp", -] - -sources_pressure = [ - "jffs/pressure/It_fs_jffs_performance_001.cpp", - "jffs/pressure/It_fs_jffs_performance_002.cpp", - "jffs/pressure/It_fs_jffs_performance_003.cpp", - "jffs/pressure/It_fs_jffs_performance_004.cpp", - "jffs/pressure/It_fs_jffs_performance_005.cpp", - "jffs/pressure/It_fs_jffs_performance_006.cpp", - "jffs/pressure/It_fs_jffs_performance_007.cpp", - "jffs/pressure/It_fs_jffs_performance_008.cpp", - "jffs/pressure/It_fs_jffs_performance_009.cpp", - "jffs/pressure/It_fs_jffs_performance_010.cpp", - "jffs/pressure/It_fs_jffs_performance_011.cpp", - "jffs/pressure/It_fs_jffs_performance_012.cpp", - "jffs/pressure/It_fs_jffs_performance_013.cpp", - "jffs/pressure/It_fs_jffs_pressure_001.cpp", - "jffs/pressure/It_fs_jffs_pressure_002.cpp", - "jffs/pressure/It_fs_jffs_pressure_003.cpp", - "jffs/pressure/It_fs_jffs_pressure_004.cpp", - "jffs/pressure/It_fs_jffs_pressure_005.cpp", - "jffs/pressure/It_fs_jffs_pressure_006.cpp", - "jffs/pressure/It_fs_jffs_pressure_007.cpp", - "jffs/pressure/It_fs_jffs_pressure_008.cpp", - "jffs/pressure/It_fs_jffs_pressure_009.cpp", - "jffs/pressure/It_fs_jffs_pressure_010.cpp", - "jffs/pressure/It_fs_jffs_pressure_011.cpp", - "jffs/pressure/It_fs_jffs_pressure_012.cpp", - "jffs/pressure/It_fs_jffs_pressure_014.cpp", - "jffs/pressure/It_fs_jffs_pressure_015.cpp", - "jffs/pressure/It_fs_jffs_pressure_016.cpp", - "jffs/pressure/It_fs_jffs_pressure_017.cpp", - "jffs/pressure/It_fs_jffs_pressure_018.cpp", - "jffs/pressure/It_fs_jffs_pressure_019.cpp", - "jffs/pressure/It_fs_jffs_pressure_020.cpp", - "jffs/pressure/It_fs_jffs_pressure_021.cpp", - "jffs/pressure/It_fs_jffs_pressure_022.cpp", - "jffs/pressure/It_fs_jffs_pressure_023.cpp", - "jffs/pressure/It_fs_jffs_pressure_024.cpp", - "jffs/pressure/It_fs_jffs_pressure_025.cpp", - "jffs/pressure/It_fs_jffs_pressure_026.cpp", - "jffs/pressure/It_fs_jffs_pressure_027.cpp", - "jffs/pressure/It_fs_jffs_pressure_028.cpp", - "jffs/pressure/It_fs_jffs_pressure_029.cpp", - "jffs/pressure/It_fs_jffs_pressure_030.cpp", - "jffs/pressure/It_fs_jffs_pressure_031.cpp", - "jffs/pressure/It_fs_jffs_pressure_032.cpp", - "jffs/pressure/It_fs_jffs_pressure_033.cpp", - "jffs/pressure/It_fs_jffs_pressure_034.cpp", - "jffs/pressure/It_fs_jffs_pressure_035.cpp", - "jffs/pressure/It_fs_jffs_pressure_036.cpp", - "jffs/pressure/It_fs_jffs_pressure_037.cpp", - "jffs/pressure/It_fs_jffs_pressure_038.cpp", - "jffs/pressure/It_fs_jffs_pressure_039.cpp", - "jffs/pressure/It_fs_jffs_pressure_040.cpp", - "jffs/pressure/It_fs_jffs_pressure_041.cpp", - "jffs/pressure/It_fs_jffs_pressure_042.cpp", - "jffs/pressure/It_fs_jffs_pressure_043.cpp", - "jffs/pressure/It_fs_jffs_pressure_044.cpp", - "jffs/pressure/It_fs_jffs_pressure_045.cpp", - "jffs/pressure/It_fs_jffs_pressure_046.cpp", - "jffs/pressure/It_fs_jffs_pressure_047.cpp", - "jffs/pressure/It_fs_jffs_pressure_048.cpp", - "jffs/pressure/It_fs_jffs_pressure_049.cpp", - "jffs/pressure/It_fs_jffs_pressure_050.cpp", - "jffs/pressure/It_fs_jffs_pressure_051.cpp", - "jffs/pressure/It_fs_jffs_pressure_052.cpp", - "jffs/pressure/It_fs_jffs_pressure_053.cpp", - "jffs/pressure/It_fs_jffs_pressure_301.cpp", - "jffs/pressure/It_fs_jffs_pressure_302.cpp", - "jffs/pressure/It_fs_jffs_pressure_303.cpp", - "jffs/pressure/It_fs_jffs_pressure_304.cpp", - "jffs/pressure/It_fs_jffs_pressure_305.cpp", - "jffs/pressure/It_fs_jffs_pressure_306.cpp", - "jffs/pressure/It_fs_jffs_pressure_307.cpp", - "jffs/pressure/It_fs_jffs_pressure_308.cpp", - "jffs/pressure/It_fs_jffs_pressure_309.cpp", - "jffs/pressure/It_fs_jffs_pressure_310.cpp", - "jffs/pressure/It_fs_jffs_pressure_311.cpp", - "jffs/pressure/It_fs_jffs_pressure_312.cpp", - "jffs/pressure/It_fs_jffs_pressure_313.cpp", - "jffs/pressure/It_fs_jffs_pressure_314.cpp", - "jffs/pressure/It_fs_jffs_pressure_315.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_001.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_002.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_003.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_004.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_005.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_006.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_007.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_008.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_009.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_010.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_011.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_012.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_013.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_014.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_015.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_016.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_017.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_018.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_019.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_020.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_021.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_022.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_023.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_024.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_025.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_026.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_027.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_028.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_029.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_030.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_031.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_032.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_033.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_034.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_035.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_036.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_037.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_038.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_039.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_040.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_041.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_042.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_043.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_044.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_045.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_046.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_047.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_048.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_049.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_050.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_051.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_052.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_053.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_054.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_055.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_056.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_057.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_058.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_059.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_060.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_061.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_062.cpp", - "jffs/pressure/It_vfs_jffs_multipthread_063.cpp", -] - -sources_full = [ - "jffs/full/It_test_faccessat_001.cpp", - "jffs/full/It_test_faccessat_002.cpp", - "jffs/full/It_test_fstatat_001.cpp", - "jffs/full/It_test_fstatat_002.cpp", - "jffs/full/It_test_fstatfs_001.cpp", - "jffs/full/It_test_fstatfs_002.cpp", - "jffs/full/it_test_fs_jffs_001.cpp", - "jffs/full/it_test_fs_jffs_002.cpp", - "jffs/full/it_test_fs_jffs_003.cpp", - "jffs/full/it_test_fs_jffs_004.cpp", - "jffs/full/it_test_fs_jffs_100.cpp", - "jffs/full/it_test_fs_jffs_101.cpp", - "jffs/full/it_test_fs_jffs_106.cpp", - "jffs/full/it_test_fs_jffs_112.cpp", - "jffs/full/it_test_fs_jffs_113.cpp", - "jffs/full/It_jffs_001.cpp", - "jffs/full/It_jffs_002.cpp", - "jffs/full/It_jffs_003.cpp", - "jffs/full/It_jffs_004.cpp", - "jffs/full/It_jffs_005.cpp", - "jffs/full/It_jffs_006.cpp", - "jffs/full/It_jffs_007.cpp", - "jffs/full/It_jffs_008.cpp", - "jffs/full/It_jffs_009.cpp", - "jffs/full/It_jffs_010.cpp", - "jffs/full/It_jffs_011.cpp", - "jffs/full/It_jffs_012.cpp", - "jffs/full/It_jffs_013.cpp", - "jffs/full/It_jffs_014.cpp", - "jffs/full/It_jffs_015.cpp", - "jffs/full/It_jffs_016.cpp", - "jffs/full/It_jffs_017.cpp", - "jffs/full/It_jffs_018.cpp", - "jffs/full/It_jffs_019.cpp", - "jffs/full/It_jffs_020.cpp", - "jffs/full/It_jffs_021.cpp", - "jffs/full/It_jffs_022.cpp", - "jffs/full/It_jffs_023.cpp", - "jffs/full/It_jffs_024.cpp", - "jffs/full/It_jffs_025.cpp", - "jffs/full/It_jffs_026.cpp", - "jffs/full/It_jffs_027.cpp", - "jffs/full/It_jffs_028.cpp", - "jffs/full/It_jffs_029.cpp", - "jffs/full/It_jffs_030.cpp", - "jffs/full/It_jffs_031.cpp", - "jffs/full/It_jffs_032.cpp", - "jffs/full/It_jffs_033.cpp", - "jffs/full/It_jffs_034.cpp", - "jffs/full/It_jffs_035.cpp", - "jffs/full/It_jffs_036.cpp", - "jffs/full/It_jffs_037.cpp", - "jffs/full/It_jffs_038.cpp", - "jffs/full/It_jffs_039.cpp", - "jffs/full/It_jffs_040.cpp", - "jffs/full/It_jffs_041.cpp", - "jffs/full/It_jffs_042.cpp", - "jffs/full/It_jffs_043.cpp", - "jffs/full/It_jffs_044.cpp", - "jffs/full/It_vfs_jffs_004.cpp", - "jffs/full/It_vfs_jffs_006.cpp", - "jffs/full/It_vfs_jffs_007.cpp", - "jffs/full/It_vfs_jffs_008.cpp", - "jffs/full/It_vfs_jffs_009.cpp", - "jffs/full/It_vfs_jffs_010.cpp", - "jffs/full/It_vfs_jffs_011.cpp", - "jffs/full/It_vfs_jffs_012.cpp", - "jffs/full/It_vfs_jffs_013.cpp", - "jffs/full/It_vfs_jffs_014.cpp", - "jffs/full/It_vfs_jffs_015.cpp", - "jffs/full/It_vfs_jffs_016.cpp", - "jffs/full/It_vfs_jffs_017.cpp", - "jffs/full/It_vfs_jffs_018.cpp", - "jffs/full/It_vfs_jffs_019.cpp", - "jffs/full/It_vfs_jffs_020.cpp", - "jffs/full/It_vfs_jffs_023.cpp", - "jffs/full/It_vfs_jffs_024.cpp", - "jffs/full/It_vfs_jffs_025.cpp", - "jffs/full/It_vfs_jffs_028.cpp", - "jffs/full/It_vfs_jffs_029.cpp", - "jffs/full/It_vfs_jffs_030.cpp", - "jffs/full/It_vfs_jffs_031.cpp", - "jffs/full/It_vfs_jffs_032.cpp", - "jffs/full/It_vfs_jffs_033.cpp", - "jffs/full/It_vfs_jffs_037.cpp", - "jffs/full/It_vfs_jffs_038.cpp", - "jffs/full/It_vfs_jffs_039.cpp", - "jffs/full/It_vfs_jffs_040.cpp", - "jffs/full/It_vfs_jffs_041.cpp", - "jffs/full/It_vfs_jffs_042.cpp", - "jffs/full/It_vfs_jffs_043.cpp", - "jffs/full/It_vfs_jffs_044.cpp", - "jffs/full/It_vfs_jffs_045.cpp", - "jffs/full/It_vfs_jffs_046.cpp", - "jffs/full/It_vfs_jffs_048.cpp", - "jffs/full/It_vfs_jffs_049.cpp", - "jffs/full/It_vfs_jffs_050.cpp", - "jffs/full/It_vfs_jffs_051.cpp", - "jffs/full/It_vfs_jffs_053.cpp", - "jffs/full/It_vfs_jffs_055.cpp", - "jffs/full/It_vfs_jffs_056.cpp", - "jffs/full/It_vfs_jffs_057.cpp", - "jffs/full/It_vfs_jffs_058.cpp", - "jffs/full/It_vfs_jffs_059.cpp", - "jffs/full/It_vfs_jffs_060.cpp", - "jffs/full/It_vfs_jffs_061.cpp", - "jffs/full/It_vfs_jffs_062.cpp", - "jffs/full/It_vfs_jffs_063.cpp", - "jffs/full/It_vfs_jffs_064.cpp", - "jffs/full/It_vfs_jffs_065.cpp", - "jffs/full/It_vfs_jffs_066.cpp", - "jffs/full/It_vfs_jffs_067.cpp", - "jffs/full/It_vfs_jffs_068.cpp", - "jffs/full/It_vfs_jffs_069.cpp", - "jffs/full/It_vfs_jffs_070.cpp", - "jffs/full/It_vfs_jffs_071.cpp", - "jffs/full/It_vfs_jffs_072.cpp", - "jffs/full/It_vfs_jffs_073.cpp", - "jffs/full/It_vfs_jffs_074.cpp", - "jffs/full/It_vfs_jffs_076.cpp", - "jffs/full/It_vfs_jffs_077.cpp", - "jffs/full/It_vfs_jffs_078.cpp", - "jffs/full/It_vfs_jffs_079.cpp", - "jffs/full/It_vfs_jffs_080.cpp", - "jffs/full/It_vfs_jffs_081.cpp", - "jffs/full/It_vfs_jffs_082.cpp", - "jffs/full/It_vfs_jffs_083.cpp", - "jffs/full/It_vfs_jffs_084.cpp", - "jffs/full/It_vfs_jffs_085.cpp", - "jffs/full/It_vfs_jffs_086.cpp", - "jffs/full/It_vfs_jffs_088.cpp", - "jffs/full/It_vfs_jffs_090.cpp", - "jffs/full/It_vfs_jffs_092.cpp", - "jffs/full/It_vfs_jffs_093.cpp", - "jffs/full/It_vfs_jffs_096.cpp", - "jffs/full/It_vfs_jffs_097.cpp", - "jffs/full/It_vfs_jffs_099.cpp", - "jffs/full/It_vfs_jffs_100.cpp", - "jffs/full/It_vfs_jffs_101.cpp", - "jffs/full/It_vfs_jffs_102.cpp", - "jffs/full/It_vfs_jffs_104.cpp", - "jffs/full/It_vfs_jffs_105.cpp", - "jffs/full/It_vfs_jffs_106.cpp", - "jffs/full/It_vfs_jffs_107.cpp", - "jffs/full/It_vfs_jffs_116.cpp", - "jffs/full/It_vfs_jffs_117.cpp", - "jffs/full/It_vfs_jffs_118.cpp", - "jffs/full/It_vfs_jffs_119.cpp", - "jffs/full/It_vfs_jffs_120.cpp", - "jffs/full/It_vfs_jffs_121.cpp", - "jffs/full/It_vfs_jffs_122.cpp", - "jffs/full/It_vfs_jffs_123.cpp", - "jffs/full/It_vfs_jffs_124.cpp", - "jffs/full/It_vfs_jffs_125.cpp", - "jffs/full/It_vfs_jffs_126.cpp", - "jffs/full/It_vfs_jffs_127.cpp", - "jffs/full/It_vfs_jffs_128.cpp", - "jffs/full/It_vfs_jffs_129.cpp", - "jffs/full/It_vfs_jffs_130.cpp", - "jffs/full/It_vfs_jffs_131.cpp", - "jffs/full/It_vfs_jffs_132.cpp", - "jffs/full/It_vfs_jffs_133.cpp", - "jffs/full/It_vfs_jffs_134.cpp", - "jffs/full/It_vfs_jffs_135.cpp", - "jffs/full/It_vfs_jffs_136.cpp", - "jffs/full/It_vfs_jffs_137.cpp", - "jffs/full/It_vfs_jffs_138.cpp", - "jffs/full/It_vfs_jffs_139.cpp", - "jffs/full/It_vfs_jffs_140.cpp", - "jffs/full/It_vfs_jffs_141.cpp", - "jffs/full/It_vfs_jffs_142.cpp", - "jffs/full/It_vfs_jffs_143.cpp", - "jffs/full/It_vfs_jffs_144.cpp", - "jffs/full/It_vfs_jffs_145.cpp", - "jffs/full/It_vfs_jffs_146.cpp", - "jffs/full/It_vfs_jffs_147.cpp", - "jffs/full/It_vfs_jffs_148.cpp", - "jffs/full/It_vfs_jffs_149.cpp", - "jffs/full/It_vfs_jffs_150.cpp", - "jffs/full/It_vfs_jffs_151.cpp", - "jffs/full/It_vfs_jffs_152.cpp", - "jffs/full/It_vfs_jffs_153.cpp", - "jffs/full/It_vfs_jffs_154.cpp", - "jffs/full/It_vfs_jffs_155.cpp", - "jffs/full/It_vfs_jffs_156.cpp", - "jffs/full/It_vfs_jffs_157.cpp", - "jffs/full/It_vfs_jffs_158.cpp", - "jffs/full/It_vfs_jffs_159.cpp", - "jffs/full/It_vfs_jffs_160.cpp", - "jffs/full/It_vfs_jffs_161.cpp", - "jffs/full/It_vfs_jffs_162.cpp", - "jffs/full/It_vfs_jffs_163.cpp", - "jffs/full/It_vfs_jffs_164.cpp", - "jffs/full/It_vfs_jffs_165.cpp", - "jffs/full/It_vfs_jffs_166.cpp", - "jffs/full/It_vfs_jffs_167.cpp", - "jffs/full/It_vfs_jffs_168.cpp", - "jffs/full/It_vfs_jffs_169.cpp", - "jffs/full/It_vfs_jffs_170.cpp", - "jffs/full/It_vfs_jffs_171.cpp", - "jffs/full/It_vfs_jffs_172.cpp", - "jffs/full/It_vfs_jffs_173.cpp", - "jffs/full/It_vfs_jffs_174.cpp", - "jffs/full/It_vfs_jffs_175.cpp", - "jffs/full/It_vfs_jffs_176.cpp", - "jffs/full/It_vfs_jffs_177.cpp", - "jffs/full/It_vfs_jffs_178.cpp", - "jffs/full/It_vfs_jffs_179.cpp", - "jffs/full/It_vfs_jffs_180.cpp", - "jffs/full/It_vfs_jffs_182.cpp", - "jffs/full/It_vfs_jffs_183.cpp", - "jffs/full/It_vfs_jffs_184.cpp", - "jffs/full/It_vfs_jffs_185.cpp", - "jffs/full/It_vfs_jffs_187.cpp", - "jffs/full/It_vfs_jffs_188.cpp", - "jffs/full/It_vfs_jffs_189.cpp", - "jffs/full/It_vfs_jffs_190.cpp", - "jffs/full/It_vfs_jffs_191.cpp", - "jffs/full/It_vfs_jffs_192.cpp", - "jffs/full/It_vfs_jffs_193.cpp", - "jffs/full/It_vfs_jffs_194.cpp", - "jffs/full/It_vfs_jffs_195.cpp", - "jffs/full/It_vfs_jffs_196.cpp", - "jffs/full/It_vfs_jffs_197.cpp", - "jffs/full/It_vfs_jffs_198.cpp", - "jffs/full/It_vfs_jffs_199.cpp", - "jffs/full/It_vfs_jffs_200.cpp", - "jffs/full/It_vfs_jffs_201.cpp", - "jffs/full/It_vfs_jffs_202.cpp", - "jffs/full/It_vfs_jffs_203.cpp", - "jffs/full/It_vfs_jffs_204.cpp", - "jffs/full/It_vfs_jffs_205.cpp", - "jffs/full/It_vfs_jffs_206.cpp", - "jffs/full/It_vfs_jffs_207.cpp", - "jffs/full/It_vfs_jffs_208.cpp", - "jffs/full/It_vfs_jffs_209.cpp", - "jffs/full/It_vfs_jffs_210.cpp", - "jffs/full/It_vfs_jffs_211.cpp", - "jffs/full/It_vfs_jffs_212.cpp", - "jffs/full/It_vfs_jffs_213.cpp", - "jffs/full/It_vfs_jffs_214.cpp", - "jffs/full/It_vfs_jffs_215.cpp", - "jffs/full/It_vfs_jffs_216.cpp", - "jffs/full/It_vfs_jffs_217.cpp", - "jffs/full/It_vfs_jffs_218.cpp", - "jffs/full/It_vfs_jffs_219.cpp", - "jffs/full/It_vfs_jffs_220.cpp", - "jffs/full/It_vfs_jffs_221.cpp", - "jffs/full/It_vfs_jffs_222.cpp", - "jffs/full/It_vfs_jffs_223.cpp", - "jffs/full/It_vfs_jffs_224.cpp", - "jffs/full/It_vfs_jffs_225.cpp", - "jffs/full/It_vfs_jffs_226.cpp", - "jffs/full/It_vfs_jffs_227.cpp", - "jffs/full/It_vfs_jffs_228.cpp", - "jffs/full/It_vfs_jffs_229.cpp", - "jffs/full/It_vfs_jffs_230.cpp", - "jffs/full/It_vfs_jffs_231.cpp", - "jffs/full/It_vfs_jffs_232.cpp", - "jffs/full/It_vfs_jffs_233.cpp", - "jffs/full/It_vfs_jffs_234.cpp", - "jffs/full/It_vfs_jffs_235.cpp", - "jffs/full/It_vfs_jffs_236.cpp", - "jffs/full/It_vfs_jffs_237.cpp", - "jffs/full/It_vfs_jffs_238.cpp", - "jffs/full/It_vfs_jffs_239.cpp", - "jffs/full/It_vfs_jffs_240.cpp", - "jffs/full/It_vfs_jffs_241.cpp", - "jffs/full/It_vfs_jffs_242.cpp", - "jffs/full/It_vfs_jffs_243.cpp", - "jffs/full/It_vfs_jffs_244.cpp", - "jffs/full/It_vfs_jffs_245.cpp", - "jffs/full/It_vfs_jffs_246.cpp", - "jffs/full/It_vfs_jffs_247.cpp", - "jffs/full/It_vfs_jffs_248.cpp", - "jffs/full/It_vfs_jffs_249.cpp", - "jffs/full/It_vfs_jffs_250.cpp", - "jffs/full/It_vfs_jffs_251.cpp", - "jffs/full/It_vfs_jffs_252.cpp", - "jffs/full/It_vfs_jffs_253.cpp", - "jffs/full/It_vfs_jffs_254.cpp", - "jffs/full/It_vfs_jffs_255.cpp", - "jffs/full/It_vfs_jffs_256.cpp", - "jffs/full/It_vfs_jffs_257.cpp", - "jffs/full/It_vfs_jffs_258.cpp", - "jffs/full/It_vfs_jffs_259.cpp", - "jffs/full/It_vfs_jffs_260.cpp", - "jffs/full/It_vfs_jffs_261.cpp", - "jffs/full/It_vfs_jffs_262.cpp", - "jffs/full/It_vfs_jffs_263.cpp", - "jffs/full/It_vfs_jffs_264.cpp", - "jffs/full/It_vfs_jffs_265.cpp", - "jffs/full/It_vfs_jffs_266.cpp", - "jffs/full/It_vfs_jffs_267.cpp", - "jffs/full/It_vfs_jffs_268.cpp", - "jffs/full/It_vfs_jffs_269.cpp", - "jffs/full/It_vfs_jffs_270.cpp", - "jffs/full/It_vfs_jffs_271.cpp", - "jffs/full/It_vfs_jffs_272.cpp", - "jffs/full/It_vfs_jffs_273.cpp", - "jffs/full/It_vfs_jffs_274.cpp", - "jffs/full/It_vfs_jffs_275.cpp", - "jffs/full/It_vfs_jffs_276.cpp", - "jffs/full/It_vfs_jffs_277.cpp", - "jffs/full/It_vfs_jffs_278.cpp", - "jffs/full/It_vfs_jffs_279.cpp", - "jffs/full/It_vfs_jffs_280.cpp", - "jffs/full/It_vfs_jffs_281.cpp", - "jffs/full/It_vfs_jffs_282.cpp", - "jffs/full/It_vfs_jffs_283.cpp", - "jffs/full/It_vfs_jffs_284.cpp", - "jffs/full/It_vfs_jffs_285.cpp", - "jffs/full/It_vfs_jffs_286.cpp", - "jffs/full/It_vfs_jffs_287.cpp", - "jffs/full/It_vfs_jffs_288.cpp", - "jffs/full/It_vfs_jffs_289.cpp", - "jffs/full/It_vfs_jffs_290.cpp", - "jffs/full/It_vfs_jffs_291.cpp", - "jffs/full/It_vfs_jffs_292.cpp", - "jffs/full/It_vfs_jffs_293.cpp", - "jffs/full/It_vfs_jffs_294.cpp", - "jffs/full/It_vfs_jffs_295.cpp", - "jffs/full/It_vfs_jffs_296.cpp", - "jffs/full/It_vfs_jffs_297.cpp", - "jffs/full/It_vfs_jffs_298.cpp", - "jffs/full/It_vfs_jffs_299.cpp", - "jffs/full/It_vfs_jffs_300.cpp", - "jffs/full/It_vfs_jffs_301.cpp", - "jffs/full/It_vfs_jffs_302.cpp", - "jffs/full/It_vfs_jffs_303.cpp", - "jffs/full/It_vfs_jffs_304.cpp", - "jffs/full/It_vfs_jffs_305.cpp", - "jffs/full/It_vfs_jffs_306.cpp", - "jffs/full/It_vfs_jffs_307.cpp", - "jffs/full/It_vfs_jffs_308.cpp", - "jffs/full/It_vfs_jffs_309.cpp", - "jffs/full/It_vfs_jffs_310.cpp", - "jffs/full/It_vfs_jffs_311.cpp", - "jffs/full/It_vfs_jffs_312.cpp", - "jffs/full/It_vfs_jffs_313.cpp", - "jffs/full/It_vfs_jffs_314.cpp", - "jffs/full/It_vfs_jffs_315.cpp", - "jffs/full/It_vfs_jffs_316.cpp", - "jffs/full/It_vfs_jffs_317.cpp", - "jffs/full/It_vfs_jffs_318.cpp", - "jffs/full/It_vfs_jffs_319.cpp", - "jffs/full/It_vfs_jffs_320.cpp", - "jffs/full/It_vfs_jffs_321.cpp", - "jffs/full/It_vfs_jffs_322.cpp", - "jffs/full/It_vfs_jffs_323.cpp", - "jffs/full/It_vfs_jffs_324.cpp", - "jffs/full/It_vfs_jffs_325.cpp", - "jffs/full/It_vfs_jffs_326.cpp", - "jffs/full/It_vfs_jffs_327.cpp", - "jffs/full/It_vfs_jffs_328.cpp", - "jffs/full/It_vfs_jffs_329.cpp", - "jffs/full/It_vfs_jffs_330.cpp", - "jffs/full/It_vfs_jffs_331.cpp", - "jffs/full/It_vfs_jffs_332.cpp", - "jffs/full/It_vfs_jffs_333.cpp", - "jffs/full/It_vfs_jffs_334.cpp", - "jffs/full/It_vfs_jffs_335.cpp", - "jffs/full/It_vfs_jffs_336.cpp", - "jffs/full/It_vfs_jffs_337.cpp", - "jffs/full/It_vfs_jffs_338.cpp", - "jffs/full/It_vfs_jffs_339.cpp", - "jffs/full/It_vfs_jffs_340.cpp", - "jffs/full/It_vfs_jffs_342.cpp", - "jffs/full/It_vfs_jffs_343.cpp", - "jffs/full/It_vfs_jffs_344.cpp", - "jffs/full/It_vfs_jffs_346.cpp", - "jffs/full/It_vfs_jffs_352.cpp", - "jffs/full/It_vfs_jffs_353.cpp", - "jffs/full/It_vfs_jffs_354.cpp", - "jffs/full/It_vfs_jffs_355.cpp", - "jffs/full/It_vfs_jffs_356.cpp", - "jffs/full/It_vfs_jffs_357.cpp", - "jffs/full/It_vfs_jffs_358.cpp", - "jffs/full/It_vfs_jffs_359.cpp", - "jffs/full/It_vfs_jffs_360.cpp", - "jffs/full/It_vfs_jffs_361.cpp", - "jffs/full/It_vfs_jffs_362.cpp", - "jffs/full/It_vfs_jffs_364.cpp", - "jffs/full/It_vfs_jffs_365.cpp", - "jffs/full/It_vfs_jffs_366.cpp", - "jffs/full/It_vfs_jffs_367.cpp", - "jffs/full/It_vfs_jffs_368.cpp", - "jffs/full/It_vfs_jffs_369.cpp", - "jffs/full/It_vfs_jffs_370.cpp", - "jffs/full/It_vfs_jffs_371.cpp", - "jffs/full/It_vfs_jffs_372.cpp", - "jffs/full/It_vfs_jffs_373.cpp", - "jffs/full/It_vfs_jffs_374.cpp", - "jffs/full/It_vfs_jffs_375.cpp", - "jffs/full/It_vfs_jffs_376.cpp", - "jffs/full/It_vfs_jffs_377.cpp", - "jffs/full/It_vfs_jffs_378.cpp", - "jffs/full/It_vfs_jffs_379.cpp", - "jffs/full/It_vfs_jffs_380.cpp", - "jffs/full/It_vfs_jffs_381.cpp", - "jffs/full/It_vfs_jffs_382.cpp", - "jffs/full/It_vfs_jffs_383.cpp", - "jffs/full/It_vfs_jffs_384.cpp", - "jffs/full/It_vfs_jffs_385.cpp", - "jffs/full/It_vfs_jffs_386.cpp", - "jffs/full/It_vfs_jffs_387.cpp", - "jffs/full/It_vfs_jffs_388.cpp", - "jffs/full/It_vfs_jffs_389.cpp", - "jffs/full/It_vfs_jffs_390.cpp", - "jffs/full/It_vfs_jffs_391.cpp", - "jffs/full/It_vfs_jffs_392.cpp", - "jffs/full/It_vfs_jffs_393.cpp", - "jffs/full/It_vfs_jffs_394.cpp", - "jffs/full/It_vfs_jffs_395.cpp", - "jffs/full/It_vfs_jffs_396.cpp", - "jffs/full/It_vfs_jffs_397.cpp", - "jffs/full/It_vfs_jffs_398.cpp", - "jffs/full/It_vfs_jffs_399.cpp", - "jffs/full/It_vfs_jffs_400.cpp", - "jffs/full/It_vfs_jffs_401.cpp", - "jffs/full/It_vfs_jffs_402.cpp", - "jffs/full/It_vfs_jffs_403.cpp", - "jffs/full/It_vfs_jffs_404.cpp", - "jffs/full/It_vfs_jffs_405.cpp", - "jffs/full/It_vfs_jffs_406.cpp", - "jffs/full/It_vfs_jffs_407.cpp", - "jffs/full/It_vfs_jffs_408.cpp", - "jffs/full/It_vfs_jffs_409.cpp", - "jffs/full/It_vfs_jffs_410.cpp", - "jffs/full/It_vfs_jffs_411.cpp", - "jffs/full/It_vfs_jffs_412.cpp", - "jffs/full/It_vfs_jffs_413.cpp", - "jffs/full/It_vfs_jffs_414.cpp", - "jffs/full/It_vfs_jffs_415.cpp", - "jffs/full/It_vfs_jffs_416.cpp", - "jffs/full/It_vfs_jffs_417.cpp", - "jffs/full/It_vfs_jffs_418.cpp", - "jffs/full/It_vfs_jffs_419.cpp", - "jffs/full/It_vfs_jffs_420.cpp", - "jffs/full/It_vfs_jffs_421.cpp", - "jffs/full/It_vfs_jffs_422.cpp", - "jffs/full/It_vfs_jffs_423.cpp", - "jffs/full/It_vfs_jffs_424.cpp", - "jffs/full/It_vfs_jffs_425.cpp", - "jffs/full/It_vfs_jffs_426.cpp", - "jffs/full/It_vfs_jffs_427.cpp", - "jffs/full/It_vfs_jffs_428.cpp", - "jffs/full/It_vfs_jffs_429.cpp", - "jffs/full/It_vfs_jffs_430.cpp", - "jffs/full/It_vfs_jffs_431.cpp", - "jffs/full/It_vfs_jffs_432.cpp", - "jffs/full/It_vfs_jffs_433.cpp", - "jffs/full/It_vfs_jffs_434.cpp", - "jffs/full/It_vfs_jffs_435.cpp", - "jffs/full/It_vfs_jffs_454.cpp", - "jffs/full/It_vfs_jffs_455.cpp", - "jffs/full/It_vfs_jffs_456.cpp", - "jffs/full/It_vfs_jffs_457.cpp", - "jffs/full/It_vfs_jffs_458.cpp", - "jffs/full/It_vfs_jffs_459.cpp", - "jffs/full/It_vfs_jffs_460.cpp", - "jffs/full/It_vfs_jffs_461.cpp", - "jffs/full/It_vfs_jffs_462.cpp", - "jffs/full/It_vfs_jffs_487.cpp", - "jffs/full/It_vfs_jffs_488.cpp", - "jffs/full/It_vfs_jffs_489.cpp", - "jffs/full/It_vfs_jffs_490.cpp", - "jffs/full/It_vfs_jffs_491.cpp", - "jffs/full/It_vfs_jffs_492.cpp", - "jffs/full/It_vfs_jffs_493.cpp", - "jffs/full/It_vfs_jffs_494.cpp", - "jffs/full/It_vfs_jffs_495.cpp", - "jffs/full/It_vfs_jffs_496.cpp", - "jffs/full/It_vfs_jffs_497.cpp", - "jffs/full/It_vfs_jffs_498.cpp", - "jffs/full/It_vfs_jffs_499.cpp", - "jffs/full/It_vfs_jffs_500.cpp", - "jffs/full/It_vfs_jffs_501.cpp", - "jffs/full/It_vfs_jffs_502.cpp", - "jffs/full/It_vfs_jffs_503.cpp", - "jffs/full/It_vfs_jffs_504.cpp", - "jffs/full/It_vfs_jffs_505.cpp", - "jffs/full/It_vfs_jffs_506.cpp", - "jffs/full/It_vfs_jffs_507.cpp", - "jffs/full/It_vfs_jffs_508.cpp", - "jffs/full/It_vfs_jffs_509.cpp", - "jffs/full/It_vfs_jffs_510.cpp", - "jffs/full/It_vfs_jffs_511.cpp", - "jffs/full/It_vfs_jffs_512.cpp", - "jffs/full/It_vfs_jffs_513.cpp", - "jffs/full/It_vfs_jffs_514.cpp", - "jffs/full/It_vfs_jffs_515.cpp", - "jffs/full/It_vfs_jffs_516.cpp", - "jffs/full/It_vfs_jffs_517.cpp", - "jffs/full/It_vfs_jffs_518.cpp", - "jffs/full/It_vfs_jffs_519.cpp", - "jffs/full/It_vfs_jffs_520.cpp", - "jffs/full/It_vfs_jffs_521.cpp", - "jffs/full/It_vfs_jffs_522.cpp", - "jffs/full/It_vfs_jffs_523.cpp", - "jffs/full/It_vfs_jffs_524.cpp", - "jffs/full/It_vfs_jffs_526.cpp", - "jffs/full/It_vfs_jffs_528.cpp", - "jffs/full/It_vfs_jffs_529.cpp", - "jffs/full/It_vfs_jffs_530.cpp", - "jffs/full/It_vfs_jffs_531.cpp", - "jffs/full/It_vfs_jffs_532.cpp", - "jffs/full/It_vfs_jffs_533.cpp", - "jffs/full/It_vfs_jffs_534.cpp", - "jffs/full/It_vfs_jffs_541.cpp", - "jffs/full/It_vfs_jffs_542.cpp", - "jffs/full/It_vfs_jffs_543.cpp", - "jffs/full/It_vfs_jffs_544.cpp", - "jffs/full/It_vfs_jffs_545.cpp", - "jffs/full/It_vfs_jffs_546.cpp", - "jffs/full/It_vfs_jffs_547.cpp", - "jffs/full/It_vfs_jffs_548.cpp", - "jffs/full/It_vfs_jffs_549.cpp", - "jffs/full/It_vfs_jffs_550.cpp", - "jffs/full/It_vfs_jffs_551.cpp", - "jffs/full/It_vfs_jffs_552.cpp", - "jffs/full/It_vfs_jffs_553.cpp", - "jffs/full/It_vfs_jffs_554.cpp", - "jffs/full/It_vfs_jffs_555.cpp", - "jffs/full/It_vfs_jffs_556.cpp", - "jffs/full/It_vfs_jffs_557.cpp", - "jffs/full/It_vfs_jffs_560.cpp", - "jffs/full/It_vfs_jffs_562.cpp", - "jffs/full/It_vfs_jffs_563.cpp", - "jffs/full/It_vfs_jffs_564.cpp", - "jffs/full/It_vfs_jffs_565.cpp", - "jffs/full/It_vfs_jffs_566.cpp", - "jffs/full/It_vfs_jffs_567.cpp", - "jffs/full/It_vfs_jffs_568.cpp", - "jffs/full/It_vfs_jffs_569.cpp", - "jffs/full/It_vfs_jffs_570.cpp", - "jffs/full/It_vfs_jffs_571.cpp", - "jffs/full/It_vfs_jffs_572.cpp", - "jffs/full/It_vfs_jffs_573.cpp", - "jffs/full/It_vfs_jffs_574.cpp", - "jffs/full/It_vfs_jffs_583.cpp", - "jffs/full/It_vfs_jffs_584.cpp", - "jffs/full/It_vfs_jffs_586.cpp", - "jffs/full/It_vfs_jffs_589.cpp", - "jffs/full/It_vfs_jffs_590.cpp", - "jffs/full/It_vfs_jffs_591.cpp", - "jffs/full/It_vfs_jffs_592.cpp", - "jffs/full/It_vfs_jffs_593.cpp", - "jffs/full/It_vfs_jffs_594.cpp", - "jffs/full/It_vfs_jffs_595.cpp", - "jffs/full/It_vfs_jffs_596.cpp", - "jffs/full/It_vfs_jffs_603.cpp", - "jffs/full/It_vfs_jffs_636.cpp", - "jffs/full/It_vfs_jffs_643.cpp", - "jffs/full/It_vfs_jffs_644.cpp", - "jffs/full/It_vfs_jffs_645.cpp", - "jffs/full/It_vfs_jffs_646.cpp", - "jffs/full/It_vfs_jffs_648.cpp", - "jffs/full/It_vfs_jffs_649.cpp", - "jffs/full/It_vfs_jffs_650.cpp", - "jffs/full/It_vfs_jffs_651.cpp", - "jffs/full/It_vfs_jffs_652.cpp", - "jffs/full/It_vfs_jffs_653.cpp", - "jffs/full/It_vfs_jffs_654.cpp", - "jffs/full/It_vfs_jffs_655.cpp", - "jffs/full/It_vfs_jffs_656.cpp", - "jffs/full/It_vfs_jffs_663.cpp", - "jffs/full/It_vfs_jffs_664.cpp", - "jffs/full/It_vfs_jffs_665.cpp", - "jffs/full/It_vfs_jffs_666.cpp", - "jffs/full/It_vfs_jffs_668.cpp", - "jffs/full/It_vfs_jffs_669.cpp", - "jffs/full/It_vfs_jffs_670.cpp", - "jffs/full/It_vfs_jffs_671.cpp", - "jffs/full/It_vfs_jffs_672.cpp", - "jffs/full/It_vfs_jffs_673.cpp", - "jffs/full/It_vfs_jffs_674.cpp", - "jffs/full/It_vfs_jffs_675.cpp", - "jffs/full/It_vfs_jffs_676.cpp", - "jffs/full/It_vfs_jffs_690.cpp", - "jffs/full/It_vfs_jffs_694.cpp", - "jffs/full/It_vfs_jffs_696.cpp", - "jffs/full/It_vfs_jffs_697.cpp", - "jffs/full/It_vfs_jffs_700.cpp", - "jffs/full/It_vfs_jffs_701.cpp", - "jffs/full/It_vfs_jffs_807.cpp", - "jffs/full/It_vfs_jffs_808.cpp", - "jffs/full/It_vfs_test_link_001.cpp", - "jffs/full/It_vfs_test_link_002.cpp", - "jffs/full/It_vfs_test_link_003.cpp", - "jffs/full/It_vfs_test_linkat_001.cpp", - "jffs/full/It_vfs_test_linkat_002.cpp", - "jffs/full/It_vfs_test_linkat_003.cpp", - "jffs/full/It_vfs_test_readlink_001.cpp", - "jffs/full/It_vfs_test_symlink_001.cpp", - "jffs/full/It_vfs_test_symlink_002.cpp", - "jffs/full/It_vfs_test_symlink_003.cpp", - "jffs/full/It_vfs_test_symlinkat_001.cpp", - "jffs/full/It_vfs_test_mount_rdonly_001.cpp", - "jffs/full/It_vfs_test_mount_rdonly_002.cpp", - "jffs/full/It_vfs_test_mount_rdonly_003.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_fs_unittest_door_old") { - 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 - sources_pressure = [] - sources += sources_pressure - configs = [ "..:public_config_for_door" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_fs_unittest_old") { - 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 - sources_pressure = [] - sources += sources_pressure - configs = [ "..:public_config_for_all" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) { - unittest("liteos_a_fs_unittest_pressure_old") { - output_extension = "bin" - output_dir = "$root_out_dir/test/unittest/kernel" - include_dirs = common_include_dirs - sources = sources_entry - sources_smoke = [] - sources += sources_smoke - sources_full = [] - sources += sources_full - sources += sources_pressure - configs = [ "..:public_config_for_pressure" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} diff --git a/testsuites/unittest_old/fs/jffs/It_vfs_jffs.h b/testsuites/unittest_old/fs/jffs/It_vfs_jffs.h deleted file mode 100644 index d103c95a..00000000 --- a/testsuites/unittest_old/fs/jffs/It_vfs_jffs.h +++ /dev/null @@ -1,1159 +0,0 @@ -/* - * 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. - */ -#include -#include -#include "sys/capability.h" -#include "sys/ioctl.h" -#include "sys/select.h" -#include "sys/stat.h" -#include "sys/statfs.h" -#include "sys/types.h" -#include "sys/uio.h" -#include "syslog.h" - -#include "fcntl.h" -#include "stdlib.h" -#include "time.h" -#include "unistd.h" -#include "utime.h" - -#include "dirent.h" -#include "ftw.h" -#include "libgen.h" -#include "limits.h" -#include "los_typedef.h" -#include "osTest.h" -#include "pthread.h" -#include "sched.h" -#include "semaphore.h" -#include "signal.h" -#include "wchar.h" - -constexpr int F_RDO = 0x01; /* Read only */ -constexpr int F_HID = 0x02; /* Hidden */ -constexpr int F_SYS = 0x04; /* System */ -constexpr int F_ARC = 0x20; /* Archive */ -constexpr int CONFIG_NFILE_DESCRIPTORS = 512; -constexpr int LOS_WAIT_FOREVER = 0xFFFFFFFF; -#if 0 -constexpr int DT_UNKNOWN = 0; -constexpr int DT_FIFO = 1; -constexpr int DT_CHR = 2; -constexpr int DT_DIR = 4; -constexpr int DT_BLK = 6; -constexpr int DT_REG = 8; -constexpr int DT_LNK = 10; -constexpr int DT_SOCK = 12; -constexpr int DT_WHT = 14; -constexpr int MS_RDONLY = 1; -#endif - -#if 0 -constexpr const char* JFFS_MAIN_DIR0 = "/storage"; -constexpr const char* JFFS_MOUNT_DIR0 = "/storage"; -constexpr const char* JFFS_MAIN_DIR1 = "/storage1"; -constexpr const char* JFFS_PATH_NAME0 = "/storage/test"; -constexpr const char* JFFS_PATH_NAME01 = "/storage/test1"; -constexpr const char* JFFS_PATH_NAME02 = "/storage/test2"; -constexpr const char* JFFS_PATH_NAME00 = "/storage/test/test00"; -constexpr const char* JFFS_PATH_NAME11 = "/storage/test1/test11"; -constexpr const char* JFFS_PATH_NAME22 = "/storage/test2/test22"; -constexpr const char* JFFS_PATH_NAME_0 = "/storage/test/test0"; -constexpr const char* JFFS_PATH_NAME_01 = "/storage/test/test0/test1"; -constexpr const char* JFFS_PATH_NAME1 = "/storage1/test"; -constexpr const char* JFFS_DEV_PATH0 = "/dev/spinorblk2"; -constexpr const char* JFFS_DEV_PATH1 = "/dev/spinorblk1"; -constexpr const char* JFFS_FILESYS_TYPE = "jffs2"; -constexpr const char* JFFS_CHINESE_NAME1 = "���Ϻ�"; -constexpr const char* JFFS_BASE_DIR = "/"; -#endif - -#define JFFS_FILE_MODE 0755 -#define JFFS_MAIN_DIR0 "/storage" -#define JFFS_MOUNT_DIR0 "/storage" -#define JFFS_MAIN_DIR1 "/storage1" -#define JFFS_PATH_NAME0 "/storage/test" -#define JFFS_PATH_NAME01 "/storage/test1" -#define JFFS_PATH_NAME02 "/storage/test2" -#define JFFS_PATH_NAME03 "/storage/test3" -#define JFFS_PATH_NAME04 "/storage/test4" -#define JFFS_PATH_NAME00 "/storage/test/test00" -#define JFFS_PATH_NAME11 "/storage/test1/test11" -#define JFFS_PATH_NAME22 "/storage/test2/test22" -#define JFFS_PATH_NAME_0 "/storage/test/test0" -#define JFFS_PATH_NAME_01 "/storage/test/test0/test1" -#define JFFS_PATH_NAME1 "/storage1/test" -#define JFFS_DEV_PATH0 "/dev/spinorblk2" -#define JFFS_DEV_PATH1 "/dev/spinorblk1" -#define JFFS_FILESYS_TYPE "jffs2" -#define JFFS_CHINESE_NAME1 "���Ϻ�" -#define JFFS_BASE_DIR "/" - -constexpr int MSECS_PER_SEC = 1000; -constexpr int USECS_PER_SEC = 1000000; -constexpr int BYTES_PER_KBYTE = 1024; -constexpr int BYTES_PER_MBYTE = (1024 * 1024); -constexpr int BYTES_PER_GBYTES = (1024 * 1024 * 1024); - -constexpr int FILE_BUF_SIZE = 260; -constexpr int HIGHEST_AUTHORITY = 0777; -constexpr int JFFS_MAX_NUM_TEST = 1000; -constexpr int JFFS_NAME_LIMITTED_SIZE = 300; -constexpr int JFFS_STANDARD_NAME_LENGTH = 50; - -constexpr int JFFS_LONG_ARRAY_LENGTH = 100; -constexpr int JFFS_MIDDLE_ARRAY_LENGTH = 50; -constexpr int JFFS_SHORT_ARRAY_LENGTH = 10; -constexpr int JFFS_WR_CAP_SIZE_TEST = 0x100000; // the size is 1MB for each speed calculation -constexpr int JFFS_MAX_DEF_BUF_NUM = 21; - -constexpr int JFFS_FILE_LIMITTED_NUM = 200; - -constexpr int JFFS_FILE_SIZE_TEST = 100 * 1024 * 1024; // *1024 -constexpr int JFFS_PERFORMANCE_W_R_SIZE = 5 * 1024 * 1024; -constexpr int JFFS_FILE_PER_WRITE_SIZE = 5 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE1 = 1 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE2 = 5 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE3 = 10 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE4 = 50 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE5 = 100 * 1024 * 1024; -constexpr int JFFS_PRESSURE_W_R_SIZE = JFFS_PRESSURE_W_R_SIZE3; -constexpr int JFFS_THREAD_NUM_TEST = 3; - -constexpr int SLEEP_TIME = 10; -constexpr int TASK_PRIO_TEST2 = TASK_PRIO_TEST - 2; - -constexpr int JFFS_MIDDLE_CYCLES = 3; -constexpr int JFFS_MIDDLE_NUM = 6; -constexpr int JFFS_MAX_CYCLES = 5; -constexpr int JFFS_CREATFILE_NUM = 5; -constexpr int JFFS_WR_TYPE_TEST1 = 0; // 0:use fwrite and fread for test -constexpr int JFFS_WR_TYPE_TEST2 = 1; // 1:use write and read for test -constexpr int JFFS_WR_TYPE_TEST = JFFS_WR_TYPE_TEST2; - -constexpr int JFFS_PRESSURE_CYCLES = 10; -constexpr int JFFS_MAXIMUM_OPERATIONS = 10; -constexpr int JFFS_MAXIMUM_SIZES = 10; -constexpr int JFFS_MAX_THREADS = 3; -#define JFFS_NO_ERROR 0 -#define JFFS_IS_ERROR -1 -#define JFFS_TO_NULL NULL - -constexpr int JFFS_UTIME_SUPPORT = -1; // 0 means utime is supported,-1 means utime is not supported -constexpr int JFFS_BASE_ADDR = 0x1900000; -constexpr int JFFS_MTD_SIZE = 0x200000; -constexpr int JFFS_SECOND_MDT = 1; - -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY = 10; -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1 = JFFS2NUM_JFFS2_GC_THREAD_PRIORITY - 1; -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2 = JFFS2NUM_JFFS2_GC_THREAD_PRIORITY - 2; -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY3 = JFFS2NUM_JFFS2_GC_THREAD_PRIORITY - 3; -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4 = JFFS2NUM_JFFS2_GC_THREAD_PRIORITY - 4; -constexpr int JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5 = JFFS2NUM_JFFS2_GC_THREAD_PRIORITY - 5; - - -constexpr int JFFS_PRESSURE_MTD_SIZE = 0x6A00000; /* The size is 106MB */ -#if defined TEST3516A || defined TEST3516EV200 -constexpr int JFFS_PRESSURE_ADDRESS_BEGIN = 0xe00000; -constexpr int JFFS_PRESSURE_ADDRESS_END = 0X7f00000; -#elif defined TEST3518E || defined TEST3516CV300 -constexpr int JFFS_PRESSURE_ADDRESS_BEGIN = 0xe00000; -constexpr int JFFS_PRESSURE_ADDRESS_END = 0X7f00000; -#endif - -extern INT32 g_jffsFilesMax; -extern INT32 g_jffsFlag; -extern INT32 g_jffsFlagF01; -extern INT32 g_jffsFlagF02; -extern INT32 g_jffsFd; -extern DIR *g_jffsDir; -extern BOOL isCpuAffiMaskTest; -extern INT32 g_TestCnt; - -extern INT32 g_jffsFd11[JFFS_MAXIMUM_SIZES]; -extern INT32 g_jffsFd12[JFFS_MAXIMUM_SIZES][JFFS_MAXIMUM_SIZES]; - -extern CHAR g_jffsPathname1[JFFS_STANDARD_NAME_LENGTH]; -extern CHAR g_jffsPathname2[JFFS_STANDARD_NAME_LENGTH]; -extern CHAR g_jffsPathname3[JFFS_STANDARD_NAME_LENGTH]; -extern CHAR g_jffsPathname4[JFFS_STANDARD_NAME_LENGTH]; - -extern CHAR g_jffsPathname6[JFFS_NAME_LIMITTED_SIZE]; -extern CHAR g_jffsPathname7[JFFS_NAME_LIMITTED_SIZE]; -extern CHAR g_jffsPathname8[JFFS_NAME_LIMITTED_SIZE]; - -extern CHAR g_jffsPathname11[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE]; -extern CHAR g_jffsPathname12[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE]; -extern CHAR g_jffsPathname13[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE]; - -extern struct iovec g_jffsIov[10]; - -extern pthread_mutex_t g_jffs2GlobalLock1; -extern pthread_mutex_t g_jffs2GlobalLock2; - -INT32 JffsFixWrite(CHAR *path, INT64 fileSize, INT32 writeSize, INT32 interfaceType); -INT32 JffsFixRead(CHAR *path, INT64 fileSize, INT32 readSize, INT32 interfaceType); -INT32 JffsMultiWrite(CHAR *path, INT64 fileSize, INT32 writeSize, int oflags, INT32 interfaceType); -INT32 JffsMultiRead(CHAR *path, INT64 fileSize, INT32 readSize, int oflags, INT32 interfaceType); -INT32 JffsRandWrite(CHAR *path, INT64 fileSize, INT32 interfaceType); -INT32 JffsRandRead(CHAR *path, INT64 fileSize, INT32 interfaceType); - -INT32 JffsDeleteDirs(char *str, int n); -INT32 JffsDeletefile(int fd, char *pathname); -INT32 JffsStrcat2(char *pathname, char *str, int len); -INT32 JffsScandirFree(struct dirent **namelist, int n); -INT32 JffsStatPrintf(struct stat sb); -INT32 JffsStatfsPrintf(struct statfs buf); -INT32 JffsStat64Printf(struct stat64 sb); - -extern int open64(const char *__path, int __oflag, ...); -extern int fcntl64(int fd, int cmd, ...); - -extern int osShellCmdPartitionShow(int argc, char **argv); - -extern int alphasort(const struct dirent **a, const struct dirent **b); -extern int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, - const void *data); -extern int umount(const char *target); -extern bool IS_MOUNTPT(const char *dev); -extern int chattr(const char *path, mode_t mode); - -extern VOID ItSuite_Vfs_Jffs(VOID); - -#if defined(LOSCFG_USER_TEST_SMOKE) -VOID ItTestDac001(VOID); -VOID ItFsJffs001(VOID); -VOID ItFsJffs002(VOID); -VOID ItFsJffs003(VOID); -VOID ItFsJffs005(VOID); -VOID ItFsJffs021(VOID); -VOID ItFsJffs022(VOID); -VOID ItFsJffs026(VOID); -VOID ItFsJffs027(VOID); -VOID ItFsJffs034(VOID); -VOID ItFsJffs035(VOID); -VOID ItFsJffs094(VOID); -VOID ItFsJffs095(VOID); -VOID ItFsJffs103(VOID); -VOID ItFsJffs535(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -VOID IO_TEST_FACCESSAT_001(void); -VOID IO_TEST_FACCESSAT_002(void); -VOID IO_TEST_FSTATFS_001(void); -VOID IO_TEST_FSTATFS_002(void); -VOID IO_TEST_FSTATAT_001(void); -VOID IO_TEST_FSTATAT_002(void); -void ItTestFsJffs001(void); -void ItTestFsJffs002(void); -void ItTestFsJffs003(void); -void ItTestFsJffs004(void); -void ItTestFsJffs100(void); -void ItTestFsJffs101(void); -void ItTestFsJffs102(void); -void ItTestFsJffs103(void); -void ItTestFsJffs106(void); -void ItTestFsJffs112(void); -void ItTestFsJffs113(void); -VOID ItJffs001(VOID); -VOID ItJffs002(VOID); -VOID ItJffs003(VOID); -VOID ItJffs004(VOID); -VOID ItJffs005(VOID); -VOID ItJffs006(VOID); -VOID ItJffs007(VOID); -VOID ItJffs008(VOID); -VOID ItJffs009(VOID); -VOID ItJffs010(VOID); -VOID ItJffs011(VOID); -VOID ItJffs012(VOID); -VOID ItJffs013(VOID); -VOID ItJffs014(VOID); -VOID ItJffs015(VOID); -VOID ItJffs016(VOID); -VOID ItJffs017(VOID); -VOID ItJffs018(VOID); -VOID ItJffs019(VOID); -VOID ItJffs020(VOID); -VOID ItJffs021(VOID); -VOID ItJffs022(VOID); -VOID ItJffs023(VOID); -VOID ItJffs024(VOID); -VOID ItJffs025(VOID); -VOID ItJffs026(VOID); -VOID ItJffs027(VOID); -VOID ItJffs028(VOID); -VOID ItJffs029(VOID); -VOID ItJffs030(VOID); -VOID ItJffs031(VOID); -VOID ItJffs032(VOID); -VOID ItJffs033(VOID); -VOID ItJffs034(VOID); -VOID ItJffs035(VOID); -VOID ItJffs036(VOID); -VOID ItJffs037(VOID); -VOID ItJffs038(VOID); -VOID ItJffs039(VOID); -VOID ItJffs040(VOID); -VOID ItJffs041(VOID); -VOID ItJffs042(VOID); -VOID ItJffs043(VOID); -VOID ItJffs044(VOID); - -VOID ItFsJffs004(VOID); -VOID ItFsJffs006(VOID); -VOID ItFsJffs007(VOID); -VOID ItFsJffs008(VOID); -VOID ItFsJffs009(VOID); -VOID ItFsJffs010(VOID); -VOID ItFsJffs011(VOID); -VOID ItFsJffs012(VOID); -VOID ItFsJffs013(VOID); -VOID ItFsJffs014(VOID); -VOID ItFsJffs015(VOID); -VOID ItFsJffs016(VOID); -VOID ItFsJffs017(VOID); -VOID ItFsJffs018(VOID); -VOID ItFsJffs019(VOID); -VOID ItFsJffs020(VOID); -VOID ItFsJffs023(VOID); -VOID ItFsJffs024(VOID); -VOID ItFsJffs025(VOID); -VOID ItFsJffs028(VOID); -VOID ItFsJffs029(VOID); -VOID ItFsJffs030(VOID); -VOID ItFsJffs031(VOID); -VOID ItFsJffs032(VOID); -VOID ItFsJffs033(VOID); -VOID ItFsJffs037(VOID); -VOID ItFsJffs038(VOID); -VOID ItFsJffs039(VOID); -VOID ItFsJffs040(VOID); -VOID ItFsJffs041(VOID); -VOID ItFsJffs042(VOID); -VOID ItFsJffs043(VOID); -VOID ItFsJffs044(VOID); -VOID ItFsJffs045(VOID); -VOID ItFsJffs046(VOID); -VOID ItFsJffs047(VOID); -VOID ItFsJffs048(VOID); -VOID ItFsJffs049(VOID); -VOID ItFsJffs050(VOID); -VOID ItFsJffs052(VOID); -VOID ItFsJffs053(VOID); -VOID ItFsJffs054(VOID); -VOID ItFsJffs055(VOID); -VOID ItFsJffs056(VOID); -VOID ItFsJffs057(VOID); -VOID ItFsJffs058(VOID); -VOID ItFsJffs059(VOID); -VOID ItFsJffs060(VOID); -VOID ItFsJffs061(VOID); -VOID ItFsJffs062(VOID); -VOID ItFsJffs063(VOID); -VOID ItFsJffs064(VOID); -VOID ItFsJffs065(VOID); -VOID ItFsJffs066(VOID); -VOID ItFsJffs067(VOID); -VOID ItFsJffs068(VOID); -VOID ItFsJffs069(VOID); -VOID ItFsJffs070(VOID); -VOID ItFsJffs071(VOID); -VOID ItFsJffs072(VOID); -VOID ItFsJffs073(VOID); -VOID ItFsJffs074(VOID); -VOID ItFsJffs075(VOID); -VOID ItFsJffs076(VOID); -VOID ItFsJffs077(VOID); -VOID ItFsJffs078(VOID); -VOID ItFsJffs079(VOID); -VOID ItFsJffs080(VOID); -VOID ItFsJffs081(VOID); -VOID ItFsJffs082(VOID); -VOID ItFsJffs083(VOID); -VOID ItFsJffs084(VOID); -VOID ItFsJffs085(VOID); -VOID ItFsJffs086(VOID); -VOID ItFsJffs088(VOID); -VOID ItFsJffs089(VOID); -VOID ItFsJffs090(VOID); -VOID ItFsJffs091(VOID); -VOID ItFsJffs092(VOID); -VOID ItFsJffs093(VOID); -VOID ItFsJffs096(VOID); -VOID ItFsJffs097(VOID); -VOID ItFsJffs098(VOID); -VOID ItFsJffs099(VOID); -VOID ItFsJffs100(VOID); -VOID ItFsJffs101(VOID); -VOID ItFsJffs102(VOID); -VOID ItFsJffs104(VOID); -VOID ItFsJffs105(VOID); -VOID ItFsJffs106(VOID); -VOID ItFsJffs107(VOID); -VOID ItFsJffs109(VOID); -VOID ItFsJffs110(VOID); -VOID ItFsJffs111(VOID); -VOID ItFsJffs112(VOID); -VOID ItFsJffs113(VOID); -VOID ItFsJffs114(VOID); -VOID ItFsJffs115(VOID); -VOID ItFsJffs116(VOID); -VOID ItFsJffs117(VOID); -VOID ItFsJffs118(VOID); -VOID ItFsJffs119(VOID); -VOID ItFsJffs120(VOID); -VOID ItFsJffs121(VOID); -VOID ItFsJffs122(VOID); -VOID ItFsJffs123(VOID); -VOID ItFsJffs124(VOID); -VOID ItFsJffs125(VOID); -VOID ItFsJffs126(VOID); -VOID ItFsJffs127(VOID); -VOID ItFsJffs128(VOID); -VOID ItFsJffs129(VOID); -VOID ItFsJffs130(VOID); -VOID ItFsJffs131(VOID); -VOID ItFsJffs132(VOID); -VOID ItFsJffs133(VOID); -VOID ItFsJffs134(VOID); -VOID ItFsJffs135(VOID); -VOID ItFsJffs136(VOID); -VOID ItFsJffs137(VOID); -VOID ItFsJffs138(VOID); -VOID ItFsJffs139(VOID); -VOID ItFsJffs140(VOID); -VOID ItFsJffs141(VOID); -VOID ItFsJffs142(VOID); -VOID ItFsJffs143(VOID); -VOID ItFsJffs144(VOID); -VOID ItFsJffs145(VOID); -VOID ItFsJffs146(VOID); -VOID ItFsJffs147(VOID); -VOID ItFsJffs148(VOID); -VOID ItFsJffs149(VOID); -VOID ItFsJffs150(VOID); -VOID ItFsJffs151(VOID); -VOID ItFsJffs152(VOID); -VOID ItFsJffs153(VOID); -VOID ItFsJffs154(VOID); -VOID ItFsJffs155(VOID); -VOID ItFsJffs156(VOID); -VOID ItFsJffs157(VOID); -VOID ItFsJffs158(VOID); -VOID ItFsJffs159(VOID); -VOID ItFsJffs160(VOID); -VOID ItFsJffs161(VOID); -VOID ItFsJffs162(VOID); -VOID ItFsJffs163(VOID); -VOID ItFsJffs164(VOID); -VOID ItFsJffs165(VOID); -VOID ItFsJffs166(VOID); -VOID ItFsJffs167(VOID); -VOID ItFsJffs168(VOID); -VOID ItFsJffs169(VOID); -VOID ItFsJffs170(VOID); -VOID ItFsJffs171(VOID); -VOID ItFsJffs172(VOID); -VOID ItFsJffs173(VOID); -VOID ItFsJffs174(VOID); -VOID ItFsJffs175(VOID); -VOID ItFsJffs176(VOID); -VOID ItFsJffs177(VOID); -VOID ItFsJffs178(VOID); -VOID ItFsJffs179(VOID); -VOID ItFsJffs180(VOID); -VOID ItFsJffs182(VOID); -VOID ItFsJffs183(VOID); -VOID ItFsJffs184(VOID); -VOID ItFsJffs185(VOID); -VOID ItFsJffs187(VOID); -VOID ItFsJffs188(VOID); -VOID ItFsJffs189(VOID); -VOID ItFsJffs190(VOID); -VOID ItFsJffs191(VOID); -VOID ItFsJffs192(VOID); -VOID ItFsJffs193(VOID); -VOID ItFsJffs194(VOID); -VOID ItFsJffs195(VOID); -VOID ItFsJffs196(VOID); -VOID ItFsJffs197(VOID); -VOID ItFsJffs198(VOID); -VOID ItFsJffs199(VOID); -VOID ItFsJffs200(VOID); -VOID ItFsJffs201(VOID); -VOID ItFsJffs202(VOID); -VOID ItFsJffs203(VOID); -VOID ItFsJffs204(VOID); -VOID ItFsJffs205(VOID); -VOID ItFsJffs206(VOID); -VOID ItFsJffs207(VOID); -VOID ItFsJffs208(VOID); -VOID ItFsJffs209(VOID); -VOID ItFsJffs210(VOID); -VOID ItFsJffs211(VOID); -VOID ItFsJffs212(VOID); -VOID ItFsJffs213(VOID); -VOID ItFsJffs214(VOID); -VOID ItFsJffs215(VOID); -VOID ItFsJffs216(VOID); -VOID ItFsJffs217(VOID); -VOID ItFsJffs218(VOID); -VOID ItFsJffs219(VOID); -VOID ItFsJffs220(VOID); -VOID ItFsJffs221(VOID); -VOID ItFsJffs222(VOID); -VOID ItFsJffs223(VOID); -VOID ItFsJffs224(VOID); -VOID ItFsJffs225(VOID); -VOID ItFsJffs226(VOID); -VOID ItFsJffs227(VOID); -VOID ItFsJffs228(VOID); -VOID ItFsJffs229(VOID); -VOID ItFsJffs230(VOID); -VOID ItFsJffs231(VOID); -VOID ItFsJffs232(VOID); -VOID ItFsJffs233(VOID); -VOID ItFsJffs234(VOID); -VOID ItFsJffs235(VOID); -VOID ItFsJffs236(VOID); -VOID ItFsJffs237(VOID); -VOID ItFsJffs238(VOID); -VOID ItFsJffs239(VOID); -VOID ItFsJffs240(VOID); -VOID ItFsJffs241(VOID); -VOID ItFsJffs242(VOID); -VOID ItFsJffs243(VOID); -VOID ItFsJffs244(VOID); -VOID ItFsJffs245(VOID); -VOID ItFsJffs246(VOID); -VOID ItFsJffs247(VOID); -VOID ItFsJffs248(VOID); -VOID ItFsJffs249(VOID); -VOID ItFsJffs250(VOID); -VOID ItFsJffs251(VOID); -VOID ItFsJffs252(VOID); -VOID ItFsJffs253(VOID); -VOID ItFsJffs254(VOID); -VOID ItFsJffs255(VOID); -VOID ItFsJffs256(VOID); -VOID ItFsJffs257(VOID); -VOID ItFsJffs258(VOID); -VOID ItFsJffs259(VOID); -VOID ItFsJffs260(VOID); -VOID ItFsJffs261(VOID); -VOID ItFsJffs262(VOID); -VOID ItFsJffs263(VOID); -VOID ItFsJffs264(VOID); -VOID ItFsJffs265(VOID); -VOID ItFsJffs266(VOID); -VOID ItFsJffs267(VOID); -VOID ItFsJffs268(VOID); -VOID ItFsJffs269(VOID); -VOID ItFsJffs270(VOID); -VOID ItFsJffs271(VOID); -VOID ItFsJffs272(VOID); -VOID ItFsJffs273(VOID); -VOID ItFsJffs274(VOID); -VOID ItFsJffs275(VOID); -VOID ItFsJffs276(VOID); -VOID ItFsJffs277(VOID); -VOID ItFsJffs278(VOID); -VOID ItFsJffs279(VOID); -VOID ItFsJffs280(VOID); -VOID ItFsJffs281(VOID); -VOID ItFsJffs282(VOID); -VOID ItFsJffs283(VOID); -VOID ItFsJffs284(VOID); -VOID ItFsJffs285(VOID); -VOID ItFsJffs286(VOID); -VOID ItFsJffs287(VOID); -VOID ItFsJffs288(VOID); -VOID ItFsJffs289(VOID); -VOID ItFsJffs290(VOID); -VOID ItFsJffs291(VOID); -VOID ItFsJffs292(VOID); -VOID ItFsJffs293(VOID); -VOID ItFsJffs294(VOID); -VOID ItFsJffs295(VOID); -VOID ItFsJffs296(VOID); -VOID ItFsJffs297(VOID); -VOID ItFsJffs298(VOID); -VOID ItFsJffs299(VOID); -VOID ItFsJffs300(VOID); -VOID ItFsJffs301(VOID); -VOID ItFsJffs302(VOID); -VOID ItFsJffs303(VOID); -VOID ItFsJffs304(VOID); -VOID ItFsJffs305(VOID); -VOID ItFsJffs306(VOID); -VOID ItFsJffs307(VOID); -VOID ItFsJffs308(VOID); -VOID ItFsJffs309(VOID); -VOID ItFsJffs310(VOID); -VOID ItFsJffs311(VOID); -VOID ItFsJffs312(VOID); -VOID ItFsJffs313(VOID); -VOID ItFsJffs314(VOID); -VOID ItFsJffs315(VOID); -VOID ItFsJffs316(VOID); -VOID ItFsJffs317(VOID); -VOID ItFsJffs318(VOID); -VOID ItFsJffs319(VOID); -VOID ItFsJffs320(VOID); -VOID ItFsJffs321(VOID); -VOID ItFsJffs322(VOID); -VOID ItFsJffs323(VOID); -VOID ItFsJffs324(VOID); -VOID ItFsJffs325(VOID); -VOID ItFsJffs326(VOID); -VOID ItFsJffs327(VOID); -VOID ItFsJffs328(VOID); -VOID ItFsJffs329(VOID); -VOID ItFsJffs330(VOID); -VOID ItFsJffs331(VOID); -VOID ItFsJffs332(VOID); -VOID ItFsJffs333(VOID); -VOID ItFsJffs334(VOID); -VOID ItFsJffs335(VOID); -VOID ItFsJffs336(VOID); -VOID ItFsJffs337(VOID); -VOID ItFsJffs338(VOID); -VOID ItFsJffs339(VOID); -VOID ItFsJffs340(VOID); -VOID ItFsJffs341(VOID); -VOID ItFsJffs342(VOID); -VOID ItFsJffs343(VOID); -VOID ItFsJffs344(VOID); -VOID ItFsJffs345(VOID); -VOID ItFsJffs346(VOID); -VOID ItFsJffs347(VOID); -VOID ItFsJffs348(VOID); -VOID ItFsJffs349(VOID); -VOID ItFsJffs350(VOID); -VOID ItFsJffs351(VOID); -VOID ItFsJffs352(VOID); -VOID ItFsJffs353(VOID); -VOID ItFsJffs354(VOID); -VOID ItFsJffs355(VOID); -VOID ItFsJffs356(VOID); -VOID ItFsJffs357(VOID); -VOID ItFsJffs358(VOID); -VOID ItFsJffs359(VOID); -VOID ItFsJffs360(VOID); -VOID ItFsJffs361(VOID); -VOID ItFsJffs362(VOID); -VOID ItFsJffs363(VOID); -VOID ItFsJffs364(VOID); -VOID ItFsJffs365(VOID); -VOID ItFsJffs366(VOID); -VOID ItFsJffs367(VOID); -VOID ItFsJffs368(VOID); -VOID ItFsJffs369(VOID); -VOID ItFsJffs370(VOID); -VOID ItFsJffs371(VOID); -VOID ItFsJffs372(VOID); -VOID ItFsJffs373(VOID); -VOID ItFsJffs374(VOID); -VOID ItFsJffs375(VOID); -VOID ItFsJffs376(VOID); -VOID ItFsJffs377(VOID); -VOID ItFsJffs378(VOID); -VOID ItFsJffs379(VOID); -VOID ItFsJffs380(VOID); -VOID ItFsJffs381(VOID); -VOID ItFsJffs382(VOID); -VOID ItFsJffs383(VOID); -VOID ItFsJffs384(VOID); -VOID ItFsJffs385(VOID); -VOID ItFsJffs386(VOID); -VOID ItFsJffs387(VOID); -VOID ItFsJffs388(VOID); -VOID ItFsJffs389(VOID); -VOID ItFsJffs390(VOID); -VOID ItFsJffs391(VOID); -VOID ItFsJffs392(VOID); -VOID ItFsJffs393(VOID); -VOID ItFsJffs394(VOID); -VOID ItFsJffs395(VOID); -VOID ItFsJffs396(VOID); -VOID ItFsJffs397(VOID); -VOID ItFsJffs398(VOID); -VOID ItFsJffs399(VOID); -VOID ItFsJffs400(VOID); -VOID ItFsJffs401(VOID); -VOID ItFsJffs402(VOID); -VOID ItFsJffs403(VOID); -VOID ItFsJffs404(VOID); -VOID ItFsJffs405(VOID); -VOID ItFsJffs406(VOID); -VOID ItFsJffs407(VOID); -VOID ItFsJffs408(VOID); -VOID ItFsJffs409(VOID); -VOID ItFsJffs410(VOID); -VOID ItFsJffs411(VOID); -VOID ItFsJffs412(VOID); -VOID ItFsJffs413(VOID); -VOID ItFsJffs414(VOID); -VOID ItFsJffs415(VOID); -VOID ItFsJffs416(VOID); -VOID ItFsJffs417(VOID); -VOID ItFsJffs418(VOID); -VOID ItFsJffs419(VOID); -VOID ItFsJffs420(VOID); -VOID ItFsJffs421(VOID); -VOID ItFsJffs422(VOID); -VOID ItFsJffs423(VOID); -VOID ItFsJffs424(VOID); -VOID ItFsJffs425(VOID); -VOID ItFsJffs426(VOID); -VOID ItFsJffs427(VOID); -VOID ItFsJffs428(VOID); -VOID ItFsJffs429(VOID); -VOID ItFsJffs430(VOID); -VOID ItFsJffs431(VOID); -VOID ItFsJffs432(VOID); -VOID ItFsJffs433(VOID); -VOID ItFsJffs434(VOID); -VOID ItFsJffs435(VOID); -VOID ItFsJffs436(VOID); -VOID ItFsJffs437(VOID); -VOID ItFsJffs438(VOID); -VOID ItFsJffs439(VOID); -VOID ItFsJffs440(VOID); -VOID ItFsJffs441(VOID); -VOID ItFsJffs442(VOID); -VOID ItFsJffs443(VOID); -VOID ItFsJffs444(VOID); -VOID ItFsJffs445(VOID); -VOID ItFsJffs446(VOID); -VOID ItFsJffs447(VOID); -VOID ItFsJffs448(VOID); -VOID ItFsJffs449(VOID); -VOID ItFsJffs450(VOID); -VOID ItFsJffs451(VOID); -VOID ItFsJffs452(VOID); -VOID ItFsJffs453(VOID); -VOID ItFsJffs454(VOID); -VOID ItFsJffs455(VOID); -VOID ItFsJffs456(VOID); -VOID ItFsJffs457(VOID); -VOID ItFsJffs458(VOID); -VOID ItFsJffs459(VOID); -VOID ItFsJffs460(VOID); -VOID ItFsJffs461(VOID); -VOID ItFsJffs462(VOID); -VOID ItFsJffs463(VOID); -VOID ItFsJffs464(VOID); -VOID ItFsJffs465(VOID); -VOID ItFsJffs466(VOID); -VOID ItFsJffs467(VOID); -VOID ItFsJffs468(VOID); -VOID ItFsJffs469(VOID); -VOID ItFsJffs470(VOID); -VOID ItFsJffs471(VOID); -VOID ItFsJffs472(VOID); -VOID ItFsJffs473(VOID); -VOID ItFsJffs475(VOID); -VOID ItFsJffs476(VOID); -VOID ItFsJffs477(VOID); -VOID ItFsJffs478(VOID); -VOID ItFsJffs479(VOID); -VOID ItFsJffs480(VOID); -VOID ItFsJffs481(VOID); -VOID ItFsJffs482(VOID); -VOID ItFsJffs483(VOID); -VOID ItFsJffs484(VOID); -VOID ItFsJffs485(VOID); -VOID ItFsJffs486(VOID); -VOID ItFsJffs487(VOID); -VOID ItFsJffs488(VOID); -VOID ItFsJffs489(VOID); -VOID ItFsJffs490(VOID); -VOID ItFsJffs491(VOID); -VOID ItFsJffs492(VOID); -VOID ItFsJffs493(VOID); -VOID ItFsJffs494(VOID); -VOID ItFsJffs495(VOID); -VOID ItFsJffs496(VOID); -VOID ItFsJffs497(VOID); -VOID ItFsJffs498(VOID); -VOID ItFsJffs499(VOID); -VOID ItFsJffs500(VOID); -VOID ItFsJffs501(VOID); -VOID ItFsJffs502(VOID); -VOID ItFsJffs503(VOID); -VOID ItFsJffs504(VOID); -VOID ItFsJffs505(VOID); -VOID ItFsJffs506(VOID); -VOID ItFsJffs507(VOID); -VOID ItFsJffs508(VOID); -VOID ItFsJffs509(VOID); -VOID ItFsJffs510(VOID); -VOID ItFsJffs511(VOID); -VOID ItFsJffs512(VOID); -VOID ItFsJffs513(VOID); -VOID ItFsJffs514(VOID); -VOID ItFsJffs515(VOID); -VOID ItFsJffs516(VOID); -VOID ItFsJffs517(VOID); -VOID ItFsJffs518(VOID); -VOID ItFsJffs519(VOID); -VOID ItFsJffs520(VOID); -VOID ItFsJffs521(VOID); -VOID ItFsJffs522(VOID); -VOID ItFsJffs523(VOID); -VOID ItFsJffs524(VOID); -VOID ItFsJffs525(VOID); -VOID ItFsJffs526(VOID); -VOID ItFsJffs528(VOID); -VOID ItFsJffs529(VOID); -VOID ItFsJffs530(VOID); -VOID ItFsJffs531(VOID); -VOID ItFsJffs532(VOID); -VOID ItFsJffs533(VOID); -VOID ItFsJffs534(VOID); -VOID ItFsJffs536(VOID); -VOID ItFsJffs537(VOID); -VOID ItFsJffs538(VOID); -VOID ItFsJffs539(VOID); -VOID ItFsJffs540(VOID); -VOID ItFsJffs541(VOID); -VOID ItFsJffs542(VOID); -VOID ItFsJffs543(VOID); -VOID ItFsJffs544(VOID); -VOID ItFsJffs545(VOID); -VOID ItFsJffs546(VOID); -VOID ItFsJffs547(VOID); -VOID ItFsJffs548(VOID); -VOID ItFsJffs549(VOID); -VOID ItFsJffs550(VOID); -VOID ItFsJffs551(VOID); -VOID ItFsJffs552(VOID); -VOID ItFsJffs553(VOID); -VOID ItFsJffs554(VOID); -VOID ItFsJffs555(VOID); -VOID ItFsJffs556(VOID); -VOID ItFsJffs557(VOID); -VOID ItFsJffs560(VOID); -VOID ItFsJffs562(VOID); -VOID ItFsJffs563(VOID); -VOID ItFsJffs564(VOID); -VOID ItFsJffs565(VOID); -VOID ItFsJffs566(VOID); -VOID ItFsJffs567(VOID); -VOID ItFsJffs568(VOID); -VOID ItFsJffs569(VOID); -VOID ItFsJffs570(VOID); -VOID ItFsJffs571(VOID); -VOID ItFsJffs572(VOID); -VOID ItFsJffs573(VOID); -VOID ItFsJffs574(VOID); - -VOID ItFsJffs124(VOID); -VOID ItFsJffs125(VOID); -VOID ItFsJffs577(VOID); -VOID ItFsJffs578(VOID); -VOID ItFsJffs578(VOID); -VOID ItFsJffs579(VOID); -VOID ItFsJffs580(VOID); -VOID ItFsJffs581(VOID); -VOID ItFsJffs582(VOID); -VOID ItFsJffs583(VOID); -VOID ItFsJffs584(VOID); -VOID ItFsJffs585(VOID); -VOID ItFsJffs586(VOID); -VOID ItFsJffs589(VOID); -VOID ItFsJffs590(VOID); -VOID ItFsJffs591(VOID); -VOID ItFsJffs592(VOID); -VOID ItFsJffs593(VOID); -VOID ItFsJffs594(VOID); -VOID ItFsJffs595(VOID); -VOID ItFsJffs596(VOID); -VOID ItFsJffs603(VOID); -VOID ItFsJffs605(VOID); -VOID ItFsJffs606(VOID); -VOID ItFsJffs607(VOID); -VOID ItFsJffs608(VOID); -VOID ItFsJffs609(VOID); -VOID ItFsJffs610(VOID); -VOID ItFsJffs611(VOID); -VOID ItFsJffs612(VOID); -VOID ItFsJffs613(VOID); -VOID ItFsJffs614(VOID); -VOID ItFsJffs615(VOID); -VOID ItFsJffs618(VOID); -VOID ItFsJffs619(VOID); -VOID ItFsJffs620(VOID); -VOID ItFsJffs621(VOID); -VOID ItFsJffs622(VOID); -VOID ItFsJffs623(VOID); -VOID ItFsJffs624(VOID); -VOID ItFsJffs625(VOID); -VOID ItFsJffs626(VOID); -VOID ItFsJffs627(VOID); -VOID ItFsJffs628(VOID); -VOID ItFsJffs629(VOID); -VOID ItFsJffs636(VOID); -VOID ItFsJffs643(VOID); -VOID ItFsJffs644(VOID); -VOID ItFsJffs645(VOID); -VOID ItFsJffs646(VOID); -VOID ItFsJffs648(VOID); -VOID ItFsJffs649(VOID); -VOID ItFsJffs650(VOID); -VOID ItFsJffs651(VOID); -VOID ItFsJffs652(VOID); -VOID ItFsJffs653(VOID); -VOID ItFsJffs654(VOID); -VOID ItFsJffs655(VOID); -VOID ItFsJffs656(VOID); -VOID ItFsJffs663(VOID); -VOID ItFsJffs664(VOID); -VOID ItFsJffs665(VOID); -VOID ItFsJffs666(VOID); -VOID ItFsJffs668(VOID); -VOID ItFsJffs669(VOID); -VOID ItFsJffs670(VOID); -VOID ItFsJffs671(VOID); -VOID ItFsJffs672(VOID); -VOID ItFsJffs673(VOID); -VOID ItFsJffs674(VOID); -VOID ItFsJffs675(VOID); -VOID ItFsJffs676(VOID); -VOID ItFsJffs690(VOID); -VOID ItFsJffs694(VOID); -VOID ItFsJffs696(VOID); -VOID ItFsJffs697(VOID); -VOID ItFsJffs700(VOID); -VOID ItFsJffs701(VOID); -VOID ItFsJffs800(VOID); -VOID ItFsJffs807(VOID); -VOID ItFsJffs808(VOID); - -VOID ItFsJffsLSFD_001(VOID); -VOID ItFsJffsLSFD_002(VOID); -VOID ItFsJffsLSFD_003(VOID); -VOID ItFsJffsLSFD_004(VOID); -VOID ItFsJffsLSFD_005(VOID); -VOID ItFsJffsLSFD_006(VOID); -VOID ItFsJffsLSFD_007(VOID); - -VOID ItFsTestLink001(VOID); -VOID ItFsTestLink002(VOID); -VOID ItFsTestLink003(VOID); -VOID ItFsTestLinkat001(VOID); -VOID ItFsTestLinkat002(VOID); -VOID ItFsTestLinkat003(VOID); -VOID ItFsTestReadlink001(VOID); -VOID ItFsTestSymlink001(VOID); -VOID ItFsTestSymlink002(VOID); -VOID ItFsTestSymlink003(VOID); -VOID ItFsTestSymlinkat001(VOID); -VOID ItFsTestMountRdonly001(VOID); -VOID ItFsTestMountRdonly002(VOID); -VOID ItFsTestMountRdonly003(VOID); -#endif - -#if defined(LOSCFG_USER_TESTSUIT_SHELL) -VOID ItFsJffsLSFD_008(VOID); -VOID ItFsJffsLSFD_009(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_PRESSURE) -VOID ItFsJffsMultipthread001(VOID); -VOID ItFsJffsMultipthread002(VOID); -VOID ItFsJffsMultipthread003(VOID); -VOID ItFsJffsMultipthread004(VOID); -VOID ItFsJffsMultipthread005(VOID); -VOID ItFsJffsMultipthread006(VOID); -VOID ItFsJffsMultipthread007(VOID); -VOID ItFsJffsMultipthread008(VOID); -VOID ItFsJffsMultipthread009(VOID); -VOID ItFsJffsMultipthread010(VOID); -VOID ItFsJffsMultipthread011(VOID); -VOID ItFsJffsMultipthread012(VOID); -VOID ItFsJffsMultipthread013(VOID); -VOID ItFsJffsMultipthread014(VOID); -VOID ItFsJffsMultipthread015(VOID); -VOID ItFsJffsMultipthread016(VOID); -VOID ItFsJffsMultipthread017(VOID); -VOID ItFsJffsMultipthread018(VOID); -VOID ItFsJffsMultipthread019(VOID); -VOID ItFsJffsMultipthread020(VOID); -VOID ItFsJffsMultipthread021(VOID); -VOID ItFsJffsMultipthread022(VOID); -VOID ItFsJffsMultipthread023(VOID); -VOID ItFsJffsMultipthread024(VOID); -VOID ItFsJffsMultipthread025(VOID); -VOID ItFsJffsMultipthread026(VOID); -VOID ItFsJffsMultipthread027(VOID); -VOID ItFsJffsMultipthread028(VOID); -VOID ItFsJffsMultipthread029(VOID); -VOID ItFsJffsMultipthread030(VOID); -VOID ItFsJffsMultipthread031(VOID); -VOID ItFsJffsMultipthread032(VOID); -VOID ItFsJffsMultipthread033(VOID); -VOID ItFsJffsMultipthread034(VOID); -VOID ItFsJffsMultipthread035(VOID); -VOID ItFsJffsMultipthread036(VOID); -VOID ItFsJffsMultipthread037(VOID); -VOID ItFsJffsMultipthread038(VOID); -VOID ItFsJffsMultipthread039(VOID); -VOID ItFsJffsMultipthread040(VOID); -VOID ItFsJffsMultipthread041(VOID); -VOID ItFsJffsMultipthread042(VOID); -VOID ItFsJffsMultipthread043(VOID); -VOID ItFsJffsMultipthread044(VOID); -VOID ItFsJffsMultipthread045(VOID); -VOID ItFsJffsMultipthread046(VOID); -VOID ItFsJffsMultipthread047(VOID); -VOID ItFsJffsMultipthread048(VOID); -VOID ItFsJffsMultipthread049(VOID); -VOID ItFsJffsMultipthread050(VOID); -VOID ItFsJffsMultipthread051(VOID); -VOID ItFsJffsMultipthread052(VOID); -VOID ItFsJffsMultipthread053(VOID); -VOID ItFsJffsMultipthread054(VOID); -VOID ItFsJffsMultipthread055(VOID); -VOID ItFsJffsMultipthread056(VOID); -VOID ItFsJffsMultipthread057(VOID); -VOID ItFsJffsMultipthread058(VOID); -VOID ItFsJffsMultipthread059(VOID); -VOID ItFsJffsMultipthread060(VOID); -VOID ItFsJffsMultipthread061(VOID); -VOID ItFsJffsMultipthread062(VOID); -VOID ItFsJffsMultipthread063(VOID); - -VOID ItFsJffsPressure001(VOID); -VOID ItFsJffsPressure002(VOID); -VOID ItFsJffsPressure003(VOID); -VOID ItFsJffsPressure004(VOID); -VOID ItFsJffsPressure005(VOID); -VOID ItFsJffsPressure006(VOID); -VOID ItFsJffsPressure007(VOID); -VOID ItFsJffsPressure008(VOID); -VOID ItFsJffsPressure009(VOID); -VOID ItFsJffsPressure010(VOID); -VOID ItFsJffsPressure011(VOID); -VOID ItFsJffsPressure012(VOID); -VOID ItFsJffsPRESSURE_013(VOID); -VOID ItFsJffsPressure014(VOID); -VOID ItFsJffsPressure015(VOID); -VOID ItFsJffsPressure016(VOID); -VOID ItFsJffsPressure017(VOID); -VOID ItFsJffsPressure018(VOID); -VOID ItFsJffsPressure019(VOID); -VOID ItFsJffsPressure020(VOID); -VOID ItFsJffsPressure021(VOID); -VOID ItFsJffsPressure022(VOID); -VOID ItFsJffsPressure023(VOID); -VOID ItFsJffsPressure024(VOID); -VOID ItFsJffsPressure025(VOID); -VOID ItFsJffsPressure026(VOID); -VOID ItFsJffsPressure027(VOID); -VOID ItFsJffsPressure028(VOID); -VOID ItFsJffsPressure029(VOID); -VOID ItFsJffsPressure030(VOID); -VOID ItFsJffsPressure031(VOID); -VOID ItFsJffsPressure032(VOID); -VOID ItFsJffsPressure033(VOID); -VOID ItFsJffsPressure034(VOID); -VOID ItFsJffsPressure035(VOID); -VOID ItFsJffsPressure036(VOID); -VOID ItFsJffsPressure037(VOID); -VOID ItFsJffsPressure038(VOID); -VOID ItFsJffsPressure039(VOID); -VOID ItFsJffsPressure040(VOID); -VOID ItFsJffsPressure041(VOID); -VOID ItFsJffsPressure042(VOID); -VOID ItFsJffsPressure043(VOID); -VOID ItFsJffsPressure044(VOID); -VOID ItFsJffsPressure045(VOID); -VOID ItFsJffsPressure046(VOID); -VOID ItFsJffsPressure047(VOID); -VOID ItFsJffsPressure048(VOID); -VOID ItFsJffsPressure049(VOID); -VOID ItFsJffsPressure050(VOID); -VOID ItFsJffsPressure051(VOID); -VOID ItFsJffsPressure052(VOID); -VOID ItFsJffsPressure053(VOID); - -VOID ItFsJffsPressure301(VOID); -VOID ItFsJffsPressure302(VOID); -VOID ItFsJffsPressure303(VOID); -VOID ItFsJffsPressure304(VOID); -VOID ItFsJffsPressure305(VOID); -VOID ItFsJffsPressure306(VOID); -VOID ItFsJffsPressure307(VOID); -VOID ItFsJffsPressure308(VOID); -VOID ItFsJffsPressure309(VOID); -VOID ItFsJffsPressure310(VOID); -VOID ItFsJffsPressure311(VOID); -VOID ItFsJffsPressure312(VOID); -VOID ItFsJffsPressure313(VOID); -VOID ItFsJffsPressure314(VOID); -VOID ItFsJffsPressure315(VOID); - -VOID ItFsJffsPerformance001(VOID); -VOID ItFsJffsPerformance002(VOID); -VOID ItFsJffsPerformance003(VOID); -VOID ItFsJffsPerformance004(VOID); -VOID ItFsJffsPerformance005(VOID); -VOID ItFsJffsPerformance006(VOID); -VOID ItFsJffsPerformance007(VOID); -VOID ItFsJffsPerformance008(VOID); -VOID ItFsJffsPerformance009(VOID); -VOID ItFsJffsPerformance010(VOID); -VOID ItFsJffsPerformance011(VOID); -VOID ItFsJffsPerformance012(VOID); -VOID ItFsJffsPerformance013(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_LLT) -VOID ItFsJffs036(VOID); -VOID ItFsJffs087(VOID); -VOID ItFsJffs108(VOID); -VOID ItFsJffs181(VOID); -VOID ItFsJffs186(VOID); -VOID ItFsJffs474(VOID); -VOID ItFsJffs527(VOID); -VOID ItFsJffs558(VOID); -VOID ItFsJffs559(VOID); -VOID ItFsJffs561(VOID); -VOID ItFsJffs616(VOID); -VOID ItFsJffs698(VOID); -VOID ItFsJffs699(VOID); -VOID LLT_VFS_JFFS_003(VOID); -VOID LLT_VFS_JFFS_014(VOID); -#endif diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_001.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_001.cpp deleted file mode 100644 index 89f467e1..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_001.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, dirFd, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - fd = openat(dirFd, "test.txt", O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); // 16 means length which will be writed - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlinkat(dirFd, "test.txt", 0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_NO_ERROR; -} - -VOID ItJffs001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_002.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_002.cpp deleted file mode 100644 index 8c6e3f38..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_002.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = "/test1/test2/test3"; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = "/test1/test2"; - CHAR *dname = NULL; - INT32 ret; - - dname = dirname(pathname1); - ret = strcmp(pathname2, dname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_003.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_003.cpp deleted file mode 100644 index 286f0a03..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_003.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR *dname = NULL; - INT32 ret; - INT32 fd = -1; - DIR *dir1 = NULL; - DIR *dir2 = NULL; - - dir1 = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test123"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - dir2 = fdopendir(fd); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT2: - closedir(dir2); -EXIT1: - unlink(pathname2); - return JFFS_NO_ERROR; -EXIT: - closedir(dir1); - return JFFS_NO_ERROR; -} - -VOID ItJffs003(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_004.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_004.cpp deleted file mode 100644 index b22c3de0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_004.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - CHAR dname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *dname2 = NULL; - CHAR *pret = NULL; - INT32 ret; - - pret = getcwd(dname1, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT); - - dname2 = get_current_dir_name(); - ICUNIT_GOTO_NOT_EQUAL(dname2, NULL, dname2, EXIT); - - ret = strcmp(dname1, dname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs004(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_005.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_005.cpp deleted file mode 100644 index 0521a563..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_005.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret1, ret2; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - ret1 = getdtablesize(); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret2 = getdtablesize(); - ICUNIT_GOTO_EQUAL(ret2, (ret1 + 1), ret2, EXIT2); - - ret1 = close(fd); - ICUNIT_GOTO_EQUAL(ret1, JFFS_NO_ERROR, ret1, EXIT2); - - ret1 = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret1, JFFS_NO_ERROR, ret1, EXIT1); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs005(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_006.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_006.cpp deleted file mode 100644 index 0defff83..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_006.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret1, ret2; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - struct mntent *mnt = NULL; - FILE *fp = NULL; - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "test12"); - fp = setmntent(pathname1, "w+b"); - ICUNIT_GOTO_NOT_EQUAL(fp, NULL, fp, EXIT); - - mnt = getmntent(fp); - ICUNIT_GOTO_NOT_EQUAL(mnt, NULL, mnt, EXIT); - - printf("[%s:%d] mnt->mnt_fsname=%s\n", __FUNCTION__, __LINE__, mnt->mnt_fsname); - printf("[%s:%d] mnt->mnt_dir=%s\n", __FUNCTION__, __LINE__, mnt->mnt_dir); - printf("[%s:%d] mnt->mnt_type=%s\n", __FUNCTION__, __LINE__, mnt->mnt_type); - printf("[%s:%d] mnt->mnt_opts=%s\n", __FUNCTION__, __LINE__, mnt->mnt_opts); - printf("[%s:%d] mnt->mnt_freq=%d\n", __FUNCTION__, __LINE__, mnt->mnt_freq); - printf("[%s:%d] mnt->mnt_passno=%d\n", __FUNCTION__, __LINE__, mnt->mnt_passno); - - endmntent(fp); - unlink(pathname1); - return JFFS_NO_ERROR; -EXIT: - endmntent(fp); - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs006(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_007.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_007.cpp deleted file mode 100644 index 3bcc2b99..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_007.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MOUNT_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MOUNT_DIR0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MOUNT_DIR0 }; - glob_t buf; - int i, ret; - int fd1 = -1; - int fd2 = -2; - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test1"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test2"); - fd2 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, JFFS_IS_ERROR, fd2, EXIT2); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - glob("/storage/*", GLOB_NOSORT, NULL, &buf); - ICUNIT_GOTO_EQUAL(buf.gl_pathc, 2, buf.gl_pathc, EXIT1); // 2 means size of path - - ret = strcmp(pathname1, buf.gl_pathv[0]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = strcmp(pathname2, buf.gl_pathv[1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - globfree(&buf); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT2: - close(fd2); - unlink(pathname2); -EXIT1: - close(fd1); - unlink(pathname1); -EXIT: - globfree(&buf); - return JFFS_NO_ERROR; -} - -VOID ItJffs007(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_008.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_008.cpp deleted file mode 100644 index f75b0ef4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_008.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - DIR *dir = NULL; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - fd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = mkdirat(fd, "TEST", HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = rmdir("/storage/TEST"); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT2: - rmdir("/storage/TEST"); -EXIT1: - closedir(dir); - return JFFS_NO_ERROR; -} - -VOID ItJffs008(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_009.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_009.cpp deleted file mode 100644 index 3119f6f2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_009.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR tempFile[] = "tmp_XXXXXX"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - fd = mkstemp(tempFile); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlink(tempFile); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(tempFile); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs009(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_010.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_010.cpp deleted file mode 100644 index 022e8ce3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_010.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR tempFile[] = "tmp_XXXXXX_hello"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - fd = mkstemps(tempFile, 6); // 6 means size of file - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlink(tempFile); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(tempFile); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs010(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_011.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_011.cpp deleted file mode 100644 index df31ea3f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_011.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR tempFile[] = "test.XXXXXX"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR *pfd = NULL; - - ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - pfd = mktemp(tempFile); - ICUNIT_GOTO_NOT_EQUAL(pfd, NULL, pfd, EXIT1); - printf("temp_file = %s\n", tempFile); - - fd = open(pfd, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlink(pfd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(pfd); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs011(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_012.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_012.cpp deleted file mode 100644 index 931adfd6..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_012.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR tempFile[] = "test_XXXXXX"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR *pfd = NULL; - - ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - pfd = mkdtemp(tempFile); - ICUNIT_GOTO_NOT_EQUAL(pfd, NULL, pfd, EXIT1); - printf("temp_file = %s, pfd=%s\n", tempFile, pfd); - - ret = rmdir(tempFile); - printf("%s-%d temp=%s ret=%d\n", __FUNCTION__, __LINE__, tempFile, ret); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pfd); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs012(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_013.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_013.cpp deleted file mode 100644 index 92247072..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_013.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR tempFile[] = "test_XXXXXX"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = chdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - fd = mkostemp(tempFile, O_APPEND); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlink(tempFile); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(tempFile); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs013(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_014.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_014.cpp deleted file mode 100644 index 2f4eb103..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_014.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - - openlog("Test", LOG_CONS | LOG_PID, LOG_USER); - syslog(LOG_INFO, "This is a massage just for test"); - closelog(); - - return JFFS_NO_ERROR; -EXIT: - close(fd); - unlink("Test"); - return JFFS_NO_ERROR; -} - -VOID ItJffs014(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_015.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_015.cpp deleted file mode 100644 index 8112716c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_015.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - long ret; - - ret = pathconf(pathname1, _PC_LINK_MAX); - ICUNIT_GOTO_EQUAL(ret, _POSIX_LINK_MAX, ret, EXIT); - - ret = pathconf(pathname1, _PC_NAME_MAX); - ICUNIT_GOTO_EQUAL(ret, NAME_MAX, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItJffs015(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_016.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_016.cpp deleted file mode 100644 index 61a1325a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_016.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret1, ret2; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - struct mntent *mnt = NULL; - char *buf = NULL; - static struct mntent mnt1; - FILE *fp = NULL; - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "test12"); - fp = setmntent(pathname1, "w+b"); - ICUNIT_GOTO_NOT_EQUAL(fp, NULL, fp, EXIT); - - mnt = getmntent_r(fp, &mnt1, buf, 1); - ICUNIT_GOTO_NOT_EQUAL(mnt, NULL, mnt, EXIT); - - printf("[%s:%d] mnt->mnt_fsname=%s\n", __FUNCTION__, __LINE__, mnt->mnt_fsname); - printf("[%s:%d] mnt->mnt_dir=%s\n", __FUNCTION__, __LINE__, mnt->mnt_dir); - printf("[%s:%d] mnt->mnt_type=%s\n", __FUNCTION__, __LINE__, mnt->mnt_type); - printf("[%s:%d] mnt->mnt_opts=%s\n", __FUNCTION__, __LINE__, mnt->mnt_opts); - printf("[%s:%d] mnt->mnt_freq=%d\n", __FUNCTION__, __LINE__, mnt->mnt_freq); - printf("[%s:%d] mnt->mnt_passno=%d\n", __FUNCTION__, __LINE__, mnt->mnt_passno); - - endmntent(fp); - unlink(pathname1); - return JFFS_NO_ERROR; -EXIT: - endmntent(fp); - unlink(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItJffs016(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_017.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_017.cpp deleted file mode 100644 index a7628c00..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_017.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 DisplayInfo(const char *fpath, const struct stat *sb, int tflag, struct FTW *ftwbuf) -{ - printf("%-3s %2d ", - (tflag == FTW_D) ? "d" : (tflag == FTW_DNR) ? "dnr" : - (tflag == FTW_DP) ? "dp" : (tflag == FTW_F) ? "f" : - (tflag == FTW_NS) ? "ns" : (tflag == FTW_SL) ? "sl" : - (tflag == FTW_SLN) ? "sln" : "???", - ftwbuf->level); - - if (tflag == FTW_NS) { - printf("-------"); - } else { - printf("%7jd", (intmax_t)sb->st_size); - } - - printf(" %-40s %d %s\n", fpath, ftwbuf->base, fpath + ftwbuf->base); - - return 0; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 flags = 0; - CHAR *pathnamedir = { JFFS_MAIN_DIR0 }; - CHAR pathname01[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname11[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR pathname02[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - - ret = mkdir(pathname01, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname11, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mkdir(pathname02, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = nftw(pathnamedir, DisplayInfo, 20, flags); // 20 means max fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rmdir(pathname02); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rmdir(pathname11); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname01); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT3: - rmdir(pathname02); -EXIT2: - rmdir(pathname11); -EXIT1: - rmdir(pathname01); - return JFFS_IS_ERROR; -} - -VOID ItJffs017(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_018.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_018.cpp deleted file mode 100644 index d285c6fe..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_018.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -#define TEST_STR "hello world" -static UINT32 Testcase(VOID) -{ - FILE *fd = NULL; - INT32 ret; - size_t size; - char *ptr = NULL; - char *ptr1 = TEST_STR; - - fd = open_memstream(&ptr, &size); - ICUNIT_GOTO_NOT_EQUAL(fd, NULL, fd, EXIT1); - - fprintf(fd, TEST_STR); - - ret = fclose(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = strcmp(ptr, ptr1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = strlen(ptr); - ICUNIT_GOTO_EQUAL(size, ret, size, EXIT); - - free(ptr); - return JFFS_NO_ERROR; -EXIT1: - fclose(fd); -EXIT: - free(ptr); - return JFFS_IS_ERROR; -} - -VOID ItJffs018(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_019.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_019.cpp deleted file mode 100644 index cc9c954b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_019.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static constexpr wchar_t* TEST_STR = L"hello world"; -static UINT32 Testcase(VOID) -{ - FILE *fd = NULL; - INT32 ret; - size_t size; - wchar_t *ptr = NULL; - wchar_t *ptr1 = { TEST_STR }; - - fd = open_wmemstream(&ptr, &size); - ICUNIT_GOTO_NOT_EQUAL(fd, NULL, fd, EXIT1); - - fwprintf(fd, ptr1); - - ret = fclose(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = wcscmp(ptr, ptr1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = wcslen(ptr); - ICUNIT_GOTO_EQUAL(size, ret, size, EXIT); - - free(ptr); - return JFFS_NO_ERROR; -EXIT1: - fclose(fd); -EXIT: - free(ptr); - return JFFS_IS_ERROR; -} - -VOID ItJffs019(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_020.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_020.cpp deleted file mode 100644 index e813bff0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_020.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -static constexpr int LINE_LENGTH = 50; -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathnamedir[LINE_LENGTH] = { JFFS_MAIN_DIR0 }; - FILE *file = nullptr; - CHAR line[LINE_LENGTH]; - CHAR *ptr = NULL; - - ret = chdir(pathnamedir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - file = popen("pwd", "r"); - ICUNIT_GOTO_NOT_EQUAL(file, NULL, file, EXIT); - - ptr = fgets(line, LINE_LENGTH, file); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT1); - - strcat_s(pathnamedir, LINE_LENGTH, "\n"); - ret = strcmp(line, pathnamedir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = pclose(file); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - pclose(file); -EXIT: - return JFFS_IS_ERROR; -} - -VOID ItJffs020(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_021.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_021.cpp deleted file mode 100644 index fb14b4cd..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_021.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - DIR *dirp = NULL; - INT32 ret; - CHAR *pathnamedir = { JFFS_MAIN_DIR0 }; - CHAR pathname01[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct dirent *dp1 = (struct dirent *)malloc(sizeof(struct dirent)); - struct dirent *dp2 = (struct dirent *)malloc(sizeof(struct dirent)); - struct dirent *dp2Bak = dp2; - - strcat_s(pathname01, JFFS_STANDARD_NAME_LENGTH, "/test1"); - ret = mkdir(pathname01, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dirp = opendir(pathnamedir); - ICUNIT_GOTO_NOT_EQUAL(dirp, NULL, dirp, EXIT2); - - while (1) { - readdir_r(dirp, dp1, &dp2); - - if (dp2 == NULL) { - break; - } - - ret = strcmp(dp2->d_name, "test1"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ret = rmdir(pathname01); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - closedir(dirp); - free(dp1); - free(dp2Bak); - return JFFS_NO_ERROR; -EXIT2: - rmdir(pathname01); - closedir(dirp); - free(dp1); - free(dp2Bak); - return JFFS_IS_ERROR; -EXIT1: - rmdir(pathname01); - return JFFS_IS_ERROR; -} - -VOID ItJffs021(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_022.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_022.cpp deleted file mode 100644 index 8f27f5df..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_022.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static constexpr int MB = 1024 * 1024; - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR *pathname = { JFFS_MAIN_DIR0 }; - struct statvfs vfs; - fsblkcnt_t blockSize; - fsblkcnt_t blockCount; - fsblkcnt_t totalSize; - fsblkcnt_t freeSize; - fsblkcnt_t usedSize; - fsblkcnt_t availSize; - - ret = statvfs(pathname, &vfs); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - blockSize = vfs.f_bsize; - totalSize = vfs.f_blocks * blockSize; - freeSize = vfs.f_bfree * blockSize; - usedSize = (vfs.f_blocks - vfs.f_bavail) * blockSize; - availSize = vfs.f_bavail * blockSize; - - printf("total_size = %0.2lf MB\n", (double)totalSize / (MB)); - printf("free_size = %0.2lf MB\n", (double)freeSize / (MB)); - printf("used_size = %0.2lf MB\n", (double)usedSize / (MB)); - printf("avail_size = %0.2lf MB\n", (double)availSize / (MB)); - - return JFFS_NO_ERROR; -EXIT: - return JFFS_IS_ERROR; -} - -VOID ItJffs022(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_023.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_023.cpp deleted file mode 100644 index 3bb14f82..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_023.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, dirFd, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - printf("dirFd = %d\n", dirFd); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlinkat(dirFd, "test.txt", 0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_NO_ERROR; -} - -VOID ItJffs023(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_024.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_024.cpp deleted file mode 100644 index eab44ec7..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_024.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, dirFd, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - printf("dirFd = %d\n", dirFd); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = renameat(dirFd, "test.txt", dirFd, "TEST.txt"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/TEST.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT2: - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_NO_ERROR; -} - -VOID ItJffs024(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_025.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_025.cpp deleted file mode 100644 index 756fb6fa..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_025.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - FILE *fp = NULL; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - fp = fopen(pathname1, "w+"); - ICUNIT_GOTO_NOT_EQUAL(fp, NULL, fp, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - fclose(fp); -EXIT: - unlink(pathname1); - return JFFS_IS_ERROR; -} - -VOID ItJffs025(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_026.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_026.cpp deleted file mode 100644 index 22c98fe4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_026.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs026(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_027.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_027.cpp deleted file mode 100644 index 6138c427..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_027.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs027(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_028.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_028.cpp deleted file mode 100644 index 5cc50c21..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_028.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static constexpr int TEST_STRLEN = 30; -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname[TEST_STRLEN] = { JFFS_BASE_DIR }; - CHAR pathname1[TEST_STRLEN] = { JFFS_PATH_NAME0 }; - CHAR pathname2[TEST_STRLEN] = { JFFS_PATH_NAME0 }; - CHAR *pathname3 = NULL; - CHAR buf1[TEST_STRLEN] = ""; - CHAR buf2[TEST_STRLEN] = ""; - CHAR *pret = NULL; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - pathname3 = pathname2; - strcat_s(pathname2, TEST_STRLEN, "/test1"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - pret = getcwd(buf1, TEST_STRLEN); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(buf1, pathname, buf1, EXIT1); - - ret = fchdir(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - pret = getcwd(buf2, TEST_STRLEN); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(buf2, pathname3, buf2, EXIT1); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_IS_ERROR; -} - -VOID ItJffs028(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_029.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_029.cpp deleted file mode 100644 index 2168a0c8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_029.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static constexpr int TEST_STRLEN = 30; -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[TEST_STRLEN] = { JFFS_PATH_NAME0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = fchmod(fd, S_IREAD); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - unlink(pathname1); -EXIT: - rmdir(pathname1); - return JFFS_IS_ERROR; -} - -VOID ItJffs029(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_030.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_030.cpp deleted file mode 100644 index e24b569c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_030.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufname[PATH_MAX] = ""; - CHAR *realName = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/////"); - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "test"); - - realName = realpath(pathname2, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItJffs030(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_031.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_031.cpp deleted file mode 100644 index b70ae91d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_031.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -#define TEST_STR "abcdefghijk" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = { TEST_STR }; - CHAR str[JFFS_STANDARD_NAME_LENGTH]; - FILE *ptr = NULL; - - fd = open(pathname1, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, buf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ptr = freopen(pathname1, "r", stdin); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT1); - - scanf_s("%s", str, sizeof(str)); - ret = strcmp(buf, str); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fclose(ptr); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs031(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_032.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_032.cpp deleted file mode 100644 index 72e6a21c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_032.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - - ret = lstat64(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = lstat64(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = lstat64(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItJffs032(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_033.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_033.cpp deleted file mode 100644 index 47d73877..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_033.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - - ret = lstat(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = lstat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = lstat(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItJffs033(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_034.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_034.cpp deleted file mode 100644 index 8a545054..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_034.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -#define TEST_STR "abcdefghijk" -#define EXPECT_TEST_STR "ghijk" -static constexpr int OFFSET_NUM = 6; - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = { TEST_STR }; - CHAR str[JFFS_STANDARD_NAME_LENGTH]; - FILE *ptr = NULL; - off_t offset = OFFSET_NUM; - size_t fret; - - fd = open(pathname1, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, buf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ptr = fopen(pathname1, "r+"); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT2); - - ret = fseeko(ptr, offset, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fret = fread(str, 1, JFFS_STANDARD_NAME_LENGTH, ptr); - ICUNIT_GOTO_EQUAL(fret, (JFFS_STANDARD_NAME_LENGTH - OFFSET_NUM), fret, EXIT2); - - ret = strcmp(EXPECT_TEST_STR, str); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = fclose(ptr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - fclose(ptr); - unlink(pathname1); - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs034(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_035.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_035.cpp deleted file mode 100644 index 00e7ddc6..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_035.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -#define TEST_STR "abcdefghijk" -#define EXPECT_TEST_STR "ghijk" -static constexpr int OFFSET_NUM = 6; - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = { TEST_STR }; - CHAR str[JFFS_STANDARD_NAME_LENGTH]; - FILE *ptr = NULL; - off_t offset1 = OFFSET_NUM; - off_t offset2; - size_t fret; - - fd = open(pathname1, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, buf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ptr = fopen(pathname1, "r+"); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT2); - - ret = fseeko(ptr, offset1, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - offset2 = ftello(ptr); - ICUNIT_GOTO_EQUAL(offset2, offset1, offset2, EXIT2); - - ret = fclose(ptr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - fclose(ptr); - unlink(pathname1); - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItJffs035(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_036.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_036.cpp deleted file mode 100644 index c5e1a541..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_036.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - dir = opendir(pathname2); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - closedir(dir); - rmdir(pathname2); - return JFFS_IS_ERROR; -EXIT1: - closedir(dir); -EXIT: - return JFFS_IS_ERROR; -} - -VOID ItJffs036(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_037.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_037.cpp deleted file mode 100644 index 3f051912..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_037.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - dir = opendir(pathname2); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOTDIR, errno, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - unlink(pathname2); - return JFFS_IS_ERROR; -EXIT1: - closedir(dir); - return JFFS_IS_ERROR; -} - -VOID ItJffs037(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_038.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_038.cpp deleted file mode 100644 index 9f231318..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_038.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - long offset; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT2: - closedir(dir); - rmdir(pathname2); - return JFFS_IS_ERROR; -EXIT1: - closedir(dir); -EXIT: - return JFFS_IS_ERROR; -} - -VOID ItJffs038(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_039.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_039.cpp deleted file mode 100644 index 9c093f4b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_039.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT2: - closedir(dir); - rmdir(pathname2); - return JFFS_IS_ERROR; -EXIT1: - closedir(dir); -EXIT: - return JFFS_IS_ERROR; -} - -VOID ItJffs039(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_040.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_040.cpp deleted file mode 100644 index 640f1cbc..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_040.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -typedef struct __dirstream { - off_t tell; - int fd; - int bufPos; - int bufEnd; - volatile int lock[1]; - void *dirk; - void *resv; - /* Any changes to this struct must preserve the property: - * offsetof(struct __dirent, buf) % sizeof(off_t) == 0 */ - char buf[2048]; -} DIR; - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR adir = { 0 }; - DIR *dir1 = &adir; - struct dirent *ptr = NULL; - off_t offset, offset1, offset2, offset3, offset4; - struct dirent **namelist = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - offset1 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset2 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset3 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset4 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ptr = readdir(dir); - offset1 = ptr->d_off; - - ptr = readdir(dir); - offset2 = ptr->d_off; - - ptr = readdir(dir); - offset3 = ptr->d_off; - - ptr = readdir(dir); - offset4 = ptr->d_off; - - seekdir(dir, offset2); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset2, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset4); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset4, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, offset3); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset3, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "0file", namelist[0]->d_name, EXIT); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "0test", namelist[1]->d_name, EXIT); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "1test", namelist[2]->d_name, EXIT); // 2 means third file - ICUNIT_GOTO_STRING_EQUAL(namelist[3]->d_name, "2test", namelist[3]->d_name, EXIT); // 3 means four file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset1, namelist[3]->d_off, offset1, EXIT5); // 3 means four file - ICUNIT_GOTO_EQUAL(offset, namelist[3]->d_off, offset, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - - seekdir(dir, namelist[2]->d_off); // 2 means third file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset3, namelist[2]->d_off, offset3, EXIT5); // 2 means third file - ICUNIT_GOTO_EQUAL(offset, namelist[2]->d_off, offset, EXIT5); // 2 means third file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - - JffsScandirFree(namelist, scandirCount); - - scandirCount = 0; - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - ICUNIT_GOTO_EQUAL(offset4, namelist[3]->d_off, offset4, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, namelist[0]->d_off); // 0 means first file - ICUNIT_GOTO_EQUAL(offset1, namelist[0]->d_off, offset1, EXIT5); // 0 means first file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - -EXIT6: - JffsScandirFree(namelist, scandirCount); -EXIT5: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItJffs040(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_041.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_041.cpp deleted file mode 100644 index 00aec4a3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_041.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -typedef struct __dirstream { - off_t tell; - int fd; - int bufPos; - int bufEnd; - volatile int lock[1]; - void *dirk; - void *resv; - /* Any changes to this struct must preserve the property: - * offsetof(struct __dirent, buf) % sizeof(off_t) == 0 */ - char buf[2048]; -} DIR; - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR adir = { 0 }; - DIR *dir1 = &adir; - struct dirent *ptr = NULL; - off_t offset, offset1, offset2, offset3, offset4; - struct dirent **namelist = NULL; - - errno = 0; - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, -1, scandirCount, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - offset1 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset2 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset3 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - offset4 = telldir(dir1); - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ptr = readdir(dir); - offset1 = ptr->d_off; - - ptr = readdir(dir); - offset2 = ptr->d_off; - - ptr = readdir(dir); - offset3 = ptr->d_off; - - ptr = readdir(dir); - offset4 = ptr->d_off; - - seekdir(dir, offset2); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset2, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset4); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset4, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, offset3); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset3, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "0file", namelist[0]->d_name, EXIT); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "0test", namelist[1]->d_name, EXIT); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "1test", namelist[2]->d_name, EXIT); // 2 means third file - ICUNIT_GOTO_STRING_EQUAL(namelist[3]->d_name, "2test", namelist[3]->d_name, EXIT); // 3 means four file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset1, namelist[3]->d_off, offset1, EXIT5); // 3 means four file - ICUNIT_GOTO_EQUAL(offset, namelist[3]->d_off, offset, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - - seekdir(dir, namelist[2]->d_off); // 2 means third file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset3, namelist[2]->d_off, offset3, EXIT5); // 2 means third file - ICUNIT_GOTO_EQUAL(offset, namelist[2]->d_off, offset, EXIT5); // 2 means third file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - - JffsScandirFree(namelist, scandirCount); - - scandirCount = 0; - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - ICUNIT_GOTO_EQUAL(offset4, namelist[3]->d_off, offset4, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, namelist[0]->d_off); // 0 means first file - ICUNIT_GOTO_EQUAL(offset1, namelist[0]->d_off, offset1, EXIT5); // 0 means first file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - -EXIT6: - JffsScandirFree(namelist, scandirCount); -EXIT5: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItJffs041(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_042.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_042.cpp deleted file mode 100644 index 7e8413ea..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_042.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent **namelist = NULL; - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - scandirCount = scandir(pathname2, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, -1, scandirCount, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOTDIR, errno, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - unlink(pathname2); - return JFFS_IS_ERROR; -EXIT1: - closedir(dir); - return JFFS_IS_ERROR; -} - -VOID ItJffs042(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_043.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_043.cpp deleted file mode 100644 index 06f93d47..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_043.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -typedef struct __dirstream { - off_t tell; - int fd; - int bufPos; - int bufEnd; - volatile int lock[1]; - void *dirk; - void *resv; - /* Any changes to this struct must preserve the property: - * offsetof(struct __dirent, buf) % sizeof(off_t) == 0 */ - char buf[2048]; -} DIR; - -static UINT32 Testcase(VOID) -{ - DIR *dirp = NULL; - INT32 ret; - CHAR *pathnamedir = (CHAR *)JFFS_MAIN_DIR0; - CHAR pathname01[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct dirent *dp1 = (struct dirent *)malloc(sizeof(struct dirent)); - struct dirent *dp2 = (struct dirent *)malloc(sizeof(struct dirent)); - struct dirent *dp2Bak = dp2; - DIR adir = { 0 }; - DIR *dir1 = &adir; - - strcat_s(pathname01, JFFS_STANDARD_NAME_LENGTH, "/test1"); - ret = mkdir(pathname01, HIGHEST_AUTHORITY); - if (ret != 0) { - if (errno != EEXIST) { - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - dirp = opendir(pathnamedir); - ICUNIT_GOTO_NOT_EQUAL(dirp, NULL, dirp, EXIT2); - - while (1) { - ret = readdir_r(dir1, dp1, &dp2); - printf("ret=%d\n", ret); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT2); - break; - } - - ret = rmdir(pathname01); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - closedir(dirp); - free(dp1); - free(dp2Bak); - return JFFS_NO_ERROR; -EXIT2: - rmdir(pathname01); - if (dirp) closedir(dirp); - free(dp1); - free(dp2Bak); - return JFFS_IS_ERROR; -EXIT1: - rmdir(pathname01); - return JFFS_IS_ERROR; -} - -VOID ItJffs043(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_jffs_044.cpp b/testsuites/unittest_old/fs/jffs/full/It_jffs_044.cpp deleted file mode 100644 index deff6249..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_jffs_044.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -typedef struct __dirstream { - off_t tell; - int fd; - int bufPos; - int bufEnd; - volatile int lock[1]; - void *dirk; - void *resv; - /* Any changes to this struct must preserve the property: - * offsetof(struct __dirent, buf) % sizeof(off_t) == 0 */ - char buf[2048]; -} DIR; - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR adir = { 0 }; - DIR *dir1 = &adir; - struct dirent *ptr = NULL; - off_t offset, offset1, offset2, offset3, offset4; - off_t offsetTest; - struct dirent **namelist = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ptr = readdir(dir); - offset1 = ptr->d_off; - - ptr = readdir(dir); - offset2 = ptr->d_off; - - ptr = readdir(dir); - offset3 = ptr->d_off; - - ptr = readdir(dir); - offset4 = ptr->d_off; - - errno = 0; - seekdir(dir, offset2); - ICUNIT_GOTO_EQUAL(errno, 0, errno, EXIT5); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset2, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset4); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset4, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, offset3); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset3, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "0file", namelist[0]->d_name, EXIT); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "0test", namelist[1]->d_name, EXIT); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "1test", namelist[2]->d_name, EXIT); // 2 means third file - ICUNIT_GOTO_STRING_EQUAL(namelist[3]->d_name, "2test", namelist[3]->d_name, EXIT); // 3 means four file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset1, namelist[3]->d_off, offset1, EXIT5); // 3 means four file - ICUNIT_GOTO_EQUAL(offset, namelist[3]->d_off, offset, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - - seekdir(dir, namelist[2]->d_off); // 2 means third file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset3, namelist[2]->d_off, offset3, EXIT5); // 2 means third file - ICUNIT_GOTO_EQUAL(offset, namelist[2]->d_off, offset, EXIT5); // 2 means third file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - - JffsScandirFree(namelist, scandirCount); - - scandirCount = 0; - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - ICUNIT_GOTO_EQUAL(offset4, namelist[3]->d_off, offset4, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, namelist[0]->d_off); // 0 means first file - ICUNIT_GOTO_EQUAL(offset1, namelist[0]->d_off, offset1, EXIT5); // 0 means first file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - -EXIT6: - JffsScandirFree(namelist, scandirCount); -EXIT5: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItJffs044(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_test_faccessat_001.cpp b/testsuites/unittest_old/fs/jffs/full/It_test_faccessat_001.cpp deleted file mode 100644 index bb2d2469..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_test_faccessat_001.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" -#include -#include -#include - -static UINT32 Testcase(VOID) -{ - int ret = 0; - int argc = 2; - char *argv[2]; - - argv[1] = (char *)"/lib/libc.so"; - - if (argc != 2) { - printf("Usage: %s \n", argv[0]); - exit(1); - } - - ret = faccessat(AT_FDCWD, argv[1], R_OK, AT_EACCESS); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - if (ret < 0) { - printf("faccessat error for %s\n", argv[1]); - } else { - printf("read access OK\n"); - } - - if (open(argv[1], O_RDONLY) < 0) { - printf("open error for %s\n", argv[1]); - } else { - printf("open for reading OK\n"); - } - - return LOS_OK; -} - -VOID IO_TEST_FACCESSAT_001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_test_faccessat_002.cpp b/testsuites/unittest_old/fs/jffs/full/It_test_faccessat_002.cpp deleted file mode 100644 index b7dd3021..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_test_faccessat_002.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" -#include -#include -#include - -static UINT32 testcase(VOID) -{ - int ret = 0; - - open(FILEPATH_000, O_RDWR | O_EXCL | O_CREAT, 0); - - errno = 0; - ret = faccessat(AT_FDCWD, FILEPATH_000, R_OK, AT_EACCESS); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - -#if 0 - errno = 0; - ret = open(FILEPATH_000, O_RDONLY); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); -#endif - - return LOS_OK; -OUT: - return LOS_NOK; -} - -VOID IO_TEST_FACCESSAT_002(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_test_fstatat_001.cpp b/testsuites/unittest_old/fs/jffs/full/It_test_fstatat_001.cpp deleted file mode 100644 index 1aaf5128..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_test_fstatat_001.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -#include "sys/stat.h" - -static UINT32 testcase1(VOID) -{ - struct stat buf; - char *pathname = (char *)FILEPATH_775; - int ret = 0; - int fd = 0; - - errno = 0; - fd = open(pathname, O_RDWR | O_CREAT); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(buf.st_ino, 0, -1, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase2(VOID) -{ - struct stat buf; - char *pathname = (char *)"./fstatat.tmp"; - int ret = 0; - int fd = 0; - - errno = 0; - fd = open(pathname, O_RDWR | O_CREAT); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(AT_FDCWD, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(buf.st_ino, 0, -1, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase3(VOID) -{ - struct stat buf; - char *pathname = (char *)FILEPATH_775; - int ret = 0; - int fd = 0; - - errno = 0; - fd = open(pathname, O_RDWR | O_CREAT); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(buf.st_ino, 0, -1, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase4(VOID) -{ - struct stat buf; - char *pathname = (char *)FILEPATH_775; - int ret = 0; - int fd = 0; - - errno = 0; - fd = open(pathname, O_RDWR | O_CREAT); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(buf.st_ino, 0, -1, OUT); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); - testcase2(); - testcase3(); - testcase4(); - - return LOS_OK; -} - -VOID IO_TEST_FSTATAT_001(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_test_fstatat_002.cpp b/testsuites/unittest_old/fs/jffs/full/It_test_fstatat_002.cpp deleted file mode 100644 index 345c7555..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_test_fstatat_002.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -#include -#include "sys/stat.h" -#include "string.h" - -static UINT32 testcase8(VOID) -{ - struct stat buf; - char pathname[200] = FILEPATH_775; - int ret = 0; - int fd = 0; - - /* omit to create test file dynamicly,use prepared test files in /storage instand. */ - #if 0 - errno = 0; - sprintf(pathname, "%s%s", __func__, ".tmp"); - #endif - - errno = 0; - fd = open(pathname, O_CREAT, 0777); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, FILEPATH_RELATIVE, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, ENOTDIR, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase7(VOID) -{ - struct stat buf; - char pathname[] = FILEPATH_NOACCESS; - char dirname[] = DIRPATH_775; - DIR *dir = NULL; - int ret = 0; - int fd = 0; - - errno = 0; - dir = opendir(dirname); - fd = dirfd(dir); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase6(VOID) -{ - struct stat buf; - /* let the pathname more than 4096 characters,to generate the ENAMETOOLONG errno. */ - char pathname[] = PATHNAME_ENAMETOOLONG; - int ret = 0; - char dirname[] = DIRPATH_775; - DIR *dir = NULL; - int fd = 0; - - errno = 0; - dir = opendir(dirname); - fd = dirfd(dir); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = fstatat(fd, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase5(VOID) -{ - struct stat buf; - char pathname[] = FILEPATH_ENOENT; - int ret = 0; - - errno = 0; - ret = fstatat(FD_EBADF, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase3(VOID) -{ - struct stat buf; - char pathname[] = ""; - int ret = 0; - - errno = 0; - ret = fstatat(AT_FDCWD, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase2(VOID) -{ - struct stat buf; - char pathname[] = FILEPATH_ENOENT; - int ret = 0; - - errno = 0; - ret = fstatat(AT_FDCWD, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase1(VOID) -{ - struct stat buf; - char pathname[] = FILEPATH_000; - int ret = 0; - - errno = 0; - ret = fstatat(1, pathname, &buf, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase8(); /* CASE:fd is no a dirfd */ - /* testcase7(); omitted as program can not create file with no access privilege. */ - testcase6(); - testcase5(); - testcase3(); - testcase2(); - /* testcase1(); CASE:no access */ - - return LOS_OK; -} - -VOID IO_TEST_FSTATAT_002(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_test_fstatfs_001.cpp b/testsuites/unittest_old/fs/jffs/full/It_test_fstatfs_001.cpp deleted file mode 100644 index 678716fa..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_test_fstatfs_001.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -#include -#include "fcntl.h" -#include "sys/vfs.h" - -static UINT32 testcase1(VOID) -{ - int fd; - struct statfs buf; - int ret; - errno = 0; - - fd = open("/lib/libc.so", O_RDONLY); - ret = fstatfs(fd, &buf); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - TEST_PRINT("[INFO]The \"/lib/libc.so\" 's,buf->f_type=0x%x\n", buf.f_type); - TEST_PRINT("[INFO]Check the file's filesystem type:./musl/kernel/include/sys/statfs.h:#define JFFS2_SUPER_MAGIC 0x72b6,#define MSDOS_SUPER_MAGIC 0x4d44\n"); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_ASSERT_EQUAL(buf.f_type, 0x4d44, -1); - ICUNIT_GOTO_EQUAL(buf.f_type, 0x4d44, -1, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - testcase1(); - - return LOS_OK; -} - -VOID IO_TEST_FSTATFS_001(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_test_fstatfs_002.cpp b/testsuites/unittest_old/fs/jffs/full/It_test_fstatfs_002.cpp deleted file mode 100644 index 4d802762..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_test_fstatfs_002.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -#include -#include "fcntl.h" -#include "sys/vfs.h" - -static UINT32 testcase1(VOID) -{ - struct statfs buf; - char pathname[] = "./fstatfs.tmp"; - int ret = 0; - int fd = 0; - errno = 0; - - fd = open(pathname, O_RDWR | O_CREAT); - TEST_PRINT("[INFO]%s:%d,%s,fd=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, fd, errno, strerror(errno)); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, OUT); - - errno = 0; - ret = chmod(pathname, 0); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - - errno = 0; - ret = fstatfs(fd, &buf); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - /* ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); omitted temprorily,as chmod does no works. */ - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase2(VOID) -{ - struct statfs buf; - int ret; - - errno = 0; - ret = fstatfs(0xffffffff, &buf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, OUT); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase3(VOID) -{ - struct statfs buf; - int ret; - int fd; - char *pathname = (char *)"./fstatfs2.tmp"; - - errno = 0; - fd = open(pathname, O_RDONLY | O_CREAT); - - errno = 0; - ret = fstatfs(fd, &buf); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 test() -{ - return 0; -} - -static UINT32 testcase4(VOID) -{ - struct statfs *buf = nullptr; - int ret; - int fd; - - errno = 0; - fd = open("/lib/libc.so", O_RDONLY); - - errno = 0; - ret = fstatfs(fd, (struct statfs *)nullptr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -static UINT32 testcase(VOID) -{ - /* testcase1(); 本用例因chmod函数无法改文件æƒé™è€Œæ— æ³•æµ‹ï¼Œæ•…注释*/ - testcase2(); - /* testcase3(); 本用例传éžæ³•å‚数由内核检测返回EINVAL,但musl部分代ç ä¼šå¯¹ç©ºåœ°å€èµ‹å€¼è¿›è€Œè·‘飞,故注释*/ - /* testcase4(); 本用例传éžæ³•å‚数由内核检测返回EINVAL,但musl部分代ç ä¼šå¯¹ç©ºåœ°å€èµ‹å€¼è¿›è€Œè·‘飞,故注释*/ - - return LOS_OK; -} - -VOID IO_TEST_FSTATFS_002(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_004.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_004.cpp deleted file mode 100644 index 2e123436..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_004.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset, offset1, offset2, offset3, offset4; - struct dirent **namelist = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ptr = readdir(dir); - offset1 = ptr->d_off; - - ptr = readdir(dir); - offset2 = ptr->d_off; - - ptr = readdir(dir); - offset3 = ptr->d_off; - - ptr = readdir(dir); - offset4 = ptr->d_off; - - seekdir(dir, offset2); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset2, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - seekdir(dir, offset4); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset4, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, offset3); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, offset3, offset, EXIT5); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "0file", namelist[0]->d_name, EXIT); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "0test", namelist[1]->d_name, EXIT); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "1test", namelist[2]->d_name, EXIT); // 2 means third file - ICUNIT_GOTO_STRING_EQUAL(namelist[3]->d_name, "2test", namelist[3]->d_name, EXIT); // 3 means four file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset1, namelist[3]->d_off, offset1, EXIT5); // 3 means four file - ICUNIT_GOTO_EQUAL(offset, namelist[3]->d_off, offset, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - - seekdir(dir, namelist[2]->d_off); // 2 means third file - offset = telldir(dir); - ICUNIT_GOTO_NOT_EQUAL(offset, -1, offset, EXIT5); - ICUNIT_GOTO_EQUAL(offset3, namelist[2]->d_off, offset3, EXIT5); // 2 means third file - ICUNIT_GOTO_EQUAL(offset, namelist[2]->d_off, offset, EXIT5); // 2 means third file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - - JffsScandirFree(namelist, scandirCount); - - scandirCount = 0; - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT5); // 4 means total scaned file - - seekdir(dir, namelist[3]->d_off); // 3 means four file - ICUNIT_GOTO_EQUAL(offset4, namelist[3]->d_off, offset4, EXIT5); // 3 means four file - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - - seekdir(dir, namelist[0]->d_off); // 0 means first file - ICUNIT_GOTO_EQUAL(offset1, namelist[0]->d_off, offset1, EXIT5); // 0 means first file - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - -EXIT6: - JffsScandirFree(namelist, scandirCount); -EXIT5: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs004(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_004", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_006.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_006.cpp deleted file mode 100644 index 8a0613cb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_006.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret; - CHAR *pret = NULL; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR buf[30] = ""; - struct dirent *ptr = NULL; - INT32 offset, offset1, offset2, offset3, offset4; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - pret = getcwd(buf, 30); // 30 means name length - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT); - - strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - pret = getcwd(buf, 30); // 30 means name length - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - pret = getcwd(buf, 30); // 30 means name length - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT3); - - strcat_s(pathname, sizeof(pathname), "/1file"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - pret = getcwd(buf, 30); // 30 means name length - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT5); - - ret = chdir("/storage"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - pret = getcwd(buf, 30); // 30 means name length - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(buf, "/storage", buf, EXIT5); - -EXIT5: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/2test/1file", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs006(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_006", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_007.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_007.cpp deleted file mode 100644 index ffb42563..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_007.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 fd3 = -1; - INT32 ret, scandirCount; - CHAR *pret = NULL; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR buf[50] = ""; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct stat statfile; - struct statfs statfsfile; - struct dirent **namelist = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pret = getcwd(buf, 20); // 20 means path name len - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT); - - strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - strcat_s(pathname, sizeof(pathname), "/1file"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT4); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - pret = getcwd(buf, 20); // 20 means path name len - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT5); - - fd2 = open("2file", O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - fd3 = open("2file", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd3, -1, fd3, EXIT6); - - ret = mkdir("3dir", HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT7); - - ret = mkdir("3dir", HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT7); - - dir = opendir("3dir"); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT8); - - scandirCount = scandir(".", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 3, scandirCount, EXIT8); // 3 means scan file num - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "1file", namelist[0]->d_name, EXIT9); // 0 means first file - - ret = rename("2file", "file2"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); - - ret = stat("file2", &statfile); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); - ICUNIT_GOTO_EQUAL(statfile.st_size, 0, statfile.st_size, EXIT10); - - ret = statfs("file2", &statfsfile); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); - - ret = access("file2", R_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - - ret = unlink("file2"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); - - ret = chdir("3dir"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT9); - strcat_s(pathname, sizeof(pathname), "/3dir"); - pret = getcwd(buf, 30); // 30 means path name len - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT9); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT9); - - ret = chdir("../"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT9); - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - pret = getcwd(buf, 20); // 20 means path name len - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT9); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname, buf, EXIT9); - -EXIT10: - JffsStrcat2(pathname, "/2test/file2", sizeof(pathname)); - close(fd2); - remove(pathname); -EXIT9: - JffsScandirFree(namelist, scandirCount); -EXIT8: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); -EXIT7: - JffsStrcat2(pathname, "/2test/3dir", sizeof(pathname)); - rmdir(pathname); -EXIT6: - JffsStrcat2(pathname, "/2test/2file", sizeof(pathname)); - close(fd2); - close(fd3); - remove(pathname); -EXIT5: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/2test/1file", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs007(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_007", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_008.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_008.cpp deleted file mode 100644 index fee0df33..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_008.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, scandirCount; - CHAR *pret = NULL; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct dirent **namelist = NULL; - INT32 offset, offset1, offset2, offset3, offset4; - CHAR buf[20]; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - strcat_s(pathname, sizeof(pathname), "/1file"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT4); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset1 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset1 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset2 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset2 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset3 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset3 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset4 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset4 - 1, offset, EXIT6); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, NULL, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 4, scandirCount, EXIT6); // 4 means total scaned file - - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "0file", namelist[0]->d_name, EXIT7); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "0test", namelist[1]->d_name, EXIT7); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "1test", namelist[2]->d_name, EXIT7); // 2 means third file - ICUNIT_GOTO_STRING_EQUAL(namelist[3]->d_name, "2test", namelist[3]->d_name, EXIT7); // 3 means four file - ICUNIT_GOTO_EQUAL(namelist[0]->d_off, offset2, namelist[0]->d_off, EXIT7); // 0 means first file - ICUNIT_GOTO_EQUAL(namelist[2]->d_off, offset3, namelist[2]->d_off, EXIT7); // 2 means third file - -EXIT7: - JffsScandirFree(namelist, scandirCount); -EXIT6: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); -EXIT5: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/2test/1file", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs008(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_008", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_009.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_009.cpp deleted file mode 100644 index 99da60b2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_009.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 ScandirF01(const struct dirent *ent) -{ - // read out a file while the name begined with "test" - return (strncmp(ent->d_name, "test", 4) == 0); -} -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, scandirCount; - CHAR *pret = NULL; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct dirent **namelist = NULL; - INT32 offset, offset1, offset2, offset3, offset4; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname, sizeof(pathname), "/test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/testfile", 50); // 50 means name length - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/0test1", 50); // 50 means name length - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - strcat_s(pathname, sizeof(pathname), "/test1file"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - JffsStrcat2(pathname, "/test2", 50); // 50 means name length - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset1 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset1 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset2 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset2 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset3 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset3 - 1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset4 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset4 - 1, offset, EXIT6); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, ScandirF01, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 3, scandirCount, EXIT6); // 3 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "test", namelist[0]->d_name, EXIT7); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "test2", namelist[1]->d_name, EXIT7); // 1 means second file - ICUNIT_GOTO_STRING_EQUAL(namelist[2]->d_name, "testfile", namelist[2]->d_name, EXIT7); // 2 means third file - ICUNIT_GOTO_EQUAL(namelist[0]->d_type, DT_DIR, namelist[0]->d_name, EXIT7); // 0 means first file - -EXIT7: - JffsScandirFree(namelist, scandirCount); -EXIT6: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); -EXIT5: - JffsStrcat2(pathname, "/test2", sizeof(pathname)); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/0test1/test1file", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "/0test1", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/testfile", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs009(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_009", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_010.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_010.cpp deleted file mode 100644 index b4e6e104..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_010.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 ScandirF01(const struct dirent *ent) -{ - return (strncmp(ent->d_name, "test", 4) == 0); -} - -static INT32 ScandirF02(const struct dirent **a, const struct dirent **b) -{ - return -1; -} - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, scandirCount; - CHAR *pret = NULL; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct dirent **namelist = NULL; - INT32 offset, offset1, offset2, offset3, offset4; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname, sizeof(pathname), "/test0"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/testfile", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/0test1", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - strcat_s(pathname, sizeof(pathname), "/test1file"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - JffsStrcat2(pathname, "/test1", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset1 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset2 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset2, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset3 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset3, offset, EXIT6); - - offset = telldir(dir); - ptr = readdir(dir); - offset4 = ptr->d_off; - ICUNIT_GOTO_EQUAL(offset, offset4, offset, EXIT6); - - scandirCount = scandir(JFFS_PATH_NAME0, &namelist, ScandirF01, ScandirF02); - ICUNIT_GOTO_EQUAL(scandirCount, 3, scandirCount, EXIT7); // 3 means total scaned file - ICUNIT_GOTO_STRING_EQUAL(namelist[0]->d_name, "test0", namelist[0]->d_name, EXIT7); // 0 means first file - ICUNIT_GOTO_STRING_EQUAL(namelist[1]->d_name, "test1", namelist[1]->d_name, EXIT7); // 1 means second file - ICUNIT_GOTO_EQUAL(namelist[0]->d_type, DT_DIR, namelist[0]->d_name, EXIT7); // 0 means first file - -EXIT7: - JffsScandirFree(namelist, scandirCount); -EXIT6: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); -EXIT5: - JffsStrcat2(pathname, "/test1", sizeof(pathname)); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/0test1/test1file", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "/0test1", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/testfile", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/test0", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs010(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_010", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_011.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_011.cpp deleted file mode 100644 index f2be1f73..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_011.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - INT32 offset; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat_s(pathname, sizeof(pathname), "/1test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - strcat_s(pathname, sizeof(pathname), "/2test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - strcat_s(pathname, sizeof(pathname), "/0file"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT5); - - JffsStrcat2(pathname, "/0test/1test/2test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/0test/1test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/0test/1test/2test/0file", sizeof(pathname)); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/0test/1test/2test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/0test/1test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT5: - JffsStrcat2(pathname, "/0test/1test/2test/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT4: - JffsStrcat2(pathname, "/0test/1test/2test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/0test/1test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT1: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs011(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_011", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_012.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_012.cpp deleted file mode 100644 index 0f1965c9..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_012.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir1 = NULL; - DIR *dir2 = NULL; - DIR *dir3 = NULL; - DIR *dir4 = NULL; - struct dirent *ptr = NULL; - INT32 offset; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir1 = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT1); - - strcat_s(pathname, sizeof(pathname), "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - dir2 = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT3); - - strcat_s(pathname, sizeof(pathname), "/1test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir3 = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir3, NULL, dir3, EXIT5); - - strcat_s(pathname, sizeof(pathname), "/2test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - dir4 = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir4, NULL, dir4, EXIT7); - - strcat_s(pathname, sizeof(pathname), "/0file"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT8); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - ret = closedir(dir3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - ret = closedir(dir4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - JffsStrcat2(pathname, "/0test/1test/2test/0file", sizeof(pathname)); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - JffsStrcat2(pathname, "/0test/1test/2test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/0test/1test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT8: - JffsStrcat2(pathname, "/0test/1test/2test/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT7: - closedir(dir4); -EXIT6: - JffsStrcat2(pathname, "/0test/1test/2test", sizeof(pathname)); - rmdir(pathname); -EXIT5: - closedir(dir3); -EXIT4: - JffsStrcat2(pathname, "/0test/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - closedir(dir2); -EXIT2: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT1: - closedir(dir1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs012(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_012", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_013.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_013.cpp deleted file mode 100644 index 30e7209e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_013.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd[5] = { -1 }; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[100] = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd[0] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], -1, fd[0], EXIT); // 0 means first fd - - strcat_s(pathname, sizeof(pathname), "0"); - fd[1] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], -1, fd[1], EXIT1); // 1 means second fd - - strcat_s(pathname, sizeof(pathname), "1"); - fd[2] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(fd[2], -1, fd[2], EXIT2); // 2 means third fd - - strcat_s(pathname, sizeof(pathname), "2"); - fd[3] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // 3 means four fd - ICUNIT_GOTO_NOT_EQUAL(fd[3], -1, fd[3], EXIT3); // 3 means four fd - - strcat_s(pathname, sizeof(pathname), "3"); - fd[4] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // 4 means fifth fd - ICUNIT_GOTO_NOT_EQUAL(fd[4], -1, fd[4], EXIT4); // 4 means fifth fd - - len = write(fd[0], filebuf, strlen(filebuf)); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - - off = lseek(fd[0], 0, SEEK_SET); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT4); - - len = read(fd[0], readbuf, JFFS_STANDARD_NAME_LENGTH); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - len = write(fd[1], filebuf, strlen(filebuf)); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - - off = lseek(fd[1], 0, SEEK_SET); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT4); - - len = read(fd[1], readbuf, JFFS_STANDARD_NAME_LENGTH); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - len = write(fd[2], filebuf, strlen(filebuf)); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - - off = lseek(fd[2], 0, SEEK_SET); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT4); - - len = read(fd[2], readbuf, JFFS_STANDARD_NAME_LENGTH); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - len = write(fd[3], filebuf, strlen(filebuf)); // 3 means four fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - - off = lseek(fd[3], 0, SEEK_SET); // 3 means four fd - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT4); - - len = read(fd[3], readbuf, JFFS_STANDARD_NAME_LENGTH); // 3 means four fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - len = write(fd[4], filebuf, strlen(filebuf)); // 4 means fifth fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - - off = lseek(fd[4], 0, SEEK_SET); // 4 means fifth fd - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT4); - - len = read(fd[4], readbuf, JFFS_STANDARD_NAME_LENGTH); // 4 means fifth fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - -EXIT4: - JffsStrcat2(pathname, "0123", sizeof(pathname)); - close(fd[4]); // 4 means fifth fd - remove(pathname); -EXIT3: - JffsStrcat2(pathname, "012", sizeof(pathname)); - close(fd[3]); // 3 means four fd - remove(pathname); -EXIT2: - JffsStrcat2(pathname, "01", sizeof(pathname)); - close(fd[2]); // 2 means third fd - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "0", sizeof(pathname)); - close(fd[1]); // 1 means second fd - remove(pathname); -EXIT: - close(fd[0]); // 0 means first fd - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs013(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_013", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_014.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_014.cpp deleted file mode 100644 index eef10fe8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_014.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd[3] = { -1 }; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[100] = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd[0] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], -1, fd[0], EXIT1); // 0 means first fd - - fd[1] = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], -1, fd[1], EXIT2); // 1 means second fd - - fd[2] = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(fd[2], -1, fd[2], EXIT3); // 2 means third fd - - len = write(fd[0], filebuf, strlen(filebuf)); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - - len = read(fd[1], readbuf, JFFS_STANDARD_NAME_LENGTH); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - len = read(fd[2], readbuf, JFFS_STANDARD_NAME_LENGTH); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - len = write(fd[2], filebuf, strlen(filebuf)); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - - len = read(fd[1], readbuf, JFFS_STANDARD_NAME_LENGTH); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - len = read(fd[0], readbuf, JFFS_STANDARD_NAME_LENGTH); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - strcpy_s(filebuf, sizeof(filebuf), "abcdeabcde1"); - len = write(fd[1], filebuf, strlen(filebuf)); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, 11, len, EXIT3); // 11 means write len - - len = read(fd[2], readbuf, JFFS_STANDARD_NAME_LENGTH); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, 11, len, EXIT3); // 11 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - len = read(fd[0], readbuf, JFFS_STANDARD_NAME_LENGTH); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, 11, len, EXIT3); // 11 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - strcpy_s(filebuf, sizeof(filebuf), "fghjkfghjk12"); - len = write(fd[0], filebuf, strlen(filebuf)); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, 12, len, EXIT3); // 12 means write len - - strcpy_s(filebuf, sizeof(filebuf), "qqqqqppppp12"); - len = write(fd[2], filebuf, strlen(filebuf)); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, 12, len, EXIT3); // 12 means write len - - len = read(fd[1], readbuf, JFFS_STANDARD_NAME_LENGTH); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, 12, len, EXIT3); // 12 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "qqqqqppppp12", readbuf, EXIT3); - - ret = close(fd[2]); // 2 means third fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = unlink(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd[2]); // 2 means third fd -EXIT2: - close(fd[1]); // 1 means second fd -EXIT1: - close(fd[0]); // 0 means first fd -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs014(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_014", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_015.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_015.cpp deleted file mode 100644 index e38d2c30..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_015.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[20] = { 0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - DIR *dir = NULL; - struct dirent *ptr = NULL; - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname2, sizeof(pathname2), "/jffs_1015.txt"); - fd = creat(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname3, sizeof(pathname3), "/1015_123.txt"); - ret = rename(pathname2, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname2, O_NONBLOCK | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT); - - fd = open(pathname3, O_NONBLOCK | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - - fd1 = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd1, -1, fd1, EXIT4); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1015_123.txt", ptr->d_name, EXIT5); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT3); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - return JFFS_NO_ERROR; -EXIT5: - if (dir) ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - close(fd1); -EXIT3: - strcat_s(pathname3, sizeof(pathname3), "/1015_123.txt"); - close(fd); - remove(pathname3); -EXIT2: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -EXIT1: - strcat_s(pathname2, sizeof(pathname2), "/jffs_1015.txt"); - close(fd); - remove(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs015(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_015", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_016.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_016.cpp deleted file mode 100644 index 10c256fd..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_016.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[20] = { 0 }; - off_t off; - - fd = open(JFFS_PATH_NAME0, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - strcat_s(pathname, sizeof(pathname), "123"); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - len = read(fd1, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rename(JFFS_PATH_NAME0, pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - fd1 = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - len = read(fd1, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - return JFFS_NO_ERROR; - -EXIT5: - close(fd1); -EXIT4: - JffsStrcat2(pathname, "123", strlen(pathname)); - remove(pathname); - return JFFS_NO_ERROR; - -EXIT3: - close(fd1); -EXIT2: - JffsStrcat2(pathname, "123", strlen(pathname)); - remove(pathname); -EXIT1: - close(fd); -EXIT: - JffsStrcat2(pathname, JFFS_PATH_NAME0, strlen(pathname)); - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs016(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_016", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_017.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_017.cpp deleted file mode 100644 index ffd2ffa3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_017.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/0test"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname, sizeof(pathname), "/dirfiles"); - - ret = rename(pathname1, pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - ret = rmdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); // ²»´æÔÚ - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT2: - JffsStrcat2(pathname, "/dirfiles", strlen(pathname)); - remove(pathname); -EXIT1: - JffsStrcat2(pathname1, "/0test", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs017(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_017", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_018.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_018.cpp deleted file mode 100644 index 86df9fde..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_018.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/0test"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(pathname, sizeof(pathname), "/dirfiles"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname1, pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - ret = rmdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); // ²»´æÔÚ - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - JffsStrcat2(pathname, "/dirfiles", strlen(pathname)); - remove(pathname); -EXIT1: - JffsStrcat2(pathname1, "/0test", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs018(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_018", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_019.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_019.cpp deleted file mode 100644 index f0c9a9d1..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_019.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - CHAR filebuf[20] = "1234567890"; - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname2, sizeof(pathname2), "/0test"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(pathname1, sizeof(pathname1), "/dirfiles"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat_s(pathname3, sizeof(pathname3), "/dirfiles/files"); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - printf("pathname1: %s pathname2: %s pathname3: %s\n", pathname1, pathname2, pathname3); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT4); // 10 means file name length - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rename(pathname2, pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT5); - - ret = rename(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname3, "/0test/files", sizeof(pathname3)); - ret = unlink(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT5: - JffsStrcat2(pathname3, "/0test/files", strlen(pathname3)); - remove(pathname3); -EXIT4: - close(fd); -EXIT3: - JffsStrcat2(pathname3, "/dirfiles/files", strlen(pathname3)); - remove(pathname3); -EXIT2: - JffsStrcat2(pathname2, "/dirfiles", strlen(pathname2)); - remove(pathname2); -EXIT1: - JffsStrcat2(pathname1, "/0test", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs019(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_019", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_020.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_020.cpp deleted file mode 100644 index 9fd127c1..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_020.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR pathname1[20] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(pathname, sizeof(pathname), "/files"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = rename(pathname1, pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = rename(pathname, pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir1", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs020(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_020", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_023.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_023.cpp deleted file mode 100644 index 208130c0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_023.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR bufdir1[50] = { JFFS_PATH_NAME0 }; - CHAR bufdir2[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(bufdir1, sizeof(bufdir1), "/dir/dirfile1"); - ret = mkdir(bufdir1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat_s(bufdir2, sizeof(bufdir2), "/dir/dirfile1/dirfile2"); - ret = mkdir(bufdir2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = rename(bufdir1, bufdir2); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = rename(bufdir2, bufdir1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - ret = rmdir(bufdir1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(bufdir2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(bufdir1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - JffsStrcat2(pathname1, "/dir/dirfile1/dirfile2", strlen(pathname1)); - remove(pathname1); -EXIT2: - JffsStrcat2(pathname1, "/dir/dirfile1", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs023(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_023", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_024.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_024.cpp deleted file mode 100644 index 8d907c9e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_024.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile1[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rename(pathname1, pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(buffile1, sizeof(buffile1), "/dir/file1"); - fd1 = open(buffile1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rename(buffile1, buffile1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = unlink(buffile1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd1); -EXIT2: - JffsStrcat2(pathname1, "/dir/file1", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs024(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_024", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_025.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_025.cpp deleted file mode 100644 index 21352442..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_025.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR bufdir1[50] = { JFFS_PATH_NAME0 }; - CHAR bufdir2[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(bufdir1, sizeof(bufdir1), "/dir/dirfile1"); - ret = mkdir(bufdir1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat_s(bufdir2, sizeof(bufdir2), "/dir/dirfile1/dirfile2"); - ret = rename(bufdir2, bufdir1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(bufdir1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(bufdir2); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - JffsStrcat2(pathname1, "/dir/dirfile1/dirfile2", strlen(pathname1)); - remove(pathname1); - goto EXIT1; -EXIT2: - JffsStrcat2(pathname1, "/dir/dirfile1", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs025(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_025", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_028.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_028.cpp deleted file mode 100644 index 10b6ee56..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_028.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, "012345678901234567890123456789", 30); // 30 means write len - ICUNIT_GOTO_EQUAL(len, 30, len, EXIT3); // 30 means write len - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs028(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_028", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_029.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_029.cpp deleted file mode 100644 index f6e18c67..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_029.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - INT32 n = 103; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - while (n--) { - len = write(fd, "0123456789012345678901234567890123456789", 40); // 40 means write len - ICUNIT_GOTO_EQUAL(len, 40, len, EXIT3); // 40 means write len - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs029(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_029", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_030.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_030.cpp deleted file mode 100644 index e7d1d132..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_030.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - INT32 n = 256; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - while (n--) { - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); // 16 means write len - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs030(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_030", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_031.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_031.cpp deleted file mode 100644 index 08a21a61..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_031.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); // 16 means write len - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs031(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_031", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_032.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_032.cpp deleted file mode 100644 index 0bb59f07..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_032.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - CHAR readbuf[20] = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = fstat(fd, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - LosTaskDelay(20); // 20 means timedelay length - len = read(fd, readbuf, 20); // 20 means read length - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - ret = fstat(fd, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - LosTaskDelay(20); // 20 means timedelay length - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); // 16 means write len - - ret = fstat(fd, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs032(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_032", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_033.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_033.cpp deleted file mode 100644 index 082f373a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_033.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - CHAR readbuf[20] = { 0 }; - - LosTaskDelay(10); // 10 means delay time length - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - LosTaskDelay(10); // 10 means delay time length - strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - LosTaskDelay(10); // 10 means delay time length - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - LosTaskDelay(10); // 10 means delay time length - len = write(fd, "01234567890123456789012345", 16); // 16 means write len - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); // 16 means write len - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs033(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_033", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_037.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_037.cpp deleted file mode 100644 index 2ceda67d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_037.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[50] = { 0 }; - CHAR pathname[50] = "/storage/liteos"; - CHAR pathname1[50] = "/storage/liteosliteosli"; - CHAR pathname2[50] = "/storage/liteosliteoslit"; - CHAR pathname3[50] = "/storage/liteos"; - CHAR pathname4[50] = "/storage/liteosliteosli"; - CHAR pathname5[50] = "/jffs/liteosliteoslit"; - off_t off; - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - JffsDeletefile(fd, pathname3); - - fd = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - JffsDeletefile(fd, pathname4); - - fd = open(pathname5, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT5); - - return JFFS_NO_ERROR; -EXIT5: - close(fd); - remove(pathname5); - return JFFS_NO_ERROR; -EXIT4: - close(fd); - remove(pathname4); - return JFFS_NO_ERROR; -EXIT3: - close(fd); - remove(pathname3); - return JFFS_NO_ERROR; -EXIT2: - remove(pathname2); - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); - return JFFS_NO_ERROR; -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs037(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_037", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_038.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_038.cpp deleted file mode 100644 index bf59e2df..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_038.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - struct stat buf1; - - fd = creat(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = stat(pathname, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.st_size, 0, buf1.st_size, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs038(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_038", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_039.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_039.cpp deleted file mode 100644 index 744cb5de..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_039.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[50] = " "; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs039(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_039", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_040.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_040.cpp deleted file mode 100644 index 339ff5cc..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_040.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH][JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0, }; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - DIR *dir = NULL; - DIR *dir1[JFFS_STANDARD_NAME_LENGTH] = { NULL, }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - memset_s(pathname2[i], JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH - 1, JFFS_SHORT_ARRAY_LENGTH, "/test%d", i); - JffsStrcat2(pathname2[i], bufname, strlen(bufname)); - - ret = mkdir(pathname2[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - dir1[i] = opendir(pathname2[i]); - ICUNIT_GOTO_NOT_EQUAL(dir1[i], NULL, dir1[i], EXIT3); - } - - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - ret = remove(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - closedir(dir1[i]); - } -EXIT2: - for (i = 0; i < JFFS_STANDARD_NAME_LENGTH; i++) { - remove(pathname2[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs040(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_040", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_041.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_041.cpp deleted file mode 100644 index 35b6ef88..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_041.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_EQUAL(readbuf[0], 0, readbuf[0], EXIT1); - - fd1 = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs041(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_041", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_042.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_042.cpp deleted file mode 100644 index c3e4e88d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_042.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_WRONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT1); - - fd1 = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs042(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_042", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_043.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_043.cpp deleted file mode 100644 index 4863839f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_043.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs043(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_043", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_044.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_044.cpp deleted file mode 100644 index d922b5cb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_044.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_WRONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_EXCL | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd1, -1, fd1, EXIT2); - -EXIT2: - close(fd1); -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs044(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_044", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_045.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_045.cpp deleted file mode 100644 index f99e7df8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_045.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - fd2 = open(pathname, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd2, -1, fd2, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT2); - - fd1 = open(pathname, O_APPEND | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT3); // 10 means read size - - len = write(fd1, "abcde", 6); // 6 means write len - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT3); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT3); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); // 16 means path name len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890abcde", readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - ret = unlink(pathname); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); -#if 1 - close(fd1); -#endif - return JFFS_NO_ERROR; -EXIT3: - close(fd1); -EXIT2: - close(fd2); -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs045(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_045", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_046.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_046.cpp deleted file mode 100644 index 158367c4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_046.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd1 = open(pathname, O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, " ", readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - ret = unlink(pathname); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); - goto EXIT; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs046(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_046", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_048.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_048.cpp deleted file mode 100644 index f484f594..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_048.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[20] = "1234567890abcde"; - CHAR readbuf[7] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 15, len, EXIT1); // 15 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 4); // 4 means read len - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // 4 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234", readbuf, EXIT1); - - len = read(fd, readbuf, 5); // 5 means read len - ICUNIT_GOTO_EQUAL(len, 5, len, EXIT1); // 5 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "56789", readbuf, EXIT1); - - len = read(fd, readbuf, 6); // 6 means read len - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0abcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs048(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_048", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_049.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_049.cpp deleted file mode 100644 index 5fa6a7c1..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_049.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[10] = "123456"; - CHAR readbuf[10] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 9); // 9 means length of data to be read - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "123456", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 10); // 10 means length of data to be read - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "123456", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - len = read(fd, readbuf, 11); // 11 means length of data to be read - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "123456", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs049(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_049", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_050.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_050.cpp deleted file mode 100644 index cb1fe87a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_050.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[10] = "123456"; - CHAR readbuf[10] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1", readbuf, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs050(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_050", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_051.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_051.cpp deleted file mode 100644 index d289e95b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_051.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd[10] = { -1 }; - INT32 ret; - CHAR pathname[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - INT32 offset; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT0); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT0); - - strcat_s(pathname, JFFS_NAME_LIMITTED_SIZE, "/0testwe12rttyututututqweqqfsdfsdfsdf.exe"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.TXT", JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname, - "/0testwe12rttyututututqweqqfsdfsdfsdffsdf12345678900testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.123", - JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/12345678901234567890123456789012345678901234567890.123", JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz.123", JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - JffsStrcat2(pathname, "/����ϵͳ������ȱ�δ�δ�.123", JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname, "/����ϵͳ������ȱ�δ�δ�123ttt.www", JFFS_NAME_LIMITTED_SIZE); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT7); - - JffsStrcat2(pathname, "/����ϵͳ������ȱ�δ�δ�123ttt.www", JFFS_NAME_LIMITTED_SIZE); - fd[0] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_EQUAL(fd[0], -1, fd[0], EXIT7); // 0 means first fd - - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdf.exe", JFFS_NAME_LIMITTED_SIZE); - fd[0] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_EQUAL(fd[0], -1, fd[0], EXIT7); // 0 means first fd - - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdf.txt", JFFS_NAME_LIMITTED_SIZE); - fd[0] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], -1, fd[0], EXIT8); // 0 means first fd - - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.WWW", JFFS_NAME_LIMITTED_SIZE); - fd[1] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], -1, fd[1], EXIT9); // 1 means second fd - - JffsStrcat2(pathname, - "/0testwe12rttyututututqweqqfsdfsdfsdffsdf12345678900testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.AAA", - JFFS_NAME_LIMITTED_SIZE); - fd[2] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(fd[2], -1, fd[2], EXIT10); // 2 means third fd - - JffsStrcat2(pathname, "/12345678901234567890123456789012345678901234567890.456", JFFS_NAME_LIMITTED_SIZE); - fd[3] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 3 means four fd - ICUNIT_GOTO_NOT_EQUAL(fd[3], -1, fd[3], EXIT11); // 3 means four fd - - JffsStrcat2(pathname, "/ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz.456", JFFS_NAME_LIMITTED_SIZE); - fd[4] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 4 means fifth fd - ICUNIT_GOTO_NOT_EQUAL(fd[4], -1, fd[4], EXIT12); // 4 means fifth fd - - JffsStrcat2(pathname, "/����ϵͳ������ȱ�δ�δ�.123.456", JFFS_NAME_LIMITTED_SIZE); - fd[5] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 5 means six fd - ICUNIT_GOTO_NOT_EQUAL(fd[5], -1, fd[5], EXIT13); // 5 means six fd - - JffsStrcat2(pathname, "/����ϵͳ������ȱ�δ�δ�123ttt.www", JFFS_NAME_LIMITTED_SIZE); - fd[6] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 6 means seven fd - ICUNIT_GOTO_EQUAL(fd[6], -1, fd[6], EXIT13); // 6 means seven fd - - JffsStrcat2(pathname, "/����ϵͳ������ȱ�δ�δ�123ttt.AAA", JFFS_NAME_LIMITTED_SIZE); - fd[6] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 6 means seven fd - ICUNIT_GOTO_NOT_EQUAL(fd[6], -1, fd[6], EXIT14); // 6 means seven fd - - JffsStrcat2(pathname, "/����ϵͳ������ȱ�δ�δ�123ttt.AAA", JFFS_NAME_LIMITTED_SIZE); - fd[7] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 7 means eight fd - ICUNIT_GOTO_EQUAL(fd[7], -1, fd[7], EXIT14); // 7 means eight fd - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT15); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT15); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT15); - LosTaskDelay(5); // 5 means timedelay len - -EXIT14: - JffsStrcat2(pathname, "/����ϵͳ������ȱ�δ�δ�123ttt.AAA", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[6]); // 6 means seven fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT14_1); -EXIT14_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT13); - -EXIT13: - JffsStrcat2(pathname, "/����ϵͳ������ȱ�δ�δ�.123.456", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[5]); // 5 means six fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT13_1); -EXIT13_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT12); -EXIT12: - JffsStrcat2(pathname, "/ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz.456", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[4]); // 4 means fifth fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT12_1); -EXIT12_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT11); -EXIT11: - JffsStrcat2(pathname, "/12345678901234567890123456789012345678901234567890.456", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[3]); // 3 means four fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT11_1); -EXIT11_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10); -EXIT10: - JffsStrcat2(pathname, - "/0testwe12rttyututututqweqqfsdfsdfsdffsdf12345678900testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.AAA", - JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[2]); // 2 means third fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT10_1); -EXIT10_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT9); -EXIT9: - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.WWW", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT9_1); -EXIT9_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - -EXIT8: - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdf.txt", JFFS_NAME_LIMITTED_SIZE); - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8_1); -EXIT8_1: - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT7); - -EXIT7: - JffsStrcat2(pathname, "/����ϵͳ������ȱ�δ�δ�123ttt.www", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); - -EXIT6: - JffsStrcat2(pathname, "/����ϵͳ������ȱ�δ�δ�.123", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); -EXIT5: - JffsStrcat2(pathname, "/ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz.123", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); -EXIT4: - JffsStrcat2(pathname, "/12345678901234567890123456789012345678901234567890.123", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, - "/0testwe12rttyututututqweqqfsdfsdfsdffsdf12345678900testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.123", - JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); - -EXIT2: - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdffsdf1234567890.TXT", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); - -EXIT1: - JffsStrcat2(pathname, "/0testwe12rttyututututqweqqfsdfsdfsdf.exe", JFFS_NAME_LIMITTED_SIZE); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -EXIT15: - closedir(dir); - goto EXIT14; - return JFFS_NO_ERROR; -EXIT0: - closedir(dir); - goto EXIT; -} - -VOID ItFsJffs051(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_051", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_053.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_053.cpp deleted file mode 100644 index f11494a2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_053.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[20] = "1234567890abcde"; - CHAR readbuf[JFFS_SHORT_ARRAY_LENGTH] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 4); // 4 means read len - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // 4 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - memset_s(readbuf, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - - len = read(fd, readbuf, 2); // 2 means read len - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - ICUNIT_GOTO_EQUAL(readbuf[0], 0, readbuf[0], EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); // Ôٴδò¿ªÎļþ - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 4); // 4 means read len - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // 4 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - len = read(fd, readbuf, 2); // 2 means read len - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234", readbuf, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs053(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_053", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_055.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_055.cpp deleted file mode 100644 index 1d5325e1..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_055.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[20] = "1234567890abcde&"; - CHAR readbuf[5] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); // 16 means write len - - len = write(fd, filebuf, strlen(filebuf) + 1); - ICUNIT_GOTO_EQUAL(len, 17, len, EXIT1); // 17 means write len - - len = write(fd, filebuf, strlen(filebuf) - 1); - ICUNIT_GOTO_EQUAL(len, 15, len, EXIT1); // 15 means write len - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs055(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_055", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_056.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_056.cpp deleted file mode 100644 index f5addcc5..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_056.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR filebuf[20] = "1234567890abcde&"; - CHAR readbuf[50] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); // 16 means write len - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); // 16 means write len - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); // 16 means write len - - len = write(fd, "END", 3); // 3 means name len - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); // 3 means write len - - off = lseek(fd, 10, SEEK_SET); // 10 means file seek len - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT1); // 10 means current file positon - - len = read(fd, readbuf, 6); // 6 means read len - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcde&", readbuf, EXIT1); - - off = lseek(fd, 2, SEEK_CUR); // 2 means file seek len - ICUNIT_GOTO_EQUAL(off, 18, off, EXIT1); // 18 means current file positon - - memset_s(readbuf, sizeof(readbuf), 0, sizeof(readbuf)); - - len = read(fd, readbuf, 5); // 5 means read len - ICUNIT_GOTO_EQUAL(len, 5, len, EXIT1); // 5 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "34567", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 23, off, EXIT1); // 23 means current file positon - - len = read(fd, readbuf, 5); // 5 means read len - ICUNIT_GOTO_EQUAL(len, 5, len, EXIT1); // 5 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "890ab", readbuf, EXIT1); - - off = lseek(fd, -2, SEEK_CUR); // -2 means file seek back len - ICUNIT_GOTO_EQUAL(off, 26, off, EXIT1); // 26 means current file positon - - len = read(fd, readbuf, 6); // 6 means read len - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); // 6 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcde&", readbuf, EXIT1); - - memset_s(readbuf, sizeof(readbuf), 0, sizeof(readbuf)); - - off = lseek(fd, -2, SEEK_END); // -2 means file seek back len - ICUNIT_GOTO_EQUAL(off, 49, off, EXIT1); // 49 means current file positon - - len = read(fd, readbuf, 5); // 5 means read len - ICUNIT_GOTO_EQUAL(len, 2, len, EXIT1); // 2 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "ND", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 51, off, EXIT1); // 51 means current file positon - - len = read(fd, readbuf, 6); // 6 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - off = lseek(fd, 2, SEEK_END); // 2 means file seek len - ICUNIT_GOTO_EQUAL(off, 53, off, EXIT1); // 53 means current file positon - len = read(fd, readbuf, 6); // 6 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - len = write(fd, "mmm", 3); // 3 means write len - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); // 3 means write len - - off = lseek(fd, -3, SEEK_END); // -3 means file seek back len - ICUNIT_GOTO_EQUAL(off, 53, off, EXIT1); // 53 means current file positon - - len = read(fd, readbuf, 5); // 5 means read len - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); // 3 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "mmm", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs056(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_056", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_057.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_057.cpp deleted file mode 100644 index 874eb88e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_057.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, scandirCount; - INT32 fd = -1; - CHAR pathname[30] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct dirent **namelist = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT1); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT1); - - scandirCount = scandir(pathname, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 0, scandirCount, EXIT2); - - JffsScandirFree(namelist, scandirCount); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - if (scandirCount > 0) - JffsScandirFree(namelist, scandirCount); - else - goto EXIT1; -EXIT1: - closedir(dir); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs057(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_057", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_058.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_058.cpp deleted file mode 100644 index 83ba2400..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_058.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname[30] = { JFFS_MAIN_DIR0 }; - CHAR pathname1[30] = { JFFS_PATH_NAME0 }; - CHAR pathname2[30] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct dirent **namelist = NULL; - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(pathname2, sizeof(pathname2), "/test"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - rmdir(pathname2); -EXIT1: - rmdir(pathname1); -EXIT: - closedir(dir); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs058(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_058", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_059.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_059.cpp deleted file mode 100644 index ad522df9..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_059.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static constexpr int FILE_NAME_LEN = 10; -static constexpr int MAX_FILE_NAME_LEN = 50; - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[MAX_FILE_NAME_LEN] = "liteos"; - CHAR pathname[MAX_FILE_NAME_LEN] = { JFFS_PATH_NAME0 }; - off_t off; - struct stat buf1; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FILE_NAME_LEN, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = creat(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, MAX_FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = stat(pathname, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.st_size, 0, buf1.st_size, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FILE_NAME_LEN, len, EXIT1); - - len = read(fd, readbuf, MAX_FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs059(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_059", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_060.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_060.cpp deleted file mode 100644 index 2e8dc814..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_060.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[50] = { 0 }; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - off_t off; - fd = open(pathname, O_NONBLOCK | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, 0, fd, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs060(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_060", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_061.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_061.cpp deleted file mode 100644 index 7f1c775e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_061.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - INT32 offset; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs061(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_061", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_062.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_062.cpp deleted file mode 100644 index 7cd4633f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_062.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs062(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_062", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_063.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_063.cpp deleted file mode 100644 index de652027..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_063.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static constexpr int FILE_NAME_LEN = 10; -static constexpr int MAX_FILE_NAME_LEN = 50; - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret; - CHAR pathname[MAX_FILE_NAME_LEN] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDONLY | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_WRONLY | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd1, -1, fd1, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_WRONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(ret, FILE_NAME_LEN, ret, EXIT1); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(ret, FILE_NAME_LEN, ret, EXIT1); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs063(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_063", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_064.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_064.cpp deleted file mode 100644 index 47dbe0ed..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_064.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs064(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_064", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_065.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_065.cpp deleted file mode 100644 index 21ddec70..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_065.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static constexpr int MAX_FILE_NUM = 50; - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1[MAX_FILE_NUM] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - while (i < MAX_FILE_NUM) { - dir1[i] = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir1[i], NULL, dir1[i], EXIT1); - - i++; - } - for (i = 0; i < MAX_FILE_NUM; i++) { - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs065(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_065", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_066.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_066.cpp deleted file mode 100644 index 6f2fa45a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_066.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i, j; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR bufname[10] = ""; - CHAR pathname2[10][50] = { 0 }; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - for (i = 0; i < 10; i++) { // 10 means max file num - memset_s(bufname, sizeof(bufname), 0, strlen(bufname)); - snprintf_s(bufname, sizeof(bufname) - 1, sizeof(bufname), "/%d", i); - strcat_s(pathname1, sizeof(pathname1), bufname); - strcpy_s(pathname2[i], sizeof(pathname2[i]), pathname1); - - ret = mkdir(pathname2[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - - for (i = 0; i < 9; i++) { // 9 means max file num - ret = rmdir(pathname2[i]); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - } - for (i = 9; i >= 0; i--) { // 9 means max file num - ret = rmdir(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - for (i = 9; i >= 0; i--) { // 9 means max file num - rmdir(pathname2[i]); - } -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs066(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_066", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_067.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_067.cpp deleted file mode 100644 index 74efa6cf..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_067.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs067(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_067", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_068.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_068.cpp deleted file mode 100644 index ee3447fe..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_068.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static constexpr int MAX_FILE_NAME_LEN = 50; - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 pfd = -1; - INT32 ret, len; - CHAR filebuf1[10] = "liteos "; - CHAR filebuf2[10] = "good"; - CHAR readbuf[MAX_FILE_NAME_LEN] = { 0 }; - CHAR pathname1[MAX_FILE_NAME_LEN] = { JFFS_PATH_NAME0 }; - CHAR pathname2[MAX_FILE_NAME_LEN] = { JFFS_PATH_NAME0 }; - off_t off; - struct stat buf1; - - errno = 0; - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - pfd = dup2(20, 20); // 20 means dup length - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT2); - - pfd = dup2(fd, fd); - ICUNIT_GOTO_EQUAL(pfd, fd, pfd, EXIT2); - - strcat_s(pathname2, sizeof(pathname2), "T"); - fd1 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT4); - - pfd = dup2(fd, fd1); - printf("[%d] fd:%d, fd1:%d, pfd:%d, errno:%d\n", __LINE__, fd, fd1, pfd, errno); - ICUNIT_GOTO_EQUAL(pfd, fd1, pfd, EXIT4); - - len = write(fd1, filebuf1, strlen(filebuf1)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf1), len, EXIT4); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - len = write(fd, filebuf2, strlen(filebuf2)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf2), len, EXIT4); - - fd2 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT5); - - errno = 0; - len = read(fd2, readbuf, MAX_FILE_NAME_LEN); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT5); - - ICUNIT_GOTO_EQUAL((INT32)lseek(fd2, 0, SEEK_CUR), 0, (INT32)lseek(fd2, 0, SEEK_CUR), EXIT5); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - len = write(fd, filebuf2, strlen(filebuf2)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT5); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT5); - - memset_s(readbuf, sizeof(readbuf), 0, strlen(readbuf)); - len = read(fd, readbuf, MAX_FILE_NAME_LEN); - printf("[%d] fd:%d, errno:%d,readbuf:%s\n", __LINE__, fd, errno, readbuf); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf1) + strlen(filebuf2), len, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos good", readbuf, EXIT5); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - return JFFS_NO_ERROR; -EXIT5: - close(fd2); - goto EXIT3; -EXIT4: - close(fd1); -EXIT3: - remove(pathname2); -EXIT2: - close(pfd); -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs068(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_068", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_069.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_069.cpp deleted file mode 100644 index fe6f6f67..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_069.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 pfd = -100; - INT32 pfd2 = -1; - INT32 ret, len; - CHAR filebuf1[JFFS_SHORT_ARRAY_LENGTH] = "liteos "; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - struct stat buf1; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - pfd = dup(fd); - ICUNIT_GOTO_NOT_EQUAL(pfd, -1, pfd, EXIT2); - - len = write(fd, filebuf1, strlen(filebuf1)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf1), len, EXIT2); - - off = lseek(fd, 3, SEEK_SET); // 3 means seek len - ICUNIT_GOTO_EQUAL(off, 3, off, EXIT2); // 3 means current file positon - - pfd2 = dup(fd); - ICUNIT_GOTO_NOT_EQUAL(pfd2, -1, pfd2, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - memset_s(readbuf, sizeof(readbuf), 0, sizeof(readbuf)); - len = read(fd, readbuf, 50); // 50 means read len - ICUNIT_GOTO_EQUAL(len, 7, len, EXIT1); // 7 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos ", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = close(pfd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = close(pfd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(pfd2); -EXIT2: - close(pfd); -EXIT1: - close(fd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs069(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_069", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_070.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_070.cpp deleted file mode 100644 index ece103a5..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_070.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd1 = open(pathname, O_NONBLOCK | O_TRUNC, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname, O_NONBLOCK | O_TRUNC | O_RDONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd1 = open(pathname, O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd1, -1, fd1, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd1); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs070(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_070", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_071.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_071.cpp deleted file mode 100644 index 7b0eda76..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_071.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i; - INT32 fileCount = 0; - INT32 fd[JFFS_NAME_LIMITTED_SIZE] = { -1 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE][JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0, }; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - memset_s(pathname2[i], JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH - 1, JFFS_SHORT_ARRAY_LENGTH, "/test%d", i); - JffsStrcat2(pathname2[i], bufname, strlen(bufname)); - - if (fd[fileCount] == (CONFIG_NFILE_DESCRIPTORS - 1)) { - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd[i], -1, fd[i], EXIT3); - ICUNIT_GOTO_EQUAL(errno, EMFILE, errno, EXIT3); - continue; - } - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT3); - fileCount = i; - } - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - if (i > fileCount) { - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - continue; - } - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - if (i > fileCount) { - ret = remove(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT2); - continue; - } - - ret = remove(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - close(fd[i]); - } -EXIT2: - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - remove(pathname2[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs071(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_071", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_072.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_072.cpp deleted file mode 100644 index 72e2e87c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_072.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - dir = opendir(JFFS_MAIN_DIR0); - printf("#####test72###11111111\n"); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - ret = closedir(dir); - printf("#####test72###22222222\n"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - printf("#####test72###333333333\n"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - printf("#####test72###444444444\n"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - printf("#####test72###555555555\n"); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs072(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_072", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_073.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_073.cpp deleted file mode 100644 index 095ee361..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_073.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - dir = opendir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs073(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_073", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_074.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_074.cpp deleted file mode 100644 index 66c42e75..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_074.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret, i, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < 1000; i++) { // 1000 means mount and umount times - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs074(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_074", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_076.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_076.cpp deleted file mode 100644 index ed4760da..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_076.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret, i, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - - return JFFS_NO_ERROR; -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs076(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_076", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_077.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_077.cpp deleted file mode 100644 index 0665026f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_077.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/test"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(pathname2, sizeof(pathname2), "/test"); - strcat_s(pathname2, sizeof(pathname2), "/test"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - remove(pathname2); -EXIT1: - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs077(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_077", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_078.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_078.cpp deleted file mode 100644 index c9d5c6d7..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_078.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, i; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - strcat_s(pathname2, sizeof(pathname2), "/TEst"); - fd2 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd2); - remove(pathname2); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs078(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_078", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_079.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_079.cpp deleted file mode 100644 index f9fd5ca2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_079.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, i; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat_s(pathname2, sizeof(pathname2), "/TEst"); - ret = rename(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd2 = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT2); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd2); - remove(pathname2); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs079(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_079", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_080.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_080.cpp deleted file mode 100644 index 0fb08369..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_080.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret, i, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[50] = "liteos"; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBUSY, errno, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs080(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_080", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_081.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_081.cpp deleted file mode 100644 index 224ad0bb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_081.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret, i, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[50] = "liteos"; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR pathname3[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBUSY, errno, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - closedir(dir); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs081(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_081", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_082.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_082.cpp deleted file mode 100644 index cd31aa46..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_082.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct dirent *ptr = NULL; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/1082"); - fd = open(pathname1, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_mode & S_IFMT, S_IFREG, buf1.st_mode & S_IFMT, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return LOS_NOK; -} - -VOID ItFsJffs082(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_082", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_083.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_083.cpp deleted file mode 100644 index cc05fb85..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_083.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - struct dirent *ptr = NULL; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/10 77"); - fd = open(pathname1, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_mode & S_IFMT, S_IFREG, buf1.st_mode & S_IFMT, EXIT2); - - len = write(fd, buf, sizeof(buf)); - ICUNIT_GOTO_EQUAL(len, sizeof(buf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return LOS_NOK; -} - -VOID ItFsJffs083(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_083", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_084.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_084.cpp deleted file mode 100644 index 1b81f594..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_084.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - struct dirent *ptr = NULL; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/10 78"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname3, sizeof(pathname3), "/10 78/test"); - fd = open(pathname3, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = stat(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_mode & S_IFMT, S_IFREG, buf1.st_mode & S_IFMT, EXIT2); - - len = write(fd, buf, sizeof(buf)); - ICUNIT_GOTO_EQUAL(len, sizeof(buf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - remove(pathname3); -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return LOS_NOK; -} - -VOID ItFsJffs084(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_084", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_085.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_085.cpp deleted file mode 100644 index 8894682f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_085.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - struct dirent *ptr = NULL; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/test\0test"); - fd = open(pathname1, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname1, "/test\ntest", JFFS_STANDARD_NAME_LENGTH); - fd = open(pathname1, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname1, "/test\ttest", JFFS_STANDARD_NAME_LENGTH); - fd = open(pathname1, O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return LOS_NOK; -} - -VOID ItFsJffs085(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_085", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_086.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_086.cpp deleted file mode 100644 index c2ddc867..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_086.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = "/jffs111"; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = "/jffs222"; - struct stat buf1 = { 0 }; - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, pathname2, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, pathname3, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = umount(pathname3); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = stat(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(pathname2); - goto EXIT; -EXIT1: - remove(pathname3); -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return LOS_NOK; -} - -VOID ItFsJffs086(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_086", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_088.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_088.cpp deleted file mode 100644 index d5529cde..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_088.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - errno = 0; - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs088(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_088", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_090.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_090.cpp deleted file mode 100644 index e66b4633..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_090.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_SHORT_ARRAY_LENGTH] = "lalala"; - CHAR readbuf[JFFS_SHORT_ARRAY_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, sizeof(pathname2), "/test"); - fd = open64(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT1); - - memset_s(readbuf, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs090(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_090", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_092.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_092.cpp deleted file mode 100644 index 0ab18405..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_092.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chmod(pathname1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - strcat_s(pathname2, sizeof(pathname2), "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = chmod(pathname1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - - ret = chmod(pathname1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs092(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_092", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_093.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_093.cpp deleted file mode 100644 index a9162e18..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_093.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static constexpr int MAX_FILE_LEN = 10; - -static UINT32 Testcase(VOID) -{ - INT32 fd[10] = { -1 }; - INT32 ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[10][JFFS_STANDARD_NAME_LENGTH] = {JFFS_PATH_NAME0}; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - INT32 randTest1[10] = { 2, 6, 3, 1, 0, 8, 7, 9, 4, 5 }; - INT32 randTest2[10] = { 5, 3, 1, 6, 7, 2, 4, 9, 0, 8 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < MAX_FILE_LEN; i++) { - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - memset_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH - 1, JFFS_SHORT_ARRAY_LENGTH, "/1071_%d", i); - strcat_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, pathname1); - strcat_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, bufname); - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - for (i = 0; i < MAX_FILE_LEN; i++) { - len = write(fd[randTest1[i]], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - ret = close(fd[randTest1[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < MAX_FILE_LEN; i++) { - fd[randTest2[i]] = open(pathname2[randTest2[i]], O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - - len = read(fd[randTest2[i]], readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - - ret = close(fd[randTest2[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < MAX_FILE_LEN; i++) { - ret = remove(pathname2[randTest2[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < MAX_FILE_LEN; i++) { - close(fd[randTest1[i]]); - } -EXIT1: - for (i = 0; i < MAX_FILE_LEN; i++) { - remove(pathname2[randTest2[i]]); - } -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs093(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_093", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_096.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_096.cpp deleted file mode 100644 index d42e75ed..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_096.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 pfd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, sizeof(pathname2), "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - pfd = dup(fd); - ICUNIT_GOTO_NOT_EQUAL(pfd, -1, pfd, EXIT2); - - ret = close(pfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(pfd); -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs096(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_096", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_097.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_097.cpp deleted file mode 100644 index c4745728..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_097.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1 = -1; - INT32 ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1, buf2; - struct utimbuf utime1; - time_t ttime1; - struct tm ttm1; - - ttm1.tm_year = 90; // 90 means year - ttm1.tm_mon = 0; // 0 means month - ttm1.tm_mday = 1; // 1 means day - ttm1.tm_hour = 12; // 12 means hour - ttm1.tm_min = 12; // 12 means minute - ttm1.tm_sec = 12; // 12 means second - ttm1.tm_isdst = 0; - ttime1 = mktime(&ttm1); - utime1.modtime = ttime1; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/097"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, 0644); // 0644 means mode of file - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs097(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_097", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_099.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_099.cpp deleted file mode 100644 index c9c98d16..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_099.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "test12"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, len, off, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, off); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - strcpy_s(readbuf, JFFS_STANDARD_NAME_LENGTH, "liteos"); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, len, off, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, off); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = pread(fd, readbuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs099(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_099", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_100.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_100.cpp deleted file mode 100644 index 54c8ef95..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_100.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "test12"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = pwrite(fd, filebuf, strlen(filebuf), 0); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - strcpy_s(readbuf, JFFS_STANDARD_NAME_LENGTH, "liteos"); - - strcat_s(pathname1, sizeof(pathname1), "test12"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = pwrite64(fd, filebuf, strlen(filebuf), 0); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs100(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_100", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_101.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_101.cpp deleted file mode 100644 index 4dc89a75..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_101.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i, scandirCount; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = "/jf/test"; - CHAR pathname6[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - memset_s(pathname2, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(pathname3, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(pathname6, sizeof(pathname6), "/"); - - while (i < 247) { // 247 means loop times - i++; - strcat_s(pathname2, sizeof(pathname2), "t"); - strcat_s(pathname3, sizeof(pathname3), "t"); - strcat_s(pathname6, sizeof(pathname6), "t"); - } - ICUNIT_GOTO_EQUAL(strlen(pathname6), 259, strlen(pathname6), EXIT); // 259 means current name len - ICUNIT_GOTO_EQUAL(strlen(pathname2), 247, strlen(pathname2), EXIT); // 247 means current name len - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT1); - - strcat_s(pathname3, sizeof(pathname3), "t"); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - strcat_s(pathname6, sizeof(pathname6), "t"); - ICUNIT_GOTO_EQUAL(strlen(pathname6), 260, strlen(pathname6), EXIT); // 260 means current name len - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, pathname4, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - scandirCount = scandir(pathname5, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // 2 means total scaned file - - JffsScandirFree(namelist, scandirCount); - - ret = umount(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - scandirCount = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // 2 means total scaned file - - JffsScandirFree(namelist, scandirCount); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT4); - - ret = rmdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, pathname4, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT5: - JffsScandirFree(namelist, scandirCount); -EXIT4: - umount(pathname4); - remove(pathname4); -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - remove(pathname3); - remove(pathname6); -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs101(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_101", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_102.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_102.cpp deleted file mode 100644 index 30bd1abb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_102.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, i, scandirCount; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_MAIN_DIR0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname5[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - CHAR pathname7[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - - struct dirent **namelist = NULL; - - ret = chdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - memset_s(pathname4, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(pathname5, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(pathname3, sizeof(pathname3), "/"); - - while (i < 252) { // 252 means loop times - i++; - strcat_s(pathname4, sizeof(pathname4), "t"); - strcat_s(pathname5, sizeof(pathname5), "t"); - strcat_s(pathname3, sizeof(pathname3), "t"); - } - ICUNIT_GOTO_EQUAL(strlen(pathname3), 259, strlen(pathname3), EXIT); // 259 means current name len - ICUNIT_GOTO_EQUAL(strlen(pathname4), 252, strlen(pathname4), EXIT); // 252 means current name len - - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT2); - - strcat_s(pathname5, sizeof(pathname5), "t"); - fd = open(pathname5, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - strcat_s(pathname3, sizeof(pathname3), "t"); - ICUNIT_GOTO_EQUAL(strlen(pathname3), 260, strlen(pathname3), EXIT); // 260 means current name len - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, pathname6, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = access(pathname4, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - fd = open(pathname5, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - scandirCount = scandir(pathname7, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // 2 means total scaned file - - JffsScandirFree(namelist, scandirCount); - - ret = umount(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - scandirCount = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // 2 means total scaned file - - JffsScandirFree(namelist, scandirCount); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, pathname6, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = umount(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - return JFFS_NO_ERROR; -EXIT5: - JffsScandirFree(namelist, scandirCount); -EXIT4: - umount(pathname6); - remove(pathname6); -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - close(fd); - remove(pathname5); - remove(pathname3); -EXIT1: - close(fd); - remove(pathname4); -EXIT: - close(fd); - remove(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs102(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_102", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_104.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_104.cpp deleted file mode 100644 index 82c0f28a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_104.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd[3] = { -1 }; - INT32 ret, len; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd[0] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], JFFS_IS_ERROR, fd[0], EXIT1); // 0 means first fd - - fd[1] = open(pathname1, O_NONBLOCK | O_RDONLY, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], JFFS_IS_ERROR, fd[1], EXIT2); // 1 means second fd - - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd[0] = open(pathname1, O_NONBLOCK | O_CREAT | O_WRONLY, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], JFFS_IS_ERROR, fd[0], EXIT1); // 0 means first fd - - fd[1] = open(pathname1, O_NONBLOCK | O_RDONLY, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], JFFS_IS_ERROR, fd[1], EXIT2); // 1 means second fd - - fd[2] = open(pathname1, O_NONBLOCK | O_WRONLY, HIGHEST_AUTHORITY); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(fd[2], JFFS_IS_ERROR, fd[2], EXIT3); // 2 means third fd - - ret = close(fd[2]); // 2 means third fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd[0] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDONLY, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], JFFS_IS_ERROR, fd[0], EXIT1); // 0 means first fd - - fd[1] = open(pathname1, O_NONBLOCK | O_RDONLY, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], JFFS_IS_ERROR, fd[1], EXIT2); // 1 means second fd - - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd[0] = open(pathname1, O_NONBLOCK | O_RDONLY, HIGHEST_AUTHORITY); // 0 means first fd - ICUNIT_GOTO_NOT_EQUAL(fd[0], JFFS_IS_ERROR, fd[0], EXIT1); // 0 means first fd - - fd[1] = open(pathname1, O_NONBLOCK | O_RDONLY, HIGHEST_AUTHORITY); // 1 means second fd - ICUNIT_GOTO_NOT_EQUAL(fd[1], JFFS_IS_ERROR, fd[1], EXIT2); // 1 means second fd - - fd[2] = open(pathname1, O_NONBLOCK | O_WRONLY, HIGHEST_AUTHORITY); // 2 means third fd - ICUNIT_GOTO_NOT_EQUAL(fd[2], JFFS_IS_ERROR, fd[2], EXIT3); // 2 means third fd - - len = write(fd[0], filebuf, strlen(filebuf)); // 0 means first fd - ICUNIT_GOTO_EQUAL(len, JFFS_IS_ERROR, len, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT3); - - len = write(fd[2], filebuf, strlen(filebuf)); // 2 means third fd - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - off = lseek(fd[0], 0, SEEK_SET); // 0 means first fd - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT3); - - len = read(fd[1], readbuf, JFFS_STANDARD_NAME_LENGTH); // 1 means second fd - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - ret = close(fd[2]); // 2 means third fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd[1]); // 1 means second fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd[0]); // 0 means first fd - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd[2]); // 2 means third fd -EXIT2: - close(fd[1]); // 1 means second fd -EXIT1: - close(fd[0]); // 0 means first fd -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_104 -* -@tspec The Function test for open -* -@ttitle Open the file several times in read-only mode -* -@tprecon The filesystem module is open -* -@tbrief -1. create one file and opened it in read-write mode; -2. open the file several times in read-only mode -3. write and read these fd -4. close and remove all the file -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs104(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_104", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_105.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_105.cpp deleted file mode 100644 index 298c9fa3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_105.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = access(pathname1, F_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, S_IRWXU); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, S_IRWXU | S_IRWXG); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, S_IRWXU | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_105 -* -@tspec The Function test for access -* -@ttitle Check file existence and permissions normally -* -@tprecon The filesystem module is open -* -@tbrief -1. create one file ; -2. check file existence and permissions normally; -3. delete the file; -4. N/A; -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A; -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs105(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_105", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_106.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_106.cpp deleted file mode 100644 index 45939702..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_106.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, 0); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT, S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT, S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT, S_IRWXG); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_106 -* -@tspec The Function test for access -* -@ttitle Exception check file presence and permissions -* -@tprecon The filesystem module is open -* -@tbrief -1. create one file ; -2. exception check file presence and permissions; -3. delete the file; -4. N/A; -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A; -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs106(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_106", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_107.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_107.cpp deleted file mode 100644 index 016d5853..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_107.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, R_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, X_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_107 -* -@tspec The Function test for access -* -@ttitle Exception Check directory presence and permissions -* -@tprecon The filesystem module is open -* -@tbrief -1. create one directory ; -2. check directory presence and permissions; -3. delete the directory; -4. N/A; -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A; -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs107(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_107", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_116.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_116.cpp deleted file mode 100644 index 4cb074f3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_116.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/118.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, 0); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_116 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs116(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_116", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_117.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_117.cpp deleted file mode 100644 index 50e0b588..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_117.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/119.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_117 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0x444 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0x444 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs117(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_117", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_118.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_118.cpp deleted file mode 100644 index f7717b3c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_118.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/120.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, 0x222); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_118 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0x222 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0x222 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs118(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_118", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_119.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_119.cpp deleted file mode 100644 index e4190028..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_119.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/121.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, 0x111); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_119 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0x111 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0x111 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs119(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_119", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_120.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_120.cpp deleted file mode 100644 index f2ca2048..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_120.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/122.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, 0x177); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_120 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0x177 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0x177 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs120(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_120", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_121.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_121.cpp deleted file mode 100644 index 47216f59..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_121.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/123.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, 0x277); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_121 -* -@tspec The Function test for open -* -@ttitle Create a file with permission 0x277 and open an existing file -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file with permission 0x277 and open an existing file ; -2. read and write the file; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs121(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_121", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_122.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_122.cpp deleted file mode 100644 index e6d7ee76..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_122.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = access(pathname1, F_OK | X_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = access(pathname1, F_OK | R_OK | W_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, 10); // 10 means access len - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = access(pathname1, -1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = access(pathname1, 0xffff); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_122 -* -@tspec The API test for access -* -@ttitle Access parameter (mode) exception test -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file ; -2. access parameter (mode) exception test; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs122(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_122", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_123.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_123.cpp deleted file mode 100644 index 175182c0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_123.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH - 1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* * -* -@test IT_FS_JFFS_123 -* -@tspec The API test for write -* -@ttitle The length of the write data is 0xffff -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file ; -2. the length of the write data is 0xffff; -3. delete the file; -4. N/A -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsJffs123(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_123", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_124.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_124.cpp deleted file mode 100644 index 63529b5d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_124.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufbuf[10] = { 0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1124"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs124(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_124", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_125.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_125.cpp deleted file mode 100644 index f55e1dfc..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_125.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[15] = "0123456789"; - CHAR readbuf[30] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1125.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, 20); // 20 means write len - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT1); // 20 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 25); // 25 means write len - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT1); // 20 means write len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs125(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_125", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_126.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_126.cpp deleted file mode 100644 index 07b6dad5..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_126.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1111111111"; - CHAR readbuf[20] = "liteosliteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1110"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteosliteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1111111111os", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs126(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_126", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_127.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_127.cpp deleted file mode 100644 index eaff8153..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_127.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "111111111122222"; - CHAR readbuf[20] = "liteosliteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1111"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteosliteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1111111111os", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs127(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_127", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_128.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_128.cpp deleted file mode 100644 index ed04cf83..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_128.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "1111111111"; - CHAR readbuf[20] = "liteosliteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1112"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteosliteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 15); // 15 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1111111111os", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs128(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_128", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_129.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_129.cpp deleted file mode 100644 index 712faef4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_129.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[11] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1113"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs129(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_129", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_130.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_130.cpp deleted file mode 100644 index 3734b94b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_130.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[20] = "liteosliteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1114"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteosliteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 15); // 15 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcdeos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs130(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_130", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_131.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_131.cpp deleted file mode 100644 index 653d0537..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_131.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufbuf[10] = { 0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1115"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 0xffff); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs131(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_131", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_132.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_132.cpp deleted file mode 100644 index f65f3bf4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_132.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1122.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, NULL, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs132(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_132", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_133.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_133.cpp deleted file mode 100644 index 7736992c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_133.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1123.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs133(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_133", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_134.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_134.cpp deleted file mode 100644 index 27e8775b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_134.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufbuf[10] = { 0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1124"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs134(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_134", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_135.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_135.cpp deleted file mode 100644 index a3a8c20d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_135.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[15] = "0123456789"; - CHAR readbuf[30] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1125.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, 20); // 20 means write len - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT1); // 20 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 25); // 25 means read len - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT1); // 20 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs135(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_135", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_136.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_136.cpp deleted file mode 100644 index fa85295f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_136.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[25] = "01234567890123456789"; - CHAR readbuf[25] = "liteosliteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1126.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteosliteos", readbuf, EXIT1); - - len = write(fd, filebuf, 15); // 15 means write len - ICUNIT_GOTO_EQUAL(len, 15, len, EXIT1); // 15 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 15, len, EXIT1); // 15 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "012345678901234", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs136(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_136", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_137.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_137.cpp deleted file mode 100644 index d4ece6aa..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_137.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[20] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1127.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, 10); // 10 means write len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT1); - - len = read(fd, readbuf, 15); // 15 means read len - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means read len - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs137(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_137", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_138.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_138.cpp deleted file mode 100644 index e4e92d22..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_138.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1134.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek(fd, -1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, -1, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - off = lseek(fd, -10, SEEK_CUR); // -10 means seek back len - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs138(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_138", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_139.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_139.cpp deleted file mode 100644 index b5152e00..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_139.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1135.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0xffff, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs139(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_139", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_140.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_140.cpp deleted file mode 100644 index 99d3b287..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_140.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1136.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, len, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, len, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs140(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_140", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_141.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_141.cpp deleted file mode 100644 index c6b0c278..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_141.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1137.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, (len + 2), SEEK_SET); // 2 means seek len - ICUNIT_GOTO_EQUAL(off, (len + 2), off, EXIT1); // 2 means seek len - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs141(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_141", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_142.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_142.cpp deleted file mode 100644 index ca159649..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_142.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1138.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, -1, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 9, off, EXIT1); // 9 means current file positon - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "eiteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs142(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_142", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_143.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_143.cpp deleted file mode 100644 index cd5dbbe8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_143.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1139.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT1); // 10 means current file positon - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs143(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_143", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_144.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_144.cpp deleted file mode 100644 index f8bf8158..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_144.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1140.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0xffff, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0x10009, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs144(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_144", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_145.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_145.cpp deleted file mode 100644 index 2d291d0a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_145.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1141.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, len, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0x14, off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs145(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_145", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_146.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_146.cpp deleted file mode 100644 index 351304f9..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_146.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1142.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, (len + 2), SEEK_CUR); // 2 means seek len - ICUNIT_GOTO_EQUAL(off, (len + len + 2), off, EXIT1); // 2 means seek len - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs146(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_146", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_147.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_147.cpp deleted file mode 100644 index 54a3743d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_147.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1143.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT1); // 10 means current file positon - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs147(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_147", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_148.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_148.cpp deleted file mode 100644 index 70562873..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_148.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1144.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, -1, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 9, off, EXIT1); // 9 means current positon - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT1); // 1 means length of actually read data - ICUNIT_GOTO_STRING_EQUAL(readbuf, "9iteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs148(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_148", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_149.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_149.cpp deleted file mode 100644 index eaaa2d90..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_149.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1145.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0xffff, SEEK_END); - ICUNIT_GOTO_EQUAL(off, (0xffff + 10), off, EXIT1); // 10 means seek len - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs149(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_149", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_150.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_150.cpp deleted file mode 100644 index 26976ad3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_150.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1146.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, len, SEEK_END); - ICUNIT_GOTO_EQUAL(off, (len + len), off, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs150(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_150", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_151.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_151.cpp deleted file mode 100644 index 92b87029..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_151.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, (len + 2), SEEK_END); // 2 means seek len - ICUNIT_GOTO_EQUAL(off, (len + len + 2), off, EXIT1); // 2 means seek len - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs151(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_151", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_152.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_152.cpp deleted file mode 100644 index e7e10a51..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_152.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, -1); - ICUNIT_GOTO_EQUAL(off, -1, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs152(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_152", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_153.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_153.cpp deleted file mode 100644 index 7a949eb8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_153.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, 0xffff); - ICUNIT_GOTO_EQUAL(off, -1, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs153(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_153", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_154.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_154.cpp deleted file mode 100644 index d588b043..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_154.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - strcat_s(pathname1, sizeof(pathname1), "1150xt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 10); // 10 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // 10 means write len - - off = lseek(fd, 0, 10); // 10 means seek len - ICUNIT_GOTO_EQUAL(off, -1, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // 20 means read len - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs154(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_154", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_155.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_155.cpp deleted file mode 100644 index a989152d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_155.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs155(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_155", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_156.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_156.cpp deleted file mode 100644 index 9e742836..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_156.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs156(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_156", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_157.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_157.cpp deleted file mode 100644 index ab77af9f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_157.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs157(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_157", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_158.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_158.cpp deleted file mode 100644 index 01d764c8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_158.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs158(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_158", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_159.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_159.cpp deleted file mode 100644 index f9531d96..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_159.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink(""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs159(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_159", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_160.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_160.cpp deleted file mode 100644 index f6340e51..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_160.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink(".."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EISDIR, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs160(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_160", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_161.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_161.cpp deleted file mode 100644 index a58bb29c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_161.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs161(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_161", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_162.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_162.cpp deleted file mode 100644 index 809c6c11..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_162.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink("''"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs162(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_162", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_163.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_163.cpp deleted file mode 100644 index d3d2f2b7..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_163.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EISDIR, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs163(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_163", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_164.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_164.cpp deleted file mode 100644 index 6cd6fad9..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_164.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname2, sizeof(pathname2), "/"); - strcat_s(pathname2, sizeof(pathname2), pathname3); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs164(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_164", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_165.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_165.cpp deleted file mode 100644 index 43912f3a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_165.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs165(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_165", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_166.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_166.cpp deleted file mode 100644 index 41a740c0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_166.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname2, sizeof(pathname2), "/abc.txt"); - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs166(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_166", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_167.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_167.cpp deleted file mode 100644 index 4a802fdb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_167.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("//", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - strcat_s(pathname2, sizeof(pathname2), "//"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs167(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_167", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_168.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_168.cpp deleted file mode 100644 index 0034e6ad..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_168.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("/", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - strcat_s(pathname2, sizeof(pathname2), "/"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs168(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_168", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_169.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_169.cpp deleted file mode 100644 index 9f861f62..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_169.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("aaaaa", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("aaaaa"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs169(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_169", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_170.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_170.cpp deleted file mode 100644 index 43971180..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_170.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("+-", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/+-"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs170(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_170", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_171.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_171.cpp deleted file mode 100644 index cf8ac38f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_171.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/"""); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs171(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_171", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_172.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_172.cpp deleted file mode 100644 index 6118c0b3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_172.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("..", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/.."); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs172(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_172", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_173.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_173.cpp deleted file mode 100644 index 9faa5bc1..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_173.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(".", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - ret = strcat_s(pathname2, sizeof(pathname2), "/."); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - remove("."); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs173(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_173", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_174.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_174.cpp deleted file mode 100644 index cbf8c53b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_174.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 fd3 = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd1 = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - (void)memset_s(pathname4, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - (void)strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/"); - ret = strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd2 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT3); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, pathname4); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - fd3 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd3, -1, fd3, EXIT4); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd3); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT4: - close(fd3); - goto EXIT1; -EXIT3: - close(fd2); - goto EXIT1; -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname2, pathname4, strlen(pathname2)); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs174(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_174", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_175.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_175.cpp deleted file mode 100644 index 73baf8b8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_175.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open("""", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - fd = open("/""""", O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/"""""); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - close(fd); - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs175(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_175", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_176.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_176.cpp deleted file mode 100644 index 927af185..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_176.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_1176.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs176(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_176", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_177.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_177.cpp deleted file mode 100644 index f2ddd455..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_177.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs177(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_177", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_178.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_178.cpp deleted file mode 100644 index fc1d5011..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_178.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "ABCDE"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1178.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_NOCTTY | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs178(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_178", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_179.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_179.cpp deleted file mode 100644 index 305d89ce..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_179.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1179.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_SYNC | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs179(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_179", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_180.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_180.cpp deleted file mode 100644 index 1faa5d17..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_180.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, sizeof(pathname1), "/1180.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_ASYNC | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs180(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_180", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_182.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_182.cpp deleted file mode 100644 index 17e79cdc..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_182.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, sizeof(pathname1), "/1182.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_NOFOLLOW | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs182(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_182", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_183.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_183.cpp deleted file mode 100644 index 1b3640b3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_183.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1183.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_DIRECT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs183(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_183", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_184.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_184.cpp deleted file mode 100644 index 312efdc0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_184.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1184.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_NOATIME | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs184(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_184", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_185.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_185.cpp deleted file mode 100644 index 511297a6..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_185.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, sizeof(pathname1), "/1185.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | O_CLOEXEC | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs185(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_185", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_187.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_187.cpp deleted file mode 100644 index 3b2bef77..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_187.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - off_t off; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = " "; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1187.txt"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd1 = open(pathname1, O_NONBLOCK | (-1) | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd1, -1, fd1, EXIT3); - ICUNIT_GOTO_EQUAL(errno, ENOTDIR, errno, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT3: - close(fd1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs187(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_187", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_188.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_188.cpp deleted file mode 100644 index 7e3522f2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_188.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("aaaaa", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("aaaaa"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs188(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_188", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_189.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_189.cpp deleted file mode 100644 index e08359c9..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_189.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("+-/*%^@", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = rmdir("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("+-/*%^@"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs189(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_189", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_190.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_190.cpp deleted file mode 100644 index c7c321c6..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_190.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("+-/*%^@"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs190(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_190", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_191.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_191.cpp deleted file mode 100644 index c6a61c4c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_191.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("..", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(".."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs191(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_191", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_192.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_192.cpp deleted file mode 100644 index a27475b6..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_192.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(".", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs192(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_192", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_193.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_193.cpp deleted file mode 100644 index 8479df33..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_193.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname3); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs193(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_193", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_194.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_194.cpp deleted file mode 100644 index 03251395..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_194.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("/", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("/"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs194(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_194", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_195.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_195.cpp deleted file mode 100644 index 1727734e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_195.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("//", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("//"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs195(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_195", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_196.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_196.cpp deleted file mode 100644 index 2e99f6ff..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_196.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("aaaaa", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("aaaaa"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs196(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_196", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_197.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_197.cpp deleted file mode 100644 index dbfb2257..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_197.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("+-/*%^@", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("+-/*%^@"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs197(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_197", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_198.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_198.cpp deleted file mode 100644 index 3d93e8cc..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_198.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(""); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs198(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_198", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_199.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_199.cpp deleted file mode 100644 index ed3d413a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_199.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("..", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(".."); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs199(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_199", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_200.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_200.cpp deleted file mode 100644 index 4c259181..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_200.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat(".", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove("."); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs200(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_200", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_201.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_201.cpp deleted file mode 100644 index 561ae7fc..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_201.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static const int PARAM_NUM = 2; -static int Dup2Test(void) -{ - int ret = 0; - int number1, number2, sum; - int savedStdin = -1; - int savedStdout = -1; - - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - (void)strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/input.txt"); - - int inputFds = open(pathname, O_CREAT | O_RDWR, S_IRWXU); - ICUNIT_GOTO_NOT_EQUAL(inputFds, -1, inputFds, EXIT); - - savedStdin = dup(STDIN_FILENO); - savedStdout = dup(STDOUT_FILENO); - - setbuf(stdout, NULL); - setbuf(stdin, NULL); - - ret = dup2(inputFds, STDIN_FILENO); - ICUNIT_GOTO_EQUAL(ret, STDIN_FILENO, ret, EXIT); - - ret = dup2(inputFds, STDOUT_FILENO); - ICUNIT_GOTO_EQUAL(ret, STDOUT_FILENO, ret, EXIT); - - /* STDIN_FILENO STDOUT_FILENO all be directed */ - printf("1 1\n"); - lseek(inputFds, 0, SEEK_SET); - ret = scanf_s("%d %d", &number1, &number2); - ICUNIT_GOTO_EQUAL(ret, PARAM_NUM, ret, EXIT); - - sum = number1 + number2; - -EXIT: - close(inputFds); - dup2(savedStdin, STDIN_FILENO); - dup2(savedStdout, STDOUT_FILENO); - close(savedStdin); - close(savedStdout); - unlink(pathname); - return sum; -} - -const int DUP_TEST_RET = 2; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = Dup2Test(); - ICUNIT_GOTO_EQUAL(ret, DUP_TEST_RET, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs201(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_201", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_202.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_202.cpp deleted file mode 100644 index 2d78caaf..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_202.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat("""", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); - remove(""""); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs202(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_202", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_203.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_203.cpp deleted file mode 100644 index b2197251..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_203.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("""", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(""""); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs203(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_203", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_204.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_204.cpp deleted file mode 100644 index 12af9ddf..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_204.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd1 = -1; - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT1); - - fd1 = creat(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); /* pathname1 already open, cannot creat */ - ICUNIT_GOTO_NOT_EQUAL(fd1, 0, fd1, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs204(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_204", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_205.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_205.cpp deleted file mode 100644 index ba6c6bcb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_205.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = creat(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs205(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_205", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_206.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_206.cpp deleted file mode 100644 index 6804fcac..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_206.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufbuf[10] = { 0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "1208"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT); - - len = read(fd, NULL, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs206(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_206", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_207.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_207.cpp deleted file mode 100644 index cc62c293..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_207.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname2, sizeof(pathname2), "/aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = access(NULL, F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT1); - - ret = access(0, F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT1); - - ret = access("//", F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = access("/", F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = access("aaaaaa", F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = access("+-/*%^@", F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = access("", F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = access("..", F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = access(".", F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = access("""", F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(pathname2); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs207(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_207", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_208.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_208.cpp deleted file mode 100644 index 4c879b46..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_208.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/jffs_1239.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs208(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_208", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_209.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_209.cpp deleted file mode 100644 index 4a5d45f8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_209.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static const int DUP_WRONG_FD = 256; -static const int DUP_WRONG_FD2 = 250; - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 pfd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1127.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - pfd = dup2(CONFIG_NFILE_DESCRIPTORS, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - pfd = dup2(DUP_WRONG_FD, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - pfd = dup2(DUP_WRONG_FD2, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - pfd = dup2(0xffff, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - pfd = dup2(CONFIG_NFILE_DESCRIPTORS - 1, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - pfd = dup2(-1, fd); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(pfd); -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs209(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_209", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_210.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_210.cpp deleted file mode 100644 index 7d9a3532..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_210.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 pfd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1128.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - pfd = dup2(fd, CONFIG_NFILE_DESCRIPTORS); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - - pfd = dup2(fd, CONFIG_NFILE_DESCRIPTORS); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - - pfd = dup2(fd, CONFIG_NFILE_DESCRIPTORS + 1); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - - pfd = dup2(fd, 0xffff); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - - pfd = dup2(fd, -1); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(pfd); -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs210(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_210", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_211.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_211.cpp deleted file mode 100644 index b208de0f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_211.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static const int DUP_FD1 = 256; -static const int DUP_FD2 = 250; - -static UINT32 TestCase(VOID) -{ - INT32 pfd = -1; - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pfd = dup2(CONFIG_NFILE_DESCRIPTORS, CONFIG_NFILE_DESCRIPTORS); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - - pfd = dup2(DUP_FD1, DUP_FD1); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - pfd = dup2(DUP_FD2, DUP_FD2); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - - pfd = dup2(0xffff, 0xffff); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - - pfd = dup2(CONFIG_NFILE_DESCRIPTORS - 1, CONFIG_NFILE_DESCRIPTORS - 1); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - - pfd = dup2(-1, -1); - ICUNIT_GOTO_EQUAL(pfd, -1, pfd, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(pfd); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs211(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_211", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_212.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_212.cpp deleted file mode 100644 index 95e0efc9..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_212.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pret = getcwd(buf, 0); - ICUNIT_GOTO_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs212(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_212", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_213.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_213.cpp deleted file mode 100644 index 4d02da28..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_213.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[0xff + 2] = ""; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pret = getcwd(buf, 0xff); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(buf, pathname1, buf, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs213(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_213", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_214.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_214.cpp deleted file mode 100644 index 7a97e2c0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_214.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pret = getcwd(buf, 1); - ICUNIT_GOTO_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ERANGE, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs214(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_214", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_215.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_215.cpp deleted file mode 100644 index 6927fc30..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_215.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pret = getcwd(buf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(buf, JFFS_PATH_NAME0, buf, EXIT); - - pret = getcwd(buf, 5); // 5 is less than path length - ICUNIT_GOTO_EQUAL(pret, NULL, pret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ERANGE, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs215(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_215", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_216.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_216.cpp deleted file mode 100644 index bbb0bd59..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_216.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH]; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("//", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("//"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs216(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_216", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_217.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_217.cpp deleted file mode 100644 index 6a5dfc6f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_217.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buf[JFFS_STANDARD_NAME_LENGTH]; - CHAR *pret = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir("/", S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir("/"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs217(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_217", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_218.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_218.cpp deleted file mode 100644 index 2a3a92a0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_218.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs218(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_218", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_219.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_219.cpp deleted file mode 100644 index 88db7bd0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_219.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs219(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_219", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_220.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_220.cpp deleted file mode 100644 index 670686dc..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_220.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove(""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs220(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_220", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_221.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_221.cpp deleted file mode 100644 index cba3e4d9..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_221.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove(".."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs221(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_221", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_222.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_222.cpp deleted file mode 100644 index d44c1aba..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_222.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs222(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_222", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_223.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_223.cpp deleted file mode 100644 index 0611d05d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_223.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - struct statfs buf1 = {0}; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/"); - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname3); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs223(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_223", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_224.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_224.cpp deleted file mode 100644 index 4f76cda2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_224.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = {0}; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove(""""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs224(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_224", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_225.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_225.cpp deleted file mode 100644 index 00d5730e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_225.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs225(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_225", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_226.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_226.cpp deleted file mode 100644 index b2da2d7d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_226.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs226(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_226", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_227.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_227.cpp deleted file mode 100644 index 207919ce..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_227.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1241"); - ret = mkdir(pathname2, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs227(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_227", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_228.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_228.cpp deleted file mode 100644 index a5bab8bd..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_228.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1242"); - ret = mkdir(pathname2, 0xffff); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs228(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_228", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_229.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_229.cpp deleted file mode 100644 index 0d057250..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_229.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1243"); - ret = mkdir(pathname2, S_IXUSR | S_IXGRP | S_IXOTH); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs229(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_229", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_230.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_230.cpp deleted file mode 100644 index 0788d60d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_230.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1244"); - - ret = mkdir(pathname2, S_IWUSR | S_IWGRP | S_IWOTH); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs230(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_230", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_231.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_231.cpp deleted file mode 100644 index 523466bb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_231.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1245"); - - ret = mkdir(pathname2, S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs231(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_231", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_232.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_232.cpp deleted file mode 100644 index 6fceebd2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_232.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1246"); - - ret = mkdir(pathname2, S_IXUSR | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs232(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_232", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_233.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_233.cpp deleted file mode 100644 index b096a66d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_233.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname1, S_IWUSR | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs233(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_233", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_234.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_234.cpp deleted file mode 100644 index f86dfbbb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_234.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir("//"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("//"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs234(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_234", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_235.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_235.cpp deleted file mode 100644 index 883a923e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_235.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir("/"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("/"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs235(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_235", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_236.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_236.cpp deleted file mode 100644 index eebaff7e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_236.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("aaaaa"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs236(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_236", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_237.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_237.cpp deleted file mode 100644 index efa64941..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_237.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir("+-/*%^@"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("+-/*%^@"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs237(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_237", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_238.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_238.cpp deleted file mode 100644 index 756160d7..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_238.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(""); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(""); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs238(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_238", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_239.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_239.cpp deleted file mode 100644 index bd0d6305..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_239.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(".."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(".."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs239(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_239", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_240.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_240.cpp deleted file mode 100644 index 8599862f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_240.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir("."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs240(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_240", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_241.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_241.cpp deleted file mode 100644 index 9bd647a0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_241.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(""""); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("" - ""); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs241(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_241", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_242.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_242.cpp deleted file mode 100644 index d19e41ab..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_242.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOTDIR, errno, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs242(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_242", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_243.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_243.cpp deleted file mode 100644 index 78659959..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_243.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = rmdir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("/test"); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs243(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_243", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_244.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_244.cpp deleted file mode 100644 index 932b09a1..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_244.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (VOID)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs244(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_244", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_245.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_245.cpp deleted file mode 100644 index a8d3cd46..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_245.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("//"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs245(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_245", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_246.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_246.cpp deleted file mode 100644 index d71256ab..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_246.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("/"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs246(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_246", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_247.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_247.cpp deleted file mode 100644 index 04b09e4d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_247.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("aaaaa"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs247(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_247", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_248.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_248.cpp deleted file mode 100644 index 75a16d14..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_248.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("+-/*%^@"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs248(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_248", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_249.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_249.cpp deleted file mode 100644 index 3e5efa52..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_249.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(""); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs249(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_249", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_250.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_250.cpp deleted file mode 100644 index 19a401d3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_250.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(".."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs250(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_250", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_251.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_251.cpp deleted file mode 100644 index 7074031b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_251.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("."); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("."); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs251(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_251", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_252.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_252.cpp deleted file mode 100644 index c2cc1d3a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_252.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/"); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname3); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs252(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_252", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_253.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_253.cpp deleted file mode 100644 index b4507f8f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_253.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(""""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("" - ""); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs253(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_253", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_254.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_254.cpp deleted file mode 100644 index cc951423..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_254.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove("test"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs254(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_254", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_255.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_255.cpp deleted file mode 100644 index 36646599..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_255.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("test"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs255(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_255", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_256.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_256.cpp deleted file mode 100644 index 7976790a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_256.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static const int CAT_TIME = 278; -static const int PATHNAME_LEN = 292; - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "/"); - - while (i < CAT_TIME) { - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "t"); - i++; - } - ICUNIT_GOTO_EQUAL(strlen(pathname1), PATHNAME_LEN, strlen(pathname1), EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(".."); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs256(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_256", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_257.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_257.cpp deleted file mode 100644 index ba1577ba..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_257.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir("//"); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs257(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_257", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_258.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_258.cpp deleted file mode 100644 index 25d06741..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_258.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir("/"); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs258(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_258", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_259.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_259.cpp deleted file mode 100644 index 4b53e5a3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_259.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir("aaaaa"); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir("aaaaa"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - rmdir("aaaaa"); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs259(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_259", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_260.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_260.cpp deleted file mode 100644 index b377358a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_260.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir("+-/*%^@"); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs260(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_260", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_261.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_261.cpp deleted file mode 100644 index c3aa3c1e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_261.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(""); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs261(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_261", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_262.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_262.cpp deleted file mode 100644 index 611ea13e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_262.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(".."); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs262(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_262", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_263.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_263.cpp deleted file mode 100644 index f3cf4a4d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_263.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir("."); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs263(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_263", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_264.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_264.cpp deleted file mode 100644 index 104afe8d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_264.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/"); - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname3); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - rmdir(pathname3); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs264(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_264", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_265.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_265.cpp deleted file mode 100644 index 3eda7436..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_265.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1287.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - closedir(dir); -EXIT2: - close(fd); -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs265(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_265", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_266.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_266.cpp deleted file mode 100644 index 36b3b9c2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_266.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs266(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_266", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_267.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_267.cpp deleted file mode 100644 index ef770440..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_267.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static const int CAT_TIME = 280; - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "/test"); - while (i < CAT_TIME) { - i++; - (void)strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "t"); - } - - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs267(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_267", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_268.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_268.cpp deleted file mode 100644 index 27ce5bb0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_268.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dir1 = dir; - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ptr = readdir(dir1); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs268(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_268", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_269.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_269.cpp deleted file mode 100644 index 57637936..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_269.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dir1 = dir; - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs269(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_269", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_270.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_270.cpp deleted file mode 100644 index 3fc9d90e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_270.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - INT32 offset; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - printf("line:%d\n", __LINE__); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - printf("line:%d\n", __LINE__); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - printf("line:%d\n", __LINE__); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - printf("line:%d\n", __LINE__); - - dir1 = dir; - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - printf("line:%d\n", __LINE__); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - printf("line:%d\n", __LINE__); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs270(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_270", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_271.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_271.cpp deleted file mode 100644 index 976f9aa4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_271.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - INT32 offset; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 0, offset, EXIT2); - - seekdir(dir, 0xffff); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT2); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 0, offset, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs271(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_271", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_272.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_272.cpp deleted file mode 100644 index 40ca15e4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_272.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - INT32 offset; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - seekdir(dir, -1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs272(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_272", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_273.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_273.cpp deleted file mode 100644 index 1b019c16..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_273.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static const int SEEK_OFFSET = 10; -static UINT32 TestCase(VOID) -{ - INT32 i = 0; - INT32 fd, ret, len; - INT32 offset; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - seekdir(dir, SEEK_OFFSET); - - dir1 = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - seekdir(dir, SEEK_OFFSET); - - ptr = readdir(dir1); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT3); - - offset = telldir(dir1); - ICUNIT_GOTO_EQUAL(offset, 1, offset, EXIT3); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - closedir(dir1); -EXIT2: - closedir(dir); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs273(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_273", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_274.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_274.cpp deleted file mode 100644 index 1a5c5c52..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_274.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - INT32 offset; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1 = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 0, offset, EXIT); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs274(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_274", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_275.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_275.cpp deleted file mode 100644 index 7934c148..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_275.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("//", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs275(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_275", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_276.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_276.cpp deleted file mode 100644 index c2c4401b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_276.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("/", &namelist, 0, alphasort); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs276(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_276", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_277.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_277.cpp deleted file mode 100644 index bf7429fc..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_277.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("+-/*%^@", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs277(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_277", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_278.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_278.cpp deleted file mode 100644 index 0a8fa06b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_278.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs278(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_278", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_279.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_279.cpp deleted file mode 100644 index bc291ee2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_279.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("..", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs279(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_279", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_280.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_280.cpp deleted file mode 100644 index 28074a2f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_280.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - INT32 scandirCount; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - scandirCount = scandir(".", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 0, scandirCount, EXIT1); - - JffsScandirFree(namelist, scandirCount); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs280(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_280", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_281.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_281.cpp deleted file mode 100644 index ef368b30..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_281.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = scandir("aaaaa", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsScandirFree(namelist, ret); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - free(namelist); -EXIT1: - remove("aaaaa"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs281(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_281", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_282.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_282.cpp deleted file mode 100644 index cccc3171..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_282.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = scandir(pathname3, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsScandirFree(namelist, ret); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - free(namelist); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs282(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_282", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_283.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_283.cpp deleted file mode 100644 index 6de6b3f4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_283.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir("""", &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs283(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_283", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_284.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_284.cpp deleted file mode 100644 index ad3615b5..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_284.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1317.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = scandir(pathname2, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - free(namelist); -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs284(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_284", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_285.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_285.cpp deleted file mode 100644 index 6f14bd30..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_285.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - free(namelist); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs285(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_285", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_286.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_286.cpp deleted file mode 100644 index 1defe8ec..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_286.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, NULL, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - free(namelist); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs286(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_286", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_287.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_287.cpp deleted file mode 100644 index 97e25a68..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_287.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, 0, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs287(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_287", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_288.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_288.cpp deleted file mode 100644 index ba705b7e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_288.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, NULL, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs288(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_288", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_289.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_289.cpp deleted file mode 100644 index bad4059e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_289.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs289(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_289", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_290.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_290.cpp deleted file mode 100644 index e555bd6b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_290.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 ScandirFunc01(const struct dirent *ent) -{ - return -1; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, ScandirFunc01, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs290(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_290", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_291.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_291.cpp deleted file mode 100644 index e8467aea..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_291.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 ScandirFunc01(const struct dirent *ent) -{ - return 0xffff; -} -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, ScandirFunc01, alphasort); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs291(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_291", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_292.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_292.cpp deleted file mode 100644 index 998f415b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_292.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs292(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_292", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_293.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_293.cpp deleted file mode 100644 index 8b10a679..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_293.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - off_t offset; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = scandir(pathname1, &namelist, 0, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsScandirFree(namelist, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(namelist); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs293(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_293", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_294.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_294.cpp deleted file mode 100644 index 16e49b0e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_294.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret, len; - struct flock fl = { 0 }; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1328.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = fcntl(fd, F_GETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(fl.l_type, 0, fl.l_type, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs294(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_294", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_295.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_295.cpp deleted file mode 100644 index b9060f71..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_295.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("//", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs295(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_295", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_296.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_296.cpp deleted file mode 100644 index 047a2902..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_296.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("/", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs296(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_296", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_297.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_297.cpp deleted file mode 100644 index cd8188ae..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_297.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat("aaaaa", &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - close(fd); -EXIT1: - remove("aaaaa"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs297(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_297", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_298.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_298.cpp deleted file mode 100644 index 62aa8461..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_298.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("+-/*%^@", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs298(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_298", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_299.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_299.cpp deleted file mode 100644 index 27a74d68..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_299.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs299(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_299", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_300.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_300.cpp deleted file mode 100644 index 58d86902..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_300.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("..", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs300(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_300", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_301.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_301.cpp deleted file mode 100644 index 42c203ab..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_301.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(".", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs301(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_301", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_302.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_302.cpp deleted file mode 100644 index 8d82f8b8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_302.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/"); - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - close(fd); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs302(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_302", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_303.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_303.cpp deleted file mode 100644 index e4d0abf2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_303.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat("""", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs303(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_303", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_304.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_304.cpp deleted file mode 100644 index fcc003fd..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_304.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - JffsStatPrintf(buf1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs304(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_304", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_305.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_305.cpp deleted file mode 100644 index 7db64b2a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_305.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs305(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_305", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_306.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_306.cpp deleted file mode 100644 index 36cd2022..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_306.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs306(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_306", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_307.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_307.cpp deleted file mode 100644 index d632e690..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_307.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs307(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_307", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_308.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_308.cpp deleted file mode 100644 index 8b490fe0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_308.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/jffs_1350.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs308(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_308", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_309.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_309.cpp deleted file mode 100644 index 213ca066..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_309.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1351.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs309(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_309", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_310.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_310.cpp deleted file mode 100644 index 22645118..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_310.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/1352.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs310(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_310", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_311.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_311.cpp deleted file mode 100644 index 00bf2336..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_311.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs("//", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs311(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_311", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_312.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_312.cpp deleted file mode 100644 index 8b1ed9fe..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_312.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs("/", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs312(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_312", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_313.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_313.cpp deleted file mode 100644 index 68f10507..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_313.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/aaaaa"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = statfs("aaaaa", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - JffsStatfsPrintf(buf1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs313(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_313", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_314.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_314.cpp deleted file mode 100644 index c5eb2704..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_314.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs("+-/*%^@", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs314(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_314", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_315.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_315.cpp deleted file mode 100644 index 346e5f54..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_315.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs("", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs315(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_315", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_316.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_316.cpp deleted file mode 100644 index d8f50019..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_316.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs("..", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatfsPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs316(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_316", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_317.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_317.cpp deleted file mode 100644 index a2f24bae..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_317.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs(".", &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatfsPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs317(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_317", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); - -#ifdef __cpluscplus -#if __cplusplus -} -#endif -#endif -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_318.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_318.cpp deleted file mode 100644 index df04584d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_318.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/"); - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = statfs(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - JffsStatfsPrintf(buf1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs318(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_318", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_319.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_319.cpp deleted file mode 100644 index 3d8265b0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_319.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - - ret = statfs("""", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs319(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_319", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_320.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_320.cpp deleted file mode 100644 index 370a0432..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_320.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1364.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - JffsStatfsPrintf(buf1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - JffsStatfsPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs320(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_320", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_321.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_321.cpp deleted file mode 100644 index aafc7231..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_321.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1365.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs321(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_321", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_322.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_322.cpp deleted file mode 100644 index 45b2326b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_322.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 pfd, ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1373.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - pfd = fcntl(fd, F_DUPFD, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_NOT_EQUAL(pfd, -1, pfd, EXIT3); - - flags |= O_NONBLOCK | O_RDWR; - ret = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = close(pfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT3: - close(pfd); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs322(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_322", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_323.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_323.cpp deleted file mode 100644 index d2a6177d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_323.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static const int ILLEGAL_FD = -10; - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1374.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - flags = fcntl(fd, F_DUPFD, ILLEGAL_FD); - ICUNIT_GOTO_EQUAL(flags, -1, flags, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT3); - - flags |= O_NONBLOCK | O_RDWR; - flags = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(flags, 0, flags, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT3: - close(flags); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs323(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_323", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_324.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_324.cpp deleted file mode 100644 index 4fc41913..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_324.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1375.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - flags = fcntl(fd, F_DUPFD, 0xffff); - ICUNIT_GOTO_EQUAL(flags, -1, flags, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - flags |= O_NONBLOCK | O_RDWR; - flags = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(flags, 0, flags, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(flags); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs324(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_324", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_325.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_325.cpp deleted file mode 100644 index 360637e0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_325.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1376.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - flags = fcntl(fd, F_DUPFD, 0xffff); - ICUNIT_GOTO_EQUAL(flags, -1, flags, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - flags |= O_NONBLOCK | O_RDWR; - flags = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(flags, 0, flags, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT3: - close(flags); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs325(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_325", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_326.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_326.cpp deleted file mode 100644 index 6249a04b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_326.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/495.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - flags = fcntl(fd, F_SETOWN, &fl); - ICUNIT_GOTO_EQUAL(flags, -1, flags, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs326(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_326", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_327.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_327.cpp deleted file mode 100644 index 9556cc97..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_327.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/496.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - flags = fcntl(fd, 0xffff, &fl); - ICUNIT_GOTO_EQUAL(flags, -1, flags, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs327(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_327", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_328.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_328.cpp deleted file mode 100644 index 8412d676..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_328.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("s-s_s-s_s", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs328(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_328", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_329.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_329.cpp deleted file mode 100644 index dd5d7ff0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_329.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("//", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs329(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_329", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_330.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_330.cpp deleted file mode 100644 index 52788b08..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_330.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 flags; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("/", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - - -VOID ItFsJffs330(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_330", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_331.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_331.cpp deleted file mode 100644 index 5da9b478..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_331.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR filebuf[301] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(filebuf, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs331(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_331", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_332.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_332.cpp deleted file mode 100644 index 3646c3e7..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_332.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("+-*%^@", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs332(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_332", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_333.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_333.cpp deleted file mode 100644 index 37e73226..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_333.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs333(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_333", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_334.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_334.cpp deleted file mode 100644 index 144d657d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_334.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("..", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs334(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_334", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_335.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_335.cpp deleted file mode 100644 index f9efe545..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_335.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(".", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs335(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_335", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_336.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_336.cpp deleted file mode 100644 index fc0d592a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_336.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(pathname3, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - remove(pathname3); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs336(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_336", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_337.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_337.cpp deleted file mode 100644 index 06c7b65b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_337.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(pathname1, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs337(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_337", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_338.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_338.cpp deleted file mode 100644 index be25d214..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_338.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount("""", JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs338(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_338", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_339.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_339.cpp deleted file mode 100644 index 1f7eeee0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_339.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1388"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(pathname1, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(pathname1, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - remove(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname1); - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs339(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_339", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_340.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_340.cpp deleted file mode 100644 index a3b6d6ab..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_340.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mount(pathname1, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(pathname1, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs340(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_340", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_342.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_342.cpp deleted file mode 100644 index 264afaf4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_342.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, "//", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = umount("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = rmdir("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount("//"); - rmdir("//"); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs342(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_342", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_343.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_343.cpp deleted file mode 100644 index d833b7ef..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_343.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, "/", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = umount("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = rmdir("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount("/"); - rmdir("/"); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs343(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_343", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_344.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_344.cpp deleted file mode 100644 index 25552d6e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_344.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, filebuf, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = umount(filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = rmdir(filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(filebuf); - rmdir(filebuf); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs344(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_344", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_346.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_346.cpp deleted file mode 100644 index 91feb05e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_346.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, "", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(""); - rmdir(""); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs346(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_346", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_352.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_352.cpp deleted file mode 100644 index d78b5e7a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_352.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "s-s_s-s_s", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs352(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_352", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_353.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_353.cpp deleted file mode 100644 index bd689d7c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_353.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "//", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs353(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_353", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_354.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_354.cpp deleted file mode 100644 index 332b52a6..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_354.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "/", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs354(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_354", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_355.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_355.cpp deleted file mode 100644 index 01d9478b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_355.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, filebuf, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs355(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_355", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_356.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_356.cpp deleted file mode 100644 index 5f3e0638..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_356.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "+-/*%^@", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs356(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_356", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_357.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_357.cpp deleted file mode 100644 index 534833a3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_357.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs357(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_357", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_358.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_358.cpp deleted file mode 100644 index cbfd03d0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_358.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "..", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs358(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_358", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_359.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_359.cpp deleted file mode 100644 index e33c9dc5..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_359.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, ".", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs359(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_359", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_360.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_360.cpp deleted file mode 100644 index 47d8dd2c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_360.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, ".", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs360(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_360", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_361.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_361.cpp deleted file mode 100644 index 5be33aa0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_361.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, """", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs361(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_361", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_362.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_362.cpp deleted file mode 100644 index 5e828b75..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_362.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_MAIN_DIR0, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENODEV, errno, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs362(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_362", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_364.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_364.cpp deleted file mode 100644 index e4cf6ba2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_364.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0xffff, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs364(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_364", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_365.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_365.cpp deleted file mode 100644 index 1fdeb1f3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_365.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0xffffffff, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - umount(JFFS_MAIN_DIR0); - rmdir(pathname1); -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs365(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_365", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_366.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_366.cpp deleted file mode 100644 index 12e66729..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_366.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount("s-s_s-s_s"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs366(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_366", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_367.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_367.cpp deleted file mode 100644 index b7f3c486..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_367.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs367(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_367", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_368.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_368.cpp deleted file mode 100644 index 9b7692eb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_368.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - printf("%s-%d \n", __FUNCTION__, __LINE__); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - printf("%s-%d \n", __FUNCTION__, __LINE__); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs368(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_368", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_369.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_369.cpp deleted file mode 100644 index 290ff834..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_369.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs369(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_369", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_370.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_370.cpp deleted file mode 100644 index cada2014..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_370.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs370(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_370", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_371.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_371.cpp deleted file mode 100644 index 4571a882..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_371.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs371(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_371", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_372.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_372.cpp deleted file mode 100644 index 61a10278..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_372.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs372(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_372", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_373.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_373.cpp deleted file mode 100644 index 2697d68e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_373.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount("."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs373(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_373", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_374.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_374.cpp deleted file mode 100644 index fd3cf8e7..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_374.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount(""""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs374(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_374", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_375.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_375.cpp deleted file mode 100644 index 2242bf16..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_375.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs375(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_375", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_376.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_376.cpp deleted file mode 100644 index 0f31a0d5..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_376.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - (void)strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = umount(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs376(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_376", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_377.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_377.cpp deleted file mode 100644 index fa8d8abe..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_377.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("s-s_s-s_s", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename("s-s_s-s_s", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("s-s_s-s_s"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs377(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_377", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_378.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_378.cpp deleted file mode 100644 index b1c1ddba..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_378.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("//", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename("//", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("//"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs378(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_378", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_379.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_379.cpp deleted file mode 100644 index f31fd019..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_379.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("/", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename("/", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("/"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs379(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_379", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_380.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_380.cpp deleted file mode 100644 index 7a269f6b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_380.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(filebuf, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename(filebuf, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(filebuf); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs380(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_380", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_381.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_381.cpp deleted file mode 100644 index 315cb4b0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_381.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("+-/*%^@", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename("+-/*%^@", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("+-/*%^@"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs381(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_381", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_382.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_382.cpp deleted file mode 100644 index a7aa4e75..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_382.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("+-*%^@", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename("+-*%^@", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("+-*%^@"); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs382(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_382", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_383.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_383.cpp deleted file mode 100644 index e8f05fdb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_383.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - strcat(pathname1, "/test"); - ret = rename("", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(""); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs383(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_383", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_384.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_384.cpp deleted file mode 100644 index 6b8cdef3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_384.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("..", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - strcat(pathname1, "/test"); - ret = rename("..", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - remove(pathname1); - goto EXIT; -EXIT1: - remove(".."); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs384(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_384", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_385.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_385.cpp deleted file mode 100644 index c81660a2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_385.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(".", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - strcat(pathname1, "/test"); - ret = rename(".", pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBUSY, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - remove(pathname1); -EXIT1: - remove("."); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs385(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_385", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_386.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_386.cpp deleted file mode 100644 index f6628f73..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_386.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename("" - "", - pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - strcat(pathname1, "/test"); - ret = rename("" - "", - pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove("" - ""); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs386(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_386", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_387.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_387.cpp deleted file mode 100644 index d9600a6e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_387.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1436"); - ret = rename(pathname3, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname3, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs387(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_387", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_388.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_388.cpp deleted file mode 100644 index 7ce56296..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_388.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(filebuf); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs388(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_388", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_389.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_389.cpp deleted file mode 100644 index 3c5cbf9b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_389.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, pathname3); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs389(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_389", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_390.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_390.cpp deleted file mode 100644 index a02e0729..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_390.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1439"); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname1, pathname3); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs390(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_390", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_391.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_391.cpp deleted file mode 100644 index f0ce7d94..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_391.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1440"); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname1, pathname3); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs391(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_391", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_392.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_392.cpp deleted file mode 100644 index a3bbf3fb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_392.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1441"); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - strcat(pathname2, "/test1441"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname2, pathname3); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - remove(pathname2); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs392(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_392", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_393.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_393.cpp deleted file mode 100644 index 29421f15..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_393.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1442"); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat(pathname2, "/test1442"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname2, pathname3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - remove(pathname2); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs393(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_393", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_394.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_394.cpp deleted file mode 100644 index b6612b5f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_394.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname3, "/1443"); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat(pathname2, "/test1443"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rename(pathname3, pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - remove(pathname2); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs394(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_394", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_395.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_395.cpp deleted file mode 100644 index 65c6da70..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_395.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - getcwd(readbuf, 20); // cwd max length 20 - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname1, readbuf, EXIT); - - ret = rename(pathname1, "s-s_s-s_s"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir("s-s_s-s_s"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("s-s_s-s_s"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs395(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_395", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_396.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_396.cpp deleted file mode 100644 index d7911420..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_396.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, "//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("//"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs396(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_396", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_397.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_397.cpp deleted file mode 100644 index d26c22e3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_397.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, "/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("/"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs397(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_397", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_398.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_398.cpp deleted file mode 100644 index 3ac89a1f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_398.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR filebuf[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(filebuf); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(filebuf); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs398(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_398", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_399.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_399.cpp deleted file mode 100644 index 58372fef..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_399.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, "+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir("+-/*%^@"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("+-/*%^@"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs399(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_399", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_400.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_400.cpp deleted file mode 100644 index eb0a8e9d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_400.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, ""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = rmdir(""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(""); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs400(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_400", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_401.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_401.cpp deleted file mode 100644 index f346a06a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_401.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, ".."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(".."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(".."); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs401(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_401", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_402.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_402.cpp deleted file mode 100644 index 0c456db3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_402.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, "."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir("."); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("."); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs402(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_402", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_403.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_403.cpp deleted file mode 100644 index 8370f4c9..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_403.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rename(pathname1, "" - ""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = rmdir("" - ""); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove("" - ""); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs403(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_403", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_404.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_404.cpp deleted file mode 100644 index 909f6043..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_404.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime("s-s_s-s_s", NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat("s-s_s-s_s", &buf2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("s-s_s-s_s", NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs404(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_404", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_405.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_405.cpp deleted file mode 100644 index 008dab46..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_405.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime("//", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat("//", &buf2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("//", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs405(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_405", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_406.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_406.cpp deleted file mode 100644 index 3e280818..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_406.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime("/", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat("/", &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("/", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs406(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_406", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_407.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_407.cpp deleted file mode 100644 index 1734b166..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_407.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime("", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat("", &buf2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs407(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_407", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_408.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_408.cpp deleted file mode 100644 index 897a0dfd..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_408.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime("..", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat("..", &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("..", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs408(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_408", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_409.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_409.cpp deleted file mode 100644 index ab99dc46..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_409.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - sleep(2); // wait 2s - - ret = utime(".", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - sleep(2); // wait 2s - - ret = utime(".", NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs409(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_409", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_410.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_410.cpp deleted file mode 100644 index 3b4aa4ad..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_410.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - sleep(2); // wait 2s - - ret = utime("" - "", - NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = stat("" - "", - &buf2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - JffsStatPrintf(buf2); - - sleep(2); // wait 2s - - ret = utime("" - "", - NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs410(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_410", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_411.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_411.cpp deleted file mode 100644 index 2fc8eef7..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_411.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct stat buf1, buf2; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - sleep(2); // wait 2s - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs411(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_411", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_412.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_412.cpp deleted file mode 100644 index a6ae0f38..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_412.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - time_t ttime1; - struct tm tm1; - struct stat buf1, buf2; - - tm1.tm_year = 90; // test number 90 for year - tm1.tm_mon = 1; // test number 1 for mon - tm1.tm_mday = 1; // test number 1 for mday - tm1.tm_hour = 12; // test number 12 for hour - tm1.tm_min = 12; // test number 12 for min - tm1.tm_sec = 12; // test number 12 for sec - ttime1 = mktime(&tm1); - utime1.actime = ttime1; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime(pathname1, &utime1); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs412(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_412", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_413.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_413.cpp deleted file mode 100644 index 4aba508e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_413.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct stat buf1, buf2; - struct utimbuf utime1; - time_t ttime1; - struct tm ttm1; - - ttm1.tm_year = 90; // random test year 90 - ttm1.tm_mon = 0; // random test mon 0 - ttm1.tm_mday = 1; // random test mday 1 - ttm1.tm_hour = 12; // random test hour 12 - ttm1.tm_min = 12; // random test min 12 - ttm1.tm_sec = 12; // random test sec 12 - ttm1.tm_isdst = 0; - ttime1 = mktime(&ttm1); - utime1.modtime = ttime1; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/1463"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = utime(pathname1, &utime1); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd1); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs413(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_413", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_414.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_414.cpp deleted file mode 100644 index 66293604..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_414.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct utimbuf utime1; - struct stat buf1, buf2, buf3; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/1464"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf1); - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - sleep(2); // wait 2s - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - JffsStatPrintf(buf2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = utime(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_UTIME_SUPPORT, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - JffsStatPrintf(buf3); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs414(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_414", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_415.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_415.cpp deleted file mode 100644 index 8d65e4d2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_415.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1465_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1465_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1465_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1465_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1465_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1465_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = read(fd3, bufW3, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT6); // compare ret len with target len 20 - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1465_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - JffsStrcat2(pathname1, "/1465_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - JffsStrcat2(pathname1, "/1465_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1465_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1465_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1465_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs415(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_415", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_416.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_416.cpp deleted file mode 100644 index 3a84fd92..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_416.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1472_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1472_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1472_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1472_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1472_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = 0; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = 0; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 0, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1472_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1472_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1472_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1472_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1472_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1472_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs416(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_416", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_417.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_417.cpp deleted file mode 100644 index 1c8e2560..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_417.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1473_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1473_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1473_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1473_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1473_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH + 1; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH + 1; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 2 * (JFFS_SHORT_ARRAY_LENGTH + 1), lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1473_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1473_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1473_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1473_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1473_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1473_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs417(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_417", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_418.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_418.cpp deleted file mode 100644 index f715046a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_418.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1474_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1474_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1474_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1474_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1474_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH + 1; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH + 1; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 2 * (JFFS_SHORT_ARRAY_LENGTH + 1), lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1474_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1474_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1474_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1474_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1474_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1474_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs418(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_418", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_419.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_419.cpp deleted file mode 100644 index a1be828c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_419.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1475_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1475_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1475_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1475_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1475_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH - 1; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH - 1; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 2 * (JFFS_SHORT_ARRAY_LENGTH - 1), lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1475_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1475_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1475_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1475_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1475_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1475_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs419(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_419", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_420.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_420.cpp deleted file mode 100644 index b31e1713..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_420.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1476_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1476_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1476_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1476_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1476_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, -1); - ICUNIT_GOTO_EQUAL(lenV, -1, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1476_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1476_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1476_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1476_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1476_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1476_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs420(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_420", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_421.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_421.cpp deleted file mode 100644 index 39258b97..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_421.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1477_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1477_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1477_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1477_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1477_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 1); - ICUNIT_GOTO_EQUAL(lenV, 10, lenV, EXIT6); // compare ret lenV to target 10 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1477_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1477_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1477_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1477_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1477_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1477_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs421(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_421", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_422.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_422.cpp deleted file mode 100644 index aa6ce0b1..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_422.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1478_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1478_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1478_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1478_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1478_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 0); - ICUNIT_GOTO_EQUAL(lenV, -1, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1478_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1478_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1478_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1478_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1478_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1478_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs422(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_422", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_423.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_423.cpp deleted file mode 100644 index 51fe628e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_423.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1479_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1479_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1479_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1479_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1479_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 3); // writes 3 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1479_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1479_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1479_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1479_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1479_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1479_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs423(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_423", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_424.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_424.cpp deleted file mode 100644 index 0802fd32..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_424.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1480_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1480_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1480_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1480_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1480_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - lenV = readv(fd3, g_jffsIov, 2); // reads 2 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1480_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1480_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1480_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1480_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1480_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1480_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs424(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_424", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_425.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_425.cpp deleted file mode 100644 index 8bca7a88..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_425.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1481_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1481_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1481_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1481_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1481_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = readv(fd3, g_jffsIov, 3); // reads 3 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1481_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1481_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1481_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1481_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1481_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1481_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs425(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_425", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_426.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_426.cpp deleted file mode 100644 index 239a4ead..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_426.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1488_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1488_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1488_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1488_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1488_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = 0; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = 0; - - lenV = readv(fd3, g_jffsIov, 2); // reads 2 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 0, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1488_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1488_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1488_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1488_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1488_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1488_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs426(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_426", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_427.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_427.cpp deleted file mode 100644 index 4f3b227c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_427.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1489_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1489_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1489_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1489_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1489_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = readv(fd3, g_jffsIov, 2); // reads 2 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1489_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1489_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1489_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1489_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1489_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1489_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs427(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_427", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_428.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_428.cpp deleted file mode 100644 index 32b6faa5..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_428.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1490_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1490_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1490_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1490_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1490_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH + 2; // set length to JFFS_SHORT_ARRAY_LENGTH + 2 - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH + 2; // set length to JFFS_SHORT_ARRAY_LENGTH + 2 - - lenV = readv(fd3, g_jffsIov, 2); // reads 2 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1490_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1490_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1490_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1490_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1490_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1490_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs428(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_428", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_429.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_429.cpp deleted file mode 100644 index f7163e35..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_429.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1491_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1491_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1491_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1491_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1491_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH - 1; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH - 1; - - lenV = readv(fd3, g_jffsIov, 2); // reads 2 buffers from the fd - ICUNIT_GOTO_EQUAL(lenV, 2 * (JFFS_SHORT_ARRAY_LENGTH - 1), lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1491_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1491_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1491_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1491_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1491_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1491_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs429(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_429", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_430.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_430.cpp deleted file mode 100644 index 35d57a4a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_430.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1492_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1492_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1492_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1492_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1492_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = readv(fd3, g_jffsIov, -1); - ICUNIT_GOTO_EQUAL(lenV, -1, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1492_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1492_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1492_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1492_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1492_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1492_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs430(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_430", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_431.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_431.cpp deleted file mode 100644 index abdbabfa..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_431.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1493_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1493_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1493_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1493_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1493_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = readv(fd3, g_jffsIov, 1); - ICUNIT_GOTO_EQUAL(lenV, 10, lenV, EXIT6); // compare ret lenV to target 10 lenV - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1493_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1493_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1493_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1493_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1493_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1493_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs431(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_431", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_432.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_432.cpp deleted file mode 100644 index 2f350944..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_432.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd1, fd2, fd3; - INT32 ret, len; - INT32 flags; - ssize_t lenV = 0; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufW1[JFFS_SHORT_ARRAY_LENGTH + 1] = "0123456789"; - CHAR bufW2[JFFS_SHORT_ARRAY_LENGTH + 1] = "abcefghijk"; - CHAR bufW3[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - JffsStrcat2(pathname1, "/1494_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT2); - - JffsStrcat2(pathname1, "/1494_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - JffsStrcat2(pathname1, "/1494_3", JFFS_STANDARD_NAME_LENGTH); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd3, -1, fd3, EXIT6); - - len = write(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = write(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1494_1", JFFS_STANDARD_NAME_LENGTH); - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - JffsStrcat2(pathname1, "/1494_2", JFFS_STANDARD_NAME_LENGTH); - fd2 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT6); - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - len = read(fd1, bufW1, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - len = read(fd2, bufW2, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT6); // compare ret len with target len 10 - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = writev(fd3, g_jffsIov, 2); // writes 2 buffers to the fd - ICUNIT_GOTO_EQUAL(lenV, 20, lenV, EXIT6); // compare ret lenV to target 20 lenV - - memset(bufW1, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - memset(bufW2, 0, JFFS_SHORT_ARRAY_LENGTH + 1); - - off = lseek(fd3, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - g_jffsIov[0].iov_base = bufW1; - g_jffsIov[0].iov_len = JFFS_SHORT_ARRAY_LENGTH; - g_jffsIov[1].iov_base = bufW2; - g_jffsIov[1].iov_len = JFFS_SHORT_ARRAY_LENGTH; - - lenV = readv(fd3, g_jffsIov, 0); - ICUNIT_GOTO_EQUAL(lenV, -1, lenV, EXIT6); - - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - JffsStrcat2(pathname1, "/1494_3", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname1, "/1494_2", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname1, "/1494_1", JFFS_STANDARD_NAME_LENGTH); - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT6: - close(fd3); -EXIT5: - JffsStrcat2(pathname1, "/1494_3", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/1494_2", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT2: - close(fd1); -EXIT1: - JffsStrcat2(pathname1, "/1494_1", JFFS_STANDARD_NAME_LENGTH); - remove(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs432(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_432", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_433.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_433.cpp deleted file mode 100644 index d9f3e442..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_433.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = "/dev"; - struct stat buf1, buf2; - struct utimbuf utime1; - time_t ttime1; - struct tm ttm1; - - ttm1.tm_year = 90; // random test year 90 - ttm1.tm_mon = 0; // random test mon 0 - ttm1.tm_mday = 1; // random test mday 1 - ttm1.tm_hour = 12; // random test hour 12 - ttm1.tm_min = 12; // random test min 12 - ttm1.tm_sec = 12; // random test sec 12 - ttm1.tm_isdst = 0; - ttime1 = mktime(&ttm1); - utime1.modtime = ttime1; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = utime(pathname2, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - sleep(2); // wait 2s - - ret = utime(pathname2, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT); - - ret = stat(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatPrintf(buf1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs433(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_433", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_434.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_434.cpp deleted file mode 100644 index 0839be5e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_434.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rename(NULL, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - strcat(pathname1, "/test"); - ret = rename(NULL, pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs434(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_434", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_435.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_435.cpp deleted file mode 100644 index fbcf1be8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_435.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - INT32 flags; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rename(pathname1, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs435(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_435", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_454.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_454.cpp deleted file mode 100644 index 25d2d360..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_454.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/589.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs454(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_454", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_455.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_455.cpp deleted file mode 100644 index fd9d148d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_455.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/590.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs455(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_455", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_456.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_456.cpp deleted file mode 100644 index ee77adb1..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_456.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs456(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_456", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_457.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_457.cpp deleted file mode 100644 index 0ca9c9ce..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_457.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0xffff, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs457(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_457", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_458.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_458.cpp deleted file mode 100644 index e84abd4f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_458.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, -1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs458(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_458", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_459.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_459.cpp deleted file mode 100644 index ce14620a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_459.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/594.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 10, 0); // ioctl request 10 to the fd - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs459(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_459", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_460.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_460.cpp deleted file mode 100644 index 87713790..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_460.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/595.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs460(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_460", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_461.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_461.cpp deleted file mode 100644 index 5bac61b8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_461.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/596.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 0xffff); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs461(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_461", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_462.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_462.cpp deleted file mode 100644 index 73b0d76e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_462.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/603.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = isatty(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = isatty(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs462(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_462", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_487.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_487.cpp deleted file mode 100644 index 8ff00789..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_487.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = fsync(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = fsync(fd); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs487(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_487", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_488.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_488.cpp deleted file mode 100644 index 9fc22401..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_488.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pread(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread64(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pread64(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs488(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_488", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_489.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_489.cpp deleted file mode 100644 index cb964c35..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_489.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread64(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs489(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_489", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_490.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_490.cpp deleted file mode 100644 index 9fc1b460..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_490.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs490(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_490", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_491.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_491.cpp deleted file mode 100644 index ce6f64a4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_491.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs491(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_491", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_492.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_492.cpp deleted file mode 100644 index c41ad8ff..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_492.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *writebuf = NULL; - CHAR *readbuf = NULL; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(0xffff + 2); // malloc 0xffff + 2 bytes buffer - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - memset(writebuf, 0, 0xffff + 2); // memset 0xffff + 2 bytes - - for (i = 0; i < 256; i++) { // generate 256 * 260 bytes writebuf - strcat(writebuf, filebuf); - } - writebuf[0xffff] = '\0'; - - readbuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - memset(readbuf, 0, 0xffff + 1); - - len = write(fd, writebuf, 0xffff); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(0xffff + 2); // malloc 0xffff + 2 bytes buffer - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - memset(writebuf, 0, 0xffff + 2); // memset 0xffff + 2 bytes - - for (i = 0; i < 256; i++) { // generate 256 * 260 bytes writebuf - strcat(writebuf, filebuf); - } - writebuf[0xffff] = '\0'; - - readbuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - memset(readbuf, 0, 0xffff + 1); - - len = write(fd, writebuf, 0xffff); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT4: - free(readbuf); -EXIT3: - free(writebuf); -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs492(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_492", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_493.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_493.cpp deleted file mode 100644 index cf82ff01..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_493.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[10] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread(fd, readbuf, 9, 1); // read 9 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread64(fd, readbuf, 9, 1); // read 9 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs493(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_493", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_494.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_494.cpp deleted file mode 100644 index 6b4720ff..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_494.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[11] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread(fd, readbuf, 10, 0); // read 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread64(fd, readbuf, 10, 0); // read 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs494(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_494", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_495.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_495.cpp deleted file mode 100644 index 9db1dbf3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_495.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[5] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 5); // memset 5 bytes - len = pread(fd, readbuf, 6, 0); // read 6 bytes from fd at offset 0 - dprintf("len=:%d,readbuf=:%s\n", len, readbuf); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 5); // memset 5 bytes - len = pread64(fd, readbuf, 6, 0); // read 6 bytes from fd at offset 0 - dprintf("len=:%d,readbuf=:%s\n", len, readbuf); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs495(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_495", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_496.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_496.cpp deleted file mode 100644 index cc11d7b8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_496.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 1); // read 10 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "234567890", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 1); // read 10 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "234567890", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs496(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_496", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_497.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_497.cpp deleted file mode 100644 index b7b32ba6..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_497.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 0xffff); // read 10 bytes from fd at offset 0xffff - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 0xffff); // read 10 bytes from fd at offset 0xffff - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs497(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_497", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_498.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_498.cpp deleted file mode 100644 index 24423089..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_498.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 10 + 1); // read 10 bytes from fd at offset 10 + 1 = 11 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 10 + 1); // read 10 bytes from fd at offset 10 + 1 = 11 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs498(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_498", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_499.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_499.cpp deleted file mode 100644 index ab5fc1e7..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_499.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 10); // read 10 bytes from fd at offset 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 10); // read 10 bytes from fd at offset 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs499(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_499", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_500.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_500.cpp deleted file mode 100644 index af0f4cbc..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_500.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, strlen(writebuf) - 1); // read 10 bytes from fd at offset strlen(writebuf) - 1 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, strlen(writebuf) - 1); // read 10 bytes from fd at offset strlen(writebuf) - 1 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs500(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_500", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_501.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_501.cpp deleted file mode 100644 index 5d087171..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_501.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, -1); // read 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, -1); // read 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs501(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_501", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_502.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_502.cpp deleted file mode 100644 index 8099fc35..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_502.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite(fd, writebuf, 10, 0); // write 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pwrite(fd, writebuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite64(fd, writebuf, 10, 0); // write 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pwrite64(fd, writebuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs502(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_502", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_503.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_503.cpp deleted file mode 100644 index 40daec16..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_503.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite64(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs503(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_503", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_504.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_504.cpp deleted file mode 100644 index a9c58d57..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_504.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite(fd, writebuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, 10); // read 10 bytes to buffer - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite64(fd, writebuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, 10); // read 10 bytes to buffer - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs504(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_504", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_505.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_505.cpp deleted file mode 100644 index c1e21748..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_505.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite64(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs505(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_505", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_506.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_506.cpp deleted file mode 100644 index 1a7df68b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_506.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *writebuf = NULL; - CHAR *readbuf = NULL; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(0xffff + 2); // malloc 0xffff + 2 bytes buffer - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - memset(writebuf, 0, 0xffff + 2); // memset 0xffff + 2 bytes - - for (i = 0; i < 256; i++) { // generate 256 * 260 bytes writebuf - strcat(writebuf, filebuf); - } - writebuf[0xffff] = '\0'; - - readbuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - memset(readbuf, 0, 0xffff + 1); - - len = pwrite(fd, writebuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT4); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 0xffff); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(0xffff + 2); // malloc 0xffff + 2 bytes buffer - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - memset(writebuf, 0, 0xffff + 2); // memset 0xffff + 2 bytes - - for (i = 0; i < 256; i++) { // generate 256 * 260 bytes writebuf - strcat(writebuf, filebuf); - } - writebuf[0xffff] = '\0'; - - readbuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - memset(readbuf, 0, 0xffff + 1); - - len = pwrite64(fd, writebuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT4); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 0xffff); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT4: - free(readbuf); -EXIT3: - free(writebuf); -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs506(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_506", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_507.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_507.cpp deleted file mode 100644 index 6e474d9a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_507.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, filebuf, strlen(filebuf) - 1, 0); - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lalalalal0", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, filebuf, strlen(filebuf) - 1, 0); - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lalalalal0", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs507(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_507", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_508.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_508.cpp deleted file mode 100644 index c1b26679..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_508.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT2); // compare ret len with target len 20 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT2); // compare ret len with target len 20 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs508(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_508", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_509.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_509.cpp deleted file mode 100644 index 5bbd37d2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_509.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, JFFS_STANDARD_NAME_LENGTH + 1, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH + 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 25); // read buffer len 25 - ICUNIT_GOTO_EQUAL(len, 25, len, EXIT2); // compare ret len with target len 25 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, JFFS_STANDARD_NAME_LENGTH + 1, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH + 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 25); // read buffer len 25 - ICUNIT_GOTO_EQUAL(len, 25, len, EXIT2); // compare ret len with target len 25 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs509(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_509", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_510.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_510.cpp deleted file mode 100644 index f75c0b75..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_510.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - len = pwrite(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - len = pwrite64(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs510(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_510", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_511.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_511.cpp deleted file mode 100644 index cf9485f7..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_511.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, strlen(writebuf), 0xffff); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0xffff - 1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff - 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, strlen(writebuf), 0xffff); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0xffff - 1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff - 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs511(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_511", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_512.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_512.cpp deleted file mode 100644 index 57d618fd..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_512.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off + 1); // write 10 bytes from fd at offset off + 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off + 1); // write 10 bytes from fd at offset off + 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs512(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_512", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_513.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_513.cpp deleted file mode 100644 index 7d2a5425..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_513.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off); // write 10 bytes from fd at offset off - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "12345678901234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off); // write 10 bytes from fd at offset off - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "12345678901234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs513(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_513", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_514.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_514.cpp deleted file mode 100644 index c0714170..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_514.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off - 1); // write 10 bytes from fd at offset off - 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) - 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567891234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off - 1); // write 10 bytes from fd at offset off - 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) - 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567891234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs514(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_514", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_515.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_515.cpp deleted file mode 100644 index 30e5d3f9..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_515.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, -1); // write 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, -1); // write 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs515(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_515", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_516.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_516.cpp deleted file mode 100644 index a931be66..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_516.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs516(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_516", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_517.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_517.cpp deleted file mode 100644 index 03c0ec4e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_517.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname2, "/test"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs517(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_517", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_518.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_518.cpp deleted file mode 100644 index 59f48e02..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_518.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs518(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_518", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_519.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_519.cpp deleted file mode 100644 index c9c25439..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_519.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs519(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_519", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_520.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_520.cpp deleted file mode 100644 index b4dd2576..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_520.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname2, NULL); - ICUNIT_GOTO_NOT_EQUAL(realName, JFFS_TO_NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname2, realName, EXIT1); - free(realName); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - free(realName); - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_520 -* -@tspec The API test for realpath -* -@ttitle The API test for realpath with NULL for the second parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. mkdir a directory in the mount dir; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs520(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_520", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_521.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_521.cpp deleted file mode 100644 index 61593a7d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_521.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - close(fd); - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_521 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the file; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a file; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs521(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_521", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_522.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_522.cpp deleted file mode 100644 index 67f34191..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_522.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_522 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs522(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_522", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_523.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_523.cpp deleted file mode 100644 index bcce4f6a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_523.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - close(fd); - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_523 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the file which has removed; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs523(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_523", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_524.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_524.cpp deleted file mode 100644 index 43b53ce6..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_524.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - DIR *dir = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_EQUAL(realName, NULL, realName, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_524 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory which has removed; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs524(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_524", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_526.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_526.cpp deleted file mode 100644 index c0b04855..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_526.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - printf("%s-%d \n", __FUNCTION__, __LINE__); - - strcat(pathname2, "/////"); - strcat(pathname2, "test"); - - realName = realpath(pathname2, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_526 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory which contains many connection symbols; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path; -3. rmdir the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs526(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_526", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_528.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_528.cpp deleted file mode 100644 index d6f6b3f0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_528.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(VOID *argument) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - - g_TestCnt++; - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - g_TestCnt++; - - return NULL; - -EXIT: - g_TestCnt++; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_t newTh1; - pthread_attr_t attr; - - g_TestCnt = 0; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - - PosixPthreadInit(&attr, 4); // init pthread with attr 4 - - ret = pthread_create(&newTh1, &attr, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - while (g_TestCnt < 2) { // wait for test count 2 complete - sleep(1); - } - - ICUNIT_GOTO_EQUAL(g_TestCnt, 2, g_TestCnt, EXIT2); // compare g_TestCnt to 2 - - ret = PosixPthreadDestroy(&attr, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname1); - - return JFFS_NO_ERROR; -EXIT2: - PosixPthreadDestroy(&attr, newTh1); -EXIT1: - remove(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_528 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory in another task; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path in another task; -3. N/A; -4. N/A. -* -@texpect -1. Return successed -2. Sucessful operation -3. N/A -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs528(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_528", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_529.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_529.cpp deleted file mode 100644 index a9c3fff8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_529.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, fd; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR *realName = NULL; - BOOL bool1 = 0; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(".", bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_616 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory which was deleted; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. delete the directory; -3. use the function realpath to get the full-pathN/A; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs529(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_529", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_530.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_530.cpp deleted file mode 100644 index ee0cc196..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_530.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 i = 0; - INT32 ret; - INT32 fd; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_MAIN_DIR0 }; - CHAR bufname[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR *realName = NULL; - BOOL bool1 = 0; - - strcat(pathname1, "/"); - - // PATH_MAX test. The dirname has occupied 9 bytes. - while (i < 246) { // generate 246 length name - i++; - strcat(pathname1, "t"); - } - ICUNIT_GOTO_EQUAL(strlen(pathname1), 255, strlen(pathname1), EXIT); // compare pathname length with 255 - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - realName = realpath(pathname1, bufname); - ICUNIT_GOTO_NOT_EQUAL(realName, NULL, realName, EXIT); - ICUNIT_GOTO_STRING_EQUAL(realName, pathname1, realName, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - close(fd); - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_616 -* -@tspec The Function test for realpath -* -@ttitle Get the realpath about the directory which is multi-level directory; -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use the function realpath to get the full-path in another task; -3. N/A; -4. N/A. -* -@texpect -1. Return successed -2. Sucessful operation -3. N/A -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs530(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_530", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_531.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_531.cpp deleted file mode 100644 index 49a80b0e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_531.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 flags; - - fd = open(pathname, O_CREAT | O_RDONLY | O_EXCL | O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - flags = fcntl(fd, F_GETFL, 0); - ICUNIT_GOTO_EQUAL(flags & O_ACCMODE, O_RDONLY, flags & O_ACCMODE, EXIT1); - ICUNIT_GOTO_EQUAL(flags & O_APPEND, O_APPEND, flags & O_APPEND, EXIT1); - ICUNIT_GOTO_NOT_EQUAL(flags & O_NONBLOCK, O_NONBLOCK, flags & O_NONBLOCK, EXIT1); - - flags |= O_NONBLOCK | O_RDWR; - flags = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(flags, 0, flags, EXIT1); - - len = read(fd, readbuf, 50); // read buffer len 50 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - flags = fcntl(fd, F_GETFL, 0); - ICUNIT_GOTO_EQUAL(flags & O_APPEND, O_APPEND, flags & O_APPEND, EXIT1); - ICUNIT_GOTO_EQUAL(flags & O_NONBLOCK, O_NONBLOCK, flags & O_NONBLOCK, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs531(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_531", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_532.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_532.cpp deleted file mode 100644 index 1d344dd6..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_532.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 flags; - - fd = open(pathname, O_CREAT | O_RDONLY | O_EXCL | O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - flags = fcntl(fd, F_GETFL, 0); - ICUNIT_GOTO_EQUAL(flags & O_ACCMODE, O_RDONLY, flags & O_ACCMODE, EXIT1); - ICUNIT_GOTO_EQUAL(flags & O_APPEND, O_APPEND, flags & O_APPEND, EXIT1); - ICUNIT_GOTO_NOT_EQUAL(flags & O_NONBLOCK, O_NONBLOCK, flags & O_NONBLOCK, EXIT1); - - flags |= O_NONBLOCK | O_RDWR; - flags = fcntl(fd, F_SETFL, flags); - ICUNIT_GOTO_EQUAL(flags, 0, flags, EXIT1); - - len = read(fd, readbuf, 50); // read buffer len 50 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - flags = fcntl(fd, F_GETFL, 0); - ICUNIT_GOTO_EQUAL(flags & O_APPEND, O_APPEND, flags & O_APPEND, EXIT1); - ICUNIT_GOTO_EQUAL(flags & O_NONBLOCK, O_NONBLOCK, flags & O_NONBLOCK, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs532(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_532", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_533.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_533.cpp deleted file mode 100644 index 4369c7ce..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_533.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - struct flock fl = { 0 }; - CHAR filebuf[10] = "good"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = fcntl(fd, F_GETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // compare ret len with target len 4 - - fl.l_type = F_UNLCK; - fl.l_whence = SEEK_SET; - fl.l_start = 10; // star from 10 - fl.l_len = 10; // length 10 - ret = fcntl(fd, F_SETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = fcntl(fd, F_GETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // compare ret len with target len 4 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs533(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_533", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_534.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_534.cpp deleted file mode 100644 index 92fdc335..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_534.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - struct flock fl = { 0 }; - CHAR filebuf[10] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // compare ret len with target len 4 - - ret = fcntl(fd, F_GETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - fl.l_type = F_WRLCK; - fl.l_whence = SEEK_SET; - fl.l_start = 10; // star from 10 - fl.l_len = 10; // length 10 - - if (fcntl(fd, F_SETLK, &fl) == -1) { - if (errno == EACCES || errno == EAGAIN || errno == ENOSYS) { - ICUNIT_GOTO_EQUAL(1, 1, errno, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(1, 0, errno, EXIT1); - } - } - - len = read(fd, readbuf, 50); // read buffer len 50 - - fl.l_type = F_UNLCK; - fl.l_whence = SEEK_SET; - fl.l_start = 10; // star from 10 - fl.l_len = 10; // length 10 - ret = fcntl(fd, F_SETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = fcntl(fd, F_GETLK, &fl); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - len = read(fd, readbuf, 50); // read buffer len 50 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs534(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_534", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_541.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_541.cpp deleted file mode 100644 index 70e33a05..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_541.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1134.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, -1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_IS_ERROR, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - off = lseek64(fd, -10, SEEK_CUR); // seek -10 from current pos - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs541(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_541", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_542.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_542.cpp deleted file mode 100644 index 9b24a5aa..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_542.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1135.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0xffff, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs542(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_542", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_543.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_543.cpp deleted file mode 100644 index 4e290310..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_543.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1136.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, len, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, len, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs543(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_543", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_544.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_544.cpp deleted file mode 100644 index bd92bd39..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_544.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1137.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, (len + 2), SEEK_SET); // seek to len + 2 - ICUNIT_GOTO_EQUAL(off, (len + 2), off, EXIT1); // compare ret off to target len + 2 off - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs544(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_544", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_545.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_545.cpp deleted file mode 100644 index fbdb2356..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_545.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1138.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, -1, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 9, off, EXIT1); // compare ret off with target off 9 - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "eiteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs545(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_545", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_546.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_546.cpp deleted file mode 100644 index 1ddb3d5c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_546.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1139.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, JFFS_SHORT_ARRAY_LENGTH, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs546(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_546", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_547.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_547.cpp deleted file mode 100644 index 7eb746c1..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_547.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1140.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0xffff, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0x10009, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs547(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_547", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_548.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_548.cpp deleted file mode 100644 index 7d93cd07..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_548.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1141.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, len, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 0x14, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs548(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_548", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_549.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_549.cpp deleted file mode 100644 index 660d41d4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_549.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "637.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, (len + 2), SEEK_CUR); // seek len + 2 from current pos - ICUNIT_GOTO_EQUAL(off, (len + len + 2), off, EXIT1); // compare ret off to target len + len + 2 off - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs549(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_549", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_550.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_550.cpp deleted file mode 100644 index 202b33b8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_550.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1143.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, JFFS_SHORT_ARRAY_LENGTH, off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs550(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_550", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_551.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_551.cpp deleted file mode 100644 index bee29690..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_551.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1144.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, -1, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 9, off, EXIT1); // compare ret off with target off 9 - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "9iteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs551(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_551", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_552.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_552.cpp deleted file mode 100644 index 194f7f38..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_552.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1145.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0xffff, SEEK_END); - ICUNIT_GOTO_EQUAL(off, (0xffff + JFFS_SHORT_ARRAY_LENGTH), off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs552(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_552", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_553.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_553.cpp deleted file mode 100644 index 66868f3f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_553.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1146.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, len, SEEK_END); - ICUNIT_GOTO_EQUAL(off, (len + len), off, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs553(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_553", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_554.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_554.cpp deleted file mode 100644 index 29fe4223..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_554.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, (len + 2), SEEK_END); // seek to len + 2 from file end - ICUNIT_GOTO_EQUAL(off, (len + len + 2), off, EXIT1); // compare ret off to target len + len + 2 off - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs554(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_554", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_555.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_555.cpp deleted file mode 100644 index 584eaac3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_555.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0, -1); - ICUNIT_GOTO_EQUAL(off, JFFS_IS_ERROR, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs555(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_555", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_556.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_556.cpp deleted file mode 100644 index 7fab5bf0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_556.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0, 0xffff); - ICUNIT_GOTO_EQUAL(off, JFFS_IS_ERROR, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs556(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_556", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_557.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_557.cpp deleted file mode 100644 index 95067eb4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_557.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, fd1, ret, len; - CHAR filebuf[12] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off64_t off; - - strcat(pathname1, "1147.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - off = lseek64(fd, 0, JFFS_SHORT_ARRAY_LENGTH); - ICUNIT_GOTO_EQUAL(off, JFFS_IS_ERROR, off, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs557(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_557", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_560.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_560.cpp deleted file mode 100644 index e031c54f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_560.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/aaaaa"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat64("aaaaa", &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - close(fd); -EXIT1: - remove("aaaaa"); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs560(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_560", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_562.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_562.cpp deleted file mode 100644 index 8f4eba97..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_562.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat64("", &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs562(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_562", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_563.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_563.cpp deleted file mode 100644 index c822a78d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_563.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat64("..", &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs563(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_563", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_564.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_564.cpp deleted file mode 100644 index 301b8e78..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_564.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat64(".", &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs564(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_564", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_565.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_565.cpp deleted file mode 100644 index 4fca7116..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_565.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_CHINESE_NAME1 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/"); - strcat(pathname2, pathname3); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat64(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - close(fd); -EXIT1: - remove(pathname3); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs565(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_565", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_566.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_566.cpp deleted file mode 100644 index 86e69651..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_566.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat64("" - "", - &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs566(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_566", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_567.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_567.cpp deleted file mode 100644 index 13c82c5d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_567.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat64(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs567(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_567", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_568.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_568.cpp deleted file mode 100644 index 755f5f0f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_568.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - - ret = stat64(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs568(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_568", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_569.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_569.cpp deleted file mode 100644 index 25c4fcc6..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_569.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs569(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_569", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_570.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_570.cpp deleted file mode 100644 index 1d90fb84..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_570.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs570(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_570", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_571.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_571.cpp deleted file mode 100644 index 04b541d0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_571.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/jffs_1350.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = fstat64(fd, &buf1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs571(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_571", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_572.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_572.cpp deleted file mode 100644 index bdcb506a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_572.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/1351.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs572(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_572", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_573.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_573.cpp deleted file mode 100644 index c87f6298..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_573.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct stat64 buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/1352.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs573(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_573", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_574.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_574.cpp deleted file mode 100644 index 853f5e9a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_574.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd; - INT32 ret = 0; - INT32 len = 0; - INT32 size = 0xffff; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *writebuf = NULL; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - memset(writebuf, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf3); - - ret = fallocate(fd, 1, 0, size + JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf3.st_size, size, buf3.st_size, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - free(writebuf); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_574 -* -@tspec The function test for fallocate -* -@ttitle Fallocate allocates space while the offset + length is more than the size of the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate to allocates space while the offset + length is more than the size of the file ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs574(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_574", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_583.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_583.cpp deleted file mode 100644 index 03026fea..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_583.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - int ret, i; - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - umount(JFFS_MAIN_DIR0); - for (i = 0; i < 30; i++) { // test 30 times - printf("%s-%d umount/mount: %d\n", __FUNCTION__, __LINE__, i); - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - umount(JFFS_MAIN_DIR0); -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs583(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_583", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_584.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_584.cpp deleted file mode 100644 index 45fa7f18..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_584.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - int ret, i; - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - umount(JFFS_MAIN_DIR0); - for (i = 0; i < 30; i++) { // test 30 times - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - umount(JFFS_MAIN_DIR0); -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs584(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_584", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_586.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_586.cpp deleted file mode 100644 index fb2fa4fe..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_586.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd; - INT32 ret = 0; - INT32 i = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = ftruncate(fd, 50); // truncate fd to 50 bytes - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* -* -@test IT_FS_JFFS_586 -* -@tspec The function test for truncate -* -@ttitle Truncate recover space for the same file fd multiple times -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one file; -2. use the function truncate to recover the space for the same file fd multiple times; -3. close and remove the file; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark - */ - -VOID ItFsJffs586(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_586", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_589.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_589.cpp deleted file mode 100644 index cc882f40..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_589.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/589.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs589(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_589", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_590.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_590.cpp deleted file mode 100644 index 78dd163c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_590.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/590.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -ENOSYS, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs590(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_590", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_591.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_591.cpp deleted file mode 100644 index a73e16cd..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_591.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs591(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_591", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_592.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_592.cpp deleted file mode 100644 index 7c144ae2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_592.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0xffff, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs592(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_592", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_593.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_593.cpp deleted file mode 100644 index d7e9096d..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_593.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, -1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs593(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_593", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_594.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_594.cpp deleted file mode 100644 index 719a6801..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_594.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/594.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 10, 0); // ioctl request 10 to the fd - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs594(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_594", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_595.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_595.cpp deleted file mode 100644 index 416e697c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_595.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/595.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs595(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_595", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_596.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_596.cpp deleted file mode 100644 index 4c5daf01..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_596.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/596.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = ioctl(fd, 0, 0xffff); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs596(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_596", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_603.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_603.cpp deleted file mode 100644 index 4561705c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_603.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[JFFS_SHORT_ARRAY_LENGTH] = "good"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct flock fl = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/603.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = isatty(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = isatty(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - remove(pathname2); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs603(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_603", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_636.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_636.cpp deleted file mode 100644 index 149f528a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_636.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = fsync(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = fsync(fd); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs636(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_636", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_643.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_643.cpp deleted file mode 100644 index f9bf593e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_643.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pread(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread64(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pread64(fd, readbuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs643(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_643", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_644.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_644.cpp deleted file mode 100644 index fea95c63..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_644.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pread64(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs644(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_644", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_645.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_645.cpp deleted file mode 100644 index be6df92e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_645.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs645(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_645", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_646.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_646.cpp deleted file mode 100644 index 57e73f3a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_646.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs646(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_646", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_648.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_648.cpp deleted file mode 100644 index 9e5c9fb7..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_648.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[10] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread(fd, readbuf, 9, 1); // read 9 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread64(fd, readbuf, 9, 1); // read 9 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs648(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_648", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_649.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_649.cpp deleted file mode 100644 index 001573ea..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_649.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[11] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread(fd, readbuf, 10, 0); // read 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 10); // memset 10 bytes - len = pread64(fd, readbuf, 10, 0); // read 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs649(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_649", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_650.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_650.cpp deleted file mode 100644 index 55c48b9c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_650.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[5] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 5); // memset 5 bytes - len = pread(fd, readbuf, 6, 0); // read 6 bytes from fd at offset 0 - dprintf("len=:%d,readbuf=:%s\n", len, readbuf); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, 5); // memset 5 bytes - len = pread64(fd, readbuf, 6, 0); // read 6 bytes from fd at offset 0 - dprintf("len=:%d,readbuf=:%s\n", len, readbuf); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs650(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_650", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_651.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_651.cpp deleted file mode 100644 index 5b125abb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_651.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 1); // read 10 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "234567890", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 1); // read 10 bytes from fd at offset 1 - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "234567890", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs651(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_651", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_652.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_652.cpp deleted file mode 100644 index 0fce9011..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_652.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 0xffff); // read 10 bytes from fd at offset 0xffff - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 0xffff); // read 10 bytes from fd at offset 0xffff - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs652(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_652", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_653.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_653.cpp deleted file mode 100644 index 673b447e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_653.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 10 + 1); // read 10 bytes from fd at offset 10 + 1 = 11 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 10 + 1); // read 10 bytes from fd at offset 10 + 1 = 11 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs653(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_653", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_654.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_654.cpp deleted file mode 100644 index 8b10a16b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_654.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, 10); // read 10 bytes from fd at offset 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, 10); // read 10 bytes from fd at offset 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs654(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_654", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_655.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_655.cpp deleted file mode 100644 index 51ed5996..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_655.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, strlen(writebuf) - 1); // read 10 bytes from fd at offset strlen(writebuf) - 1 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, strlen(writebuf) - 1); // read 10 bytes from fd at offset strlen(writebuf) - 1 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0", readbuf, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs655(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_655", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_656.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_656.cpp deleted file mode 100644 index f32eb61b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_656.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread(fd, readbuf, 10, -1); // read 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = pread64(fd, readbuf, 10, -1); // read 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "", readbuf, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs656(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_656", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_663.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_663.cpp deleted file mode 100644 index 04297cb3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_663.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite(fd, writebuf, 10, 0); // write 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pwrite(fd, writebuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite64(fd, writebuf, 10, 0); // write 10 bytes from fd at offset 0 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - len = pwrite64(fd, writebuf, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs663(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_663", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_664.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_664.cpp deleted file mode 100644 index 54682c62..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_664.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = pwrite64(fd, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - ICUNIT_GOTO_EQUAL(errno, EFAULT, errno, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs664(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_664", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_665.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_665.cpp deleted file mode 100644 index 85684649..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_665.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite(fd, writebuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, 10); // read 10 bytes to buffer - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite64(fd, writebuf, 0, 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - ret = read(fd, readbuf, 10); // read 10 bytes to buffer - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs665(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_665", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_666.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_666.cpp deleted file mode 100644 index efb82fee..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_666.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - len = pwrite64(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs666(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_666", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_668.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_668.cpp deleted file mode 100644 index c963779e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_668.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "lalalalala"; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, filebuf, strlen(filebuf) - 1, 0); - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lalalalal0", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, filebuf, strlen(filebuf) - 1, 0); - ICUNIT_GOTO_EQUAL(len, 9, len, EXIT2); // compare ret len with target len 9 - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lalalalal0", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs668(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_668", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_669.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_669.cpp deleted file mode 100644 index f0a00fe6..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_669.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT2); // compare ret len with target len 20 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, JFFS_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 20); // read buffer len 20 - ICUNIT_GOTO_EQUAL(len, 20, len, EXIT2); // compare ret len with target len 20 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs669(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_669", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_670.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_670.cpp deleted file mode 100644 index a710b421..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_670.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, JFFS_STANDARD_NAME_LENGTH + 1, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH + 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 25); // read buffer len 25 - ICUNIT_GOTO_EQUAL(len, 25, len, EXIT2); // compare ret len with target len 25 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, JFFS_STANDARD_NAME_LENGTH + 1, 0); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH + 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 25); // read buffer len 25 - ICUNIT_GOTO_EQUAL(len, 25, len, EXIT2); // compare ret len with target len 25 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs670(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_670", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_671.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_671.cpp deleted file mode 100644 index d3819d50..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_671.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - len = pwrite(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - len = pwrite64(fd, writebuf, 1, 1); - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read buffer len 10 - ICUNIT_GOTO_EQUAL(len, 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs671(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_671", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_672.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_672.cpp deleted file mode 100644 index eb041fd0..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_672.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, strlen(writebuf), 0xffff); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0xffff - 1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff - 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, strlen(writebuf), 0xffff); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0xffff - 1, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0xffff - 1, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs672(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_672", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_673.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_673.cpp deleted file mode 100644 index a987a76f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_673.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off + 1); // write 10 bytes from fd at offset off + 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off + 1); // write 10 bytes from fd at offset off + 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) + 1, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs673(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_673", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_674.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_674.cpp deleted file mode 100644 index 91a6cbc8..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_674.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off); // write 10 bytes from fd at offset off - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "12345678901234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off); // write 10 bytes from fd at offset off - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "12345678901234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs674(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_674", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_675.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_675.cpp deleted file mode 100644 index 8c10a59b..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_675.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, off - 1); // write 10 bytes from fd at offset off - 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) - 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567891234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, off - 1); // write 10 bytes from fd at offset off - 1 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf) + strlen(writebuf) - 1, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567891234567890", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs675(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_675", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_676.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_676.cpp deleted file mode 100644 index b05e2e0c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_676.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off_t off; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek64(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite(fd, writebuf, 10, -1); // write 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek64(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcpy(pathname2, JFFS_PATH_NAME0); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - - off = lseek64(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT2); // compare ret off with target off 10 - - len = pwrite64(fd, writebuf, 10, -1); // write 10 bytes from fd at offset -1 - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - off = lseek64(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); // compare ret len with target len 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs676(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_676", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_690.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_690.cpp deleted file mode 100644 index a6e2361a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_690.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs690(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_690", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_694.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_694.cpp deleted file mode 100644 index 1a9f372a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_694.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname2, "/test"); - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs694(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_694", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_696.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_696.cpp deleted file mode 100644 index b9c87281..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_696.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("//"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs696(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_696", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_697.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_697.cpp deleted file mode 100644 index 867d6be4..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_697.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct statfs buf1 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = remove("/"); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs697(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_697", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_700.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_700.cpp deleted file mode 100644 index 60401316..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_700.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - int ret, i; - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - umount(JFFS_MAIN_DIR0); - for (i = 0; i < 30; i++) { // test 30 times - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - umount(JFFS_MAIN_DIR0); -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs700(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_700", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_701.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_701.cpp deleted file mode 100644 index 7fc18b94..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_701.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - int ret, i; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - umount(JFFS_MAIN_DIR0); - for (i = 0; i < 30; i++) { // test 30 times - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - umount(JFFS_MAIN_DIR0); -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -} - -/* - * -testcase brief in English - * - */ - -VOID ItFsJffs701(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_701", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_807.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_807.cpp deleted file mode 100644 index 39013a9f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_807.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 i; - INT32 index = 0; - INT32 fd[JFFS_CREATFILE_NUM] = {}; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - strcat(bufname1, "/test0"); - strcat(bufname2, "/test1"); - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - for (i = 0; i < JFFS_CREATFILE_NUM; i++) { - snprintf(pathname1, JFFS_STANDARD_NAME_LENGTH, "/storage/test/test1/file%d.txt", index); - fd[index] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - if (fd[index] == -1) { - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - index++; - } - - ret = rename(bufname1, bufname2); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - index--; - for (i = index; i >= 0; i--) { - snprintf(pathname1, JFFS_STANDARD_NAME_LENGTH, "/storage/test/test1/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT1: - for (i = index; i >= 0; i--) { - snprintf(pathname1, JFFS_STANDARD_NAME_LENGTH, "/storage/test/test1/file%d.txt", i); - unlink(pathname1); - } -EXIT: - rmdir(bufname1); - rmdir(bufname2); - rmdir(pathname); - return JFFS_NO_ERROR; -} - -/* - * -* -@test IT_FS_JFFS_807 -* -@tspec The function test for filesystem -* -@ttitle test1 and not null test2 called API rename,rename test1 to test2 -* -@tprecon The filesystem module is open -* -@tbrief -1. mkdir test1 and test2; -2. open creat five files in test1; -3. rename test1 to test2; -4. unlink files in test1 and rmdir test1 and test2. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark - * - */ - -VOID ItFsJffs807(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_807", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_808.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_808.cpp deleted file mode 100644 index ad2e8576..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_jffs_808.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 Testcase(VOID) -{ - INT32 fd, ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - closedir(dir); - goto EXIT1; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - close(fd); -EXIT1: - remove(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -/* - * @ingroup jffs - * API test - * @brief 测试有文件或目录打开时å¸è½½jffs文件系统 - * @par description: Test that umount the jffs filesystem when any file or directory is open - * @par precon: jffs moudle open - * 1ã€open a file and umount jffs.\n - * 2ã€close the file and umount jffs.\n - * 3ã€open a directory and umount jffs.\n - * 4ã€close the directory and umount jffs.\n - * 1ã€return failed. \n - * 2ã€return success. \n - * 3ã€return failed. \n - * 4ã€return success. \n - */ - -VOID ItFsJffs808(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_808", Testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_link_001.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_link_001.cpp deleted file mode 100644 index f7b70a18..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_link_001.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - struct stat statBuf1 = {0}; - struct stat statBuf2 = {0}; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - ret = link("/lib/libc.so", pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EXDEV, errno, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = link(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname1, &statBuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf1.st_nlink, 2, statBuf1.st_nlink, EXIT2); - - ret = stat(pathname2, &statBuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_ino, statBuf1.st_ino, statBuf2.st_ino, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_mode, statBuf1.st_mode, statBuf2.st_mode, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_nlink, statBuf1.st_nlink, statBuf2.st_nlink, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_uid, statBuf1.st_uid, statBuf2.st_uid, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_gid, statBuf1.st_gid, statBuf2.st_gid, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_size, statBuf1.st_size, statBuf2.st_size, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf2.st_blksize, statBuf1.st_blksize, statBuf2.st_blksize, EXIT2); - - fd1 = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - len = read(fd1, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - memset(&statBuf1, 0, sizeof(struct stat)); - ret = stat(pathname1, &statBuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf1.st_nlink, 1, statBuf1.st_nlink, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT4: - close(fd1); - goto EXIT2; -EXIT3: - close(fd); - goto EXIT1; -EXIT2: - unlink(pathname2); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLink001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINK_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_link_002.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_link_002.cpp deleted file mode 100644 index 135c4d9f..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_link_002.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = link(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd1 = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT4); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT4: - close(fd1); - goto EXIT2; -EXIT3: - close(fd); - goto EXIT1; -EXIT2: - unlink(pathname2); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLink002(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINK_002", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_link_003.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_link_003.cpp deleted file mode 100644 index 002ce30e..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_link_003.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR filebuf[PATH_MAX + 2] = {""}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME03 }; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME04 }; - - for (int i = 0; i < PATH_MAX + 1; i++) { - strcat(filebuf, "d"); - } - filebuf[PATH_MAX + 1] = '\0'; - ret = link(filebuf, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT); - - ret = link("dddddddddddddd", pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - ret = link(JFFS_MAIN_DIR0, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EPERM, errno, EXIT); - - fd = creat(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = link(pathname2, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = creat(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = link(pathname3, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT4); - - ret = unlink(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT5: - close(fd); -EXIT4: - unlink(pathname3); -EXIT3: - unlink(pathname1); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLink003(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINK_003", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_linkat_001.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_linkat_001.cpp deleted file mode 100644 index d649f6a3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_linkat_001.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = "originfile"; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "linkfile"; - INT32 olddirFd = -1; - INT32 newdirFd = -1; - DIR *olddir = NULL; - DIR *newdir = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - olddir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(olddir, NULL, olddir, EXIT1); - - olddirFd = dirfd(olddir); - ICUNIT_GOTO_NOT_EQUAL(olddirFd, JFFS_IS_ERROR, olddirFd, EXIT2); - - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - newdir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(newdir, NULL, newdir, EXIT3); - - newdirFd = dirfd(newdir); - ICUNIT_GOTO_NOT_EQUAL(newdirFd, JFFS_IS_ERROR, newdirFd, EXIT4); - - fd = openat(olddirFd, pathname3, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT6); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - ret = linkat(olddirFd, pathname3, newdirFd, pathname4, 0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT5); - - ret = unlinkat(olddirFd, pathname3, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - fd1 = openat(newdirFd, pathname4, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT5); - - len = read(fd1, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT8); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT8); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT8); - - ret = unlinkat(newdirFd, pathname4, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = closedir(newdir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = closedir(olddir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT8: - close(fd1); -EXIT7: - unlinkat(newdirFd, pathname4, 0); - goto EXIT5; -EXIT6: - close(fd); -EXIT5: - unlinkat(olddirFd, pathname3, 0); -EXIT4: - closedir(newdir); -EXIT3: - rmdir(pathname2); -EXIT2: - closedir(olddir); -EXIT1: - rmdir(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLinkat001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINKAT_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_linkat_002.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_linkat_002.cpp deleted file mode 100644 index 35759850..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_linkat_002.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - struct stat statBuf = {0}; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "originfile"; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = "symlinkfile"; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = "linkfile"; - CHAR pathname7[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname8[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname9[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - INT32 dirFd0 = -1; - INT32 dirFd1 = -1; - INT32 dirFd2 = -1; - DIR *dir0 = NULL; - DIR *dir1 = NULL; - DIR *dir2 = NULL; - - /* get dirfd0 */ - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir0 = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir0, NULL, dir0, EXIT1); - - dirFd0 = dirfd(dir0); - ICUNIT_GOTO_NOT_EQUAL(dirFd0, JFFS_IS_ERROR, dirFd0, EXIT2); - - /* get dirfd1 */ - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dir1 = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT3); - - dirFd1 = dirfd(dir1); - ICUNIT_GOTO_NOT_EQUAL(dirFd1, JFFS_IS_ERROR, dirFd1, EXIT4); - - /* get dirfd2 */ - ret = mkdir(pathname3, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - dir2 = opendir(pathname3); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT5); - - dirFd2 = dirfd(dir2); - ICUNIT_GOTO_NOT_EQUAL(dirFd2, JFFS_IS_ERROR, dirFd2, EXIT6); - - /* creat original file */ - fd = openat(dirFd0, pathname4, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT6); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT8); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - /* creat a symbol link to the original file */ - strcat(pathname7, "/"); - strcat(pathname7, pathname4); - ret = symlinkat(pathname7, dirFd1, pathname5); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT7); - - len = readlinkat(dirFd1, pathname5, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, strlen(pathname7), len, EXIT9); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname7, readbuf, EXIT9); - - /* creat a hard link to the symlink file */ - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT9); - - strcat(pathname9, "/"); - strcat(pathname9, pathname6); - ret = stat(pathname9, &statBuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - ICUNIT_GOTO_EQUAL(statBuf.st_mode & S_IFMT, S_IFLNK, statBuf.st_mode & S_IFMT, EXIT10); - ICUNIT_GOTO_EQUAL(statBuf.st_size, strlen(pathname7), statBuf.st_size, EXIT10); - - len = readlink(pathname9, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_IS_ERROR, len, EXIT10); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT10); - - ret = unlink(pathname9); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - - /* creat a hard link to the original file by linking to the symlink file */ - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, AT_SYMLINK_FOLLOW); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT9); - - memset(&statBuf, 0, sizeof(struct stat)); - ret = stat(pathname9, &statBuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - ICUNIT_GOTO_EQUAL(statBuf.st_mode & S_IFMT, S_IFREG, statBuf.st_mode & S_IFMT, EXIT10); - - fd1 = openat(dirFd2, pathname6, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT10); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT11); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT11); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT11); - - ret = unlinkat(dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - - ret = unlinkat(dirFd1, pathname5, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT9); - - ret = unlinkat(dirFd0, pathname4, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = closedir(dir0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT11: - close(fd1); -EXIT10: - unlinkat(dirFd2, pathname6, 0); -EXIT9: - unlinkat(dirFd1, pathname5, 0); - goto EXIT7; -EXIT8: - close(fd); -EXIT7: - unlinkat(dirFd0, pathname4, 0); -EXIT6: - closedir(dir2); -EXIT5: - rmdir(pathname3); -EXIT4: - closedir(dir1); -EXIT3: - rmdir(pathname2); -EXIT2: - closedir(dir0); -EXIT1: - rmdir(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLinkat002(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINKAT_002", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_linkat_003.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_linkat_003.cpp deleted file mode 100644 index 83190062..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_linkat_003.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "symlinkfile1"; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = "symlinkfile2"; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = "linkfile"; - CHAR pathname7[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname8[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname9[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - INT32 dirFd0 = -1; - INT32 dirFd1 = -1; - INT32 dirFd2 = -1; - DIR *dir0 = NULL; - DIR *dir1 = NULL; - DIR *dir2 = NULL; - - /* get dirfd0 */ - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir0 = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir0, NULL, dir0, EXIT1); - - dirFd0 = dirfd(dir0); - ICUNIT_GOTO_NOT_EQUAL(dirFd0, JFFS_IS_ERROR, dirFd0, EXIT2); - - /* get dirfd1 */ - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dir1 = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT3); - - dirFd1 = dirfd(dir1); - ICUNIT_GOTO_NOT_EQUAL(dirFd1, JFFS_IS_ERROR, dirFd1, EXIT4); - - /* get dirfd2 */ - ret = mkdir(pathname3, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - dir2 = opendir(pathname3); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT5); - - dirFd2 = dirfd(dir2); - ICUNIT_GOTO_NOT_EQUAL(dirFd2, JFFS_IS_ERROR, dirFd2, EXIT6); - - /* creat a dangling symbolic link */ - strcat(pathname9, "/not_exist"); - ret = symlinkat(pathname9, dirFd1, pathname5); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT6); - - /* creat a hard link to the dangling symlink file */ - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT7); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT7); - - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, AT_SYMLINK_FOLLOW); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT7); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT7); - - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = unlinkat(dirFd1, pathname5, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = unlinkat(dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT8); - - /* creat two looped symbolic link */ - strcat(pathname7, "/"); - strcat(pathname7, pathname4); - ret = symlinkat(pathname7, dirFd1, pathname5); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT6); - - strcat(pathname8, "/"); - strcat(pathname8, pathname5); - ret = symlinkat(pathname8, dirFd0, pathname4); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT7); - - /* creat a hard link to the looped symlink file */ - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, AT_SYMLINK_FOLLOW); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT9); - ICUNIT_GOTO_EQUAL(errno, ELOOP, errno, EXIT9); - - ret = linkat(dirFd1, pathname5, dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT9); - - /* remove all */ - ret = unlinkat(dirFd2, pathname6, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT10); - - ret = unlinkat(dirFd0, pathname4, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT9); - - ret = unlinkat(dirFd1, pathname5, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = closedir(dir0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT10: - unlinkat(dirFd2, pathname6, 0); -EXIT9: - unlinkat(dirFd0, pathname4, 0); - goto EXIT7; -EXIT8: - unlinkat(dirFd2, pathname6, 0); -EXIT7: - unlinkat(dirFd1, pathname5, 0); -EXIT6: - closedir(dir2); -EXIT5: - rmdir(pathname3); -EXIT4: - closedir(dir1); -EXIT3: - rmdir(pathname2); -EXIT2: - closedir(dir0); -EXIT1: - rmdir(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestLinkat003(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_LINKAT_003", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_mount_rdonly_001.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_mount_rdonly_001.cpp deleted file mode 100644 index 338927ad..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_mount_rdonly_001.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2021-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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - fd = creat(pathname1, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - fd = open(pathname1, O_RDWR); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); - - ret = symlink(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT5); - - ret = rename(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT5); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT5: - unlink(pathname2); - goto EXIT3; -EXIT4: - close(fd); -EXIT3: - umount(JFFS_MAIN_DIR0); -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestMountRdonly001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_MOUNT_RDONLY_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_mount_rdonly_002.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_mount_rdonly_002.cpp deleted file mode 100644 index 7fc30971..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_mount_rdonly_002.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2021-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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - fd = creat(pathname1, 0755); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - fd = open(pathname1, O_CREAT | O_RDONLY, 0755); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - fd = open(pathname1, O_CREAT | O_RDWR, 0755); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - ret = mkdir(pathname1, 0755); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - remove(pathname1); -EXIT1: - umount(JFFS_MAIN_DIR0); - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestMountRdonly002(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_MOUNT_RDONLY_002", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_mount_rdonly_003.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_mount_rdonly_003.cpp deleted file mode 100644 index 68cd07aa..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_mount_rdonly_003.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2021-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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - const CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - fd = creat(pathname1, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(ret, strlen(writebuf), ret, EXIT4); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, MS_RDONLY, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - fd = open(pathname1, O_RDWR); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); - - fd = open(pathname1, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); - - ret = read(fd, readbuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(ret, strlen(writebuf), ret, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT4); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT4: - close(fd); -EXIT3: - umount(JFFS_MAIN_DIR0); -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestMountRdonly003(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_MOUNT_RDONLY_003", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_readlink_001.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_readlink_001.cpp deleted file mode 100644 index e80aa975..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_readlink_001.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - size_t readSize = 3; - CHAR filebuf[PATH_MAX + 2] = {""}; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - for (int i = 0; i < PATH_MAX + 1; i++) { - strcat(filebuf, "d"); - } - filebuf[PATH_MAX + 1] = '\0'; - - fd = creat(pathname1, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = symlink(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = readlink(pathname1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT3); - - ret = readlink(pathname2, readbuf, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT3); - - ret = readlink(filebuf, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT3); - - ret = readlink(pathname2, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, strlen(pathname1), ret, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname1, readbuf, EXIT3); - - ret = readlink(pathname2, readbuf, readSize); - ICUNIT_GOTO_EQUAL(ret, readSize - 1, ret, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "/s", readbuf, EXIT3); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; - -EXIT3: - unlink(pathname2); - goto EXIT1; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestReadlink001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_READLINK_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlink_001.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlink_001.cpp deleted file mode 100644 index ceabe1c3..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlink_001.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - struct stat statBuf1 = {0}; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = symlink(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname2, &statBuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf1.st_mode & S_IFMT, S_IFLNK, statBuf1.st_mode & S_IFMT, EXIT2); - ICUNIT_GOTO_EQUAL(statBuf1.st_size, strlen(pathname1), statBuf1.st_size, EXIT2); - - len = readlink(pathname2, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, strlen(pathname1), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname1, readbuf, EXIT2); - - fd1 = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT4); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT4: - close(fd1); - goto EXIT2; -EXIT3: - close(fd); - goto EXIT1; -EXIT2: - unlink(pathname2); -EXIT1: - unlink(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestSymlink001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_SYMLINK_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlink_002.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlink_002.cpp deleted file mode 100644 index fb647dba..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlink_002.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 len, ret; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - - ret = symlink(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - len = readlink(pathname2, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, strlen(pathname1), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname1, readbuf, EXIT1); - - ret = symlink(pathname2, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - memset(readbuf, 0, sizeof(readbuf)); - len = readlink(pathname1, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, strlen(pathname2), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname2, readbuf, EXIT2); - - fd = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ELOOP, errno, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT2: - unlink(pathname1); -EXIT1: - unlink(pathname2); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestSymlink002(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_SYMLINK_002", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlink_003.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlink_003.cpp deleted file mode 100644 index 463f3afb..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlink_003.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR filebuf[PATH_MAX + 2] = {""}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME03 }; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME04 }; - - for (int i = 0; i < PATH_MAX + 1; i++) { - strcat(filebuf, "d"); - } - filebuf[PATH_MAX + 1] = '\0'; - ret = symlink(filebuf, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT); - - ret = symlink("dddddddddddddd", pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = symlink("aaaaaaaaaaaaaaa", pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT1); - - ret = symlink("", pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd = open(pathname3, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - fd = creat(pathname4, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = symlink(pathname4, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - fd = open(pathname5, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT5); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - fd = open(pathname5, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT7); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT7); - - ret = unlink(pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = unlink(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT7: - unlink(pathname5); - goto EXIT2; -EXIT6: - close(fd); -EXIT5: - unlink(pathname5); - goto EXIT3; -EXIT4: - close(fd); -EXIT3: - unlink(pathname4); -EXIT2: - unlink(pathname3); -EXIT1: - unlink(pathname2); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestSymlink003(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_SYMLINK_003", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlinkat_001.cpp b/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlinkat_001.cpp deleted file mode 100644 index 2124ab0c..00000000 --- a/testsuites/unittest_old/fs/jffs/full/It_vfs_test_symlinkat_001.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 len, ret; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = "originfile"; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "linkfile"; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - INT32 olddirFd = -1; - INT32 newdirFd = -1; - DIR *olddir = NULL; - DIR *newdir = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - olddir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(olddir, NULL, olddir, EXIT1); - - olddirFd = dirfd(olddir); - ICUNIT_GOTO_NOT_EQUAL(olddirFd, JFFS_IS_ERROR, olddirFd, EXIT2); - - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - newdir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(newdir, NULL, newdir, EXIT3); - - newdirFd = dirfd(newdir); - ICUNIT_GOTO_NOT_EQUAL(newdirFd, JFFS_IS_ERROR, newdirFd, EXIT4); - - fd = openat(olddirFd, pathname3, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT4); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT6); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT6); - - strcat(pathname5, "/"); - strcat(pathname5, pathname3); - ret = symlinkat(pathname5, newdirFd, pathname4); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT5); - - len = readlinkat(newdirFd, pathname4, readbuf, sizeof(readbuf)); - ICUNIT_GOTO_EQUAL(len, strlen(pathname5), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, pathname5, readbuf, EXIT2); - - fd1 = openat(newdirFd, pathname4, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT5); - - memset(readbuf, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd1, readbuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT8); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT8); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT8); - - ret = unlinkat(newdirFd, pathname4, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = unlinkat(olddirFd, pathname3, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = closedir(newdir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = closedir(olddir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT8: - close(fd1); -EXIT7: - unlinkat(newdirFd, pathname4, 0); - goto EXIT5; -EXIT6: - close(fd); -EXIT5: - unlinkat(olddirFd, pathname3, 0); -EXIT4: - closedir(newdir); -EXIT3: - rmdir(pathname2); -EXIT2: - closedir(olddir); -EXIT1: - rmdir(pathname1); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsTestSymlinkat001(VOID) -{ - TEST_ADD_CASE("IT_FS_TEST_SYMLINKAT_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_001.cpp b/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_001.cpp deleted file mode 100644 index 10c9c819..00000000 --- a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_001.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" - -#define FILEPATH "/storage/testfdopen.txt" -#define TESTFILE "/storage/testfopen" -#define MAXFD 512 -#define MINFD 8 - -static int TestCase0(void) -{ - FILE *fp = NULL; - int fd = -1; - char buf[10U] = "123456789"; - char rdbuf[10U] = {0}; - int ret = -1; - - fd = open(FILEPATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* r+ */ - fp = fdopen(fd, "r+"); - ICUNIT_GOTO_NOT_EQUAL(fp, JFFS_TO_NULL, fp, EXIT); - - ret = fwrite(buf, 10U, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fseek(fp, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fread(rdbuf, 10U, 1, fp); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - fp = NULL; - - /* a+ /appen + rw */ - fd = open(FILEPATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - fp = fdopen(fd, "a+"); - ICUNIT_GOTO_NOT_EQUAL(fp, JFFS_TO_NULL, fp, EXIT); - - ret = fwrite(buf, 10U, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fseek(fp, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fread(rdbuf, 10U, 1, fp); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - fp = NULL; - - /* r / only read */ - fd = open(FILEPATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - fp = fdopen(fd, "r"); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_TO_NULL, fd, EXIT); - - ret = fwrite(buf, 10u, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, 1, ret, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - fp = NULL; - - /* w / only write */ - fd = open(FILEPATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - fp = fdopen(fd, "w"); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_TO_NULL, fd, EXIT); - - ret = fread(rdbuf, 10u, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, 1, ret, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - fp = NULL; - - /* w+ */ - fd = open(FILEPATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - fp = fdopen(fd, "w+"); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_TO_NULL, fd, EXIT); - - ret = fwrite(buf, 10u, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fseek(fp, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fread(rdbuf, 10u, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fclose(fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - fp = NULL; - - /* a */ - fd = open(FILEPATH, O_WRONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - fp = fdopen(fd, "a"); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_TO_NULL, fd, EXIT); - - ret = fwrite(buf, 10u, 1, fp); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fseek(fp, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = fread(rdbuf, 10u, 1, fp); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = fclose(fp); - - return JFFS_NO_ERROR; - -EXIT: - if(fp != NULL) { - fclose(fp); - } else { - remove(FILEPATH); - } - - return JFFS_IS_ERROR; -} - -/* error */ -static int TestCase1(void) -{ - FILE *fp = NULL; - int fd = -1; - int errFd = -1; - int i = 0; - - fd = open(FILEPATH, O_RDWR, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* EIVNAL */ - fp = fdopen(fd, "hello"); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_TO_NULL, fd, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - close(fd); - remove(TESTFILE); - - return JFFS_NO_ERROR; - -EXIT: - close(fd); - remove(TESTFILE); - - return JFFS_IS_ERROR; -} - -static int TestCase(void) -{ - int ret = -1; - int fd = -1; - - fd = open(FILEPATH, O_RDWR | O_EXCL | O_CREAT, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = TestCase0(); - ICUNIT_GOTO_EQUAL(ret, JFFS_TO_NULL, ret, EXIT); - - ret = TestCase1(); - ICUNIT_GOTO_EQUAL(ret, JFFS_TO_NULL, ret, EXIT); - - close(fd); - remove(FILEPATH); - - return JFFS_NO_ERROR; - -EXIT: - close(fd); - remove(FILEPATH); - - return JFFS_IS_ERROR; -} - -void ItTestFsJffs001(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_001", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_002.cpp b/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_002.cpp deleted file mode 100644 index ebdbdef2..00000000 --- a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_002.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" -#include -#include -#include - -#define FILEPATH "/storage/testfstatvfs.txt" -#define FILEPATHLEN (strlen(FILEPATH) + 1U) - -static int TestCase0(void) -{ - INT32 fd = -1; - INT32 ret = 0; - struct statvfs fileInfo = {0}; - - fd=open(FILEPATH, O_RDWR, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, 1, fd, EXIT); - - ret= fstatvfs(fd, &fileInfo); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - /*ICUNIT_GOTO_EQUAL(fileInfo.f_flag, 0, fileInfo.f_flag, EXIT);*/ - close(fd); - return JFFS_NO_ERROR; - -EXIT: - close(fd); - return JFFS_IS_ERROR; -} - -static int TestCase1(void) -{ - INT32 fd = -1; - INT32 ret= 0; - INT32 errFd = -1; - struct statvfs fileInfo = {0}; - - fd = open(FILEPATH, O_RDWR, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* EBADF */ - ret=fstatvfs(errFd, &fileInfo); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - /* EBADF(When the file does not exist, an error occurs when the file is - converted from the fd file to the system FD file.) */ - close(fd); - ret= remove(FILEPATH); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - errno =0; - ret=fstatvfs(fd, &fileInfo); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - close(fd); - - return JFFS_NO_ERROR; -EXIT: - close(fd); - return JFFS_IS_ERROR; -} - -static int TestCase(void) -{ - INT32 fd=-1; - int ret =-1; - - fd=open(FILEPATH, O_CREAT | O_RDWR | O_EXCL, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, 1, fd, EXIT); - - close(fd); - ret= TestCase0(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret= TestCase1(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - remove(FILEPATH); - return JFFS_NO_ERROR; -EXIT: - remove(FILEPATH); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs002(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_002", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_003.cpp b/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_003.cpp deleted file mode 100644 index ad5f3264..00000000 --- a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_003.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" - -#define DIRPATH1 "/storage/test1" -#define DIRPATH2 "/storage/test2" -#define TEST_MAXPATHLEN 4098 - -static int TestCase0(void) -{ - INT32 ret = -1; - INT32 dirFd = -1; - INT32 fd = -1; - INT32 len = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = DIRPATH1; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = DIRPATH2; - DIR *dir = NULL; - - ret = mkdir(pathname1, JFFS_FILE_MODE); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = renameat(AT_FDCWD, DIRPATH1, AT_FDCWD, DIRPATH2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - ret = strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test1.txt"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname2, O_EXCL | O_CREAT | O_RDWR, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890", 11); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = renameat(dirFd, "test1.txt", dirFd, "test2.txt"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink("/storage/test2/test2.txt"); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(DIRPATH2); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT2: - unlink(pathname2); - closedir(dir); -EXIT: - rmdir(DIRPATH2); - return JFFS_NO_ERROR; -} - -static int TestCase1(void) -{ - int ret = -1; - char pathName[TEST_MAXPATHLEN] = {0}; - int errFd = -1; - /* ENAMETOOLONG */ - ret = memset_s(pathName, TEST_MAXPATHLEN, 1, TEST_MAXPATHLEN); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = renameat(AT_FDCWD, pathName, AT_FDCWD, pathName); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, ret, EXIT); - /* EINVAL */ - ret = renameat(AT_FDCWD, "\0", AT_FDCWD, "\0"); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - /* ENOENT */ - ret = renameat(errFd, "/storage/test.txt", errFd, "/storage/test1.txt"); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_IS_ERROR; -} - -static int TestCase(void) -{ - int ret = -1; - ret = TestCase0(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = TestCase1(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_IS_ERROR; -} - -void ItTestFsJffs003(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_003", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_004.cpp b/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_004.cpp deleted file mode 100644 index 24562d37..00000000 --- a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_004.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" - -#define MOUNT_FILEPATH "/storage/mounts" -#define TESTFILE "/storage/hellomnt" -#define MAXFD 512 -#define MINFD 8 - -static int TestCase0(void) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = MOUNT_FILEPATH; - struct mntent *mnt = NULL; - FILE *fp = NULL; - int ret = -1; - struct mntent mountsData = { - .mnt_fsname = "jffs", - .mnt_dir = "/", - .mnt_type = "jffs", - .mnt_opts = nullptr, - .mnt_freq = 0, - .mnt_passno = 0, - }; - - fp = setmntent(pathname1, "r+"); - ICUNIT_GOTO_NOT_EQUAL(fp, NULL, fp, EXIT); - - mnt = getmntent(fp); - ICUNIT_GOTO_NOT_EQUAL(mnt, NULL, mnt, EXIT); - - ret = strcmp(mnt->mnt_fsname, mountsData.mnt_fsname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = strcmp(mnt->mnt_dir, mountsData.mnt_dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = strcmp(mnt->mnt_type, mountsData.mnt_type); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ICUNIT_GOTO_EQUAL(mnt->mnt_freq, mountsData.mnt_freq, mnt.mnt_freq, EXIT); - ICUNIT_GOTO_EQUAL(mnt->mnt_passno, mountsData.mnt_passno, mnt.mnt_passno, EXIT); - - endmntent(fp); - return JFFS_NO_ERROR; - -EXIT: - endmntent(fp); - return JFFS_IS_ERROR; -} - -static int TestCase1(void) -{ - int ret = -1; - FILE *fp = NULL; - int i = 0; - int fd =-1; - /* EINVAL */ - fp = setmntent(MOUNT_FILEPATH, "+r"); - ICUNIT_GOTO_EQUAL(fp, NULL, fp, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, fp, EXIT); - - /* EISDIR */ - fp = setmntent("./", "r+"); - ICUNIT_GOTO_EQUAL(fp, NULL, fp, EXIT); - ICUNIT_GOTO_EQUAL(errno, EISDIR, fp, EXIT); - /* ENOENT */ - fp = setmntent("/storage/testmnt", "r+"); - ICUNIT_GOTO_EQUAL(fp, NULL, fp, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, fp, EXIT); - remove(TESTFILE); - - return JFFS_NO_ERROR; -EXIT: - remove(TESTFILE); - return JFFS_IS_ERROR; -} - -static int TestCase(void) -{ - int ret = -1; - ret = TestCase0(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = TestCase1(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT: - return JFFS_IS_ERROR; -} - -void ItTestFsJffs004(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_004", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_100.cpp b/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_100.cpp deleted file mode 100644 index d21b1ca9..00000000 --- a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_100.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" - -static int TestCase(void) -{ - INT32 ret, dirFd, fd, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs100(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_100", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_101.cpp b/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_101.cpp deleted file mode 100644 index cc56a689..00000000 --- a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_101.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" - -#define TEST_STRLEN 30 - -static int TestCase(void) -{ - INT32 fd = 0; - INT32 ret = 0; - CHAR pathname[TEST_STRLEN] = JFFS_MAIN_DIR0; - CHAR pathname1[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname2[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR *pathname3 = NULL; - CHAR buf1[TEST_STRLEN] = ""; - CHAR buf2[TEST_STRLEN] = ""; - CHAR *pret = NULL; - DIR *dir = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - pathname3 = pathname2; - strcat_s(pathname2, TEST_STRLEN, "/test1"); - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname2, O_DIRECTORY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* EBADF */ - ret = fchdir(-1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EBADF, ret, EXIT1); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - pret = getcwd(buf1, TEST_STRLEN); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(buf1, pathname, buf1, EXIT1); - - ret = fchdir(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - pret = getcwd(buf2, TEST_STRLEN); - ICUNIT_GOTO_NOT_EQUAL(pret, NULL, pret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(buf2, pathname3, buf2, EXIT1); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname2); -EXIT: - rmdir(pathname2); - rmdir(pathname1); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs101(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_101", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_102.cpp b/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_102.cpp deleted file mode 100644 index 52211c12..00000000 --- a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_102.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" - -#define TEST_STRLEN 30 - -static int TestCase(void) -{ - INT32 fd = 0; - INT32 ret = JFFS_IS_ERROR; - CHAR pathname1[TEST_STRLEN] = JFFS_PATH_NAME0; - struct stat info = {0}; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - /* EBADF */ - ret = fchmod(-1, S_IREAD); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EBADF, ret, EXIT1); - - /* S_IRWXU */ - ret = fchmod(fd, S_IRWXU); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IRWXU; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IRUSR */ - ret = fchmod(fd, S_IRUSR); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IRUSR; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IWUSR */ - ret = fchmod(fd, S_IWUSR); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IWUSR; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IXUSR */ - ret = fchmod(fd, S_IXUSR); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IXUSR; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IRWXG */ - ret = fchmod(fd, S_IRWXG); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IRWXG; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* SIRGRP */ - ret = fchmod(fd, S_IRGRP); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IRGRP; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IXGRP */ - ret = fchmod(fd, S_IXGRP); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IXGRP; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IRWXO */ - ret = fchmod(fd, S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode &S_IRWXO; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IROTH */ - ret = fchmod(fd, S_IROTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IROTH; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - /* S_IXOTH */ - ret = fchmod(fd, S_IXOTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - stat(pathname1, &info); - ret = info.st_mode & S_IXOTH; - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname1); -EXIT: - rmdir(pathname1); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs102(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_102", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_103.cpp b/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_103.cpp deleted file mode 100644 index f1c29fc9..00000000 --- a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_103.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" - -#define TEST_STRLEN 30 - -static int TestCase(void) -{ - INT32 dirfd = 0; - INT32 fd = 0; - INT32 ret = JFFS_IS_ERROR; - CHAR pathname0[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname1[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname2[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname3[TEST_STRLEN] = JFFS_PATH_NAME01; - CHAR filebuf[256] = "abcdeab89abcedcde01234567fghij9876543210abcdeabc89abcedfghde0123456710abcdeabcde012876543289abcedfghij987654345673210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfg10abcdeahij9876543289abcedfghlbcde01234567I0lalalalalalalal"; - struct stat info = {0}; - - ret = mkdir(pathname0, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, TEST_STRLEN, "/test1"); - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chmod(pathname1, S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - stat(pathname1, &info); - ret = info.st_mode & (S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - - dirfd = open(pathname0, O_DIRECTORY); - ICUNIT_GOTO_NOT_EQUAL(dirfd, JFFS_IS_ERROR, dirfd, EXIT); - - /* ENAMETOOLONG */ - ret = fchmodat(dirfd, filebuf, S_IREAD, 0); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, ENAMETOOLONG, ret, EXIT); - - /* ENOENT */ - ret = fchmodat(-1, "test1", S_IREAD, 0); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, ENOENT, ret, EXIT); - - /* EINVAL */ - ret = fchmodat(dirfd, NULL, S_IREAD, 0); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - /* absolute path */ - ret = fchmodat(0, pathname1, S_IRUSR | S_IWUSR | S_IXUSR, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - stat(pathname1, &info); - ret = info.st_mode & (S_IRUSR | S_IWUSR | S_IXUSR); - ICUNIT_GOTO_EQUAL(ret, (S_IRUSR | S_IWUSR | S_IXUSR), ret, EXIT); - - /* S_IRUSR | S_IWUSR | S_IXUSR */ - ret = fchmodat(dirfd, "test1", S_IRUSR | S_IWUSR | S_IXUSR, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - stat(pathname1, &info); - ret = info.st_mode & (S_IRUSR | S_IWUSR | S_IXUSR); - ICUNIT_GOTO_EQUAL(ret, (S_IRUSR | S_IWUSR | S_IXUSR), ret, EXIT); - - /* AT_FDCWD */ - ret = fchmodat(AT_FDCWD, "test/test1", S_IRUSR | S_IWUSR | S_IXUSR, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - stat(pathname1, &info); - ret = info.st_mode & (S_IRUSR | S_IWUSR | S_IXUSR); - ICUNIT_GOTO_EQUAL(ret, (S_IRUSR | S_IWUSR | S_IXUSR), ret, EXIT); - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* ENOTDIR */ - dirfd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - ret = fchmodat(dirfd, "test1", S_IROTH | S_IWOTH | S_IXOTH, 0); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, ENOTDIR, ret, EXIT); - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = remove(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dirfd = open(pathname0, O_DIRECTORY); - ICUNIT_GOTO_NOT_EQUAL(dirfd, JFFS_IS_ERROR, dirfd, EXIT); - - strcat_s(pathname2, TEST_STRLEN, "/test.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = chmod(pathname2, S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - stat(pathname2, &info); - ret = info.st_mode & (S_IRUSR | S_IRGRP | S_IROTH); - ICUNIT_GOTO_EQUAL(ret, (S_IRUSR | S_IRGRP | S_IROTH), ret, EXIT); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = fchmodat(dirfd, "test.txt", S_IRUSR | S_IWUSR | S_IXUSR, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - stat(pathname2, &info); - ret = info.st_mode & (S_IRUSR | S_IWUSR | S_IXUSR); - ICUNIT_GOTO_EQUAL(ret, (S_IRUSR | S_IWUSR | S_IXUSR), ret, EXIT); - - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT1: - if (dirfd > 0) { - close(dirfd); - } - if (fd > 0) { - close(fd); - } -EXIT: - remove(pathname3); - remove(pathname2); - remove(pathname1); - remove(pathname0); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs103(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_103", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_106.cpp b/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_106.cpp deleted file mode 100644 index 202b3ecc..00000000 --- a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_106.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" - -#define TEST_STR "abcdefghijk" - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - INT32 len = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME0; - CHAR buf[JFFS_STANDARD_NAME_LENGTH] = TEST_STR; - CHAR str[JFFS_STANDARD_NAME_LENGTH] = ""; - FILE *ptr = NULL; - - fd = open(pathname1, O_CREAT, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ptr = freopen(pathname1, "w+", stdin); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT1); - - ret = fwrite(buf, JFFS_STANDARD_NAME_LENGTH, 1, ptr); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ret = fclose(ptr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(pathname1, O_RDWR, 0777); - ret = read(fd, str, JFFS_STANDARD_NAME_LENGTH); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - ret = strcmp(buf, str); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - if (fd > 0) { - close(fd); - } -EXIT: - unlink(pathname1); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs106(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_106", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_112.cpp b/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_112.cpp deleted file mode 100644 index 8782e61a..00000000 --- a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_112.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" - -static int TestCase(void) -{ - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_MAIN_DIR0; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_MAIN_DIR0; - CHAR *dname = NULL; - INT32 ret; - INT32 fd = 0; - DIR *dir1 = NULL; - DIR *dir2 = NULL; - - dir1 = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test123"); - ret = mkdir(pathname2, 0777); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - fd = open(pathname2, O_DIRECTORY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - dir2 = fdopendir(fd); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT2); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - if (fd) { - close(fd); - } - if (dir2) { - closedir(dir2); - } -EXIT1: - remove(pathname2); - return JFFS_IS_ERROR; -EXIT: - if (dir1) { - closedir(dir1); - } - return JFFS_IS_ERROR; -} - -void ItTestFsJffs112(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_112", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_113.cpp b/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_113.cpp deleted file mode 100644 index 1f92e148..00000000 --- a/testsuites/unittest_old/fs/jffs/full/it_test_fs_jffs_113.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_jffs.h" -#include - -static FILE *g_filep; -#define NUM 64 -#define COUNT 10 - -void *DoChild(void *) -{ - int ret, count; - char buf[NUM]; - - flockfile(g_filep); - - if (fseek(g_filep, 0L, SEEK_SET) == -1) { - perror("fseek()"); - } - ret = fread(buf, NUM, 1, g_filep); - - count = atoi(buf); - ++count; - sprintf_s(buf, NUM, "%d", count); - if (fseek(g_filep, 0L, SEEK_SET) == -1) { - perror("fseek()"); - } - ret = fwrite(buf, strlen(buf), 1, g_filep); - - funlockfile(g_filep); - - return NULL; -} - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - INT32 count = 0; - pthread_t tid[COUNT]; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR buf[COUNT]; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test12345.txt"); - g_filep = fopen(pathname2, "w+"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (count = 0; count < COUNT; count++) { - ret = pthread_create(tid + count, NULL, DoChild, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (count = 0; count < COUNT; count++) { - ret = pthread_join(tid[count], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = fclose(g_filep); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname2, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = read(fd, buf, COUNT); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = atoi(buf); - ICUNIT_GOTO_EQUAL(ret, COUNT, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - g_filep = nullptr; - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname2); - g_filep = nullptr; -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs113(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_113", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_001.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_001.cpp deleted file mode 100644 index 0e596d98..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_001.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - - memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_001_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsRandWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsRandRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - g_TestCnt = 0; - return JFFS_NO_ERROR; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 2; - - g_TestCnt = 0; - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - while (g_TestCnt < testNum) { - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance001(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance001", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_002.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_002.cpp deleted file mode 100644 index 4cee2c78..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_002.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_002_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsFixWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsFixRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 i; - INT32 ret; - struct sched_param param; - pthread_t threadId; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 2; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - while (g_TestCnt < testNum) { - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance002(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance002", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_003.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_003.cpp deleted file mode 100644 index 3ec4ebdb..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_003.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_003_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsRandWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsRandRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 i; - INT32 ret; - struct sched_param param; - pthread_t threadId; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 2; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - while (g_TestCnt < testNum) { - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance003(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance003", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_004.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_004.cpp deleted file mode 100644 index 62589886..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_004.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_004_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsFixWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsFixRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 2; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - while (g_TestCnt < testNum) { - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance004(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance004", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_005.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_005.cpp deleted file mode 100644 index dfe15dd9..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_005.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_005_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsFixWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsFixRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[JFFS_MAX_THREADS]; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 4; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)(i + 1)); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - while (g_TestCnt < testNum) { - sleep(1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance005(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance005", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_006.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_006.cpp deleted file mode 100644 index b13a64d2..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_006.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_006_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsRandWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsRandRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 6; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - while (g_TestCnt < testNum) { - sleep(1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance006(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance006", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_007.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_007.cpp deleted file mode 100644 index b8ada1b7..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_007.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_007_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsRandWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsRandRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 6; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - while (g_TestCnt < testNum) { - sleep(1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance007(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance007", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_008.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_008.cpp deleted file mode 100644 index 0113be3a..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_008.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[JFFS_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm *pstTM = NULL; - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - snprintf_s(fileName, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname1, - (INT32)(INTPTR)arg); - - snprintf_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "performance_008_%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname1, 0, 0, 0); - - ret = JffsFixWrite(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsFixRead(fileName, (INT64)JFFS_PERFORMANCE_W_R_SIZE, JFFS_PRESSURE_W_R_SIZE1, JFFS_WR_TYPE_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return JFFS_NO_ERROR; - -EXIT: - return JFFS_NO_ERROR; - g_TestCnt = 0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - INT32 priority = 14; - INT32 testNum = 6; - - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - while (g_TestCnt < testNum) { - sleep(1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); - -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance008(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance008", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_009.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_009.cpp deleted file mode 100644 index 3d744ad5..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_009.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, j, index, index1, len; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR pathname0[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname0[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - INT32 bufWLen = 500 * BYTES_PER_KBYTE; // 500 KB - struct dirent *ptr = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, bufW); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(pathname0, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(pathname0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - snprintf_s(bufname0, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(bufname0, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - - ICUNIT_GOTO_NOT_EQUAL(fd[index], JFFS_IS_ERROR, fd, EXIT2); - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - index++; - } - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - snprintf_s(bufname0, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(bufname0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %d\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - free(bufW); - return JFFS_NO_ERROR; -EXIT3: - for (i = index; i >= 0; i--) { - snprintf_s(bufname0, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(bufname0); - } -EXIT2: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT1: - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance009(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance009", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_010.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_010.cpp deleted file mode 100644 index b07de9b0..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_010.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -#define MS_NOSYNC 2 - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, j, index, index1, len; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - INT32 bufWLen = 300 * BYTES_PER_KBYTE; // 300 KB - struct dirent *ptr = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, bufW); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - errno = 0; - snprintf_s(bufname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(bufname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - printf("[%d] name:%s, fd:%d, errno:%d\n", __LINE__, bufname1, fd[index], errno); - if (errno == ENOSPC) { - index; - goto EXIT3; - } - ICUNIT_GOTO_NOT_EQUAL(fd[index], JFFS_IS_ERROR, fd, EXIT3); - - len = write(fd[index], bufW, strlen(bufW)); - printf("[%d] name:%s,len:%d, errno:%d\n", __LINE__, bufname1, len, errno); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - if (len <= 0) { - flag = 1; - break; - } - - index++; - } - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - sync(); - for (i = index; i >= 0; i--) { - snprintf_s(bufname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(bufname1); - printf("[%d] name:%s,ret:%d, errno:%d\n", __LINE__, bufname1, ret, errno); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %d\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - free(bufW); - return JFFS_NO_ERROR; -EXIT4: - umount(JFFS_MOUNT_DIR0); -EXIT3: - for (i = index - 1; i >= 0; i--) { - close(fd[i]); - } -EXIT2: - for (i = index - 1; i >= 0; i--) { - errno = 0; - snprintf_s(bufname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(bufname1); - printf("[%d] name:%s,ret:%d, errno:%d\n", __LINE__, bufname1, ret, errno); - } -EXIT1: -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPerformance010(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance010", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_011.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_011.cpp deleted file mode 100644 index 0ddf40a0..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_011.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static constexpr INT32 USLEEP_TIME = 10; - -static VOID *PthreadF01(void *arg) -{ - INT32 i, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = BYTES_PER_KBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/file%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - - usleep(SLEEP_TIME); - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = BYTES_PER_KBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - - usleep(SLEEP_TIME); - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = BYTES_PER_KBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - - usleep(SLEEP_TIME); - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - errno = 0; - - i = 0; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - - return JFFS_NO_ERROR; -} - -/* * -* - @test ItFsJffsPerformance011 -* - @tspec function test -* - @ttitle Multi-threaded takes time to delete directory files -* - @tbrief -1. Create 200 files per directory; -2. The size of each file is 300K; -3. Call the gettimeofday() to get the time; -4. Delete files and directories; -5. Call the gettimeofday() to get the time and View the time of serial port printing. -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsJffsPerformance011(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance011", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_012.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_012.cpp deleted file mode 100644 index 43c08cce..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_012.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = 300 * BYTES_PER_KBYTE; // 300 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (len <= 0) { - flag = 1; - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = 300 * BYTES_PER_KBYTE; // 300 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (len <= 0) { - flag = 1; - break; - } - - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[JFFS_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct timeval testTime1; - struct timeval testTime2; - INT32 bufWLen = 300 * BYTES_PER_KBYTE; // 300 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < JFFS_FILE_LIMITTED_NUM; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], bufW, strlen(bufW)); - - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - if (len <= 0) { - flag = 1; - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - dprintf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec)); - - g_TestCnt++; - free(bufW); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (i; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - free(bufW); -EXIT: - rmdir(bufname); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - i = 0; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - return JFFS_NO_ERROR; -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - return JFFS_NO_ERROR; -} - -/* * -* - @test ItFsJffsPerformance012 -* - @tspec function test -* - @ttitle Multi-threaded takes time to delete directory files -* - @tbrief -1. Create 200 files per directory; -2. The size of each file is 300K; -3. Call the gettimeofday() to get the time; -4. Delete files and directories; -5. Call the gettimeofday() to get the time and View the time of serial port printing. -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsJffsPerformance012(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance012", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_013.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_013.cpp deleted file mode 100644 index 6a0e16f8..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_performance_013.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - - -static void *PthreadFunc(void *arg) -{ - int fd = -1; - int ret; - int num = JFFS_MAX_NUM_TEST; - char *fileName = { JFFS_PATH_NAME0 }; - char *filebuf = "helloworld"; - - while (num-- > 0) { - fd = open(fileName, O_RDWR | O_CREAT, S_IRUSR); - if (fd < 0) { - printf("open %s failed, error: %s\n", fileName, strerror(errno)); - } - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = write(fd, filebuf, strlen(filebuf)); - if (ret != strlen(filebuf)) { - printf("write %s failed, ret: %d, error: %s\n", fileName, ret, strerror(errno)); - } - ICUNIT_GOTO_EQUAL(ret, strlen(filebuf), ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(fileName); - if (ret != 0) { - printf("remove %s failed, ret: %d, error: %s\n", fileName, ret, strerror(errno)); - } - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - pthread_exit(0); -EXIT1: - close(fd); -EXIT2: - unlink(fileName); -EXIT: - pthread_exit(0); -} - -static UINT32 TestCase(VOID) -{ - pthread_attr_t attr1, attr2; - pthread_t newTh1, newTh2; - int ret; - int num = 100; - int priority = 14; - - while (num-- > 0) { - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&newTh1, &attr1, PthreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh2, &attr2, PthreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - ret = pthread_join(newTh1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_join(newTh2, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attr2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - return JFFS_NO_ERROR; -EXIT2: - pthread_join(newTh2, NULL); - pthread_attr_destroy(&attr2); -EXIT1: - pthread_join(newTh1, NULL); - pthread_attr_destroy(&attr1); -EXIT: - return JFFS_NO_ERROR; -} - - -VOID ItFsJffsPerformance013(VOID) -{ - TEST_ADD_CASE("ItFsJffsPerformance013", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_001.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_001.cpp deleted file mode 100644 index ef13823b..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_001.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - struct flock fl = { 0 }; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/jffs_1600.txt"); - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - ret = rename(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rename(pathname2, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT2); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rename(pathname1, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rename(pathname2, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); - goto EXIT1; -EXIT2: - close(fd1); -EXIT1: - remove(pathname1); - remove(pathname2); -EXIT: - rmdir(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure001(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure001", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_002.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_002.cpp deleted file mode 100644 index 6b4a7e1d..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_002.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test/test1"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/test2", strlen(pathname1)); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/test3", strlen(pathname1)); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/jffs_1601.txt", strlen(pathname1)); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, "/123"); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - ret = rename(pathname2, pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rename(pathname3, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - dir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 0, offset, EXIT); // dir offset: 0 - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 1, offset, EXIT3); // dir offset: 1 - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 2, offset, EXIT); // dir offset: 2 - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 3, offset, EXIT); // dir offset: 3 - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 4, offset, EXIT); // dir offset: 4 - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT); - - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, 4, offset, EXIT); // dir offset: 4 - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/jffs_1601.txt", strlen(pathname1)); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/test1", strlen(pathname1)); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/test2", strlen(pathname1)); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname1, "/test/test3", strlen(pathname1)); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - JffsStrcat2(pathname2, "/test", strlen(pathname2)); - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/test/jffs_1601.txt", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/test/test3", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/test/test2", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/test/test1", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "/123/jffs_1601.txt", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/123/test3", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/123/test2", strlen(pathname1)); - remove(pathname1); - JffsStrcat2(pathname1, "/123/test1", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure002(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure002", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_003.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_003.cpp deleted file mode 100644 index 9f8dc1c6..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_003.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1602_%d", i); - JffsStrcat2(pathname2, bufname, strlen(bufname)); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname4); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure003(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure003", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_004.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_004.cpp deleted file mode 100644 index 2651a0cb..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_004.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dirbuf[JFFS_SHORT_ARRAY_LENGTH] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - memset_s(pathname1, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - strcpy_s(pathname1, JFFS_NAME_LIMITTED_SIZE, pathname2); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1603_%d", i); - strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, bufname); - strcpy_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, pathname1); - - ret = mkdir(pathname[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dirbuf[i] = opendir(pathname[i]); - ICUNIT_GOTO_NOT_EQUAL(dirbuf[i], NULL, dirbuf[i], EXIT2); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - JffsStatPrintf(buf2); - - for (i = JFFS_PRESSURE_CYCLES - 1; i >= 0; i--) { - ret = closedir(dirbuf[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - closedir(dirbuf[i]); - } - -EXIT1: - for (i = JFFS_PRESSURE_CYCLES - 1; i >= 0; i--) { - rmdir(pathname[i]); - } -EXIT: - remove(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure004(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure004", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_005.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_005.cpp deleted file mode 100644 index fed0a86e..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_005.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - static UINT32 flag = 0; - signed long long offset; - - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname5[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname6[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - DIR *dir1 = NULL; - DIR *dir2 = NULL; - DIR *dir3 = NULL; - DIR *dir4 = NULL; - DIR *dir5 = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "/test1"); - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "/test2"); - strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "/test3"); - strcat_s(pathname4, JFFS_NAME_LIMITTED_SIZE, "/test4"); - strcat_s(pathname5, JFFS_NAME_LIMITTED_SIZE, "/test5"); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = mkdir(pathname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = mkdir(pathname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - dir1 = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir1, NULL, dir1, EXIT6); - - dir2 = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir2, NULL, dir2, EXIT7); - - dir3 = opendir(pathname3); - ICUNIT_GOTO_NOT_EQUAL(dir3, NULL, dir3, EXIT8); - - dir4 = opendir(pathname4); - ICUNIT_GOTO_NOT_EQUAL(dir4, NULL, dir4, EXIT9); - - dir5 = opendir(pathname5); - ICUNIT_GOTO_NOT_EQUAL(dir5, NULL, dir5, EXIT10); - - ret = closedir(dir1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = closedir(dir2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = closedir(dir3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = closedir(dir4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = closedir(dir5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = rmdir(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - - ret = rmdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT10: - closedir(dir5); -EXIT9: - closedir(dir4); -EXIT8: - closedir(dir3); -EXIT7: - closedir(dir2); -EXIT6: - closedir(dir1); -EXIT5: - rmdir(pathname5); -EXIT4: - rmdir(pathname4); -EXIT3: - rmdir(pathname3); -EXIT2: - rmdir(pathname2); -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname6); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure005(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure005", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_006.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_006.cpp deleted file mode 100644 index 41d70b51..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_006.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - JffsStrcat2(pathname2, "/", strlen(pathname2)); - - for (j = 0; j < 40; j++) { // loop times: 40 - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "test%d", j); - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, bufname); - } - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - remove(pathname2); - goto EXIT; -EXIT1: - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure006(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure006", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_007.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_007.cpp deleted file mode 100644 index 59d7b837..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_007.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname5[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, strlen(readbuf)); - memset_s(pathname2, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, pathname6); - - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - memset_s(pathname3[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, bufname); - strcpy_s(pathname3[j], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname3[j], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - strcpy_s(pathname4[j], JFFS_NAME_LIMITTED_SIZE, pathname3[j]); - strcat_s(pathname4[j], JFFS_NAME_LIMITTED_SIZE, ".txt"); - } - - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - fd = open(pathname4[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname4[j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - for (j = JFFS_SHORT_ARRAY_LENGTH - 1; j >= 0; j--) { - ret = rmdir(pathname3[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname4[i]); - } -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - rmdir(pathname3[i]); - } -EXIT: - rmdir(pathname5); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure007(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure007", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_008.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_008.cpp deleted file mode 100644 index b103d3a1..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_008.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - memset_s(pathname2, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - JffsStrcat2(pathname2, "/_", strlen(pathname2)); - - for (j = 0; j < 31; j++) { // loop times: 31 - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "test%d", j); - JffsStrcat2(pathname2, bufname, strlen(bufname)); - } - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - closedir(dir); -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure008(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure008", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_009.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_009.cpp deleted file mode 100644 index d700b161..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_009.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "/1608.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - fd = open(pathname2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure009(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure009", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_010.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_010.cpp deleted file mode 100644 index 11ec8ddf..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_010.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname5[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname6[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "/1609.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, strlen(readbuf)); - - fd = open(pathname2, O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname2); -EXIT: - rmdir(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure010(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure010", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_011.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_011.cpp deleted file mode 100644 index 61ce1b5b..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_011.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname3[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - INT32 even = 2; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - strcpy_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1016_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - strcpy_s(pathname3[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - } - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - if ((j % even) == 0) { - ret = rename(pathname[i], pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } else { - ret = rename(pathname3[i], pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - } - if ((j % even) == 0) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = rmdir(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } else { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = rmdir(pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = rmdir(pathname3[i]); - } - -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = rmdir(pathname[i]); - } -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure011(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure011", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_012.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_012.cpp deleted file mode 100644 index d521a5e1..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_012.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH], fd1, ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname3[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname6[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - INT32 even = 2; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - strcpy_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "/test.txt"); - strcpy_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1011_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - strcpy_s(pathname3[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "/test.txt"); - strcpy_s(pathname6[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd[i] = open(pathname5[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT3); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - } - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - if ((j % even) == 0) { - ret = rename(pathname[i], pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } else { - ret = rename(pathname3[i], pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - } - - if ((j % even) == 1) { - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = unlink(pathname6[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } else { - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = unlink(pathname5[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname5[i]); - unlink(pathname6[i]); - } - -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - rmdir(pathname[i]); - rmdir(pathname3[i]); - } -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure012(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure012", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_014.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_014.cpp deleted file mode 100644 index 3d89a806..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_014.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - DIR *dir = NULL; - DIR *dirbuf[BYTES_PER_KBYTE] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - JffsStrcat2(pathname3, "/1613.txt", strlen(pathname3)); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0000000000111111111122222222223333333333", readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT4); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - } - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - JffsStatPrintf(buf2); - - ret = unlink(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT4: - closedir(dir); - goto EXIT2; -EXIT3: - close(fd); -EXIT2: - unlink(pathname3); -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure014(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure014", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_015.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_015.cpp deleted file mode 100644 index e17ac723..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_015.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dirbuf[JFFS_SHORT_ARRAY_LENGTH] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1614_%d", i); - strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, bufname); - strcpy_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, pathname1); - - ret = mkdir(pathname[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - dirbuf[i] = opendir(pathname[i]); - ICUNIT_GOTO_NOT_EQUAL(dirbuf[i], NULL, dirbuf[i], EXIT2); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = closedir(dirbuf[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = rmdir(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - closedir(dirbuf[i]); - } -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - rmdir(pathname[i]); - } - -EXIT: - rmdir(pathname3); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure015(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure015", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_016.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_016.cpp deleted file mode 100644 index a2091611..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_016.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(pathname[i], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1615_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - strcat_s(pathname[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - fd[i] = open(pathname[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - - len = write(fd[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - len = read(fd[i], readbuf, 45); // read length: 45 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } - -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname[i]); - } - -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure016(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure016", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_017.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_017.cpp deleted file mode 100644 index cf43972d..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_017.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1616_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - strcat_s(pathname[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - - fd[i] = open(pathname[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(fd[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname[i]); - } -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure017(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure017", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_018.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_018.cpp deleted file mode 100644 index b69073cb..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_018.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1617_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - strcat_s(pathname[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - - fd[i] = open(pathname[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT); - - len = write(fd[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - } - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - } - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unlink(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname[i]); - } -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure018(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure018", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_019.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_019.cpp deleted file mode 100644 index 96f5f4c3..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_019.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname1[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR bufname2[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(pathname3, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - snprintf_s(bufname1, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, bufname1); - strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, pathname2); - strcpy_s(pathname4[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname4[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, ".txt"); - strcpy_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, pathname3); - - fd[i] = open(pathname5[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(fd[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(fd[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - } - } - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - off = lseek(fd[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - len = read(fd[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT2); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname5[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - unlink(pathname5[i]); - rmdir(pathname4[i]); - } -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure019(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure019", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_020.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_020.cpp deleted file mode 100644 index cf057b21..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_020.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(pathname[i], JFFS_NAME_LIMITTED_SIZE, 0, strlen(pathname[i])); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1616_%d", i); - JffsStrcat2(pathname2, bufname, strlen(pathname2)); - strcat_s(pathname[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - - fd[i] = open(pathname[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(pathname[i]); - } -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure020(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure020", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_021.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_021.cpp deleted file mode 100644 index 5f96fee6..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_021.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname1[JFFS_SHORT_ARRAY_LENGTH] = ""; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(pathname4[i], JFFS_NAME_LIMITTED_SIZE, 0, strlen(pathname4[i])); - memset_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, 0, strlen(pathname5[i])); - } - memset_s(pathname2, JFFS_NAME_LIMITTED_SIZE, 0, strlen(pathname2)); - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, pathname1); - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(pathname3, JFFS_NAME_LIMITTED_SIZE, 0, strlen(pathname3)); - - snprintf_s(bufname1, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, bufname1); - strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, pathname2); - strcpy_s(pathname4[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname4[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, ".txt"); - strcpy_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, pathname3); - - fd[i] = open(pathname5[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname5[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - LosTaskDelay(10); // delay time: 10 - } - LosTaskDelay(100); // delay time: 100 - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - close(fd[i]); - } -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - unlink(pathname5[i]); - rmdir(pathname4[i]); - } - -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure021(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure021", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_022.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_022.cpp deleted file mode 100644 index 1c413860..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_022.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[70] = "1111111111222222222233333333334444444444555555555566666666667777"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - struct stat statfile; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1621.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - for (i = 0; i < 16 * 1024; i++) { // loop times: 16 * 1024 - errno = 0; - ret = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(ret, strlen(filebuf), ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (strlen(filebuf) * (i + 1)), off, EXIT2); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1111111111222222222233333333334444444444555555555566666666667777", readbuf, - EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // file size: 1024 * 1024 - ICUNIT_GOTO_EQUAL(statfile.st_size, 1024 * 1024, statfile.st_size, EXIT2); - - printf("[%d] cycle:%d errno:%d\n", __LINE__, j, errno); - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure022(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure022", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp deleted file mode 100644 index 842ed161..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_023.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - INT32 jffsPressureCycles = 4; // write size 4 * 1024 * 1024 - signed long long offset; - - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, 0); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - strcat_s(bufW, bufWLen + 1, bufW1); - } - - free(bufW1); - free(bufW2); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - JffsStatPrintf(buf1); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1622.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - for (j = 0; j < jffsPressureCycles; j++) { - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - for (i = 0; i < jffsPressureCycles; i++) { - ret = write(fd, bufW, strlen(bufW)); - printf("cnt=%d %d\n", i, j); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - } - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // file size: 4 * 1024 * 1024 - ICUNIT_GOTO_EQUAL(statfile.st_size, 4 * 1024 * 1024, statfile.st_size, EXIT2); - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - free(bufW1); -EXIT2: - free(bufW); - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure023(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure023", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_024.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_024.cpp deleted file mode 100644 index bb949540..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_024.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, 0); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - JffsStatPrintf(buf1); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/1623.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - for (j = 0; j < 1; j++) { - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - for (i = 0; i < 100; i++) { // loop times: 100 - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); // file position: 64 - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 100 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 100 * 1024 * 1024, statfile.st_size, EXIT2); - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - free(bufW1); -EXIT2: - free(bufW); - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure024(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure024", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_025.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_025.cpp deleted file mode 100644 index ab8015a6..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_025.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - static INT32 count = 0; - signed long long offset; - - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333 333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = "123"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_SHORT_ARRAY_LENGTH][JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 even = 2; - - struct stat statfile; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(pathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(pathname3[i], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(pathname4[i], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - - strcpy_s(pathname2, JFFS_STANDARD_NAME_LENGTH, pathname1); - snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/1623_%d.txt", i); - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - strcat_s(pathname3[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - - memset_s(pathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strcpy_s(pathname2, JFFS_STANDARD_NAME_LENGTH, pathname1); - snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/test_%d.c", i); - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - strcat_s(pathname4[i], JFFS_STANDARD_NAME_LENGTH, pathname2); - - fd[i] = open(pathname3[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - if ((j % even) == 0) { - ret = rename(pathname3[i], pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } else { - ret = rename(pathname4[i], pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - } - - if ((j % even) == 0) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = unlink(pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } else { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = unlink(pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - remove(pathname3[i]); - remove(pathname4[i]); - } -EXIT: - chdir(JFFS_MAIN_DIR0); - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure025(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure025", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp deleted file mode 100644 index c0075f20..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_026.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - signed long long offset; - - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333 333"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = "123"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - off_t off; - struct stat statfile; - INT32 even = 2; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/test%d", i); - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, bufname); - - strcpy_s(pathname3[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - - ret = mkdir(pathname3[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcpy_s(pathname4[i], JFFS_NAME_LIMITTED_SIZE, pathname3[i]); - strcat_s(pathname4[i], JFFS_NAME_LIMITTED_SIZE, ".txt"); - - strcpy_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, pathname3[i]); - strcat_s(pathname5[i], JFFS_NAME_LIMITTED_SIZE, ".c"); - - fd[i] = open(pathname4[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT3); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - for (j = 0; j < JFFS_PRESSURE_CYCLES; j++) { - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - if ((j % even) == 0) { - ret = rename(pathname4[i], pathname5[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } else { - ret = rename(pathname5[i], pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - } - - if ((j % even) == 0) { - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = unlink(pathname4[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } else { - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = unlink(pathname5[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname3[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[i]); - } -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - remove(pathname4[i]); - remove(pathname5[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - remove(pathname3[i]); - } -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure026(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure026", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_027.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_027.cpp deleted file mode 100644 index a6960abd..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_027.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, scandirCount1, scandirCount2; - INT64 i; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - struct timeval testTime1; - struct timeval testTime2; - struct dirent **namelist = NULL; - DOUBLE mountSpeed; - - totalTime = 0; - totalSize = 0; - - scandirCount1 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount1 >= 0) { - JffsScandirFree(namelist, scandirCount1); - } - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - gettimeofday(&testTime1, 0); - - ret = umount(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - dprintf("the size:%lld th,umount/mount cost %lld us \n", i, perTime); - } - - totalSize = i; - - mountSpeed = totalSize * 1.0; - mountSpeed = totalTime / mountSpeed; - - dprintf("total_size %lld,cost %lld us, speed: %0.3lf us/Size\n", totalSize, totalTime, mountSpeed); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - scandirCount2 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount2 >= 0) { - JffsScandirFree(namelist, scandirCount2); - } - - ICUNIT_GOTO_EQUAL(scandirCount1, scandirCount2, scandirCount2, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure027(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure027", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_028.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_028.cpp deleted file mode 100644 index 12c9460c..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_028.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, scandirCount1, scandirCount2; - INT64 i, j; - INT64 writeCount = 0; - INT64 readCount = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 fileLen = 2 * BYTES_PER_KBYTE; // 2 KB - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - struct timeval testTime1; - struct timeval testTime2; - struct dirent **namelist = NULL; - DOUBLE mountSpeed; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, 0); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - for (i = 0; i < fileLen / (INT32)bufW; i++) { - ret = write(fd, bufW, strlen(filebuf)); - writeCount++; - } - - free(bufW); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = statfs(JFFS_MAIN_DIR0, &buf3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatfsPrintf(buf3); - - totalTime = 0; - totalSize = 0; - - scandirCount1 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount1 >= 0) { - JffsScandirFree(namelist, scandirCount1); - } - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - gettimeofday(&testTime1, 0); - - ret = umount(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - dprintf("the size:%lld th,umount/mount cost %lld us \n", i, perTime); - } - - totalSize = i; - - mountSpeed = totalSize * 1.0; - mountSpeed = totalTime / mountSpeed; - - dprintf("total_size %lld,cost %lld us, speed: %0.3lf us/Size\n", totalSize, totalTime, mountSpeed); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - scandirCount2 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount2 >= 0) { - JffsScandirFree(namelist, scandirCount2); - } - - ICUNIT_GOTO_EQUAL(scandirCount1, scandirCount2, scandirCount2, EXIT); - - fd = open(pathname1, O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - do { - ret = read(fd, filebuf, 1); // read length: 1 - readCount++; - } while (ret == 1); - - readCount--; - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = statfs(JFFS_MAIN_DIR0, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatfsPrintf(buf2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = statfs(JFFS_MAIN_DIR0, &buf3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatfsPrintf(buf3); - - return JFFS_NO_ERROR; -EXIT4: - free(bufW1); -EXIT3: - free(bufW); - goto EXIT1; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure028(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure028", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_029.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_029.cpp deleted file mode 100644 index 96ecfff7..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_029.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, scandirCount1, scandirCount2; - INT64 i, j; - INT64 writeCount = 0; - INT64 readCount = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - struct timeval testTime1; - struct timeval testTime2; - struct dirent **namelist = NULL; - DOUBLE mountSpeed; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - off_t off; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL(bufW, NULL, 0); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - while (writeCount < 100) { // loop times: 100 - ret = write(fd, bufW, strlen(bufW)); - dprintf("write_count=:%lld\n", writeCount); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT3); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (writeCount + 1)), off, EXIT1); - - writeCount++; - } - - free(bufW); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = statfs(JFFS_MAIN_DIR0, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatfsPrintf(buf3); - - totalTime = 0; - totalSize = 0; - - scandirCount1 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount1 >= 0) { - JffsScandirFree(namelist, scandirCount1); - } - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - gettimeofday(&testTime1, 0); - - ret = umount(pathname2); - if (ret != 0) { - dprintf("umount jffs is error\n"); - goto EXIT2; - } - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - if (ret != 0) { - dprintf("mount jffs is error\n"); - goto EXIT2; - } - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - dprintf("the size:%lld th,umount/mount cost %lld us \n", i, perTime); - } - - totalSize = i; - - mountSpeed = totalSize * 1.0; - mountSpeed = totalTime / mountSpeed; - - dprintf("total_size %lld,cost %lld us, speed: %0.3lf us/Size\n", totalSize, totalTime, mountSpeed); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - scandirCount2 = scandir(pathname2, &namelist, 0, alphasort); - if (scandirCount2 >= 0) { - JffsScandirFree(namelist, scandirCount2); - } - - ICUNIT_GOTO_EQUAL(scandirCount1, scandirCount2, scandirCount2, EXIT); - - fd = open(pathname1, O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 100 * 1024 * 1024, off, EXIT1); // 100 * 1024 * 1024: filesize - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = statfs(JFFS_MAIN_DIR0, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatfsPrintf(buf2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = statfs(JFFS_MAIN_DIR0, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - JffsStatfsPrintf(buf3); - - return JFFS_NO_ERROR; -EXIT4: - free(bufW1); -EXIT3: - free(bufW); - goto EXIT1; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure029(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure029", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_030.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_030.cpp deleted file mode 100644 index af7a8247..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_030.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 i = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, pathname); - strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, pathname); - strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, "/"); - strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, "/"); - - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "AAAA%d", i); - strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, bufname); - - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "BBBB%d", i); - strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, bufname); - - ret = mkdir(g_jffsPathname11[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = rmdir(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; - -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - rmdir(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 even = 2; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - for (i = 0; i < JFFS_MAXIMUM_OPERATIONS; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - if (i % even == 0) { - ret = rename(g_jffsPathname11[j], g_jffsPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } else { - ret = rename(g_jffsPathname12[j], g_jffsPathname11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - } - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT); // even number: 2 - - g_jffsFlagF02++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - rmdir(g_jffsPathname12[i]); - } -EXIT: - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - rmdir(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag:=%d\t", g_jffsFlag); - } - dprintf("\n"); - - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure030(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure030", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_031.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_031.cpp deleted file mode 100644 index 0f576e65..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_031.cpp +++ /dev/null @@ -1,287 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 dirCount1 = 0; - INT32 dirCount2 = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - memset_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, pathname1); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - - strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, bufname); - strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - - ret = mkdir(g_jffsPathname11[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dirCount1++; - } - ICUNIT_GOTO_EQUAL(dirCount1, JFFS_SHORT_ARRAY_LENGTH, dirCount1, EXIT); - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - - len = write(g_jffsFd11[i], filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT); - - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT); - - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(g_jffsPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - close(g_jffsFd11[i]); - unlink(g_jffsPathname12[i]); - } -EXIT: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - rmdir(g_jffsPathname11[i]); - } - g_TestCnt++; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - off_t off; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF02++; - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname11[i]); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, ".txt"); - strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname7); - - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT); - } - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT); - - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcdeabcde", readbuf, EXIT); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - LosTaskDelay(2); // delay time: 2 - - g_TestCnt++; - - return NULL; -EXIT: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - close(g_jffsFd11[i]); - unlink(g_jffsPathname12[i]); - } - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - g_TestCnt++; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - UINT64 start, end; - INT32 priority = 20; - INT32 testNum = 4; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - while (g_TestCnt != testNum) { - LosTaskDelay(1); // delay time: 1 - } - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure031(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure031", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_032.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_032.cpp deleted file mode 100644 index d10d8b3d..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_032.cpp +++ /dev/null @@ -1,280 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - INT32 fileCount1 = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, pathname1); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".txt"); - strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname2); - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT1); - - if (i % JFFS_SHORT_ARRAY_LENGTH == JFFS_SHORT_ARRAY_LENGTH - 1) { - for (k = (i / JFFS_SHORT_ARRAY_LENGTH) * JFFS_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_jffsFd11[k]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - } - } - - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT1); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT1); - - off = lseek(g_jffsFd11[i], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * 1024, off, EXIT1); // file size: 1 * 1024 - - if (i % JFFS_SHORT_ARRAY_LENGTH == JFFS_SHORT_ARRAY_LENGTH - 1) { - for (k = (i / JFFS_SHORT_ARRAY_LENGTH) * JFFS_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_jffsFd11[k]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = unlink(g_jffsPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR *bufW = NULL; - off_t off; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT1); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (j = 0; j < bufWLen / strlen(filebuf); j++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT2); - - len = read(g_jffsFd11[i], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(g_jffsFd11[i], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT2); - - if (i % JFFS_SHORT_ARRAY_LENGTH == JFFS_SHORT_ARRAY_LENGTH - 1) { - for (k = (i / JFFS_SHORT_ARRAY_LENGTH) * JFFS_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_jffsFd11[k]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - } - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT2); // even number: 2 - - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - UINT64 start, end; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(1); // delay time: 1 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure032(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure032", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp deleted file mode 100644 index 04498908..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_033.cpp +++ /dev/null @@ -1,350 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -static INT32 g_testNum = 100; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[101] = "liteos"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start first get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, pathname1); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname2); - strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, ".cpp"); - - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".txt"); - strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname2); - - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT3); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - len = write(g_jffsFd11[i], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT3); - } - - free(bufW); - - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT2); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start second get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - g_jffsFd11[i] = open(g_jffsPathname11[i], O_NONBLOCK | O_APPEND | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT2); - } - memset_s(writebuf, sizeof(writebuf), 0, strlen(writebuf)); - - for (i = 0; i < g_testNum; i++) { - strcat_s(writebuf, sizeof(writebuf), "a"); - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - len = write(g_jffsFd11[j], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(10); // delay time: 10 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start third get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - errno = 0; - ret = unlink(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT3: - free(bufW); -EXIT2: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname11[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - off_t off; - INT32 bufRSize = 6074; // 6074: read length - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start frist get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - bufR = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT3); - memset_s(bufR, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - len = read(g_jffsFd11[i], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(g_jffsFd11[i], bufR, BYTES_PER_KBYTE); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT3); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = rename(g_jffsPathname12[i], g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT3); // even number: 2 - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(5); // delay time: 5 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start second get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufR = (CHAR *)malloc(bufRSize); - ICUNIT_TRACK_NOT_EQUAL(bufR, NULL, 0); - memset_s(bufR, bufRSize, 0, bufRSize); - - for (i = 0; i < g_testNum; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(g_jffsFd11[j], bufR, bufRSize + 1); - ICUNIT_GOTO_EQUAL(len, bufRSize, len, EXIT3); - } - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - g_jffsFlagF02++; - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT3); // even number: 2 - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT3: - free(bufR); -EXIT2: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname11[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(100); // delay time: 100 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag:=%d\t", g_jffsFlag); - } - - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure033(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure033", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_034.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_034.cpp deleted file mode 100644 index e53c40e0..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_034.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -static INT32 g_testNum = 100; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[101] = "liteos"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT1); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, pathname1); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".txt"); - strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname2); - - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT2); - } - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - len = write(g_jffsFd11[i], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT2); - } - - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT2); // even number: 2 - - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - memset_s(writebuf, sizeof(writebuf), 0, strlen(writebuf)); - - for (i = 0; i < g_testNum; i++) { - strcat_s(writebuf, sizeof(writebuf), "a"); - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd11[j] = open(g_jffsPathname12[j], O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT1); - - len = write(g_jffsFd11[j], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(5); // delay time: 5 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - ret = unlink(g_jffsPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[101] = "liteos"; - CHAR *bufR = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - bufR = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT2); - memset_s(bufR, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(g_jffsFd11[i], bufR, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT2); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT2); // even number: 2 - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < g_testNum; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd11[j] = open(g_jffsPathname12[j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT1); - - off = lseek(g_jffsFd11[j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(g_jffsFd11[j], readbuf, 101); // read length: 101 - ICUNIT_GOTO_EQUAL(len, 100, len, EXIT1); // read length: 100 - } - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - g_jffsFlagF02++; - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT1); // even number: 2 - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT2: - free(bufR); -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(g_jffsFd11[i]); - } -EXIT: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority1 = 18; - INT32 priority2 = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag:=%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure034(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure034", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_035.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_035.cpp deleted file mode 100644 index 118c2fb6..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_035.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -static INT32 g_testNum = 100; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[101] = "liteos"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = "/storage/jffs_035"; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 1\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - strcat_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, pathname1); - strcat_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, bufname); - strcat_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, ".txt"); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, pathname2); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".txt"); - strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname1); - strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname2); - - g_jffsFd11[i] = open(g_jffsPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT3); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - len = write(g_jffsFd11[i], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT3); - } - - ICUNIT_GOTO_NOT_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT3); // even number: 2 - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 2\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - memset_s(writebuf, sizeof(writebuf), 0, strlen(writebuf)); - - for (i = 0; i < g_testNum; i++) { - errno = 0; - strcat_s(writebuf, sizeof(writebuf), "a"); - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - - len = write(g_jffsFd11[j], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(15); // delay time: 15 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 3\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = unlink(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_jffsFlag++; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - return NULL; -EXIT3: - free(bufW); -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(g_jffsPathname11[i]); - } -EXIT: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - mkdir(pathname2, HIGHEST_AUTHORITY); - remove(pathname1); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[101] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = "/storage/jffs_035"; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufR = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start get lock 1\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF02++; - - bufR = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT3); - memset_s(bufR, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - len = read(g_jffsFd11[i], readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - off = lseek(g_jffsFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT3); - - len = read(g_jffsFd11[i], bufR, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT3); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rename(pathname2, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT3); // even number: 2 - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(10); // delay time: 10 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start get lock 2\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < g_testNum; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - errno = 0; - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - - off = lseek(g_jffsFd11[j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = read(g_jffsFd11[j], readbuf, 101); // read length: 101 - ICUNIT_GOTO_EQUAL(len, 100, len, EXIT2); // read length: 100 - - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - ICUNIT_GOTO_EQUAL((g_TestCnt % 2), 0, g_TestCnt, EXIT2); // even number: 2 - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - return NULL; -EXIT3: - free(bufR); -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(g_jffsPathname11[i]); - } -EXIT: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - unlink(g_jffsPathname12[i]); - } - g_TestCnt = 0; - remove(pathname1); - mkdir(pathname2, HIGHEST_AUTHORITY); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - void *tret = NULL; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(100); // delay time: 100 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag:=%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure035(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure035", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_036.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_036.cpp deleted file mode 100644 index e06a6912..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_036.cpp +++ /dev/null @@ -1,369 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static CHAR g_jffs1647Pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_MAXIMUM_SIZES][JFFS_STANDARD_NAME_LENGTH] = {0}; -static CHAR g_jffs1647Pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_MAXIMUM_SIZES][JFFS_STANDARD_NAME_LENGTH] = {0}; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876547210abcdeabcde0123456789abcedfghij9876547210abcdeabcde0123" - "456789abcedfghij9876547210abcdeabcde0123456789abcedfghij9876547210abcdeabcde0123456789abcedfgh" - "ij9876547210abcdeabcde0123456789abcedfghij9876547210lalalalalalalala"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - INT32 bufLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - memset_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - strcat_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, pathname1); - strcat_s(g_jffsPathname1, JFFS_STANDARD_NAME_LENGTH, bufname); - strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname1); - - ret = mkdir(g_jffsPathname11[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufW = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT3); - memset_s(bufW, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < bufLen / strlen(filebuf); i++) { - strcat_s(bufW, bufLen + 1, filebuf); - } - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd12[i][j] = open(g_jffs1647Pathname4[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT4); - - len = write(g_jffsFd12[i][j], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT4); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - } - } - - free(bufW); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(5); // delay time: 5 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufR = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT3); - memset_s(bufR, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd12[i][j] = open(g_jffs1647Pathname5[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT5); - - off = lseek(g_jffsFd12[i][j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT5); - - len = read(g_jffsFd12[i][j], bufR, bufLen + 1); - ICUNIT_GOTO_EQUAL(len, bufLen, len, EXIT5); - - ret = close(g_jffsFd12[i][k]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); - } - } - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - g_jffsFlag++; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT5: - free(bufR); - goto EXIT3; -EXIT4: - free(bufW); -EXIT3: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT2: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1647Pathname5[i][j]); - } - } -EXIT1: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1647Pathname4[i][j]); - } - } -EXIT: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(g_jffs1647Pathname4[i][j], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(g_jffs1647Pathname5[i][j], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - strcat_s(g_jffsPathname2, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname11[i]); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".txt"); - strcpy_s(g_jffs1647Pathname4[i][j], JFFS_STANDARD_NAME_LENGTH, g_jffsPathname2); - - memset_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strcat_s(g_jffsPathname2, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname11[i]); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, bufname); - strcat_s(g_jffsPathname2, JFFS_STANDARD_NAME_LENGTH, ".cpp"); - strcpy_s(g_jffs1647Pathname5[i][j], JFFS_STANDARD_NAME_LENGTH, g_jffsPathname2); - - g_jffsFd12[i][j] = open(g_jffs1647Pathname4[i][j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, - HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT1); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - ret = rename(g_jffs1647Pathname4[i][j], g_jffs1647Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - ret = unlink(g_jffs1647Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - g_jffsFlagF02++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT3: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT2: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1647Pathname5[i][j]); - } - } -EXIT1: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1647Pathname4[i][j]); - } - } -EXIT: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(1); // delay time: 1 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure036(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure036", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_037.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_037.cpp deleted file mode 100644 index ebd57831..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_037.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static CHAR g_jffs1648Pathname4[5][JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE] = {0}; -static CHAR g_jffs1648Pathname5[5][JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE] = {0}; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123" - "456789abcedfghij9876548210abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123456789abcedfgh" - "ij9876548210abcdeabcde0123456789abcedfghij9876548210lalalalalalalala"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - memset_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, pathname1); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, bufname); - strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - - ret = mkdir(g_jffsPathname11[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd12[i][j] = open(g_jffs1648Pathname4[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT3); - - len = write(g_jffsFd12[i][j], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT3); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - } - } - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(5); // delay time: 5 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufR = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT2); - memset_s(bufR, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - g_jffsFd12[i][j] = open(g_jffs1648Pathname5[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT4); - - off = lseek(g_jffsFd12[i][j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT4); - - len = read(g_jffsFd12[i][j], bufR, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT4); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - } - } - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = JFFS_MAX_CYCLES - 1; i >= 0; i--) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - ret = unlink(g_jffs1648Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT4: - free(bufR); - goto EXIT2; -EXIT3: - free(bufW); -EXIT2: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT1: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1648Pathname4[i][j]); - } - } -EXIT: - for (i = JFFS_MAX_CYCLES - 1; i >= 0; i--) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1648Pathname5[i][j]); - } - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123" - "456789abcedfghij9876548210abcdeabcde0123456789abcedfghij9876548210abcdeabcde0123456789abcedfgh" - "ij9876548210abcdeabcde0123456789abcedfghij9876548210lalalalalalalala"; - CHAR readbuf[101] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF02++; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - memset_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname8, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffs1648Pathname4[i][j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffs1648Pathname5[i][j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname11[i]); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, bufname); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, ".txt"); - strcpy_s(g_jffs1648Pathname4[i][j], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname7); - - strcat_s(g_jffsPathname8, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname11[i]); - strcat_s(g_jffsPathname8, JFFS_NAME_LIMITTED_SIZE, bufname); - strcat_s(g_jffsPathname8, JFFS_NAME_LIMITTED_SIZE, ".cpp"); - strcpy_s(g_jffs1648Pathname5[i][j], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname8); - g_jffsFd12[i][j] = open(g_jffs1648Pathname4[i][j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, - HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT2); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - ret = rename(g_jffs1648Pathname4[i][j], g_jffs1648Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT2: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT1: - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1648Pathname4[i][j]); - } - } -EXIT: - for (i = JFFS_MAX_CYCLES - 1; i >= 0; i--) { - for (j = 0; j < JFFS_MAXIMUM_SIZES; j++) { - unlink(g_jffs1648Pathname5[i][j]); - } - remove(g_jffsPathname11[i]); - } - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority1 = 18; - INT32 priority2 = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure037(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure037", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_038.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_038.cpp deleted file mode 100644 index df343bf1..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_038.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123" - "456789abcedfghij9876549210abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123456789abcedfgh" - "ij9876549210abcdeabcde0123456789abcedfghij9876549210lalalalalalalala"; - CHAR writebuf[200] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - memset_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, pathname1); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, pathname1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname13[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, bufname); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, bufname); - strcpy_s(g_jffsPathname13[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, "A"); - strcpy_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname7); - - if (i == 0) { - strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname12[i]); - } else { - strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname13[i]); - strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, "A"); - } - - ret = mkdir(g_jffsPathname13[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = rmdir(g_jffsPathname13[i]); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH - 1; i++) { - ret = rmdir(g_jffsPathname12[i]); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = rmdir(g_jffsPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - return NULL; -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - remove(g_jffsPathname12[i]); - remove(g_jffsPathname13[i]); - } -EXIT: - remove(JFFS_PATH_NAME0); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - UINT32 len; - INT32 dirCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123" - "456789abcedfghij9876549210abcdeabcde0123456789abcedfghij9876549210abcdeabcde0123456789abcedfgh" - "ij9876549210abcdeabcde0123456789abcedfghij9876549210lalalalalalalala"; - CHAR readbuf[101] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF02++; - - for (j = JFFS_SHORT_ARRAY_LENGTH - 1; j >= 0; j--) { - ret = rename(g_jffsPathname13[j], g_jffsPathname11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - return NULL; - -EXIT: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - remove(g_jffsPathname12[i]); - remove(g_jffsPathname13[i]); - } - remove(JFFS_PATH_NAME0); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(1); // delay time: 1 - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure038(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure038", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_039.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_039.cpp deleted file mode 100644 index 4d00a1f0..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_039.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static CHAR g_jffs1650Pathname4[JFFS_SHORT_ARRAY_LENGTH][JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; -static CHAR g_jffs1650Pathname5[JFFS_SHORT_ARRAY_LENGTH][JFFS_SHORT_ARRAY_LENGTH][JFFS_NAME_LIMITTED_SIZE] = {0}; -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - off_t off; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR writebuf[200] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 1\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - memset_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, pathname1); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - memset_s(g_jffs1650Pathname4[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffs1650Pathname5[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - strcat_s(g_jffsPathname6, JFFS_NAME_LIMITTED_SIZE, bufname); - strcpy_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - - ret = mkdir(g_jffsPathname11[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - memset_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, bufname); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, ".txt"); - strcpy_s(g_jffs1650Pathname4[i][j], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname7); - - memset_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, g_jffsPathname6); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, bufname); - strcat_s(g_jffsPathname7, JFFS_NAME_LIMITTED_SIZE, ".cpp"); - strcpy_s(g_jffs1650Pathname5[i][j], JFFS_NAME_LIMITTED_SIZE, g_jffsPathname7); - - g_jffsFd12[i][j] = open(g_jffs1650Pathname4[i][j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, - HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT1); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 2\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufR = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT1); - memset_s(bufR, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - g_jffsFd12[i][j] = open(g_jffs1650Pathname4[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT2); - - len = read(g_jffsFd12[i][j], bufR, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT2); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Start get lock 3\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - return NULL; -EXIT2: - free(bufR); -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - for (j = JFFS_SHORT_ARRAY_LENGTH - 1; j >= 0; j--) { - remove(g_jffs1650Pathname4[i][j]); - remove(g_jffs1650Pathname5[i][j]); - } - - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd1, ret; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - UINT32 len; - INT32 fileCount2 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR readbuf[101] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start get lock 1\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT1); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (j = 0; j < bufWLen / strlen(filebuf); j++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - g_jffsFd12[i][j] = open(g_jffs1650Pathname4[i][j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd12[i][j], -1, g_jffsFd12[i][j], EXIT2); - - len = write(g_jffsFd12[i][j], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT2); - - ret = close(g_jffsFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - } - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start get lock 2\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - ret = rename(g_jffs1650Pathname4[i][j], g_jffs1650Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Start get lock 3\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - for (j = JFFS_SHORT_ARRAY_LENGTH - 1; j >= 0; j--) { - ret = remove(g_jffs1650Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - g_jffsFlagF02++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - close(g_jffsFd12[i][j]); - } - } -EXIT: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - for (j = JFFS_SHORT_ARRAY_LENGTH - 1; j >= 0; j--) { - remove(g_jffs1650Pathname4[i][j]); - remove(g_jffs1650Pathname5[i][j]); - } - remove(g_jffsPathname11[i]); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 fd[JFFS_SHORT_ARRAY_LENGTH]; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure039(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure039", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_040.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_040.cpp deleted file mode 100644 index 27585e10..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_040.cpp +++ /dev/null @@ -1,341 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - INT32 dirCount = 0; - INT32 dirCount1 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufR = NULL; - CHAR *bufW = NULL; - INT32 bufLen = 2 * BYTES_PER_KBYTE; // 2 KB - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, pathname); - strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, pathname); - strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, "/"); - strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, "/"); - - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "AAAA%d", i); - strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, bufname); - - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "BBBB%d", i); - strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, bufname); - - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "%d", i); - strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, bufname); - strcat_s(g_jffsPathname12[i], JFFS_NAME_LIMITTED_SIZE, bufname); - - g_jffsFd11[i] = open(g_jffsPathname11[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufR = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT2); - memset_s(bufR, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - g_jffsFd11[i] = open(g_jffsPathname11[i], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT3); - - ret = read(g_jffsFd11[i], bufR, bufLen + 1); - ICUNIT_GOTO_EQUAL(ret, bufLen, ret, EXIT3); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - free(bufR); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - bufR = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR, NULL, 0, EXIT2); - memset_s(bufR, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - g_jffsFd11[i] = open(g_jffsPathname11[i], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT3); - - ret = read(g_jffsFd11[i], bufR, bufLen); - ICUNIT_GOTO_EQUAL(ret, bufLen, ret, EXIT3); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - free(bufR); - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(1); // delay time: 1 - - return NULL; -EXIT3: - free(bufR); -EXIT2: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - remove(g_jffsPathname12[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 dirCount = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 2 * BYTES_PER_KBYTE; // 2 KB - - g_TestCnt++; - g_jffsFlagF02++; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - g_jffsFd11[i] = open(g_jffsPathname11[i], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[i], -1, g_jffsFd11[i], EXIT3); - - len = write(g_jffsFd11[i], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT3); - - ret = close(g_jffsFd11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - for (j = 0; j < JFFS_SHORT_ARRAY_LENGTH; j++) { - if (j % 2 == 0) { // even number: 2 - ret = rename(g_jffsPathname11[i], g_jffsPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } else { - ret = rename(g_jffsPathname12[i], g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - } - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - return NULL; -EXIT3: - free(bufW); -EXIT2: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - close(g_jffsFd11[i]); - } -EXIT1: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - remove(g_jffsPathname12[i]); - } -EXIT: - for (i = 0; i < JFFS_MAXIMUM_SIZES; i++) { - remove(g_jffsPathname11[i]); - } - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(1); // delay time: 1 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag:=%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure040(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure040", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_041.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_041.cpp deleted file mode 100644 index f1feef74..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_041.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - INT32 dirCount1 = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - off_t off; - INT32 fileNum = 4; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 first get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (j = 0; j < fileNum; j++) { - memset_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname13[j], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, pathname); - strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, pathname); - strcat_s(g_jffsPathname13[j], JFFS_NAME_LIMITTED_SIZE, pathname); - - strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, bufname); - strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, bufname); - strcat_s(g_jffsPathname13[j], JFFS_NAME_LIMITTED_SIZE, bufname); - - strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, ".txt"); - strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, ".cpp"); - strcat_s(g_jffsPathname13[j], JFFS_NAME_LIMITTED_SIZE, ".jpg"); - - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 second get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - errno = 0; - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * 1024, off, EXIT2); // file size: 1 * 1024 - } - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - } - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < JFFS_MAXIMUM_OPERATIONS; j++) { - ret = umount(JFFS_MAIN_DIR0); - printf("[%d] umount:%s,\n", __LINE__, JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - printf("[%d] mount:%s,\n", __LINE__, JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); - } - ret = chdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - printf("[%d] Thread1 Start third get lock\n", __LINE__); - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 third get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < JFFS_MAXIMUM_OPERATIONS; j++) { - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); - } - - ret = chdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - ret = access(g_jffsPathname13[j], F_OK); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - remove(g_jffsPathname13[j]); - } -EXIT: - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 fileCount = 0; - UINT64 len; - CHAR bufname[15] = "01234567890"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufR[JFFS_SHORT_ARRAY_LENGTH] = "abcde"; - CHAR writebuf[JFFS_SHORT_ARRAY_LENGTH] = "a"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW = NULL; - off_t off; - INT32 fileNum = 4; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 first get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (j = 0; j < fileNum; j++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - g_TestCnt++; - - for (j = 0; j < fileNum; j++) { - len = write(g_jffsFd11[j], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT3); - } - - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 second get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - errno = 0; - ret = rename(g_jffsPathname11[j], g_jffsPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - } - - for (j = 0; j < fileNum; j++) { - ret = rename(g_jffsPathname12[j], g_jffsPathname13[j]); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 third get lock\n", __LINE__); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - g_jffsFd11[j] = open(g_jffsPathname13[j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * 1024, off, EXIT2); // file size: 1 * 1024 - } - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = unlink(g_jffsPathname13[j]); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1); - } - - g_jffsFlagF02++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - return NULL; -EXIT3: - free(bufW); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - remove(g_jffsPathname13[j]); - } -EXIT: - g_TestCnt = 0; - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW1 = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(50); // delay time: 50 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - - return LOS_OK; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return LOS_OK; -} - -VOID ItFsJffsPressure041(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure041", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_042.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_042.cpp deleted file mode 100644 index e21cc5f1..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_042.cpp +++ /dev/null @@ -1,356 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = "/storage/jffs_042"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - off_t off; - INT32 fileNum = 4; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (j = 0; j < fileNum; j++) { - memset_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, pathname); - strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, pathname2); - - strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, bufname); - strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, bufname); - - strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, ".txt"); - strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, ".txt"); - - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - printf("[%d] Thread1 second Get lock \n", __LINE__); - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * 1024, off, EXIT2); // file size: 1 * 1024 - } - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < JFFS_MAXIMUM_OPERATIONS; j++) { - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(3); // delay time: 3 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - printf("[%d] Thread1 third Get lock \n", __LINE__); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < JFFS_MAXIMUM_OPERATIONS; j++) { - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - for (j = 0; j < fileNum; j++) { - ret = access(g_jffsPathname12[j], F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - return NULL; -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - } -EXIT: - g_TestCnt = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR bufname[15] = "01234567890"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = "/storage/jffs_042"; - CHAR bufR[JFFS_SHORT_ARRAY_LENGTH] = "abcde"; - CHAR writebuf[JFFS_SHORT_ARRAY_LENGTH] = "a"; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW = NULL; - off_t off; - INT32 fileNum = 4; - INT32 bufWLen = BYTES_PER_KBYTE; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW, NULL, 0, EXIT2); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (j = 0; j < bufWLen / strlen(filebuf); j++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - g_TestCnt++; - - for (j = 0; j < fileNum; j++) { - len = write(g_jffsFd11[j], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT3); - } - - free(bufW); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - printf("[%d] Thread2 second Get lock \n", __LINE__); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - printf("[%d] Thread2 third Get lock \n", __LINE__); - for (j = 0; j < fileNum; j++) { - g_jffsFd11[j] = open(g_jffsPathname12[j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, BYTES_PER_KBYTE, off, EXIT2); - } - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(g_jffsPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_jffsFlagF02++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - return NULL; -EXIT3: - free(bufW); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - } -EXIT: - g_TestCnt = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW1 = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure042(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure042", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_043.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_043.cpp deleted file mode 100644 index b8793e24..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_043.cpp +++ /dev/null @@ -1,408 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf1[JFFS_STANDARD_NAME_LENGTH] = "0123456789LLLLLL"; - CHAR filebuf2[JFFS_STANDARD_NAME_LENGTH] = "aaaaaaaaaaaaaaaa"; - CHAR filebuf3[JFFS_STANDARD_NAME_LENGTH] = "BBBBBBBBBBBBBBBB"; - CHAR *bufR1 = NULL; - CHAR *bufR2 = NULL; - CHAR *bufR3 = NULL; - off_t off; - INT32 fileNum = 3; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - g_jffsFlagF01++; - - for (j = 0; j < fileNum; j++) { - memset_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", j); - strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, pathname); - strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, pathname2); - - strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, bufname); - strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, bufname); - - strcat_s(g_jffsPathname11[j], JFFS_NAME_LIMITTED_SIZE, ".txt"); - strcat_s(g_jffsPathname12[j], JFFS_NAME_LIMITTED_SIZE, ".cpp"); - - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread1 Second Get lock,ret:%d \n", __LINE__, ret); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - bufR1 = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR1, NULL, 0, EXIT2); - memset_s(bufR1, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - bufR2 = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR2, NULL, 0, EXIT3); - memset_s(bufR2, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - bufR3 = (CHAR *)malloc(BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_NOT_EQUAL(bufR3, NULL, 0, EXIT4); - memset_s(bufR3, BYTES_PER_KBYTE + 1, 0, BYTES_PER_KBYTE + 1); - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, BYTES_PER_KBYTE, off, EXIT5); - } - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT5); - } - - j = 0; - len = read(g_jffsFd11[j], bufR1, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - j++; - len = read(g_jffsFd11[j], bufR2, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - j++; - len = read(g_jffsFd11[j], bufR3, BYTES_PER_KBYTE + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - } - - for (j = 0; j < fileNum; j++) { - g_jffsFd11[j] = open(g_jffsPathname11[j], O_NONBLOCK | O_TRUNC | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT5); - } - - j = 0; - len = write(g_jffsFd11[j], bufR2, strlen(bufR2)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - j++; - len = write(g_jffsFd11[j], bufR3, strlen(bufR3)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - j++; - len = write(g_jffsFd11[j], bufR1, strlen(bufR1)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTE, len, EXIT5); - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT5); - } - - free(bufR1); - free(bufR2); - free(bufR3); - - g_jffsFlag++; - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(4); // delay time: 4 - - return NULL; -EXIT5: - free(bufR3); -EXIT4: - free(bufR2); -EXIT3: - free(bufR1); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - } -EXIT: - g_TestCnt = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR bufname[15] = "01234567890"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf1[JFFS_STANDARD_NAME_LENGTH] = "0123456789LLLLLL"; - CHAR filebuf2[JFFS_STANDARD_NAME_LENGTH] = "aaaaaaaaaaaaaaaa"; - CHAR filebuf3[JFFS_STANDARD_NAME_LENGTH] = "BBBBBBBBBBBBBBBB"; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - CHAR *bufW3 = NULL; - off_t off; - INT32 bufWLen = BYTES_PER_KBYTE; - INT32 fileNum = 3; - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 First Get lock,ret:%d \n", __LINE__, ret); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - g_TestCnt++; - - bufW1 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - memset_s(bufW1, bufWLen + 1, 0, bufWLen + 1); - - bufW2 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - memset_s(bufW2, bufWLen + 1, 0, bufWLen + 1); - - bufW3 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW3, NULL, 0, EXIT4); - memset_s(bufW3, bufWLen + 1, 0, bufWLen + 1); - - for (j = 0; j < bufWLen / strlen(filebuf1); j++) { - strcat_s(bufW1, bufWLen + 1, filebuf1); - strcat_s(bufW2, bufWLen + 1, filebuf2); - strcat_s(bufW3, bufWLen + 1, filebuf3); - } - - j = 0; - ret = write(g_jffsFd11[j], bufW1, strlen(bufW1)); - ICUNIT_GOTO_EQUAL(ret, strlen(bufW1), ret, EXIT5); - - j++; - ret = write(g_jffsFd11[j], bufW2, strlen(bufW2)); - ICUNIT_GOTO_EQUAL(ret, strlen(bufW2), ret, EXIT5); - - j++; - ret = write(g_jffsFd11[j], bufW3, strlen(bufW3)); - ICUNIT_GOTO_EQUAL(ret, strlen(bufW3), ret, EXIT5); - - free(bufW1); - free(bufW2); - free(bufW3); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(10); // delay time: 10 - - ret = pthread_mutex_lock(&g_jffs2GlobalLock1); - printf("[%d] Thread2 Second Get lock,ret:%d \n", __LINE__, ret); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - ret = rename(g_jffsPathname11[j], g_jffsPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - for (j = 0; j < JFFS_MAXIMUM_OPERATIONS; j++) { - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT7); - } - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (j = 0; j < fileNum; j++) { - g_jffsFd11[j] = open(g_jffsPathname12[j], O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd11[j], -1, g_jffsFd11[j], EXIT2); - } - - for (j = 0; j < fileNum; j++) { - off = lseek(g_jffsFd11[j], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * 1024, off, EXIT2); // file size: 1 * 1024 - } - - for (j = 0; j < fileNum; j++) { - ret = close(g_jffsFd11[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(g_jffsPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_jffsFlagF02++; - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - - LosTaskDelay(2); // delay time: 2 - - return NULL; -EXIT7: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, "vfat", 0, NULL); - goto EXIT2; -EXIT5: - free(bufW3); -EXIT4: - free(bufW2); -EXIT3: - free(bufW1); -EXIT2: - for (j = 0; j < fileNum; j++) { - close(g_jffsFd11[j]); - } -EXIT1: - for (j = 0; j < fileNum; j++) { - remove(g_jffsPathname11[j]); - remove(g_jffsPathname12[j]); - } -EXIT: - g_TestCnt = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_jffs2GlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufW1 = NULL; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - - g_jffsFlag = 0; - g_jffsFlagF01 = 0; - g_jffsFlagF02 = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - while ((g_jffsFlag < JFFS_PRESSURE_CYCLES) && (g_jffsFlag == g_jffsFlagF01)) { - g_TestCnt = 0; - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay time: 10 - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure043(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure043", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_044.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_044.cpp deleted file mode 100644 index 66974199..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_044.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "LLLLLLLLLL"; - off_t off; - - g_TestCnt++; - - fd = open(pathname, O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - - off = lseek(fd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT); - -EXIT: - close(fd); - g_TestCnt++; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - - g_TestCnt++; - - fd = open(pathname, O_RDONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - -EXIT: - g_TestCnt++; - close(fd); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - INT32 testNum = 4; - - g_jffsFlag = 0; - - ret = access(pathname, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - while (g_jffsFlag < JFFS_PRESSURE_CYCLES) { - g_TestCnt = 0; - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT3); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - while (g_TestCnt != testNum) { - LosTaskDelay(1); // delay time: 1 - } - - g_jffsFlag++; - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - return JFFS_NO_ERROR; -EXIT3: - close(fd); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure044(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure044", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_045.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_045.cpp deleted file mode 100644 index 6ce4488b..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_045.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - g_TestCnt++; - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - sleep(2); // sleep time: 2 - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - return NULL; - -EXIT: - closedir(dir); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - g_TestCnt++; - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - - sleep(3); // sleep time: 3 - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - return NULL; - -EXIT: - closedir(dir); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - INT32 testNum = 4; - - g_jffsFlag = 0; - - ret = access(pathname, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - while (g_jffsFlag < JFFS_PRESSURE_CYCLES) { - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - while (g_TestCnt != testNum) { - LosTaskDelay(1); // delay time: 1 - } - - g_jffsFlag++; - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - return JFFS_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure045(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure045", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_046.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_046.cpp deleted file mode 100644 index f2434ba2..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_046.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "LLLLLLLLLL"; - off_t off = 0; - - g_TestCnt++; - - len = write(g_jffsFd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - - off = lseek(g_jffsFd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT); // file position: 10 - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(g_jffsFd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT); - - g_TestCnt++; - - return NULL; - -EXIT: - close(g_jffsFd); - g_TestCnt++; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "AAAAAAAAAA"; - off_t off = 0; - - g_TestCnt++; - - off = lseek(g_jffsFd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off, 10, off, EXIT); // file position: 10 - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(g_jffsFd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT); // file size: 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "LLLLLLLLLL", readbuf, EXIT); - - len = write(g_jffsFd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT); - - off = lseek(g_jffsFd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off, 20, off, EXIT); // file position: 20 - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(g_jffsFd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT); // file size: 10 - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT); - - g_TestCnt++; - - return NULL; - -EXIT: - close(g_jffsFd); - g_TestCnt++; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "a"; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - pthread_t newTh1, newTh2; - pthread_attr_t attr1, attr2; - INT32 priority = 20; - INT32 testNum = 4; - - g_jffsFlag = 0; - - ret = access(pathname, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - while (g_jffsFlag < JFFS_PRESSURE_CYCLES) { - g_TestCnt = 0; - - g_jffsFd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, JFFS_IS_ERROR, g_jffsFd, EXIT3); - - len = write(g_jffsFd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT3); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(g_jffsFd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT3); - - ret = PosixPthreadInit(&attr1, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - while (g_TestCnt != testNum) { - LosTaskDelay(1); // delay time: 1 - } - - g_jffsFlag++; - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = PosixPthreadDestroy(&attr2, newTh2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("\tjffs_flag=:%d\t", g_jffsFlag); - } - dprintf("\n"); - - ICUNIT_GOTO_EQUAL(g_jffsFlag, JFFS_PRESSURE_CYCLES, g_jffsFlag, EXIT2); - - return JFFS_NO_ERROR; -EXIT3: - close(g_jffsFd); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure046(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure046", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp deleted file mode 100644 index 2e207ae3..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_047.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *writeBuf = NULL; - struct stat64 statbuf1; - off64_t off64; - - writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - memset_s(writeBuf, writeSize, 0x61, writeSize); - - g_jffsFd = open64(pathname1, O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, JFFS_IS_ERROR, g_jffsFd, EXIT1); - - while (1) { - ret = write(g_jffsFd, writeBuf, writeSize); - printf("[%d]write_size: %d write ret:%d Fd:%d \n", __LINE__, writeSize, ret, g_jffsFd); - if (ret <= 0) { - break; - } - g_TestCnt++; - dprintf("write 5M date %d times\n", g_TestCnt); - } - - ret = stat64(pathname1, &statbuf1); - printf("[%d]stat64 ret:%d Fd:%d \n", __LINE__, ret, g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - off64 = lseek64(g_jffsFd, 0, SEEK_END); - printf("[%d]lseek64 off64:%lld Fd:%d \n", __LINE__, off64, g_jffsFd); - ICUNIT_GOTO_EQUAL(statbuf1.st_size, off64, statbuf1.st_size, EXIT1); - - len = write(g_jffsFd, writeBuf, strlen(writeBuf)); - printf("[%d]lseek64 len:%d Fd:%d, errno:%d\n", __LINE__, len, g_jffsFd, errno); - ICUNIT_GOTO_EQUAL(len, JFFS_IS_ERROR, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOSPC, errno, EXIT1); - - off64 = lseek64(g_jffsFd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(statbuf1.st_size, off64, statbuf1.st_size, EXIT1); - - off64 = lseek64(g_jffsFd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off64, statbuf1.st_size - 10, off64, EXIT1); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - free(writeBuf); - - return NULL; -EXIT1: - close(g_jffsFd); -EXIT: - free(writeBuf); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off64_t off64; - pthread_t newTh1; - pthread_attr_t attr1; - struct stat64 statbuf1; - struct stat64 statbuf2; - - g_TestCnt = 0; - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - g_jffsFd = open64(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, JFFS_IS_ERROR, g_jffsFd, EXIT2); - - len = read(g_jffsFd, readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT2); - - ret = PosixPthreadInit(&attr1, TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_join(newTh1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat64(pathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_PRESSURE_CYCLES; i++) { - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - errno = 0; - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat64(pathname1, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(statbuf2.st_size, statbuf1.st_size, statbuf2.st_size, EXIT); - dprintf("\tcycle=:%d\t", i); - } - - g_jffsFd = open64(pathname1, O_RDONLY | O_APPEND, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, JFFS_IS_ERROR, g_jffsFd, EXIT2); - - off64 = lseek64(g_jffsFd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off64, statbuf1.st_size - 10, off64, EXIT); - - len = read(g_jffsFd, readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT2: - close(g_jffsFd); - goto EXIT; -EXIT1: - pthread_join(newTh1, NULL); - pthread_attr_destroy(&attr1); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure047(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure047", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_048.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_048.cpp deleted file mode 100644 index 4aa29943..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_048.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = -1; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - struct stat statbuf1; - struct stat statbuf2; - - g_TestCnt = 0; - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(statbuf1.st_size, 0, statbuf1.st_size, EXIT); - JffsStatPrintf(statbuf1); - - while (i < 1024) { // loop times: 1024 - errno = 0; - memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", i); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - printf("[%d]open cycle:%d name :%s, fd:%d, errno:%d\n", __LINE__, i, pathname3, fd, errno); - if (fd == JFFS_IS_ERROR) { - dprintf("Open the files is the moust:=%d\n", i); - break; - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - } - - for (k = 0; k < JFFS_MAXIMUM_OPERATIONS; k++) { - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = stat(pathname1, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(statbuf2.st_size, statbuf1.st_size, statbuf2.st_size, EXIT1); - - for (j = 0; j < i; j++) { - memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", j); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - - ret = remove(pathname3); - printf("[%d] cycle:%d remove name :%s, errno:%d\n", __LINE__, j, pathname3, errno); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(pathname2, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd); - for (j = 0; j < i; j++) { - memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", j); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - - remove(pathname3); - } -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure048(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure048", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_049.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_049.cpp deleted file mode 100644 index cafd78dc..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_049.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = ""; - struct stat statbuf1; - struct stat statbuf2; - - g_TestCnt = 0; - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(statbuf1.st_size, 0, statbuf1.st_size, EXIT); - - while (i < 100) { // loop times: 100 - memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", i); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - printf("[%d]mkdir cycle:%d name: %s, errno:%d\n", __LINE__, i, pathname3, errno); - if (ret == -1) { - break; - } - - i++; - } - - for (k = 0; k < JFFS_MAXIMUM_OPERATIONS; k++) { - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = stat(pathname1, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(statbuf2.st_size, statbuf1.st_size, statbuf2.st_size, EXIT1); - - for (j = 0; j < i; j++) { - errno = 0; - memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", j); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - - ret = remove(pathname3); - printf("[%d]remove cycle:%d name: %s, errno:%d\n", __LINE__, j, pathname3, errno); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = stat(pathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(statbuf2.st_size, statbuf1.st_size, statbuf2.st_size, EXIT); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - for (j = 0; j < i; j++) { - memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - memset_s(pathname3, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/_%d", j); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, pathname2); - strcat_s(pathname3, JFFS_STANDARD_NAME_LENGTH, bufname); - - remove(pathname3); - } -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure049(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure049", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_050.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_050.cpp deleted file mode 100644 index 33ef4046..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_050.cpp +++ /dev/null @@ -1,198 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *writeBuf = NULL; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - - writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - memset_s(writeBuf, writeSize, (0x61 + (INT32)(INTPTR)arg), writeSize); - - fd = open64(g_jffsPathname11[(INT32)(INTPTR)arg], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - dprintf("(INT32)(INTPTR)arg=:%d,jffs_pathname11=:%s\n", (INT32)(INTPTR)arg, g_jffsPathname11[(INT32)(INTPTR)arg]); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - LosTaskDelay(3); // delay time: 3 - - while (1) { - ret = write(fd, writeBuf, writeSize); - if (ret <= 0) { - break; - } - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_IS_ERROR, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOSPC, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - free(writeBuf); - - return NULL; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len, i; - INT32 fd = -1; - UINT64 toatlSize1, toatlSize2; - UINT64 freeSize1, freeSize2; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off64_t off64; - pthread_attr_t attr; - pthread_t threadId[JFFS_THREAD_NUM_TEST]; - struct statfs statfsbuf1; - struct statfs statfsbuf2; - struct stat64 statbuf; - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - memset_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(bufname, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - snprintf_s(bufname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "_%d", i); - strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, pathname2); - strcat_s(g_jffsPathname11[i], JFFS_NAME_LIMITTED_SIZE, bufname); - } - - g_TestCnt = 0; - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = statfs(pathname1, &statfsbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - toatlSize1 = (UINT64)statfsbuf1.f_bsize * statfsbuf1.f_blocks; - freeSize1 = (UINT64)statfsbuf1.f_bsize * statfsbuf1.f_bfree; - - ret = PosixPthreadInit(&attr, TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAXIMUM_OPERATIONS; i++) { - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - fd = open64(g_jffsPathname11[i], O_RDONLY | O_APPEND, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - ret = stat64(g_jffsPathname11[i], &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - off64 = lseek64(fd, -10, SEEK_END); // seek offset: -10 - ICUNIT_GOTO_EQUAL(off64, statbuf.st_size - 10, off64, EXIT); - - memset_s(readbuf, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(g_jffsPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ret = statfs(pathname1, &statfsbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - toatlSize2 = (UINT64)statfsbuf2.f_bsize * statfsbuf2.f_blocks; - freeSize2 = (UINT64)statfsbuf2.f_bsize * statfsbuf2.f_bfree; - ICUNIT_GOTO_EQUAL(toatlSize1, toatlSize2, toatlSize1, EXIT); - ICUNIT_GOTO_NOT_EQUAL(freeSize1, freeSize2, freeSize1, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MOUNT_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT2: - close(fd); - goto EXIT; -EXIT1: - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); -EXIT: - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - remove(g_jffsPathname11[i]); - } - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure050(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure050", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_051.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_051.cpp deleted file mode 100644 index 11491943..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_051.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len, i; - INT32 fd = -1; - INT64 total = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 cycleCount = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *writeBuf = NULL; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - DOUBLE testSpeed; - CHAR *pid = NULL; - struct timeval testTime1; - struct timeval testTime2; - - writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - - gettimeofday(&testTime1, 0); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - dprintf("\n open %s,task %lld ms,\n", pathname1, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - len = write(fd, writeBuf, writeSize); - if (len <= 0) { - break; - } - g_TestCnt++; - - total += len; - totalSize += len; - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", cycleCount++, total, - perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - dprintf("\n total write=%lld, time=%lld,arv speed =%0.3lfMB/s,\n", totalSize, totalTime, testSpeed); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_IS_ERROR, len, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOSPC, errno, EXIT1); - - gettimeofday(&testTime1, 0); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf("\n sucess to fclose the %s,task:%lld ms,\n", pathname1, perTime / MSECS_PER_SEC); - - free(writeBuf); - - return NULL; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_t newTh1; - pthread_attr_t attr1; - - g_TestCnt = 0; - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr1, TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_join(newTh1, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure051(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure051", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp deleted file mode 100644 index de6b6c9a..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_052.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static CHAR *g_writeBuf = NULL; - -static VOID *PthreadF01(void *arg) -{ - INT32 len, taskId; - INT64 total = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 cycleCount = 0; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - DOUBLE testSpeed; - struct timeval testTime1; - struct timeval testTime2; - INT32 testNum = 4 * 1024 / 5; // 4 * 1024 / 5: test number - - taskId = (UINT32)(UINTPTR)arg; - - gettimeofday(&testTime1, 0); - - while (1) { - len = write(g_jffsFd, g_writeBuf, writeSize); - if (len <= 0) { - if (g_TestCnt < testNum) { - dprintf("\n TaskID:%3d, The biggest file size is smaller than the 4GB", taskId); - goto EXIT; - } - dprintf("\n TaskID:%3d, The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB", taskId, g_TestCnt, - g_TestCnt * 5, (g_TestCnt * 5) * 1.0 / BYTES_PER_KBYTE); // file size per test: 5 MB - - break; - } - g_TestCnt++; - - total += len; - totalSize += len; - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("TaskID:%3d, %d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - dprintf("\n TaskID:%3d,total write=%lld, time=%lld,arv speed =%0.3lfMB/s,\n", taskId, totalSize, totalTime, - testSpeed); - - return NULL; -EXIT1: - close(g_jffsFd); -EXIT: - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len, i, j; - UINT64 toatlSize1, toatlSize2; - UINT64 freeSize1, freeSize2; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - off64_t off64; - pthread_t threadId[JFFS_THREAD_NUM_TEST]; - pthread_attr_t attr; - struct statfs statfsbuf1; - struct statfs statfsbuf2; - struct stat64 statbuf; - - g_TestCnt = 0; - - g_writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(g_writeBuf, NULL, g_writeBuf, EXIT); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - g_jffsFd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, JFFS_IS_ERROR, g_jffsFd, EXIT1); - - ret = statfs(pathname1, &statfsbuf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - toatlSize1 = (UINT64)statfsbuf1.f_bsize * statfsbuf1.f_blocks; - freeSize1 = (UINT64)statfsbuf1.f_bsize * statfsbuf1.f_bfree; - - ret = PosixPthreadInit(&attr, TASK_PRIO_TEST2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < JFFS_THREAD_NUM_TEST; j++) { - pthread_join(threadId[j], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat64(pathname1, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - off64 = lseek64(g_jffsFd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off64, statbuf.st_size, off64, EXIT1); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &statfsbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - toatlSize2 = (UINT64)statfsbuf2.f_bsize * statfsbuf2.f_blocks; - freeSize2 = (UINT64)statfsbuf2.f_bsize * statfsbuf2.f_bfree; - - ICUNIT_GOTO_EQUAL(toatlSize1, toatlSize2, toatlSize1, EXIT); - ICUNIT_GOTO_EQUAL(((statfsbuf1.f_bfree - statfsbuf2.f_bfree) >= 0), TRUE, (statfsbuf1.f_bfree - statfsbuf2.f_bfree), - EXIT); - - free(g_writeBuf); - g_writeBuf = NULL; - - return JFFS_NO_ERROR; -EXIT2: - for (j = 0; j < JFFS_THREAD_NUM_TEST; j++) { - pthread_join(threadId[i], NULL); - } - pthread_attr_destroy(&attr); -EXIT1: - close(g_jffsFd); - remove(pathname1); -EXIT: - free(g_writeBuf); - g_writeBuf = NULL; - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure052(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure052", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_053.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_053.cpp deleted file mode 100644 index 42adb7ae..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_053.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static CHAR *g_writeBuf = NULL; -static CHAR* g_readBuf[3] = {}; - -static VOID *PthreadF01(void *arg) -{ - INT32 ret, len, taskId; - INT32 fd = -1; - INT64 total = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 cycleCount = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - UINT32 readSize = JFFS_PRESSURE_W_R_SIZE1; - DOUBLE testSpeed; - CHAR *pid = NULL; - struct timeval testTime1; - struct timeval testTime2; - time_t tTime; - struct tm *pstTM = NULL; - INT32 testNum = 4 * 1024; // 4 * 1024: test number - - g_TestCnt++; - - time(&tTime); - pstTM = localtime(&tTime); - memset_s(g_jffsPathname4, JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - strftime(g_jffsPathname4, JFFS_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", pstTM); - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/%s_#%d", g_jffsPathname4, - (INT32)(INTPTR)arg); - - snprintf_s(g_jffsPathname4, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "testfile#%d", - (INT32)(INTPTR)arg); - prctl(PR_SET_NAME, (unsigned long)g_jffsPathname4, 0, 0, 0); - - taskId = strlen(pathname1); - pid = pathname1 + taskId - 1; - taskId = atoi(pid); - - gettimeofday(&testTime1, 0); - - fd = open(pathname1, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd < 0) { - dprintf("\n Task_%d fail to open %s,\n", taskId, pathname1); - goto EXIT1; - } - - LosTaskDelay(5); // delay time: 5 - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - dprintf("\n TaskID:%3d,open %s,task %lld ms,\n", taskId, pathname1, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - len = write(fd, g_writeBuf, writeSize); - if (len <= 0) { - if (g_TestCnt < testNum) { - dprintf("\n TaskID:%3d, The biggest file size is smaller than the 4GB", taskId); - goto EXIT1; - } - dprintf("\n TaskID:%3d, The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB", taskId, g_TestCnt, - g_TestCnt, g_TestCnt / BYTES_PER_MBYTE); - - break; - } - - g_TestCnt++; - - total += len; - totalSize += len; - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("TaskID:%3d, %d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - dprintf("\n TaskID:%3d,total write=%lld, time=%lld,arv speed =%0.3lfMB/s,\n", taskId, totalSize, totalTime, - testSpeed); - - gettimeofday(&testTime1, 0); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf("\n TaskID:%3d,sucess to fclose the %s,task:%lld ms,\n", taskId, pathname1, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - fd = open(pathname1, O_RDWR, S_IRUSR | S_IWUSR); - if (fd < 0) { - dprintf("Task_%d fail to open %s,\n", taskId, pathname1); - goto EXIT1; - } - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf(" fix_Read TaskID:%3d,open %s, task:%lld ms,\n", taskId, pathname1, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - ret = read(fd, g_readBuf[(INT32)(INTPTR)arg], readSize); - if (ret < 0) { - dprintf("ret = %d,%s read fail!-->(X),\n", ret, pathname1); - goto EXIT1; - } - if (!ret) { - dprintf("warning: read ret = %d, errno=:%d\n", ret, errno); - goto EXIT1; - } - total += ret; - totalSize += ret; - - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("fix_Read TaskID:%3d,times %d, read %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - dprintf("\n fix_Read TaskID:%3d,total read=%lld, time=%lld,arv speed =%0.3lfMB/s,\n", taskId, totalSize, totalTime, - testSpeed); - - gettimeofday(&testTime1, 0); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf("fix_Read TaskID:%3d, fclose %s!,task:%lld ms,\n", taskId, pathname1, perTime / MSECS_PER_SEC); - - return NULL; - -EXIT1: - close(fd); - remove(pathname1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, j; - pthread_t threadId[JFFS_THREAD_NUM_TEST]; - pthread_attr_t attr; - UINT32 writeSize = JFFS_PRESSURE_W_R_SIZE1; - UINT32 readSize = JFFS_PRESSURE_W_R_SIZE1; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 priority = 4; - - g_TestCnt = 0; - - g_writeBuf = (CHAR *)malloc(writeSize + 1); - ICUNIT_GOTO_NOT_EQUAL(g_writeBuf, NULL, g_writeBuf, EXIT0); - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - g_readBuf[i] = (CHAR *)malloc(readSize + 1); - ICUNIT_GOTO_NOT_EQUAL(g_readBuf[i], NULL, g_readBuf[i], EXIT0); - } - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - while (g_TestCnt < JFFS_THREAD_NUM_TEST * 2) { // thread cnts: JFFS_THREAD_NUM_TEST * 2 - sleep(1); - } - - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - for (i = 0; i < JFFS_THREAD_NUM_TEST; i++) { - pthread_join(threadId[i], NULL); - } -EXIT: - pthread_attr_destroy(&attr); -EXIT0: - free(g_writeBuf); - g_writeBuf = NULL; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - free(g_readBuf[i]); - g_readBuf[i] = NULL; - } - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure053(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure053", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_301.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_301.cpp deleted file mode 100644 index 18802a10..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_301.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - INT32 n = 103; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - while (n--) { - len = write(fd, "0123456789012345678901234567890123456789", 40); // write length: 40 - ICUNIT_GOTO_EQUAL(len, 40, len, EXIT3); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure301(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure301", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_302.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_302.cpp deleted file mode 100644 index a2ae5e2a..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_302.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 fd = -1; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - INT32 n = 256; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, sizeof(pathname1), "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat_s(buffile, sizeof(buffile), "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - while (n--) { - len = write(fd, "01234567890123456789012345", 16); // write length: 16 - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT3); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure302(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure302", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_303.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_303.cpp deleted file mode 100644 index 017804e9..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_303.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = -1; - INT32 i = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_MIDDLE_ARRAY_LENGTH][JFFS_STANDARD_NAME_LENGTH] = {JFFS_PATH_NAME0}; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - DIR *dir = NULL; - DIR *dir1[JFFS_MIDDLE_ARRAY_LENGTH] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - memset_s(pathname2[i], JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - JffsStrcat2(pathname2[i], bufname, strlen(bufname)); - - ret = mkdir(pathname2[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - dir1[i] = opendir(pathname2[i]); - ICUNIT_GOTO_NOT_EQUAL(dir1[i], NULL, dir1[i], EXIT3); - } - - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - ret = remove(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - closedir(dir1[i]); - } -EXIT2: - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - remove(pathname2[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure303(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure303", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_304.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_304.cpp deleted file mode 100644 index 3c8a4e03..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_304.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *argument) -{ - INT32 len; - INT32 n = 1000; - - g_TestCnt++; - while (n--) { - len = write(g_jffsFd, - "1234567890123456789012345678901234567890abcdefghjk12345678901234567890123456789012345678901234567890123456" - "7890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 200); // write length: 200 - ICUNIT_GOTO_EQUAL(len, 200, len, EXIT); - if (g_TestCnt == 2) { // test number: 2 - break; - } - } - g_TestCnt++; - - return (void *)0; - -EXIT: - g_TestCnt = 0; - return (void *)0; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - pthread_t newTh; - pthread_attr_t attr; - CHAR readbuf[201] = {0}; - off_t off; - INT32 priority = 4; - INT32 testNum = 2; - - g_TestCnt = 0; - g_jffsFd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(g_jffsFd, -1, g_jffsFd, EXIT1); - - ret = PosixPthreadInit(&attr, priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh, &attr, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - while (g_TestCnt < testNum) { - LosTaskDelay(1); // delay time: 1 - } - g_TestCnt++; - - off = lseek(g_jffsFd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT2); - - len = read(g_jffsFd, readbuf, 200); // read length: 200 - ICUNIT_GOTO_EQUAL(len, 200, len, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(readbuf, - "1234567890123456789012345678901234567890abcdefghjk123456789012345678901234567890123456789012345678901234567890" - "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - readbuf, EXIT2); - - ICUNIT_GOTO_EQUAL(g_TestCnt, 3, g_TestCnt, EXIT2); // 3: test num - - ret = PosixPthreadDestroy(&attr, newTh); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(g_jffsFd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - PosixPthreadDestroy(&attr, newTh); -EXIT1: - close(g_jffsFd); -EXIT: - remove(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure304(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure304", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_305.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_305.cpp deleted file mode 100644 index a6370e2c..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_305.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = -1; - INT32 i = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - DIR *dir1[JFFS_MIDDLE_ARRAY_LENGTH] = {NULL}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - while (i < JFFS_MIDDLE_ARRAY_LENGTH) { - dir1[i] = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir1[i], NULL, dir1[i], EXIT1); - - i++; - } - for (i = 0; i < JFFS_MIDDLE_ARRAY_LENGTH; i++) { - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - return JFFS_NO_ERROR; -EXIT1: - closedir(dir); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure305(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure305", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_306.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_306.cpp deleted file mode 100644 index 92e60605..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_306.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, j; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - CHAR pathname1[300] = { JFFS_PATH_NAME0 }; - CHAR bufname[10] = ""; - CHAR pathname2[10][300] = {0}; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(bufname, sizeof(bufname), 0, strlen(bufname)); - snprintf_s(bufname, sizeof(bufname), sizeof(bufname) - 1, "/test_%d", i); - strcat_s(pathname1, sizeof(pathname1), bufname); - strcpy_s(pathname2[i], sizeof(pathname2[i]), pathname1); - - ret = mkdir(pathname2[i], HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH - 1; i++) { - ret = rmdir(pathname2[i]); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - } - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - ret = rmdir(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - for (i = JFFS_SHORT_ARRAY_LENGTH - 1; i >= 0; i--) { - rmdir(pathname2[i]); - } -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure306(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure306", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_307.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_307.cpp deleted file mode 100644 index ea7e3718..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_307.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd[JFFS_NAME_LIMITTED_SIZE] = { 0 }; - INT32 i = 0; - INT32 fileCount = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE][JFFS_STANDARD_NAME_LENGTH] = {JFFS_PATH_NAME0}; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - DIR *dir = NULL; - struct inode *node = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - errno = 0; - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - memset_s(pathname2[i], JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/test%d", i); - JffsStrcat2(pathname2[i], bufname, strlen(bufname)); - - // system has 512 fd,when start testsuits_app,has open 11 file, - // so current usersapce only has 500 file counts,and its value is dynamic - // when it failed,please adapt it. - if (fileCount == 500) { // max file counts: 500 - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd[i], -1, fd[i], EXIT3); - ICUNIT_GOTO_EQUAL(errno, EMFILE, errno, EXIT3); - break; - } - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT3); - fileCount = i; - } - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - if (i > fileCount) { - ret = close(fd[i]); - printf("[%d] close: fd:%d, errno:%d,ret:%d,i:%d,\n", __LINE__, fd[i], errno, ret, i); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT3); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT3); - break; - } - ret = close(fd[i]); - printf("[%d] close: fd:%d, errno:%d,ret:%d,i:%d\n", __LINE__, fd[i], errno, ret, i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - } - - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - if (i > fileCount) { - errno = 0; - ret = remove(pathname2[i]); - printf("[%d] remove: %s, errno:%d,i:%d\n", __LINE__, pathname2[i], errno, i); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT2); - break; - } - - ret = remove(pathname2[i]); - printf("[%d] remove: %s, errno:%d,i:%d\n", __LINE__, pathname2[i], errno, i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT3: - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - close(fd[i]); - } -EXIT2: - for (i = 0; i < JFFS_NAME_LIMITTED_SIZE; i++) { - remove(pathname2[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure307(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure307", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_308.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_308.cpp deleted file mode 100644 index e0a1e2d3..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_308.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, len; - INT32 fd1 = -1; - INT32 i = 0; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_NUM_TEST; i++) { - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT1); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = remove(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure308(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure308", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_309.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_309.cpp deleted file mode 100644 index 0aded4fd..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_309.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, fd[10]; - INT32 i = 0; - INT32 len = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[10][JFFS_STANDARD_NAME_LENGTH] = {JFFS_PATH_NAME0}; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR bufname[JFFS_SHORT_ARRAY_LENGTH] = ""; - INT32 randTest1[10] = {2, 6, 3, 1, 0, 8, 7, 9, 4, 5}; - INT32 randTest2[10] = {5, 3, 1, 6, 7, 2, 4, 9, 0, 8}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - memset_s(bufname, JFFS_SHORT_ARRAY_LENGTH, 0, JFFS_SHORT_ARRAY_LENGTH); - memset_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, 0, JFFS_STANDARD_NAME_LENGTH); - snprintf_s(bufname, JFFS_SHORT_ARRAY_LENGTH, JFFS_SHORT_ARRAY_LENGTH - 1, "/1071_%d", i); - strcat_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, pathname1); - strcat_s(pathname2[i], JFFS_STANDARD_NAME_LENGTH, bufname); - fd[i] = open(pathname2[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - } - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - len = write(fd[randTest1[i]], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - ret = close(fd[randTest1[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - fd[randTest2[i]] = open(pathname2[randTest2[i]], O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], -1, fd[i], EXIT2); - - len = read(fd[randTest2[i]], readbuf, JFFS_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - ret = close(fd[randTest2[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - ret = remove(pathname2[randTest2[i]]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT2: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - close(fd[randTest1[i]]); - } -EXIT1: - for (i = 0; i < JFFS_SHORT_ARRAY_LENGTH; i++) { - remove(pathname2[randTest2[i]]); - } -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure309(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure309", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp deleted file mode 100644 index bec8b3f2..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_310.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 scandirCount = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = "/jf/test"; - CHAR pathname6[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct dirent **namelist = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - memset_s(pathname2, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(pathname3, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(pathname6, JFFS_NAME_LIMITTED_SIZE, "/"); - // PATH_MAX test. The dirname has occupied 14 bytes. - while (i < 241) { // loop times: 241 - i++; - strcat_s(pathname2, JFFS_NAME_LIMITTED_SIZE, "t"); - strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "t"); - strcat_s(pathname6, JFFS_NAME_LIMITTED_SIZE, "t"); - } - ICUNIT_GOTO_EQUAL(strlen(pathname6), 255, strlen(pathname6), EXIT); // pathname length: 255 - ICUNIT_GOTO_EQUAL(strlen(pathname2), 241, strlen(pathname2), EXIT); // pathname length: 241 - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT1); - - strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "t"); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - strcat_s(pathname6, JFFS_NAME_LIMITTED_SIZE, "t"); - ICUNIT_GOTO_EQUAL(strlen(pathname6), 256, strlen(pathname6), EXIT); // pathname length: 256 - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - errno = 0; - ret = mkdir(pathname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, pathname4, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - ret = mkdir(pathname5, HIGHEST_AUTHORITY); - printf("[%d] errno:%d\n", __LINE__, errno); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - - ret = chdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - scandirCount = scandir(pathname5, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // dir number: 2 - - JffsScandirFree(namelist, scandirCount); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - scandirCount = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // dir number: 2 - - JffsScandirFree(namelist, scandirCount); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT4); - - ret = rmdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mkdir(pathname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, pathname4, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mkdir(pathname5, HIGHEST_AUTHORITY); - printf("[%d] errno:%d\n", __LINE__, errno); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - - ret = chdir(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT5: - JffsScandirFree(namelist, scandirCount); -EXIT4: - umount(pathname4); - remove(pathname4); -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - remove(pathname3); - remove(pathname6); -EXIT1: - rmdir(pathname2); -EXIT: - rmdir(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure310(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure310", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp deleted file mode 100644 index 40fa396c..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_311.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 fd = -1; - INT32 scandirCount = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - CHAR pathname3[JFFS_NAME_LIMITTED_SIZE] = { JFFS_MAIN_DIR0 }; - CHAR pathname4[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname5[JFFS_NAME_LIMITTED_SIZE] = ""; - CHAR pathname6[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - CHAR pathname7[JFFS_STANDARD_NAME_LENGTH] = "/jf"; - - struct dirent **namelist = NULL; - - ret = chdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - memset_s(pathname4, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - memset_s(pathname5, JFFS_NAME_LIMITTED_SIZE, 0, JFFS_NAME_LIMITTED_SIZE); - strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "/"); - - // PATH_MAX test. The dirname has occupied 9 bytes. - while (i < 246) { // loop times: 246 - i++; - strcat_s(pathname4, JFFS_NAME_LIMITTED_SIZE, "t"); - strcat_s(pathname5, JFFS_NAME_LIMITTED_SIZE, "t"); - strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "t"); - } - ICUNIT_GOTO_EQUAL(strlen(pathname3), 255, strlen(pathname3), EXIT); // pathname length: 255 - ICUNIT_GOTO_EQUAL(strlen(pathname4), 246, strlen(pathname4), EXIT); // pathname length: 246 - - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - fd = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT2); - - strcat_s(pathname5, JFFS_NAME_LIMITTED_SIZE, "t"); - fd = open(pathname5, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT2); - - strcat_s(pathname3, JFFS_NAME_LIMITTED_SIZE, "t"); - ICUNIT_GOTO_EQUAL(strlen(pathname3), 256, strlen(pathname3), EXIT); // pathname length: 256 - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, -1, fd, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, pathname6, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = access(pathname4, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - fd = open(pathname5, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT4); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - scandirCount = scandir(pathname7, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // dir number: 2 - - JffsScandirFree(namelist, scandirCount); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - scandirCount = scandir(pathname1, &namelist, 0, alphasort); - ICUNIT_GOTO_EQUAL(scandirCount, 2, scandirCount, EXIT5); // dir number: 2 - - JffsScandirFree(namelist, scandirCount); - - ret = remove(pathname4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT4); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(JFFS_MOUNT_DIR0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mkdir(pathname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = mount(JFFS_DEV_PATH0, pathname6, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname5); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = umount(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = remove(pathname6); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - return JFFS_NO_ERROR; -EXIT5: - JffsScandirFree(namelist, scandirCount); -EXIT4: - umount(pathname6); - remove(pathname6); -EXIT3: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); -EXIT2: - close(fd); - remove(pathname5); - remove(pathname3); -EXIT1: - close(fd); - remove(pathname4); -EXIT: - close(fd); - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure311(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure311", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_312.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_312.cpp deleted file mode 100644 index 1f5c2eef..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_312.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "/"); - - while (i < 280) { // loop times: 280 - strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "t"); - i++; - } - ICUNIT_GOTO_EQUAL(strlen(pathname1), 294, strlen(pathname1), EXIT); // pathname length: 294 - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - remove(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure312(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure312", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_313.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_313.cpp deleted file mode 100644 index aca3e63f..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_313.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - CHAR pathname1[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "/test"); - while (i < 280) { // loop times: 280 - i++; - strcat_s(pathname1, JFFS_NAME_LIMITTED_SIZE, "t"); - } - - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - dir = opendir(pathname1); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - closedir(dir); -EXIT1: - rmdir(pathname1); -EXIT: - rmdir(pathname2); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure313(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure313", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_314.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_314.cpp deleted file mode 100644 index 5c27da3e..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_314.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *writebuf = NULL; - CHAR *readbuf = NULL; - off_t off; - INT32 bufLen = 65536; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - memset_s(writebuf, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < bufLen / strlen(filebuf); i++) { - strcat_s(writebuf, bufLen + 1, filebuf); - } - writebuf[bufLen - 1] = '\0'; - - readbuf = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - memset_s(readbuf, bufLen + 1, 0, bufLen + 1); - - len = write(fd, writebuf, bufLen - 1); - ICUNIT_GOTO_EQUAL(len, bufLen - 1, len, EXIT4); - - memset_s(readbuf, bufLen + 1, 0, bufLen + 1); - len = pread(fd, readbuf, bufLen - 1, 0); - ICUNIT_GOTO_EQUAL(len, bufLen - 1, len, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, bufLen - 1, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT4: - free(readbuf); -EXIT3: - free(writebuf); -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure314(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure314", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_315.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_315.cpp deleted file mode 100644 index 7d92ecb6..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_fs_jffs_pressure_315.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len, i; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *writebuf = NULL; - CHAR *readbuf = NULL; - off_t off; - INT32 testLen = 0xffff; - INT32 bufLen = testLen + 1; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - writebuf = (CHAR *)malloc(bufLen + 1); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - memset_s(writebuf, bufLen + 1, 0, bufLen + 1); - - for (i = 0; i < bufLen / strlen(filebuf); i++) { - strcat_s(writebuf, bufLen + 1, filebuf); - } - writebuf[bufLen - 1] = '\0'; - - readbuf = (CHAR *)malloc(bufLen); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT3); - memset_s(readbuf, bufLen, 0, bufLen); - - len = pwrite(fd, writebuf, testLen, 0); - ICUNIT_GOTO_EQUAL(len, testLen, len, EXIT4); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT4); - - memset_s(readbuf, bufLen, 0, bufLen); - len = read(fd, readbuf, testLen); - ICUNIT_GOTO_EQUAL(len, testLen, len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT4); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, testLen, off, EXIT4); - - free(readbuf); - free(writebuf); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT4: - free(readbuf); -EXIT3: - free(writebuf); -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsPressure315(VOID) -{ - TEST_ADD_CASE("ItFsJffsPressure315", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_001.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_001.cpp deleted file mode 100644 index ffb85e57..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_001.cpp +++ /dev/null @@ -1,400 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/001.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // file position: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 3 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 3 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/002.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(10); // delay time: 10 - dprintf("PthreadF02 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // file position: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 3 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 3 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/003.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 3 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 3 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - rmdir(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread001(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread001", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp deleted file mode 100644 index f09d48cd..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_002.cpp +++ /dev/null @@ -1,480 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - INT32 jffsMaxCycles = 1; // 1 means 1 * 1024 * 1024 byte size - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR writebuf[70] = "lite"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/004.txt"); // /storage/test/004.txt - fd1 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT2); - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/001.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < jffsMaxCycles; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 1 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 1 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); - close(fd1); -EXIT1: - unlink(pathname1); - unlink(pathname2); -EXIT: - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - INT32 jffsMaxCycles = 1; // 1 means 1 * 1024 * 1024 byte size - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR writebuf[70] = "lite"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/005.txt"); - fd1 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT2); - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/002.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < jffsMaxCycles; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF02 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 1 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 1 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); - close(fd1); -EXIT1: - unlink(pathname1); - unlink(pathname2); -EXIT: - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 fd2 = -1; - INT32 ret, len; - INT32 i = 0; - INT32 j = 0; - INT32 k = JFFS_SHORT_ARRAY_LENGTH; - INT32 jffsMaxCycles = 1; // 1 means 1 * 1024 * 1024 byte size - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[70] = "liteos"; - CHAR writebuf[70] = "lite"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - off_t off; - struct stat statfile; - - INT32 bufWLen = BYTES_PER_MBYTE; - INT32 bufW1Len = 512 * BYTES_PER_KBYTE; // 512 KB - INT32 bufW2Len = 16 * BYTES_PER_KBYTE; // 16 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, 0); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - bufW1 = (CHAR *)malloc(bufW1Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW1, NULL, 0, EXIT2); - memset_s(bufW1, bufW1Len + 1, 0, bufW1Len + 1); - - bufW2 = (CHAR *)malloc(bufW2Len + 1); - ICUNIT_GOTO_NOT_EQUAL(bufW2, NULL, 0, EXIT3); - memset_s(bufW2, bufW2Len + 1, 0, bufW2Len + 1); - - for (j = 0; j < bufW2Len / strlen(filebuf); j++) { - strcat_s(bufW2, bufW2Len + 1, filebuf); - } - - for (j = 0; j < bufW1Len / bufW2Len; j++) { - strcat_s(bufW1, bufW1Len + 1, bufW2); - } - - for (i = 0; i < bufWLen / bufW1Len; i++) { - strcat_s(bufW, bufWLen + 1, bufW1); - } - free(bufW1); - free(bufW2); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/006.txt"); - fd1 = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, JFFS_IS_ERROR, fd1, EXIT2); - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - len = read(fd1, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/003.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT2); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_NO_ERROR, off, EXIT2); - - for (i = 0; i < jffsMaxCycles; i++) { - ret = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTE, ret, EXIT2); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTE * (i + 1)), off, EXIT2); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - } - - off = lseek(fd, 64, SEEK_SET); // seek offset: 64 - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); - - len = read(fd, readbuf, 64); // read length: 64 - ICUNIT_GOTO_EQUAL(len, 64, len, EXIT2); - - ret = stat(pathname1, &statfile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - // 1 * 1024 * 1024: filesize - ICUNIT_GOTO_EQUAL(statfile.st_size, 1 * 1024 * 1024, statfile.st_size, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - free(bufW); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - close(fd); - close(fd1); -EXIT1: - unlink(pathname1); - unlink(pathname2); -EXIT: - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - rmdir(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread002(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread002", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_003.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_003.cpp deleted file mode 100644 index fdd4f3b9..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_003.cpp +++ /dev/null @@ -1,541 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - INT32 flag = 0; - INT32 readLen = 10; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(1); // delay time: 1 - dprintf("PthreadF01 is excecuting\n"); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(1); // delay time: 1 - dprintf("PthreadF03 is excecuting\n"); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread003(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread003", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_004.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_004.cpp deleted file mode 100644 index 7a68941a..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_004.cpp +++ /dev/null @@ -1,504 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file_%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file_%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(10); // delay time: 10 - dprintf("PthreadF02 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file_%d.txt", - i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file_%d.txt", - i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd[JFFS_MIDDLE_CYCLES] = {}; - INT32 fd1[JFFS_MIDDLE_CYCLES] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file_%d.txt", - i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file_%d.txt", - i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread004(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread004", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_005.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_005.cpp deleted file mode 100644 index f83ff62d..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_005.cpp +++ /dev/null @@ -1,325 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file0.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file2.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread005(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread005", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_006.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_006.cpp deleted file mode 100644 index 481dee73..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_006.cpp +++ /dev/null @@ -1,615 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW3 = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - index = 0; - for (i = 0; i < JFFS_CREATFILE_NUM; i++) { - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 5; j++) { // loop times: 5 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - bufW3 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW3, NULL, NULL); - memset_s(bufW3, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW3, bufWLen + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW3, strlen(bufW3)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW3); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - unlink(pathname); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname1); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW3 = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - index = 0; - for (i = 0; i < JFFS_CREATFILE_NUM; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 5; j++) { // loop times: 5 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - bufW3 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW3, NULL, NULL); - memset_s(bufW3, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW3, bufWLen + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW3, strlen(bufW3)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW3); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW3 = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - index = 0; - for (i = 0; i < JFFS_CREATFILE_NUM; i++) { - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 5; j++) { // loop times: 5 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - bufW3 = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW3, NULL, NULL); - memset_s(bufW3, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW3, bufWLen + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW3, strlen(bufW3)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read length: 10 - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW3); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread006(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread006", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_007.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_007.cpp deleted file mode 100644 index 2c9b992d..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_007.cpp +++ /dev/null @@ -1,569 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = "/storage/test"; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = "/storage/test/test00"; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = "/storage/test2"; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = "/storage/test2/test22"; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index1], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread007(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread007", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_008.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_008.cpp deleted file mode 100644 index 8b29c9c5..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_008.cpp +++ /dev/null @@ -1,553 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW); - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - if (len <= 0) { - flag = 1; - break; - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW); - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[20] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - free(bufW); - index1 = JFFS_MIDDLE_CYCLES; - for (i = JFFS_MIDDLE_CYCLES; i < JFFS_MIDDLE_NUM; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i = 1; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread008(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread008", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_009.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_009.cpp deleted file mode 100644 index 82f5513a..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_009.cpp +++ /dev/null @@ -1,414 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - CHAR *bufW1 = NULL; - CHAR *bufW2 = NULL; - CHAR *bufW3 = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT3: - free(bufW1); -EXIT2: - free(bufW); -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread009(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread009", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_010.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_010.cpp deleted file mode 100644 index 6cbbd1db..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_010.cpp +++ /dev/null @@ -1,556 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = index1; i < index1 + JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - len = write(fd[index1], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTE, len, EXIT1); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file%d.txt", i); - unlink(pathname); - } - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file%d.txt", i); - unlink(pathname1); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = index1; i < index1 + JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - len = write(fd[index1], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTE, len, EXIT1); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; - -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file%d.txt", i); - unlink(pathname); - } - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file%d.txt", i); - unlink(pathname1); - } - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag1, index, index1; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 20; j++) { // loop times: 20 - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = JFFS_MIDDLE_CYCLES; - for (i = index1; i < index1 + JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index1] == -1) { - break; - } - - len = write(fd[index1], bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTE, len, EXIT1); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf2); - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT2: - free(bufW); -EXIT1: - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file%d.txt", i); - unlink(pathname); - } - - for (i = index1; i >= JFFS_MIDDLE_CYCLES; i--) { - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file%d.txt", i); - unlink(pathname1); - } - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread010(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread010", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_011.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_011.cpp deleted file mode 100644 index 256f5f97..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_011.cpp +++ /dev/null @@ -1,663 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - struct stat statbuf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile2, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf2); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - struct stat statbuf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile2, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf2); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - struct stat statbuf2 = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &statbuf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf2); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread011(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread011", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_012.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_012.cpp deleted file mode 100644 index 907bbcf3..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_012.cpp +++ /dev/null @@ -1,634 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // 4 - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread012(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread012", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_013.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_013.cpp deleted file mode 100644 index 5736f38b..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_013.cpp +++ /dev/null @@ -1,451 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = "/storage/test2/test22"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread013(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread013", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp deleted file mode 100644 index da8bed12..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_014.cpp +++ /dev/null @@ -1,618 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" -static INT32 g_testNum = 2; - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME0 }; - CHAR buffile2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = 512 * BYTES_PER_KBYTE; // 512 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < g_testNum; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < g_testNum; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME01 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = 512 * BYTES_PER_KBYTE; // 512 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < g_testNum; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < g_testNum; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME02 }; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf = { 0 }; - INT32 bufWLen = 512 * BYTES_PER_KBYTE; // 512 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < g_testNum; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < g_testNum; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/ttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread014(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread014", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp deleted file mode 100644 index 2c1b72f4..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_015.cpp +++ /dev/null @@ -1,668 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 4 * BYTES_PER_KBYTE; // 4 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01-0 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/test%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - dprintf("mkdir filed f01\n"); - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - dprintf("PthreadF01-1 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/test_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/test_%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/test%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/test_%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 4 * BYTES_PER_KBYTE; // 4 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(2); // delay time: 2 - dprintf("PthreadF02-0 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/test%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < 10; j++) { // loop times: 10 - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - dprintf("PthreadF02-1 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/test_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/test_%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/test%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/test_%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 4 * BYTES_PER_KBYTE; // 4 KB - - flag = 0; - bufW = (CHAR *)malloc(BYTES_PER_MBYTE + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03-0 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/test%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd1, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - dprintf("PthreadF03-1 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/test_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/test_%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/test%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/test_%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread015(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread015", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp deleted file mode 100644 index fde6104e..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_016.cpp +++ /dev/null @@ -1,649 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 16 * BYTES_PER_KBYTE; // 16 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/tttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/tttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dirbuf[100] = {NULL}; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = 16 * BYTES_PER_KBYTE; // 16 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/tttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/tttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dirbuf[100] = {NULL}; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = 16 * BYTES_PER_KBYTE; // 16 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/tttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/tttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread016(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread016", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp deleted file mode 100644 index 63cad8e1..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_017.cpp +++ /dev/null @@ -1,450 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dirbuf[100] = {NULL}; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = 128 * BYTES_PER_KBYTE; // 128 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dirbuf[100] = {NULL}; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = 128 * BYTES_PER_KBYTE; // 128 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/testdir%d", - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/testdir_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/testdir_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/testdir%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/testdir_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dirbuf[100] = {NULL}; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 bufWLen = 128 * BYTES_PER_KBYTE; // 128 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test1%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test01_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test01_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test1%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test01_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread017(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread017", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp deleted file mode 100644 index 6c097601..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_018.cpp +++ /dev/null @@ -1,650 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/tttest%d", - index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test00/tttest%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/tttest%d", index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test11/tttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, index1; - INT32 fd = -1; - INT32 fd1 = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/tttest%d", index1); - ret = mkdir(pathname3, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname5, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd1); - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test22/tttest%d", - i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - snprintf_s(pathname3, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/tttest_%d", i); - strcpy_s(pathname4, JFFS_STANDARD_NAME_LENGTH, pathname3); - strcat_s(pathname4, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/test_%d", i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread018(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread018", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp deleted file mode 100644 index cd24c4cf..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_019.cpp +++ /dev/null @@ -1,449 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/file2%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/test1/file3%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is excecuting\n"); - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/test1/file3_%d.txt", index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/test1/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test0/test1/file3_%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - strcat_s(bufname2, JFFS_STANDARD_NAME_LENGTH, "/test0"); - strcat_s(bufname3, JFFS_STANDARD_NAME_LENGTH, "/test0/test1"); - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(1); // delay time: 1 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread019(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread019", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp deleted file mode 100644 index 079ada44..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_020.cpp +++ /dev/null @@ -1,443 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: // fd[0] - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: // fd[1] - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is excecuting\n"); - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test2/file3_%d.txt", - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay time: 3 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread020(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread020", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp deleted file mode 100644 index ef2ffbb7..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_021.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test1/file3_%d.txt", - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread021(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread021", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp deleted file mode 100644 index 59e7a066..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_022.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread022(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread022", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp deleted file mode 100644 index 962a5d3c..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_023.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file1%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test/test00/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test1/test11/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, - "/storage/test2/test22/file3_%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME00 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME11 }; - CHAR bufname5[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR bufname6[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME22 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread023(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread023", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp deleted file mode 100644 index c08fb7cb..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_024.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF01 is excecuting\n"); - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file1%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is excecuting\n"); - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file2%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF03 is excecuting\n"); - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "/storage/test/file3_%d.txt", i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(1); // delay time: 1 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread024(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread024", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp deleted file mode 100644 index 047d1e90..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_025.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = lseek(fd, -10, SEEK_CUR); // seek offset: -10 - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - free(bufW); - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = lseek(fd, -10, SEEK_CUR); // seek offset: -10 - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - free(bufW); - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - len = write(fd, bufW, strlen(bufW)); - ICUNIT_GOTO_EQUAL(len, strlen(bufW), len, EXIT1); - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - ret = lseek(fd, -10, SEEK_CUR); // seek offset: -10 - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - free(bufW); - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - LosTaskDelay(1); // delay time: 1 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - return JFFS_NO_ERROR; - -EXIT: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread025(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread025", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_026.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_026.cpp deleted file mode 100644 index 71df3796..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_026.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - struct stat statbuf; - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/p01.txt"); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - struct stat statbuf; - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/p02.txt"); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF02 is executing\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(1); // delay time: 1 - INT32 fd = -1; - INT32 ret, len; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - struct stat statbuf; - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/p03.txt"); - - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF03 is executing\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - len = read(fd, readbuf, strlen(writebuf)); // read length: 10 - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - return NULL; -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(1); // delay time: 1 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread026(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread026", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_027.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_027.cpp deleted file mode 100644 index c99d1435..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_027.cpp +++ /dev/null @@ -1,384 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread027(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread027", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_028.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_028.cpp deleted file mode 100644 index 8847fc21..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_028.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, ret, len, index, flag; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - - flag = 0; - - for (index = 0; index < JFFS_MIDDLE_CYCLES; index++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, ret, len, index, flag; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - - flag = 0; - - for (index = 0; index < JFFS_MIDDLE_CYCLES; index++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, ret, len, index, flag; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - - flag = 0; - - for (index = 0; index < JFFS_MIDDLE_CYCLES; index++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread028(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread028", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_029.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_029.cpp deleted file mode 100644 index ad4e055f..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_029.cpp +++ /dev/null @@ -1,385 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread029(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread029", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_030.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_030.cpp deleted file mode 100644 index 3951bb76..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_030.cpp +++ /dev/null @@ -1,373 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread030(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread030", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_031.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_031.cpp deleted file mode 100644 index c031870f..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_031.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, ret, len; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "abcd"; - CHAR *bufW = NULL; - struct stat statbuf; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - fd[i] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], JFFS_IS_ERROR, fd[i], EXIT); - - len = write(fd[i], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - } - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - close(fd[i]); - } -EXIT: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, ret, len; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "abcd"; - CHAR *bufW = NULL; - struct stat statbuf; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - fd[i] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], JFFS_IS_ERROR, fd[i], EXIT); - - len = write(fd[i], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - } - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - close(fd[i]); - } -EXIT: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, ret, len; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "abcd"; - CHAR *bufW = NULL; - struct stat statbuf; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, i); - fd[i] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd[i], JFFS_IS_ERROR, fd[i], EXIT); - - len = write(fd[i], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - } - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - close(fd[i]); - } -EXIT: - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread031(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread031", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_032.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_032.cpp deleted file mode 100644 index eb694c77..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_032.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", JFFS_PATH_NAME0, - i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread032(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread032", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_033.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_033.cpp deleted file mode 100644 index 0dda6229..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_033.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME0, i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME0, i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME01, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME01, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME01, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME02, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME02, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME02, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread033(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread033", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_034.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_034.cpp deleted file mode 100644 index bf870176..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_034.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, fd, offset; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - closedir(dir); -EXIT: - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, fd, offset; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - closedir(dir); -EXIT: - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, fd, offset; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; -EXIT1: - closedir(dir); -EXIT: - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread034(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread034", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_035.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_035.cpp deleted file mode 100644 index 5111f362..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_035.cpp +++ /dev/null @@ -1,430 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_0, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_0, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - DIR *dir = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_01, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, JFFS_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_01, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME_01, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread035(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread035", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp deleted file mode 100644 index 13e106f0..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_036.cpp +++ /dev/null @@ -1,429 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME0, i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME0, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME01, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME01, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME01, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME01, i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME01, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME02, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME02, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME02, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test%d", JFFS_PATH_NAME02, i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test_%d", JFFS_PATH_NAME02, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread036(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread036", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_037.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_037.cpp deleted file mode 100644 index 02155611..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_037.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, fd; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - i); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; - -EXIT1: - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, i); - rmdir(pathname); -EXIT: - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, fd; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME0, - i); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; - -EXIT1: - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME0, i); - rmdir(pathname); -EXIT: - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, fd; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - DIR *dir = NULL; - - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME0, - i); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", JFFS_PATH_NAME0, - i); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - } - - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", JFFS_PATH_NAME0, - j); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - return NULL; - -EXIT1: - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME0, i); - rmdir(pathname); -EXIT: - for (j = i - 1; j >= 0; j--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", JFFS_PATH_NAME0, - j); - rmdir(pathname); - } - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread037(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread037", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp deleted file mode 100644 index 55fb8abe..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_038.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay time: 3 - dprintf("PthreadF01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1%d", JFFS_PATH_NAME0, i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test1_%d", JFFS_PATH_NAME0, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME_0, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay time: 5 - dprintf("PthreadF02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME_0, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME_0, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2%d", JFFS_PATH_NAME_0, i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test2_%d", JFFS_PATH_NAME_0, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index, offset; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufW = NULL; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME_01, - index); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - if (ret == -1) { - break; - } - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd == -1) { - break; - } - - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd, bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay time: 7 - dprintf("PthreadF03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname2, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", - JFFS_PATH_NAME_01, index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", JFFS_PATH_NAME_01, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - close(fd); - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3%d", JFFS_PATH_NAME_01, i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/test3_%d", JFFS_PATH_NAME_01, - i); - strcpy_s(pathname1, JFFS_STANDARD_NAME_LENGTH, pathname); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread038(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread038", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp deleted file mode 100644 index 9d3ce6ce..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_039.cpp +++ /dev/null @@ -1,437 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread039(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread039", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp deleted file mode 100644 index d1eaae8d..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_040.cpp +++ /dev/null @@ -1,453 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread040(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread040", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp deleted file mode 100644 index 516ac388..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_041.cpp +++ /dev/null @@ -1,452 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread041(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread041", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp deleted file mode 100644 index 5786640d..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_042.cpp +++ /dev/null @@ -1,458 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(6); // delay time: 6 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread042(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread042", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp deleted file mode 100644 index b5d8dcf8..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_043.cpp +++ /dev/null @@ -1,442 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(6); // delay time: 6 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread043(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread043", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp deleted file mode 100644 index 543b261a..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_044.cpp +++ /dev/null @@ -1,457 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MIDDLE_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(6); // delay time: 6 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread044(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MULTIPTHREAD_044", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp deleted file mode 100644 index 0ebe9c36..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_045.cpp +++ /dev/null @@ -1,458 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay time: 3 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread045(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread045", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp deleted file mode 100644 index a4269f45..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_046.cpp +++ /dev/null @@ -1,442 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(6); // delay time: 6 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread046(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread046", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp deleted file mode 100644 index b17c81f5..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_047.cpp +++ /dev/null @@ -1,457 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - LosTaskDelay(3); // delay time: 3 - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = 256 * BYTES_PER_KBYTE; // 256 KB - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay time: 3 - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread047(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread047", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_048.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_048.cpp deleted file mode 100644 index cf74e095..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_048.cpp +++ /dev/null @@ -1,453 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME02, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME02, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME01 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME02 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread048(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread048", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_049.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_049.cpp deleted file mode 100644 index 4737de66..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_049.cpp +++ /dev/null @@ -1,437 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - INT32 readLen = 10; - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - struct stat st; - - g_TestCnt = 0; - - ret = mkdir(bufname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY5); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread049(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread049", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_050.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_050.cpp deleted file mode 100644 index 95158bcb..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_050.cpp +++ /dev/null @@ -1,452 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - INT32 readLen = 10; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, readLen); - ICUNIT_GOTO_EQUAL(len, readLen, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "0123456789", readbuf, EXIT1); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file1%d.txt", - JFFS_PATH_NAME0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - JffsStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file2%d.txt", - JFFS_PATH_NAME_0, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[10] = {}; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[FILE_BUF_SIZE] = - "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufW = NULL; - struct stat statbuf; - INT32 bufWLen = BYTES_PER_MBYTE; - - flag = 0; - bufW = (CHAR *)malloc(bufWLen + 1); - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufW, NULL, NULL); - memset_s(bufW, bufWLen + 1, 0, bufWLen + 1); - - for (i = 0; i < bufWLen / strlen(filebuf); i++) { - strcat_s(bufW, bufWLen + 1, filebuf); - } - - index = 0; - for (i = 0; i < JFFS_MAX_CYCLES; i++) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3%d.txt", - JFFS_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // max file num: 3 - case 0: - for (j = 0; j < JFFS_MAX_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay time: 3 - break; - case 1: - for (j = 0; j < JFFS_MIDDLE_CYCLES; j++) { - len = write(fd[index], bufW, strlen(bufW)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay time: 5 - break; - case 2: // fd[2] - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay time: 7 - default: - break; - } - - dprintf("PthreadF03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - snprintf_s(pathname1, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - } - - g_TestCnt++; - - free(bufW); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - snprintf_s(pathname, JFFS_STANDARD_NAME_LENGTH, JFFS_STANDARD_NAME_LENGTH - 1, "%s/file3_%d.txt", - JFFS_PATH_NAME_01, i); - unlink(pathname); - } - g_TestCnt = 0; - free(bufW); - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_0 }; - CHAR bufname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME_01 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY4); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF02, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], JFFS2NUM_JFFS2_GC_THREAD_PRIORITY2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], PthreadF03, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread050(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread050", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_051.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_051.cpp deleted file mode 100644 index 63eed4c5..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_051.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static VOID *MutiJffs05101(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_051_01 2 \n"); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - unlink(pathname); - - dprintf(" end muti_jffs_051_01 2 \n"); - - return NULL; -EXIT: - - unlink(pathname); - - g_TestCnt = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - pthread_attr_t attr[JFFS_MAX_THREADS]; - pthread_t threadId[JFFS_MAX_THREADS]; - INT32 priority = 20; - INT32 testNum = 3; - - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - i = 0; - ret = PosixPthreadInit(&attr[i], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], MutiJffs05101, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], MutiJffs05101, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - i++; - ret = PosixPthreadInit(&attr[i], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[i], &attr[i], MutiJffs05101, (void *)i); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - while (g_TestCnt < testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < JFFS_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, JFFS_MAX_THREADS, g_TestCnt); - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < JFFS_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - -EXIT: - rmdir(pathname); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread051(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread051", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp deleted file mode 100644 index fe64c537..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_052.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05201(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - dprintf(" start muti_jffs_052_01 1 \n"); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_52"); - - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 52_01 \n"); - } - - dprintf(" end muti_jffs_052_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - - return NULL; -} - -static VOID *MutiJffs05202(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - dprintf(" start muti_jffs_052_02 1 \n"); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_52"); - - // file size: 1024, write size: 1024 - ret = JffsMultiWrite(pathname, 1024, 1024, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - // file size: 1024, read size: 1 - ret = JffsMultiRead(pathname, 1024, 1, O_RDWR, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 52_02 \n"); - } - - dprintf(" end muti_jffs_052_02 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_52"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05201, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05202, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread052(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread052", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp deleted file mode 100644 index 454c190c..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_053.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05301(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_053_01 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_53"); - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 53_01 \n"); - } - - dprintf(" end muti_jffs_053_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05302(void *arg) -{ - INT32 ret, i; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - - dprintf(" start muti_jffs_053_02 1 \n"); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_53"); - - fd = open(pathname, O_RDONLY, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 53_02 \n"); - } - - dprintf(" end muti_jffs_053_02 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_53"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05301, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05302, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread053(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread053", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp deleted file mode 100644 index 0ca30aa1..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_054.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05401(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_054_01 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_54"); - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDONLY, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 54_01 \n"); - } - - dprintf(" end muti_jffs_054_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05402(void *arg) -{ - INT32 ret, i, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - - dprintf(" start muti_jffs_054_02 1 \n"); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_54"); - - fd = open(pathname, O_WRONLY | O_CREAT, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 54_02 \n"); - } - - dprintf(" end muti_jffs_054_02 2 \n"); - - return NULL; - -EXIT1: - close(fd); - -EXIT: - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_54"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05401, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05402, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread054(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread054", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp deleted file mode 100644 index 3c26506f..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_055.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05501(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_055_01 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_55"); - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDONLY, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 55_01 \n"); - } - - dprintf(" end muti_jffs_055_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05502(void *arg) -{ - INT32 ret, i; - INT32 fd = -1; - struct stat buf1 = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_055_02 1 \n"); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_55"); - fd = open(pathname, O_WRONLY | O_CREAT, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 55_02 \n"); - } - - dprintf(" end muti_jffs_055_02 2 \n"); - - return NULL; - -EXIT1: - close(fd); - -EXIT: - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_55"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05501, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05502, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread055(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread055", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp deleted file mode 100644 index 7a3de5d9..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_056.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05601(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_056_01 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_56"); - - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDONLY, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 56_01 \n"); - } - - dprintf(" end muti_jffs_056_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05602(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - dprintf(" start muti_jffs_056_02 1 \n"); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_56"); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_56_rename"); - - rename(pathname, pathname1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 56_02 \n"); - } - - dprintf(" end muti_jffs_056_02 2 \n"); - - return NULL; - -EXIT: - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_56"); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_56_rename"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05601, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05602, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - unlink(pathname); - unlink(pathname1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); - unlink(pathname1); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread056(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread056", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp deleted file mode 100644 index 479eeb7b..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_057.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05701(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_057_01 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_57"); - - ret = JffsMultiRead(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDONLY, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 57_01 \n"); - } - - dprintf(" end muti_jffs_057_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05702(void *arg) -{ - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - dprintf(" start muti_jffs_057_02 1 \n"); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_57"); - - umount(pathname); - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 57_02 \n"); - } - - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - dprintf(" end muti_jffs_057_02 2 \n"); - - return NULL; - -EXIT: - - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_57"); - ret = - JffsMultiWrite(pathname, JFFS_PRESSURE_W_R_SIZE2, JFFS_PRESSURE_W_R_SIZE1, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05701, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05702, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread057(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread057", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp deleted file mode 100644 index ffdc0c11..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_058.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05801(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_058_01 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_58"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 58_01 \n"); - } - - dprintf(" end muti_jffs_058_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05802(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_058_02 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_58"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - // file size: 1024, read size: 1 - ret = JffsMultiRead(pathname, 1024, 1, O_RDWR, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 58_02 \n"); - } - - dprintf(" end muti_jffs_058_02 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_58"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05801, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05802, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread058(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread058", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp deleted file mode 100644 index 909e76f2..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_059.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs05901(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_059_01 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_59"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 59_01 \n"); - } - - dprintf(" end muti_jffs_059_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs05902(void *arg) -{ - INT32 ret, i, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - - dprintf(" start muti_jffs_059_02 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_59"); - - fd = open(pathname, O_WRONLY | O_CREAT, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 59_02 \n"); - } - - dprintf(" end muti_jffs_059_02 2 \n"); - - return NULL; - -EXIT1: - close(fd); - -EXIT: - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_59"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs05901, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs05902, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread059(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread059", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp deleted file mode 100644 index 7e23e03f..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_060.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs06001(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_060_01 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_60"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_WRONLY | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 60_01 \n"); - } - - dprintf(" end muti_jffs_060_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs06002(void *arg) -{ - INT32 ret, i, len; - INT32 fd = -1; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "0000000000111111111122222222223333333333"; - - dprintf(" start muti_jffs_060_02 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_60"); - - fd = open(pathname, O_RDONLY | O_CREAT, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, JFFS_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, JFFS_STANDARD_NAME_LENGTH, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 60_02 \n"); - } - - dprintf(" end muti_jffs_060_02 2 \n"); - - return NULL; - -EXIT1: - close(fd); - -EXIT: - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_60"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs06001, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs06002, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread060(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread060", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp deleted file mode 100644 index e9147dc8..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_061.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs06101(void *arg) -{ - INT32 ret; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_061_01 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_61"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_WRONLY | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 61_01 \n"); - } - - dprintf(" end muti_jffs_061_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs06102(void *arg) -{ - INT32 ret, i; - INT32 fd = -1; - struct stat buf1 = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR buffile[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - dprintf(" start muti_jffs_061_02 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_61"); - - fd = open(pathname, O_RDONLY | O_CREAT, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - JffsStatPrintf(buf1); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 61_02 \n"); - } - - dprintf(" end muti_jffs_061_02 2 \n"); - - return NULL; - -EXIT1: - close(fd); - -EXIT: - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_61"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs06101, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs06102, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread061(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread061", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp deleted file mode 100644 index 2bc77731..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_062.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs06201(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_062_01 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_62"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_WRONLY | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 62_01 \n"); - } - - dprintf(" end muti_jffs_062_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs06202(void *arg) -{ - INT32 ret, i; - INT32 fd = -1; - struct stat buf1 = { 0 }; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - - dprintf(" start muti_jffs_062_02 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_62"); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_62_rename"); - - rename(pathname, pathname1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 62_02 \n"); - } - - dprintf(" end muti_jffs_062_02 2 \n"); - - return NULL; - -EXIT: - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_62"); - strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/test_62_rename"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs06201, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs06202, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - unlink(pathname); - unlink(pathname1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); - unlink(pathname1); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread062(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread062", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp b/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp deleted file mode 100644 index e192c193..00000000 --- a/testsuites/unittest_old/fs/jffs/pressure/It_vfs_jffs_multipthread_063.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static INT32 g_testNum = 2; - -static VOID *MutiJffs06301(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - dprintf(" start muti_jffs_063_01 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_63"); - - // file size: 1024, write size: 16 - ret = JffsMultiWrite(pathname, 1024, 16, O_WRONLY | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 63_01 \n"); - } - - dprintf(" end muti_jffs_063_01 2 \n"); - - return NULL; -EXIT: - - g_TestCnt++; - return NULL; -} - -static VOID *MutiJffs06302(void *arg) -{ - INT32 ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_MAIN_DIR0 }; - - dprintf(" start muti_jffs_063_02 1 \n"); - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_63"); - - umount(pathname); - - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - g_TestCnt++; - - while (g_TestCnt < g_testNum) { - sleep(1); - dprintf(" sleep 63_02 \n"); - } - - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - dprintf(" end muti_jffs_063_02 2 \n"); - - return NULL; - -EXIT: - mount(JFFS_DEV_PATH0, JFFS_MAIN_DIR0, JFFS_FILESYS_TYPE, 0, NULL); - - g_TestCnt++; - return NULL; -} - - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, i; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR bufname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - INT32 threadNum = 2; - pthread_attr_t attr[threadNum]; - pthread_t threadId[threadNum]; - INT32 priority = 20; - - g_TestCnt = 0; - - ret = mkdir(bufname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname, JFFS_STANDARD_NAME_LENGTH, "/test_63"); - // file size: 1024, write size: 10 - ret = JffsMultiWrite(pathname, 1024, 10, O_RDWR | O_CREAT, JFFS_WR_TYPE_TEST); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - dprintf("start create task\n"); - ret = PosixPthreadInit(&attr[0], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[0], &attr[0], MutiJffs06301, (void *)0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadInit(&attr[1], priority); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadId[1], &attr[1], MutiJffs06302, (void *)1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - dprintf("end create task\n"); - - while (g_TestCnt < g_testNum) { - sleep(10); // sleep time: 10 - dprintf(" sleep \n"); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < threadNum; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - } - - ICUNIT_ASSERT_EQUAL(g_TestCnt, 2, g_TestCnt); // test number: 2 - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - for (i = 0; i < threadNum; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < threadNum; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT1: - unlink(pathname); -EXIT: - rmdir(bufname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffsMultipthread063(VOID) -{ - TEST_ADD_CASE("ItFsJffsMultipthread063", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_001.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_001.cpp deleted file mode 100644 index da785908..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_001.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - INT32 len = 0; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off = 0; - - fd = open(pathname, O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - len = read(fd, readbuf, 50); // read length: 50 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - - len = read(fd, readbuf, 50); // read length: 50 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "liteos", readbuf, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, JFFS_IS_ERROR, off, EXIT1); - - len = read(fd, readbuf, 50); // read length: 50 - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = unlink(pathname); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - fd = open(pathname, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - unlink(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs001(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_002.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_002.cpp deleted file mode 100644 index 8649f86e..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_002.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret; - INT32 offset; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr; - - g_TestCnt = 0; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname, "/0test"); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT4); - - return JFFS_NO_ERROR; -EXIT4: - closedir(dir); - goto EXIT; -EXIT3: - closedir(dir); -EXIT2: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs002(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_002", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_003.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_003.cpp deleted file mode 100644 index 6f26ec84..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_003.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd, ret; - CHAR pathname[50] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr; - INT32 offset; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname, "/0test"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT5); - - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "2test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0file", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "1test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT5); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "0test", ptr->d_name, EXIT5); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT5); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT5); - -EXIT5: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT5); -EXIT4: - JffsStrcat2(pathname, "/1test", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/2test", sizeof(pathname)); - rmdir(pathname); -EXIT2: - JffsStrcat2(pathname, "/0file", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/0test", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs003(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_003", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_005.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_005.cpp deleted file mode 100644 index 13fb0665..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_005.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd, fd1, fd2, ret; - CHAR pathname[30] = { JFFS_PATH_NAME0 }; - DIR *dir = NULL; - struct dirent *ptr; - INT32 offset, offset1, offset2, offset3, offset4; - - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname, "/test0"); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - JffsStrcat2(pathname, "/file1", sizeof(pathname)); - fd1 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - JffsStrcat2(pathname, "/file0", sizeof(pathname)); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - JffsStrcat2(pathname, "/test2", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - JffsStrcat2(pathname, "/file2", sizeof(pathname)); - fd2 = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT5); - - JffsStrcat2(pathname, "/test1", sizeof(pathname)); - ret = mkdir(pathname, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT6); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT7); - - offset1 = 0; - ptr = readdir(dir); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file0", ptr->d_name, EXIT7); - - offset2 = ptr->d_off; - ptr = readdir(dir); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file1", ptr->d_name, EXIT7); - - offset3 = ptr->d_off; - ptr = readdir(dir); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file2", ptr->d_name, EXIT7); - - offset4 = ptr->d_off; - ptr = readdir(dir); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "test0", ptr->d_name, EXIT7); - - seekdir(dir, offset2); - rewinddir(dir); - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT7); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file0", ptr->d_name, EXIT7); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT7); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT7); - - seekdir(dir, offset1); - rewinddir(dir); - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT7); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file0", ptr->d_name, EXIT7); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT7); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT7); - - seekdir(dir, offset4); - rewinddir(dir); - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT7); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file0", ptr->d_name, EXIT7); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT7); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT7); - - seekdir(dir, offset3); - rewinddir(dir); - offset = telldir(dir); - ptr = readdir(dir); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT7); - ICUNIT_GOTO_STRING_EQUAL(ptr->d_name, "file0", ptr->d_name, EXIT7); - ICUNIT_GOTO_EQUAL(offset, offset1, offset, EXIT7); - ICUNIT_GOTO_EQUAL(offset, ptr->d_off - 1, offset, EXIT7); - -EXIT7: - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT7); -EXIT6: - JffsStrcat2(pathname, "/test1", sizeof(pathname)); - rmdir(pathname); -EXIT5: - JffsStrcat2(pathname, "/file2", sizeof(pathname)); - close(fd2); - remove(pathname); -EXIT4: - JffsStrcat2(pathname, "/test2", sizeof(pathname)); - rmdir(pathname); -EXIT3: - JffsStrcat2(pathname, "/file0", sizeof(pathname)); - close(fd); - remove(pathname); -EXIT2: - JffsStrcat2(pathname, "/file1", sizeof(pathname)); - close(fd1); - remove(pathname); -EXIT1: - JffsStrcat2(pathname, "/test0", sizeof(pathname)); - rmdir(pathname); -EXIT: - rmdir(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs005(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_005", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_021.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_021.cpp deleted file mode 100644 index 70bf2183..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_021.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd1, fd2, ret; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR bufdir1[30] = { JFFS_PATH_NAME0 }; - CHAR bufdir2[30] = { JFFS_PATH_NAME0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/dir1"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat(pathname2, "/dir2"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat(bufdir2, "/dir2/dirfile2"); - ret = mkdir(bufdir2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - strcat(bufdir1, "/dir1/dirfile1"); - ret = mkdir(bufdir1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rename(bufdir1, bufdir2); // dirfile1±ä³Édirfile2£¬dirfile2»á±»É¾³ý - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(bufdir1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(bufdir2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT4: - JffsStrcat2(bufdir1, "/dir1/dirfile1", strlen(pathname1)); - remove(pathname1); -EXIT3: - JffsStrcat2(bufdir2, "/dir2/dirfile2", strlen(pathname1)); - remove(pathname1); -EXIT2: - JffsStrcat2(pathname1, "/dir2", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir1", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs021(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_021", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_022.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_022.cpp deleted file mode 100644 index a7992f38..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_022.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd1, fd2, ret, len; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR buffile1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile2[50] = { JFFS_PATH_NAME0 }; - CHAR filebuf[20] = "1234567890"; - CHAR readbuf[20] = {0}; - off_t off; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/dir1"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat(pathname2, "/dir2"); - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - strcat(buffile1, "/dir1/file1"); - fd1 = open(buffile1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd1, -1, fd1, EXIT6); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT6); - - strcat(buffile2, "/dir2/file2"); - fd2 = open(buffile2, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - off = lseek(fd2, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT8); - - len = read(fd2, readbuf, 20); // read length: 20 - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT8); - - off = lseek(fd1, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT8); // file position: 20 - - len = read(fd1, readbuf, 20); // read length: 20 - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT8); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT8); - - ret = close(fd1); // ɾ³ý³É¹¦"/dir2/file2" - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT8); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT8); - - ret = rename(buffile1, buffile2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = rmdir(pathname1); // dir1ɾ³ý³É¹¦ - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT8); - - fd2 = open(buffile2, O_NONBLOCK | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd2, -1, fd2, EXIT4); - - len = read(fd2, readbuf, 20); // read length: 20 - ICUNIT_GOTO_EQUAL(len, strlen(filebuf), len, EXIT4); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "1234567890", readbuf, EXIT4); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = unlink(buffile2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT4); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT8: - close(fd2); -EXIT7: - JffsStrcat2(pathname1, "/dir2/file2", strlen(pathname1)); - remove(pathname1); -EXIT6: - close(fd1); -EXIT5: - JffsStrcat2(pathname1, "/dir1/file1", strlen(pathname1)); - remove(pathname1); - goto EXIT2; -EXIT4: - close(fd2); -EXIT3: - JffsStrcat2(pathname1, "/dir2/file2", strlen(pathname1)); - remove(pathname1); - goto EXIT6; -EXIT2: - JffsStrcat2(pathname1, "/dir2", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir1", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs022(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_022", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_026.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_026.cpp deleted file mode 100644 index 5e2dbde6..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_026.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret, fd, len; - off_t off; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - CHAR readbuf[301] = {0}; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - struct statfs buf4 = { 0 }; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(buffile, "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = statfs(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT3); - - len = write(fd, - "12345678901234567890123456789012345678901234567890abcdefghjk12345678901234567890123456789012345678901234567890" - "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" - "12345678901234567890123456789012345678901234567890123456789012345678901234567890", - 300); // write length: 300 - ICUNIT_GOTO_EQUAL(len, 300, len, EXIT3); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT3); - - len = read(fd, readbuf, 300); // read length: 300 - ICUNIT_GOTO_EQUAL(len, 300, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, - "12345678901234567890123456789012345678901234567890abcdefghjk12345678901234567890123456789012345678901234567890" - "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" - "12345678901234567890123456789012345678901234567890123456789012345678901234567890", - readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = statfs(buffile, &buf4); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - JffsStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - JffsStrcat2(pathname1, "dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs026(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_026", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_027.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_027.cpp deleted file mode 100644 index 816211ef..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_027.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret, fd, len; - off_t off; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR buffile[50] = { JFFS_PATH_NAME0 }; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - CHAR writebuf[20] = "ABCDEFGHJK"; - CHAR readbuf[20] = {0}; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - strcat(pathname1, "/dir"); - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - strcat(buffile, "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT3); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT3); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, -1, off, EXIT3); - - len = read(fd, readbuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT3); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf2); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - JffsStatPrintf(buf3); - - ICUNIT_GOTO_EQUAL(buf1.st_size, 10, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf2.st_size, 10, buf2.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.st_size, 0, buf3.st_size, EXIT3); - - ICUNIT_GOTO_EQUAL(buf1.st_mode & S_IFMT, S_IFREG, buf1.st_mode & S_IFMT, EXIT3); - ICUNIT_GOTO_EQUAL(buf2.st_mode & S_IFMT, S_IFREG, buf2.st_mode & S_IFMT, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.st_mode & S_IFMT, S_IFDIR, buf3.st_mode & S_IFMT, EXIT3); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - remove(buffile); -EXIT1: - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs027(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_027", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_034.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_034.cpp deleted file mode 100644 index 882cba32..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_034.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret, fd, len; - DIR *dir = NULL; - CHAR pathname1[50] = "/storage"; - CHAR pathname2[50] = { JFFS_PATH_NAME0 }; - CHAR readbuf[20] = {0}; - - ret = mkdir(pathname2, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = umount(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(dir, NULL, dir, EXIT2); - - ret = mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - dir = opendir(pathname2); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); - closedir(dir); - goto EXIT; -EXIT1: - mount(JFFS_DEV_PATH0, "/storage", JFFS_FILESYS_TYPE, 0, NULL); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs034(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_034", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_035.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_035.cpp deleted file mode 100644 index 09494447..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_035.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 ret, fd, len; - CHAR pathname1[50] = { JFFS_PATH_NAME0 }; - CHAR readbuf[50] = {0}; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); // write length: 16 - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = umount("/jffs2_test"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - ret = mount(JFFS_DEV_PATH0, "/jffs2_test", JFFS_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); // write length: 16 - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = read(fd, readbuf, 20); // read length: 20 - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); // file length: 16 - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = umount("/jffs2_test/test/test123"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); - - ret = umount(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = mount(NULL, "/jffs2_test", "storage", 0, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); - - ret = access("/jffs2_test", F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = access(pathname1, F_OK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT2: - mount(JFFS_DEV_PATH0, "/jffs2_test", JFFS_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs035(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_035", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_094.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_094.cpp deleted file mode 100644 index 09c9fa55..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_094.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd, ret, len; - CHAR filebuf[20] = "abcdeabcde"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -ENOSYS, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs094(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_094", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_095.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_095.cpp deleted file mode 100644 index 9fcafaaa..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_095.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd, ret, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - CHAR writebuf[JFFS_STANDARD_NAME_LENGTH] = "0123456789"; - - ret = mkdir(pathname1, HIGHEST_AUTHORITY); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname2, "/test"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT2); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT2); - - ret = fsync(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - remove(pathname2); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs095(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_095", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_103.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_103.cpp deleted file mode 100644 index bab3d04e..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_103.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ -/* INT32 ret,fd,len; - off_t off; - CHAR pathname1[50] = JFFS_PATH_NAME0; - CHAR pathname2[50]=JFFS_PATH_NAME0; - struct stat64 buf1={0}; - struct stat64 buf2={0}; - struct stat buf3={0}; - CHAR readbuf[20]={0}; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat(pathname1, "/dir"); - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - strcat(pathname2, "/dir/files"); - fd = open64(pathname2, O_NONBLOCK | O_CREAT | O_RDWR, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT3); - - len = write(fd, "ABCDEFGHJK", 10); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT3); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_NOT_EQUAL(off, JFFS_IS_ERROR, off, EXIT3); - - len = read(fd,readbuf,10); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "ABCDEFGHJK", readbuf, EXIT3); - - ret = stat64(pathname2, &buf1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - jffs_stat64_printf(buf1); - - ret = fstat64(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - jffs_stat64_printf(buf2); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - jffs_stat_printf(buf3); - - ICUNIT_GOTO_EQUAL(buf1.st_size, 10, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf2.st_size, 10, buf2.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.st_size, 0, buf3.st_size, EXIT3); - - ICUNIT_GOTO_EQUAL(buf1.st_mode& S_IFMT, S_IFREG, buf1.st_mode& S_IFMT, EXIT3); - ICUNIT_GOTO_EQUAL(buf2.st_mode& S_IFMT, S_IFREG, buf2.st_mode& S_IFMT, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.st_mode& S_IFMT, S_IFDIR, buf3.st_mode& S_IFMT, EXIT3); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mode& S_IFMT, buf2.st_mode& S_IFMT, buf1.st_mode& S_IFMT, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT3); - - ret = close(fd) ; - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT3); - - ret = unlink(pathname2) ; - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT3: - close(fd); -EXIT2: - jffs_strcat2(pathname1, "/dir/files",strlen(pathname1)); - remove(pathname1); -EXIT1: - jffs_strcat2(pathname1, "/dir",strlen(pathname1)); - remove(pathname1); -EXIT: - remove(JFFS_PATH_NAME0); - return JFFS_NO_ERROR;*/ -} - -/* -********** -testcase brief in English -********** -*/ - -VOID IT_FS_JFFS_103(VOID) -{ - - TEST_ADD_CASE("IT_FS_JFFS_103", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); - -} - diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_535.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_535.cpp deleted file mode 100644 index da5aa830..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_535.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static UINT32 testcase(VOID) -{ - INT32 fd, len, ret; - CHAR filebuf[JFFS_STANDARD_NAME_LENGTH] = "1234567890abcde&"; - CHAR readbuf[JFFS_STANDARD_NAME_LENGTH] = {0}; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - long off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, HIGHEST_AUTHORITY); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT1); - - len = write(fd, "END", 3); // write length: 3 - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); - - off = lseek64(fd, JFFS_SHORT_ARRAY_LENGTH, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, JFFS_SHORT_ARRAY_LENGTH, off, EXIT1); - - len = read(fd, readbuf, 6); // read length: 6 - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcde&", readbuf, EXIT1); - - off = lseek64(fd, 2, SEEK_CUR); // seek offset: 2 - ICUNIT_GOTO_EQUAL(off, 18, off, EXIT1); // file position: 18 - - memset(readbuf, 0, sizeof(readbuf)); - - len = read(fd, readbuf, 5); // read length: 5 - ICUNIT_GOTO_EQUAL(len, 5, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "34567", readbuf, EXIT1); - - off = lseek64(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, 23, off, EXIT1); // file position: 23 - - len = read(fd, readbuf, 5); // read length: 5 - ICUNIT_GOTO_EQUAL(len, 5, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "890ab", readbuf, EXIT1); - - off = lseek64(fd, -2, SEEK_CUR); // seek offset: -2 - ICUNIT_GOTO_EQUAL(off, 26, off, EXIT1); // file position: 26 - - len = read(fd, readbuf, 6); // read length: 6 - ICUNIT_GOTO_EQUAL(len, 6, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "abcde&", readbuf, EXIT1); - - off = lseek64(fd, -2, SEEK_END); // seek offset: -2 - ICUNIT_GOTO_EQUAL(off, 49, off, EXIT1); // file size: 49 - - memset(readbuf, 0, sizeof(readbuf)); - len = read(fd, readbuf, 5); // read length: 5 - ICUNIT_GOTO_EQUAL(len, 2, len, EXIT1); // file size: 2 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "ND", readbuf, EXIT1); - - off = lseek64(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 51, off, EXIT1); // file size: 51 - - len = read(fd, readbuf, 6); // read length: 6 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - - off = lseek64(fd, 2, SEEK_END); // seek offset: 2 - ICUNIT_GOTO_EQUAL(off, 53, off, EXIT1); // file size: 53 - len = read(fd, readbuf, 6); // read length: 6 - ICUNIT_GOTO_EQUAL(len, JFFS_NO_ERROR, len, EXIT1); - - len = write(fd, "mmm", 3); // write length: 3 - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); - - off = lseek64(fd, -3, SEEK_END); // seek offset: -3 - ICUNIT_GOTO_EQUAL(off, 53, off, EXIT1); // file size:49 - - len = read(fd, readbuf, 5); // read length: 5 - ICUNIT_GOTO_EQUAL(len, 3, len, EXIT1); // file length: 3 - ICUNIT_GOTO_STRING_EQUAL(readbuf, "mmm", readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return JFFS_NO_ERROR; -} - -VOID ItFsJffs535(VOID) -{ - TEST_ADD_CASE("IT_FS_JFFS_535", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_Dac_001.cpp b/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_Dac_001.cpp deleted file mode 100644 index 33f32d8f..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/It_vfs_jffs_Dac_001.cpp +++ /dev/null @@ -1,529 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -static uid_t g_testUID1 = 111; -static uid_t g_testUID2 = 222; -static char *g_testDIR = "TEST_D"; - -/* umask */ -static int TestUmask(const char *path) -{ - mode_t mode; - int ret; - struct stat buf = { 0 }; - char filename[128] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - - mode = umask(0044); // umask: 0044 - ICUNIT_ASSERT_EQUAL(mode, 0022, mode); // mode: 0022 - mode = umask(0022); // umask: 0022 - ICUNIT_ASSERT_EQUAL(mode, 0044, mode); // mode: 0044 - sprintf(filename, "%s/%s", path, g_testDIR); - ret = mkdir(filename, HIGHEST_AUTHORITY); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = stat(filename, &buf); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(buf.st_mode, 040755, buf.st_mode); - rmdir(filename); - return 0; -} - -/* open */ -static int TestOpen(const char *path) -{ - int ret; - char filename[64] = {0}; - char filename1[64] = {0}; - char filename2[64] = {0}; - char filename3[64] = {0}; - - ret = setuid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - // uid 111, gid 111,home dir 0 0 757 - - sprintf(filename, "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0753); // mode: 0753 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - sprintf(filename1, "%s/%s", filename, "f1"); - ret = open(filename1, O_CREAT | O_WRONLY, 0755); // mode: 0755 - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - close(ret); - - ret = setuid(g_testUID2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - // uid 222, gid 111,home dir 111 111 753 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - sprintf(filename2, "%s/%s", filename, "f2"); - ret = open(filename2, O_CREAT | O_WRONLY, 0755); // mode: 0755 - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = open(filename1, O_WRONLY); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EACCES, errno, errno); - - ret = setgid(g_testUID2); - // uid 222, gid 222,home dir 111 111 753 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - sprintf(filename3, "%s/%s", filename, "f3"); - ret = open(filename3, O_CREAT | O_WRONLY, 0755); // mode: 0755 - printf("%s, %d ret %d\n", __FUNCTION__, __LINE__, ret); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - close(ret); - ret = unlink(filename3); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - // file mode 755 - ret = open(filename1, O_WRONLY); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = open(filename1, O_RDONLY); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - close(ret); - - ret = setuid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = unlink(filename1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -/* unlink */ -static int TestUnlink(const char *path) -{ - int ret; - char filename[64] = {0}; - char filename1[64] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - // uid 0, gid 0, home dir 0 0 757 - sprintf(filename, "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0757); // mode 757 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - sprintf(filename1, "%s/%s", filename, "f1"); - - ret = open(filename1, O_CREAT | O_WRONLY, 0755); // mode: 0755 - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - close(ret); - - ret = setuid(g_testUID2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - // uid 222, gid 0 - ret = unlink(filename1); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = setgid(g_testUID2); - // uid 222, gid 222 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = unlink(filename1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - - return 0; -} - -/* mkdir */ -/* rmdir */ -static int TestMkdir(const char *path) -{ - int ret; - char filename[64] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - // uid 0, gid 0, home dir 0 0 757 - sprintf(filename, "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0735); // mode 735 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = setuid(g_testUID2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = setgid(g_testUID2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = setuid(0); - ret = setgid(0); - - return 0; -} - -/* chmod */ -static int TestChmod(const char *path) -{ - int ret; - struct stat buf = { 0 }; - char filename[64] = {0}; - char filename1[64] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - // uid 0, gid 0, home dir 0 0 757 - sprintf(filename, "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0757); // mode 757 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - sprintf(filename1, "%s/%s", filename, "f1"); - - setuid(g_testUID2); - ret = chmod(filename, 0111); // mode: 0111 - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - setuid(0); - ret = chmod(filename, 0111); // mode: 0111 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = stat(filename, &buf); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(buf.st_mode, 040111, buf.st_mode); // mode: 040111 - - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - - return 0; -} - -/* stat chdir */ -static int TestStatChdir(const char *path) -{ - int ret; - struct stat buf = { 0 }; - char filename[64] = {0}; - char filename1[64] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - // uid 0, gid 0, home dir 0 0 757 - sprintf(filename, "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0700); // mode: 0700 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - sprintf(filename1, "%s/%s", filename, "f1"); - - ret = mkdir(filename1, 0755); // mode: 0755 - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - ret = setuid(g_testUID2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - // uid 222, gid 0 - ret = chdir(filename); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EACCES, errno, errno); - ret = stat(filename1, &buf); - printf("%s, %d ret %d errno %d\n", __FUNCTION__, __LINE__, ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = setuid(0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - // uid 222, gid 0 - ret = chdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = stat(filename1, &buf); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = rmdir(filename1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = chdir(JFFS_MAIN_DIR0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - - return 0; -} - -/* rename */ -static int TestRename(const char *path) -{ - int ret; - char filename[64] = {0}; - char filename1[64] = {0}; - char filename2[64] = {0}; - - ret = setuid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - // uid 111, gid 111,home dir 0 0 757 - - sprintf(filename, "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0711); // mode: 0711 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - sprintf(filename1, "%s/%s", filename, "f1"); - ret = mkdir(filename1, 0755); // mode: 0755 - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - close(ret); - - sprintf(filename2, "%s/%s", filename, "f2"); - ret = rename(filename1, filename2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = setuid(g_testUID2); - // uid 222, gid 222,home dir 111 111 753 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - sprintf(filename2, "%s/%s", filename, "f2"); - ret = rename(filename2, filename1); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = setuid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(g_testUID1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = rmdir(filename2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - - -/* execve */ -/* access */ -static int TestAccess(const char *path) -{ - int ret; - char filename[64] = {0}; - - printf("%s, %d\n", __FUNCTION__, __LINE__); - // uid 0, gid 0, home dir 0 0 757 - sprintf(filename, "%s/%s", path, g_testDIR); - ret = mkdir(filename, 0757); // mode 757 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = access(filename, F_OK); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = access(filename, R_OK); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = chmod(filename, 0311); // mode: 0311 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = access(filename, R_OK); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = access(filename, W_OK); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = chmod(filename, 0111); // mode: 0111 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = access(filename, W_OK); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = access(filename, X_OK); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = chmod(filename, 0011); // mode: 0011 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = access(filename, X_OK); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = rmdir(filename); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ret = setgid(0); - - return 0; -} - -static int SetReadAndSearch() -{ - int capNum = 2; - struct __user_cap_header_struct capheader; - struct __user_cap_data_struct capdata[capNum]; - int ret; - - memset(&capheader, 0, sizeof(struct __user_cap_header_struct)); - memset(capdata, 0, capNum * sizeof(struct __user_cap_data_struct)); - capdata[0].permitted = 0xffffffff; - capdata[1].permitted = 0xffffffff; - capheader.version = _LINUX_CAPABILITY_VERSION_3; - capdata[CAP_TO_INDEX(CAP_SETPCAP)].effective |= CAP_TO_MASK(CAP_SETPCAP); - capdata[CAP_TO_INDEX(CAP_SETUID)].effective |= CAP_TO_MASK(CAP_SETUID); - capdata[CAP_TO_INDEX(CAP_SETGID)].effective |= CAP_TO_MASK(CAP_SETGID); - capdata[CAP_TO_INDEX(CAP_CHOWN)].effective |= CAP_TO_MASK(CAP_CHOWN); - capdata[CAP_TO_INDEX(CAP_DAC_READ_SEARCH)].effective |= CAP_TO_MASK(CAP_DAC_READ_SEARCH); - ret = capset(&capheader, &capdata[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -static int TestCapReadSearch() -{ - int ret; - char filenameParent[64] = {0}; - char filenameChild[64] = {0}; - - ret = setuid(0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = mkdir("/storage/test_jffs2", 0757); // mode 0757 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - sprintf(filenameParent, "%s/%s", "/storage/test_jffs2", "testParent"); - sprintf(filenameChild, "%s/%s", filenameParent, "testChild"); - ret = mkdir(filenameParent, 0222); // mode 0222 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - SetReadAndSearch(); - ret = mkdir(filenameChild, 0777); // mode 0777 - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = rmdir(filenameParent); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = rmdir("/storage/test_jffs2"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -/* execve */ -/* access */ - -static int TestJffsDac(const char *path) -{ - int ret = TestUmask(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - umask(0); - ret = TestOpen(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestUnlink(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestMkdir(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestChmod(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestStatChdir(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestRename(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = TestAccess(path); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - umask(0022); // umask: 0022 - return 0; -} - -static int ChildFunc(VOID) -{ - int capNum = 2; - struct __user_cap_header_struct capheader; - struct __user_cap_data_struct capdata[capNum]; - int ret; - - memset(&capheader, 0, sizeof(struct __user_cap_header_struct)); - memset(capdata, 0, capNum * sizeof(struct __user_cap_data_struct)); - capdata[0].permitted = 0xffffffff; - capdata[1].permitted = 0xffffffff; - capheader.version = _LINUX_CAPABILITY_VERSION_3; - capdata[CAP_TO_INDEX(CAP_SETPCAP)].effective |= CAP_TO_MASK(CAP_SETPCAP); - capdata[CAP_TO_INDEX(CAP_SETUID)].effective |= CAP_TO_MASK(CAP_SETUID); - capdata[CAP_TO_INDEX(CAP_SETGID)].effective |= CAP_TO_MASK(CAP_SETGID); - capdata[CAP_TO_INDEX(CAP_CHOWN)].effective |= CAP_TO_MASK(CAP_CHOWN); - ret = capset(&capheader, &capdata[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setuid(0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* jffs2 & rootfs test case */ - ret = mkdir("/storage/test_jffs", 0757); // mode 757 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - chmod("/storage/test_jffs", 0757); // mode 757 - ret = TestJffsDac("/storage/test_jffs"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - rmdir("/storage/test_jffs"); - - ret = setuid(2); // uid: 2 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setgid(2); // gid: 2 - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -static int testcase(VOID) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // pid must in range 0 - 100000 - if (pid == 0) { - ret = ChildFunc(); - printf("err line :%d error code: %d\n", 0, 0); - exit(0); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // pid must in range 0 - 100000 - if (pid == 0) { - ret = TestCapReadSearch(); - printf("err line :%d error code: %d\n", 0, 0); - exit(0); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT); - - return 0; - -EXIT: - return 1; -} - - -void ItTestDac001(void) -{ - TEST_ADD_CASE("IT_SEC_DAC_001", testcase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_005.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_005.cpp deleted file mode 100644 index 8f21d415..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_005.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_fs_jffs.h" - -static int TestCase(void) -{ - FILE *fp = NULL; - char *buf = "hello tmpfile !"; - char rbuf[20] = {0}; - int i = 0; - int ret = -1; - - fp = tmpfile(); - ICUNIT_GOTO_NOT_EQUAL(fp, NULL, fp, EXIT); - - ret = fwrite(buf, strlen(buf), 1, fp); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = fseek(fp, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = fread(rbuf, strlen(buf), 1, fp); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = memcmp(buf, rbuf, strlen(buf)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fclose(fp); - return JFFS_NO_ERROR; - -EXIT: - fclose(fp); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs005(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_005", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_008.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_008.cpp deleted file mode 100644 index 8c603fbb..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_008.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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. - */ -#include "It_fs_jffs.h" -#include - -#define FILE_PATH "/storage/testlockf.txt" - -/* F_TLOCKã€F_ULOCK */ -static int TestCase0(void) -{ - int fd = -1; - int ret; - - fd = open(FILE_PATH, O_WRONLY, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* lock 0-3 Regions */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lockf(fd, F_TLOCK, 3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* unlock 1 Regions */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lseek(fd, 1, SEEK_CUR); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = lockf(fd, F_ULOCK, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - close(fd); - return 0; - -EXIT: - close(fd); - return -1; -} - -/* F_TEST */ -static int TestCase1(void) -{ - int fd = -1; - int ret; - - fd = open(FILE_PATH, O_WRONLY, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* lock 0-3 Regions */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lockf(fd, F_LOCK, 3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* try lock 1 Region */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lseek(fd, 1, SEEK_CUR); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - - ret = lockf(fd, F_TEST, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* try lock 3 Region */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lseek(fd, 3, SEEK_CUR); - ICUNIT_GOTO_EQUAL(ret, 3, ret, EXIT); - - ret = lockf(fd, F_TEST, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - close(fd); - return 0; - -EXIT: - close(fd); - return -1; -} - -/* F_LOCK */ -static int TestCase2(void) -{ - int fd = -1; - int ret; - - fd = open(FILE_PATH, O_WRONLY, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - /* lock 0-3 Regions */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lockf(fd, F_LOCK, 3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - /* lock 2-5 Region */ - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = lseek(fd, 2, SEEK_CUR); - ICUNIT_GOTO_EQUAL(ret, 2, ret, EXIT); - - ret = lockf(fd, F_LOCK, 3); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - close(fd); - return 0; - -EXIT: - close(fd); - return -1; -} - -static int TestCase(void) -{ - int fd = -1; - int ret; - - fd = open(FILE_PATH, O_WRONLY | O_CREAT, JFFS_FILE_MODE); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = TestCase0(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = TestCase1(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = TestCase2(); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - -EXIT: - close(fd); - unlink(FILE_PATH); -} - -void ItTestFsJffs008(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_008", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_010.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_010.cpp deleted file mode 100644 index baf0d2ae..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_010.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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. - */ - -#include "It_fs_jffs.h" -#include - -#define RECV_SIGNUM 5U - -#define RTSIG0 (SIGRTMIN + 7) -#define RTSIG1 (SIGRTMIN + 6) -#define ERRSIG (SIGRTMAX + 10) - -static int m_sig[RECV_SIGNUM] = {0}; -static char *m_recvData = NULL; -char m_msg[] = "hello sigqueue"; -static int m_recvCount = 0; - -void Handler(int sig, siginfo_t *info, void *ctx) -{ - m_sig[m_recvCount] = sig; - m_recvData = (char *)info->si_value.sival_ptr; - m_recvCount++; -} - -void SonProcess0(pid_t pid) -{ - union sigval msg; - - msg.sival_ptr = m_msg; - sigqueue(pid, RTSIG1, msg); - sigqueue(pid, RTSIG0, msg); - sigqueue(pid, RTSIG1, msg); - - sleep(3); - exit(0); -} - -static int TestCase0(void) -{ - pid_t pid0 = -1; - pid_t pid1 = -1; - int ret = -1; - struct sigaction act = {0}; - act.sa_sigaction = Handler; - sigemptyset(&act.sa_mask); - act.sa_flags = SA_SIGINFO; - int i = 0; - int expectSig[RECV_SIGNUM] = {RTSIG1, RTSIG0, RTSIG1}; - - ret = sigaction(RTSIG1, &act, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = sigaction(RTSIG0, &act, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - pid1 = getpid(); - pid0 = fork(); - if (pid0 == 0) { - SonProcess0(pid1); - } else { - sleep(2); - for (i = 0; i 0) { - close(dirfd); - } - if (fd > 0) { - close(fd); - } -EXIT: - remove(pathname2); - remove(pathname1); - remove(pathname0); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs104(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_104", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_105.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_105.cpp deleted file mode 100644 index 824aca2e..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_105.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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. - */ -#include "It_fs_jffs.h" - -#define TEST_STRLEN 30 - -static int TestCase(void) -{ - INT32 dirfd = 0; - INT32 fd = 0; - INT32 ret = JFFS_IS_ERROR; - CHAR pathname0[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname1[TEST_STRLEN] = JFFS_PATH_NAME0; - CHAR pathname2[TEST_STRLEN] = JFFS_PATH_NAME0; - struct stat info = {0}; - - ret = mkdir(pathname0, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname1, TEST_STRLEN, "/test1"); - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = chown(pathname1, 1, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - stat(pathname1, &info); - ICUNIT_GOTO_EQUAL((uid_t)info.st_uid, 1, ret, EXIT); - ICUNIT_GOTO_EQUAL((uid_t)info.st_gid, 1, ret, EXIT); - - dirfd = open(pathname0, O_DIRECTORY); - fd = dirfd; - ICUNIT_GOTO_NOT_EQUAL(dirfd, JFFS_IS_ERROR, dirfd, EXIT); - - ret = fchownat(dirfd, "test1", 10, 10, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - stat(pathname1, &info); - ICUNIT_GOTO_EQUAL((uid_t)info.st_uid, 10, ret, EXIT1); - ICUNIT_GOTO_EQUAL((uid_t)info.st_gid, 10, ret, EXIT1); - - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dirfd = open(pathname0, O_DIRECTORY); - ICUNIT_GOTO_NOT_EQUAL(dirfd, JFFS_IS_ERROR, dirfd, EXIT); - - strcat_s(pathname2, TEST_STRLEN, "/test.txt"); - fd = open(pathname2, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, 0777); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = chown(pathname2, 1, 1); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - stat(pathname2, &info); - ICUNIT_GOTO_EQUAL((uid_t)info.st_uid, 1, ret, EXIT1); - ICUNIT_GOTO_EQUAL((uid_t)info.st_gid, 1, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = fchownat(dirfd, "test.txt", 10, 10, 0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - - stat(pathname2, &info); - ICUNIT_GOTO_EQUAL((uid_t)info.st_uid, 10, ret, EXIT1); - ICUNIT_GOTO_EQUAL((uid_t)info.st_gid, 10, ret, EXIT1); - - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = remove(pathname0); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - return JFFS_NO_ERROR; -EXIT1: - if (dirfd > 0) { - close(dirfd); - } - if (fd > 0) { - close(fd); - } -EXIT: - remove(pathname2); - remove(pathname1); - remove(pathname0); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs105(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_105", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_107.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_107.cpp deleted file mode 100644 index 40da416a..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_107.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -#include "It_fs_jffs.h" - -#define TEST_STR "abcdefghijk" - -static int TestCase(void) -{ - INT32 ret, dirFd, fd, len; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - fd = openat(dirFd, "test.txt", O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlinkat(dirFd, "test.txt", 0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs107(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_107", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_108.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_108.cpp deleted file mode 100644 index f2a2ba32..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_108.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ -#include "It_fs_jffs.h" - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - INT32 dirfd = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - time_t timep; - time_t timep1; - struct tm p; - struct stat fstate; - struct timespec times[2]; - char dateTime[64]; - struct tm t; - - p.tm_sec = 30; - p.tm_min = 27; - p.tm_hour = 16; - p.tm_mday = 18; - p.tm_mon = 0; - p.tm_year = 2020 - 1900; - p.tm_wday = 1; - p.tm_yday = 17; - p.tm_isdst = 0; - - timep = mktime(&p); - - p.tm_min = 28; - p.tm_hour = 17; - timep1 = mktime(&p); - - times[0].tv_sec = timep; - times[0].tv_nsec = 0; - times[1].tv_sec = timep1; - times[1].tv_nsec = 0; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - dirfd = fd; - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - dirfd = open(pathname1, O_DIRECTORY); - ICUNIT_GOTO_NOT_EQUAL(dirfd, JFFS_IS_ERROR, dirfd, EXIT); - - utimensat(dirfd, "test.txt", times, 0); - ret = stat(pathname2, &fstate); - ICUNIT_GOTO_EQUAL(fstate.st_atim.tv_sec, timep, fstate.st_atim.tv_sec, EXIT1); - ICUNIT_GOTO_EQUAL(fstate.st_mtim.tv_sec, timep1, fstate.st_mtim.tv_sec, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = close(dirfd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - if (fd > 0) { - close(fd); - } - if (dirfd > 0) { - close(dirfd); - } - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs108(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_108", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_109.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_109.cpp deleted file mode 100644 index 227cb86c..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_109.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - */ -#include "It_fs_jffs.h" - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - time_t timep; - time_t timep1; - struct tm p; - struct stat fstate; - struct timeval times[2]; - char dateTime[64]; - struct tm t; - - p.tm_sec = 30; - p.tm_min = 27; - p.tm_hour = 16; - p.tm_mday = 18; - p.tm_mon = 0; - p.tm_year = 2020 - 1900; - p.tm_wday = 1; - p.tm_yday = 17; - p.tm_isdst = 0; - - timep = mktime(&p); - - p.tm_min = 28; - p.tm_hour = 17; - timep1 = mktime(&p); - - times[0].tv_sec = timep; - times[0].tv_usec = 0; - times[1].tv_sec = timep1; - times[1].tv_usec = 0; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - utimes(pathname2, times); - ret = stat(pathname2, &fstate); - ICUNIT_GOTO_EQUAL(fstate.st_atim.tv_sec, timep, fstate.st_atim.tv_sec, EXIT1); - ICUNIT_GOTO_EQUAL(fstate.st_mtim.tv_sec, timep1, fstate.st_mtim.tv_sec, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs109(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_109", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_110.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_110.cpp deleted file mode 100644 index a2c0b98d..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_110.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -#include "It_fs_jffs.h" - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - time_t timep; - time_t timep1; - struct tm p; - struct stat fstate; - struct utimbuf times; - char dateTime[64]; - struct tm t; - - p.tm_sec = 30; - p.tm_min = 27; - p.tm_hour = 16; - p.tm_mday = 18; - p.tm_mon = 0; - p.tm_year = 2020 - 1900; - p.tm_wday = 1; - p.tm_yday = 17; - p.tm_isdst = 0; - - timep = mktime(&p); - - p.tm_min = 28; - p.tm_hour = 17; - timep1 = mktime(&p); - - times.actime = timep; - times.modtime = timep1; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - utime(pathname2, ×); - ret = stat(pathname2, &fstate); - ICUNIT_GOTO_EQUAL(fstate.st_atim.tv_sec, timep, fstate.st_atim.tv_sec, EXIT1); - ICUNIT_GOTO_EQUAL(fstate.st_mtim.tv_sec, timep1, fstate.st_mtim.tv_sec, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs110(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_110", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_111.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_111.cpp deleted file mode 100644 index 62b79a8a..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_111.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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. - */ -#include "It_fs_jffs.h" - -static int TestCase(void) -{ - INT32 ret = JFFS_IS_ERROR; - INT32 fd = 0; - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - time_t timep; - time_t timep1; - struct tm p; - struct stat fstate; - struct timespec times[2]; - struct tm t; - - p.tm_sec = 30; - p.tm_min = 27; - p.tm_hour = 16; - p.tm_mday = 18; - p.tm_mon = 0; - p.tm_year = 2020 - 1900; - p.tm_wday = 1; - p.tm_yday = 17; - p.tm_isdst = 0; - - timep = mktime(&p); - - p.tm_min = 28; - p.tm_hour = 17; - timep1 = mktime(&p); - - times[0].tv_sec = timep; - times[0].tv_nsec = 0; - times[1].tv_sec = timep1; - times[1].tv_nsec = 0; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - strcat_s(pathname2, JFFS_STANDARD_NAME_LENGTH, "/test.txt"); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - futimens(fd, times); - ret = stat(pathname2, &fstate); - ICUNIT_GOTO_EQUAL(fstate.st_atim.tv_sec, timep, fstate.st_atim.tv_sec, EXIT1); - ICUNIT_GOTO_EQUAL(fstate.st_mtim.tv_sec, timep1, fstate.st_mtim.tv_sec, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlink(pathname2); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - if (fd > 0) { - close(fd); - } - unlink(pathname2); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_IS_ERROR; -} - -void ItTestFsJffs111(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_111", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_201.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_201.cpp deleted file mode 100644 index 8a0eec75..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_201.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ - -#include "It_fs_jffs.h" -#include -#include - -#define FILEPATH "./test.txt" - -static int TestCase(void) -{ - int ret = -1; - int fd = -1; - - fd = open(FILEPATH, O_RDWR | O_CREAT, 0777); - ICUNIT_ASSERT_NOT_EQUAL(fd, JFFS_IS_ERROR, fd); - - ret = isastream(fd); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - - ret = close(fd); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - - ret = remove(FILEPATH); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); -} - -void ItTestFsJffs201(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_201", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_202.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_202.cpp deleted file mode 100644 index 7c1e3d5c..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_202.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_fs_jffs.h" - -#define FILEPATH "./test.txt" - -static int TestCase(void) -{ - FILE *stream = nullptr; - wchar_t *buf = nullptr; - size_t len = -1; - off_t eob = -1; - int ret = -1; - - stream = open_wmemstream(&buf, &len); - ICUNIT_ASSERT_NOT_EQUAL(stream, NULL, JFFS_IS_ERROR); - - fprintf(stream, "hello my world"); - - ret = fflush(stream); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - ICUNIT_ASSERT_EQUAL(buf, "hello my world", -1); - eob = ftello(stream); - ICUNIT_ASSERT_NOT_EQUAL(eob, JFFS_IS_ERROR, eob); - - ret = fseeko(stream, 0, SEEK_SET); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - - fprintf(stream, "good-bye"); - ret = fseeko(stream, eob, SEEK_SET); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - - ret = fclose(stream); - ICUNIT_ASSERT_NOT_EQUAL(ret, JFFS_IS_ERROR, ret); - - ICUNIT_ASSERT_EQUAL(buf, "good-bye", -1); - free(buf); -} - -void ItTestFsJffs202(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_202", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_203.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_203.cpp deleted file mode 100644 index 85d6498a..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_203.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ - -#include "It_fs_jffs.h" - -#define FILEPATH "./test.txt" - -static int TestCase(void) -{ - INT32 ret = -1; - INT32 dirFd = -1; - INT32 fd = -1; - INT32 len = -1; - - CHAR pathname1[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - CHAR pathname2[JFFS_STANDARD_NAME_LENGTH] = JFFS_PATH_NAME01; - DIR *dir = NULL; - struct dirent *ptr = NULL; - - ret = mkdir(pathname1, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - ret = strcat_s(pathname2, sizeof(pathname2), "/test.txt"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - fd = open(pathname2, O_CREAT | O_RDWR | O_TRUNC); - ICUNIT_GOTO_NOT_EQUAL(fd, JFFS_IS_ERROR, fd, EXIT1); - - len = write(fd, "01234567890123456789012345", 16); - - ret = close(fd); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = renameat(dirFd, "test.txt", dirFd, "TEST.txt"); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT2); - - ret = strcat_s(pathname1, JFFS_STANDARD_NAME_LENGTH, "/TEST.txt"); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT2); - ret = unlink(pathname1); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - ret = rmdir(JFFS_PATH_NAME01); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); -EXIT2: - unlink(pathname1); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_NO_ERROR; -} - -void ItTestFsJffs203(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_203", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_204.cpp b/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_204.cpp deleted file mode 100644 index 1206baff..00000000 --- a/testsuites/unittest_old/fs/jffs/smoke/it_test_fs_jffs_204.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#include "It_fs_jffs.h" - -#define DIRPATH "/storage/test" -#define FILEPATH "/storage/test/1.txt" - -static int TestCase(void) -{ - INT32 dirFd = -1; - INT32 fd = -1; - INT32 flags = -1; - INT32 ret = -1; - DIR *dir = nullptr; - ret = mkdir(DIRPATH, 0777); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT); - dir = opendir(DIRPATH); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - fd = open("FILEPATH", O_CREAT | O_RDWR, 0777); - dirFd = dirfd(dir); - ICUNIT_GOTO_NOT_EQUAL(dirFd, JFFS_IS_ERROR, dirFd, EXIT1); - - ret = unlinkat(dirFd, DIRPATH, 0); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - ret = unlinkat(dirFd, FILEPATH, AT_REMOVEDIR); - ICUNIT_GOTO_NOT_EQUAL(ret, JFFS_IS_ERROR, ret, EXIT1); - - return JFFS_NO_ERROR; - -EXIT1: - close(fd); - unlink(DIRPATH); - closedir(dir); -EXIT: - rmdir(JFFS_PATH_NAME01); - return JFFS_NO_ERROR; -} - -void ItTestFsJffs204(void) -{ - TEST_ADD_CASE("It_Test_Fs_Jffs_204", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/jffs/vfs_jffs_test.cpp b/testsuites/unittest_old/fs/jffs/vfs_jffs_test.cpp deleted file mode 100644 index 4bd98f91..00000000 --- a/testsuites/unittest_old/fs/jffs/vfs_jffs_test.cpp +++ /dev/null @@ -1,8748 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_jffs.h" - -#if 1 -struct iovec g_jffsIov[10]; - -INT32 g_jffsFd = 0; -DIR *g_jffsDir = nullptr; -INT32 g_jffsFilesMax = 10; -INT32 g_jffsFlag = 0; -INT32 g_jffsFlagF01 = 0; -INT32 g_jffsFlagF02 = 0; -INT32 g_TestCnt = 0; - -INT32 g_jffsFd11[JFFS_MAXIMUM_SIZES]; -INT32 g_jffsFd12[JFFS_MAXIMUM_SIZES][JFFS_MAXIMUM_SIZES]; - -CHAR g_jffsPathname1[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME1 }; -CHAR g_jffsPathname2[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME1 }; -CHAR g_jffsPathname3[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME1 }; -CHAR g_jffsPathname4[JFFS_STANDARD_NAME_LENGTH] = { JFFS_PATH_NAME0 }; - -CHAR g_jffsPathname6[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME1 }; -CHAR g_jffsPathname7[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME1 }; -CHAR g_jffsPathname8[JFFS_NAME_LIMITTED_SIZE] = { JFFS_PATH_NAME1 }; - -CHAR g_jffsPathname11[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE] = { 0, }; -CHAR g_jffsPathname12[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE] = { 0, }; -CHAR g_jffsPathname13[JFFS_MAXIMUM_SIZES][JFFS_NAME_LIMITTED_SIZE] = { 0, }; -#endif -INT32 g_jffsGrandSize[JFFS_MAX_DEF_BUF_NUM] = { 29, 30290, 3435, 235, 12345, 80, - 9845, 564, 34862, 123, 267890, 36, 6788, 86, 234567, 1232, 514, 50, 678, 9864, 333333 }; - -pthread_mutex_t g_jffs2GlobalLock1; -pthread_mutex_t g_jffs2GlobalLock2; - -#if 1 -INT32 JffsMultiWrite(CHAR *path, INT64 fileSize, INT32 writeSize, int oflags, INT32 interfaceType) -{ - INT32 ret, fd; - INT64 total = 0; - INT64 totalSize = 0; - - CHAR *writeBuf; - FILE *file; - - writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - - if (interfaceType == 1) { - fd = open(path, oflags, S_IRUSR | S_IWUSR); - if (fd < 0) { - goto EXIT1; - } - } else { - file = fopen(path, "w+b"); - if (file == nullptr) { - goto EXIT2; - } - } - - while (1) { - if (interfaceType == 1) { - ret = write(fd, writeBuf, writeSize); - if (ret <= 0) { - if (errno == ENOSPC) { - dprintf("No space !! %s,\n", strerror(errno)); - goto EXIT1; - } - dprintf("jffs_multi_write fail,path = %s,ret=:%d ,errno=:%d!\n", path, ret, errno); - goto EXIT1; - } - } else { - ret = fwrite(writeBuf, 1, writeSize, file); - if (ret <= 0 || ret != writeSize) { - if (errno == ENOSPC) { - dprintf("No space !! %s,\n", strerror(errno)); - } - dprintf("jffs_multi_write error! %s ,path=:%s, ret = %d,\n", strerror(errno), path, ret); - - goto EXIT2; - } - } - total += ret; - totalSize += ret; - - if (total >= JFFS_WR_CAP_SIZE_TEST) { - if (interfaceType == 1) { - } else { - } - total = 0; - } - - if (fileSize <= totalSize) { - break; - } - } - - if (interfaceType == 1) { - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } else { - ret = fclose(file); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - free(writeBuf); - - return JFFS_NO_ERROR; -EXIT2: - fclose(file); - goto EXIT; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return JFFS_IS_ERROR; -} - - -INT32 JffsMultiRead(CHAR *path, INT64 fileSize, INT32 readSize, int oflags, INT32 interfaceType) -{ - INT32 fd, ret; - INT64 total = 0; - INT64 totalSize = 0; - FILE *file; - CHAR *readBuf; - - readBuf = (CHAR *)malloc(readSize); - ICUNIT_ASSERT_NOT_EQUAL(readBuf, NULL, readBuf); - - if (interfaceType == 1) { - fd = open(path, oflags, S_IRUSR | S_IWUSR); - if (fd < 0) { - goto EXIT1; - } - } else { - file = fopen(path, "rb"); - if (file == nullptr) { - goto EXIT2; - } - } - - while (1) { - if (interfaceType == 1) { - ret = read(fd, readBuf, readSize); - if (ret < 0) { - dprintf("ret = %d,%s read fail!-->(X),\n", ret, path); - goto EXIT1; - } - if (!ret) { - dprintf("warning: read ret = 0,\n"); - goto EXIT1; - } - } else { - ret = fread(readBuf, 1, readSize, file); - if (ret <= 0) { - if (feof(file) == 1) { - dprintf("yyy feof of %s,\n", path); - } else { - dprintf("fread error!,\n"); - goto EXIT2; - } - } - } - total += ret; - totalSize += ret; - - if (total >= JFFS_WR_CAP_SIZE_TEST) { - total = 0; - } - - if (fileSize <= totalSize) { - break; - } - } - - if (interfaceType == 1) { - ret = close(fd); - if (ret < 0) { - dprintf("fail to close %s!\n", strerror(errno)); - } - } else { - ret = fclose(file); - if (ret < 0) { - dprintf("fail to fclose %s!\n", strerror(errno)); - } - } - - free(readBuf); - return JFFS_NO_ERROR; -EXIT2: - fclose(file); -EXIT1: - close(fd); - free(readBuf); - return JFFS_IS_ERROR; -} -#endif - -INT32 JffsFixWrite(CHAR *path, INT64 fileSize, INT32 writeSize, INT32 interfaceType) -{ - INT32 ret, i, fd; - INT64 total = 0; - CHAR filebuf[256] = "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalal"; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 cycleCount = 0; - INT32 taskId; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - CHAR *pid; - CHAR *writeBuf; - FILE *file; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - writeBuf = (CHAR *)malloc(writeSize); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - memset(writeBuf, 0, writeSize); - - for (i = 0; i < writeSize / 256; i++) { // 256 means the maxsize of write len - strcat(writeBuf, filebuf); - } - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - fd = open(path, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd < 0) { - printf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "w+b"); - if (file == nullptr) { - printf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - printf("fix_Write TaskID:%3d,open %s ,task %lld ms ,\n", taskId, path, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - if (interfaceType == 1) { - ret = write(fd, writeBuf, writeSize); - if (ret <= 0) { - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - goto EXIT1; - } - printf("fix_write fail,path = %s,ret=:%d ,errno=:%d!\n", path, ret, errno); - goto EXIT1; - } - } else { - ret = fwrite(writeBuf, 1, writeSize, file); - if (ret <= 0 || ret != writeSize) { - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - } - printf("fix_fwrite error! %s ,path=:%s, ret = %d,\n", strerror(errno), path, ret); - - goto EXIT2; - } - } - total += ret; - totalSize += ret; - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - if (interfaceType == 1) { - printf("fix_Write TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - } else { - printf("fix_fwrite TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - } - total = 0; - gettimeofday(&testTime1, 0); - } - - if (fileSize <= totalSize) { - break; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - printf("\nfix_Write TaskID:%3d,total write=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, - totalTime, testSpeed); - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } else { - ret = fclose(file); - ICUNIT_GOTO_EQUAL(ret, JFFS_NO_ERROR, ret, EXIT1); - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("fix_Write TaskID:%3d,sucess to fclose the %s ,task:%d ms,\n", taskId, path, MSECS_PER_SEC / MSECS_PER_SEC); - - free(writeBuf); - - return JFFS_NO_ERROR; -EXIT2: - fclose(file); - goto EXIT; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return JFFS_NO_ERROR; -} - -INT32 JffsFixRead(CHAR *path, INT64 fileSize, INT32 readSize, INT32 interfaceType) -{ - INT32 fd, taskId, ret; - INT32 cycleCount = 0; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - FILE *file; - CHAR *readBuf; - CHAR *pid; - DOUBLE testSpeed; - struct timeval testTime1; - struct timeval testTime2; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - readBuf = (CHAR *)malloc(readSize); - ICUNIT_ASSERT_NOT_EQUAL(readBuf, NULL, readBuf); - - gettimeofday(&testTime1, 0); - - if (interfaceType == 1) { - fd = open(path, O_RDWR, S_IRUSR | S_IWUSR); - if (fd < 0) { - printf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "rb"); - if (file == nullptr) { - printf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("fix_Read TaskID:%3d,open %s , task:%lld ms,\n", taskId, path, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - if (interfaceType == 1) { - ret = read(fd, readBuf, readSize); - if (ret < 0) { - printf("ret = %d,%s read fail!-->(X),\n", ret, path); - goto EXIT1; - } - if (!ret) { - printf("warning: read ret = 0,\n"); - goto EXIT1; - } - } else { - ret = fread(readBuf, 1, readSize, file); - if (ret <= 0) { - if (feof(file) == 1) { - printf("feof of %s,\n", path); - } else { - printf("fread error!,\n"); - goto EXIT2; - } - } - } - total += ret; - totalSize += ret; - - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - printf("fix_Read TaskID:%3d,times %d, read %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (fileSize <= totalSize) { - break; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - printf("\nfix_Read TaskID:%3d,total read=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, - totalTime, testSpeed); - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - ret = close(fd); - if (ret < 0) { - printf("fail to close %s!\n", strerror(errno)); - } - } else { - ret = fclose(file); - if (ret < 0) { - dprintf("fail to fclose %s!\n", strerror(errno)); - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf("fix_Read TaskID:%3d, fclose %s!,task:%lld ms,\n", taskId, path, perTime / MSECS_PER_SEC); - - ret = remove(path); - if (ret < 0) { - dprintf("fail to remove %s!\n", strerror(errno)); - } - - dprintf("Read TaskID:%3d,sucess to fread the %s,\n", taskId, path); - free(readBuf); - return 0; -EXIT2: - fclose(file); -EXIT1: - close(fd); - free(readBuf); - return JFFS_NO_ERROR; -} - -INT32 JffsRandWrite(CHAR *path, INT64 fileSize, INT32 interfaceType) -{ - INT32 ret, i, fd; - INT32 cycleCount = 0; - INT32 taskId; - CHAR filebuf[256] = "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalal"; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - CHAR *writeBuf; - CHAR *pid; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - FILE *file; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - writeBuf = (CHAR *)malloc(JFFS_PRESSURE_W_R_SIZE); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, NULL, writeBuf, EXIT); - memset(writeBuf, 0, JFFS_PRESSURE_W_R_SIZE); - - for (i = 0; i < JFFS_PRESSURE_W_R_SIZE / 256; i++) { // 256 means the maxsize of write len - strcat(writeBuf, filebuf); - } - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - fd = open(path, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd < 0) { - dprintf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "w+b"); - if (file == nullptr) { - dprintf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - dprintf("rand_write TaskID:%3d,open %s , cost:%lld ms,\n", taskId, path, perTime / MSECS_PER_SEC); - - gettimeofday(&testTime1, 0); - - i = 0; - - while (1) { - if (interfaceType == 1) { - ret = write(fd, writeBuf, g_jffsGrandSize[i]); - if (ret <= 0) { - dprintf("ret = %d,%s write fail!-->(X),\n", ret, path); - if (errno == ENOSPC) { - dprintf("No space !! %s,\n", strerror(errno)); - goto EXIT1; - } - goto EXIT1; - } - } else { - ret = fwrite(writeBuf, 1, g_jffsGrandSize[i], file); - if (ret <= 0 || ret != g_jffsGrandSize[i]) { - if (errno == ENOSPC) { - dprintf("No space !! %s,\n", strerror(errno)); - } - dprintf("rand_Write TaskID:%3d,fwrite error! %s , ret = %d,\n", taskId, strerror(errno), ret); - goto EXIT2; - } - } - - total += ret; - totalSize += ret; - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("rand_Write TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (fileSize <= totalSize) { - break; - } - if (++i >= JFFS_MAX_DEF_BUF_NUM) - i = 0; - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - dprintf("--------------------------------\n"); - dprintf("rand_Write TaskID:%3d,total write=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, - totalTime, testSpeed); - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - ret = close(fd); - if (ret < 0) { - dprintf("rand_Write TaskID:%3d,fail to close %s!\n", taskId, strerror(errno)); - goto EXIT1; - } - } else { - ret = fclose(file); - if (ret < 0) { - dprintf("rand_Write TaskID:%3d,fail to fclose %s!\n", taskId, strerror(errno)); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - dprintf("rand_Write TaskID:%3d,sucess to fclose the %s ,task %lld,\n", taskId, path, perTime / MSECS_PER_SEC); - - free(writeBuf); - - return JFFS_NO_ERROR; -EXIT2: - fclose(file); - goto EXIT; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return JFFS_NO_ERROR; -} - - -INT32 JffsRandRead(CHAR *path, INT64 fileSize, INT32 interfaceType) -{ - INT32 ret, fd, i; - INT32 cycleCount = 0; - INT32 taskId; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - CHAR *pid; - CHAR *readBuf; - FILE *file; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - readBuf = (CHAR *)malloc(JFFS_PRESSURE_W_R_SIZE); - ICUNIT_GOTO_NOT_EQUAL(readBuf, NULL, readBuf, EXIT); - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - fd = open(path, O_RDWR, S_IRUSR | S_IWUSR); - if (-1 == fd) { - printf("fail to open %s\n", path); - goto EXIT1; - } - } else { - file = fopen(path, "rb"); - if (file == nullptr) { - printf("fail to fopen %s\n", path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - printf("rand_read, open %s , task:%lld ms,\n", path, perTime / MSECS_PER_SEC); - - i = 0; - gettimeofday(&testTime1, 0); - - while (1) { - if (interfaceType == 1) { - ret = read(fd, readBuf, g_jffsGrandSize[i]); - if (ret < 0) { - printf("ret = %d,%s read fail!-->(X)\n", ret, path); - goto EXIT1; - } - if (!ret) { - printf("warning: read ret = 0,\n"); - } - } else { - ret = fread(readBuf, 1, g_jffsGrandSize[i], file); - if (ret <= 0) { - if (feof(file) == 1) { - printf("feof of %s\n", path); - } else { - printf("fread error!\n"); - goto EXIT2; - } - } - } - total += ret; - totalSize += ret; - - if (total >= JFFS_WR_CAP_SIZE_TEST) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - - dprintf("rand_Read TaskID:%3d, times %d, read %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (fileSize <= totalSize) { - break; - } - if (++i >= JFFS_MAX_DEF_BUF_NUM) - i = 0; - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * USECS_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_MBYTE; - printf("--------------------------------\n"); - printf("rand_Read TaskID:%3d ,total read=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, - totalTime, testSpeed); - - gettimeofday(&testTime1, 0); - if (interfaceType == 1) { - ret = close(fd); - if (ret < 0) { - printf("fail to close %s!\n", strerror(errno)); - } - } else { - ret = fclose(file); - if (ret < 0) { - printf("fail to fclose %s!\n", strerror(errno)); - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * USECS_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf(" rand_Read TaskID:%3d,fclose %s!,task:%lld ms,\n", taskId, path, perTime / MSECS_PER_SEC); - - ret = remove(path); - if (ret < 0) { - printf("fail to fclose %s!\n", strerror(errno)); - } - - printf("rand_Read TaskID:%3d,sucess to fread the %s,\n", taskId, path); - - free(readBuf); - return JFFS_NO_ERROR; - -EXIT2: - fclose(file); - goto EXIT1; -EXIT1: - close(fd); -EXIT: - free(readBuf); - return JFFS_NO_ERROR; -} - -INT32 JffsDeleteDirs(char *str, int n) -{ - struct dirent *ptr; - int ret; - DIR *dir; - int i = 0; - - ret = chdir(str); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - dir = opendir(str); - ICUNIT_ASSERT_NOT_EQUAL(dir, NULL, dir); - - rewinddir(dir); - while ((ptr = readdir(dir)) != nullptr) { - if ((strcmp(ptr->d_name, "..") == 0) || (strcmp(ptr->d_name, ".") == 0)) - continue; - - if (i == n) { - break; - } - i++; - - ret = rmdir(ptr->d_name); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - } - - ret = closedir(dir); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - ret = rmdir(str); - ICUNIT_ASSERT_EQUAL(ret, JFFS_NO_ERROR, ret); - - return JFFS_NO_ERROR; -} -INT32 JffsDeletefile(int fd, char *pathname) -{ - int ret; - - ret = close(fd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = unlink(pathname); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return JFFS_NO_ERROR; -} - -INT32 JffsStrcat2(char *pathname, char *str, int len) -{ - memset(pathname, 0, len); - strcpy(pathname, JFFS_PATH_NAME0); - strcat(pathname, str); - - return 0; -} -INT32 JffsScandirFree(struct dirent **namelist, int n) -{ - if (n < 0 || namelist == nullptr) { - return -1; - } else if (n == 0) { - free(namelist); - return 0; - } - while (n--) { - free(namelist[n]); - } - free(namelist); - - return 0; -} - -INT32 JffsStatPrintf(struct stat sb) -{ -#if VFS_STAT_PRINTF == 1 - - dprintf("File type: "); - - switch (sb.st_mode & S_IFMT) { - case S_IFBLK: - dprintf("block device\n"); - break; - case S_IFCHR: - dprintf("character device\n"); - break; - case S_IFDIR: - dprintf("directory\n"); - break; - case S_IFIFO: - dprintf("FIFO/pipe\n"); - break; - case S_IFLNK: - dprintf("symlink\n"); - break; - case S_IFREG: - dprintf("regular file\n"); - break; - case S_IFSOCK: - dprintf("socket\n"); - break; - default: - dprintf("unknown?\n"); - break; - } - - switch (sb.st_mode & S_IRWXU) { - case S_IRUSR: - dprintf("Owners have read permission\n"); - break; - case S_IWUSR: - dprintf("Owners have write permission\n"); - break; - case S_IXUSR: - dprintf("Owners have execute permissions\n"); - break; - default: - break; - } - - switch (sb.st_mode & S_IRWXG) { - case S_IRGRP: - dprintf("Group has read permission\n"); - break; - case S_IWGRP: - dprintf("Group has write permission\n"); - break; - case S_IXGRP: - dprintf("Group has execute permission\n"); - break; - default: - break; - } - - switch (sb.st_mode & S_IRWXO) { - case S_IROTH: - dprintf("Other have read permission\n"); - break; - case S_IWOTH: - dprintf("Other has write permission\n"); - break; - case S_IXOTH: - dprintf("Other has execute permission\n"); - break; - default: - break; - } - - dprintf("I-node number: %ld\n", (long)sb.st_ino); - dprintf("Mode: %lo (octal)\n", (unsigned long)sb.st_mode); - dprintf("Link count: %ld\n", (long)sb.st_nlink); - dprintf("Ownership: UID=%ld GID=%ld\n", (long)sb.st_uid, (long)sb.st_gid); - - dprintf("Preferred I/O block size: %ld bytes\n", (long)sb.st_blksize); - dprintf("File size: %lld bytes\n", (long long)sb.st_size); - dprintf("Blocks allocated: %lld\n", (long long)sb.st_blocks); - - dprintf("Last status change: %s", ctime(&sb.st_ctime)); - dprintf("Last file access: %s", ctime(&sb.st_atime)); - dprintf("Last file modification: %s\n", ctime(&sb.st_mtime)); - -#endif - return 0; -} - -INT32 JffsStatfsPrintf(struct statfs buf) -{ -#if VFS_STATFS_PRINTF == 1 - dprintf("type of file system : 0x%x\n", buf.f_type); - dprintf("optimal transfer block size : %ld\n", (long)buf.f_bsize); - dprintf("total data blocks in file system : %ld\n", (long)buf.f_blocks); - dprintf("free blocks in fs : %ld\n", (long)buf.f_bfree); - dprintf("free blocks available to unprivileged user : %ld\n", (long)buf.f_bavail); - dprintf("total file nodes in file system : %ld\n", (long)buf.f_files); - - dprintf("free file nodes in fs : %ld\n", (long)buf.f_ffree); - dprintf("file system id : %d\n", buf.f_fsid.__val[0]); - dprintf("maximum length of filenames : 0x%x\n", buf.f_namelen); - dprintf("fragment size: %d\n\n", buf.f_frsize); -#endif - return 0; -} - - -using namespace testing::ext; -namespace OHOS { -#if defined(LOSCFG_USER_TEST_PRESSURE) -pthread_mutexattr_t mutex; -#endif -class VfsJffsTest : public testing::Test { -public: - static void SetUpTestCase(void) - { -#if defined(LOSCFG_USER_TEST_PRESSURE) - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_jffs2GlobalLock1, &mutex); - pthread_mutex_init(&g_jffs2GlobalLock2, &mutex); -#endif - } - static void TearDownTestCase(void) {} -}; -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: IO_TEST_FACCESSAT_001 - * @tc.desc: normal tests for faccessat - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, IO_TEST_FACCESSAT_001, TestSize.Level0) -{ - IO_TEST_FACCESSAT_001(); -} - -/* * - * @tc.name: IO_TEST_FACCESSAT_002 - * @tc.desc: innormal tests for faccessat - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, IO_TEST_FACCESSAT_002, TestSize.Level0) -{ - IO_TEST_FACCESSAT_002(); -} - -/* * - * @tc.name: IO_TEST_FSTATFS_001 - * @tc.desc: normal tests for fstatfs - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, IO_TEST_FSTATFS_001, TestSize.Level0) -{ - IO_TEST_FSTATFS_001(); -} - -/* * - * @tc.name: IO_TEST_FSTATFS_002 - * @tc.desc: innormal tests for fstatfs - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, IO_TEST_FSTATFS_002, TestSize.Level0) -{ - IO_TEST_FSTATFS_002(); -} - -/* * - * @tc.name: IO_TEST_FSTATAT_001 - * @tc.desc: normal tests for fstatat - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, IO_TEST_FSTATAT_001, TestSize.Level0) -{ - IO_TEST_FSTATAT_001(); -} - -/* * - * @tc.name: IO_TEST_FSTATAT_002 - * @tc.desc: innormal tests for fstatat - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, IO_TEST_FSTATAT_002, TestSize.Level0) -{ - IO_TEST_FSTATAT_002(); -} - -/* * - * @tc.name: ItTestFsJffs001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs001, TestSize.Level0) -{ - ItTestFsJffs001(); -} - -/* * - * @tc.name: ItTestFsJffs002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs002, TestSize.Level0) -{ - ItTestFsJffs002(); -} - -/* * - * @tc.name: ItTestFsJffs003 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs003, TestSize.Level0) -{ - ItTestFsJffs003(); -} - -/* * - * @tc.name: ItTestFsJffs004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs004, TestSize.Level0) -{ - ItTestFsJffs004(); -} - -/* * - * @tc.name: ItTestFsJffs100 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs100, TestSize.Level0) -{ - ItTestFsJffs100(); -} - -/* * - * @tc.name: ItTestFsJffs101 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs101, TestSize.Level0) -{ - ItTestFsJffs101(); -} - -/* * - * @tc.name: ItTestFsJffs102 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs102, TestSize.Level0) -{ - ItTestFsJffs102(); -} - -/* * - * @tc.name: ItTestFsJffs103 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs103, TestSize.Level0) -{ - ItTestFsJffs103(); -} - -/* * - * @tc.name: ItTestFsJffs106 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs106, TestSize.Level0) -{ - ItTestFsJffs106(); -} - -/* * - * @tc.name: ItTestFsJffs112 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs112, TestSize.Level0) -{ - ItTestFsJffs112(); -} - -/* * - * @tc.name: ItTestFsJffs113 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestFsJffs113, TestSize.Level0) -{ - ItTestFsJffs113(); -} - -/* * - * @tc.name: IT_JFFS_002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs002, TestSize.Level0) -{ - ItJffs002(); -} - -/* * - * @tc.name: IT_JFFS_004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs004, TestSize.Level0) -{ - ItJffs004(); -} - -/* * - * @tc.name: IT_JFFS_007 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs007, TestSize.Level0) -{ - ItJffs007(); -} - -/* * - * @tc.name: IT_JFFS_009 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs009, TestSize.Level0) -{ - ItJffs009(); -} - -/* * - * @tc.name: IT_JFFS_010 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs010, TestSize.Level0) -{ - ItJffs010(); -} - -/* * - * @tc.name: IT_JFFS_011 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs011, TestSize.Level0) -{ - ItJffs011(); -} - -/* * - * @tc.name: IT_JFFS_012 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs012, TestSize.Level0) -{ - ItJffs012(); -} - -/* * - * @tc.name: IT_JFFS_013 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs013, TestSize.Level0) -{ - ItJffs013(); -} - -/* * - * @tc.name: IT_JFFS_015 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs015, TestSize.Level0) -{ - ItJffs015(); -} - -/* * - * @tc.name: IT_JFFS_017 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs017, TestSize.Level0) -{ - ItJffs017(); -} - -/* * - * @tc.name: IT_JFFS_018 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs018, TestSize.Level0) -{ - ItJffs018(); -} - -/* * - * @tc.name: IT_JFFS_019 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs019, TestSize.Level0) -{ - ItJffs019(); -} - -/* * - * @tc.name: IT_JFFS_022 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs022, TestSize.Level0) -{ - ItJffs022(); -} - -/* * - * @tc.name: IT_JFFS_025 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs025, TestSize.Level0) -{ - ItJffs025(); -} - -/* * - * @tc.name: IT_JFFS_026 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs026, TestSize.Level0) -{ - ItJffs026(); -} - -/* * - * @tc.name: IT_JFFS_027 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs027, TestSize.Level0) -{ - ItJffs027(); -} - -/* * - * @tc.name: IT_JFFS_030 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs030, TestSize.Level0) -{ - ItJffs030(); -} - -/* * - * @tc.name: IT_JFFS_032 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs032, TestSize.Level0) -{ - ItJffs032(); -} - -/* * - * @tc.name: IT_JFFS_033 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs033, TestSize.Level0) -{ - ItJffs033(); -} - -/* * - * @tc.name: IT_JFFS_034 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs034, TestSize.Level0) -{ - ItJffs034(); -} - -/* * - * @tc.name: IT_JFFS_035 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs035, TestSize.Level0) -{ - ItJffs035(); -} - -/* * - * @tc.name: IT_JFFS_036 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs036, TestSize.Level0) -{ - ItJffs036(); -} - -/* * - * @tc.name: IT_JFFS_037 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs037, TestSize.Level0) -{ - ItJffs037(); -} - -/* * - * @tc.name: IT_JFFS_038 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs038, TestSize.Level0) -{ - ItJffs038(); -} - -/* * - * @tc.name: IT_JFFS_040 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs040, TestSize.Level0) -{ - ItJffs040(); -} - -/* * - * @tc.name: IT_JFFS_041 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs041, TestSize.Level0) -{ - ItJffs041(); -} - -/* * - * @tc.name: IT_JFFS_042 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs042, TestSize.Level0) -{ - ItJffs042(); -} - -/* * - * @tc.name: IT_JFFS_021 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs021, TestSize.Level0) -{ - ItJffs021(); -} - -/* * - * @tc.name: IT_JFFS_043 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs043, TestSize.Level0) -{ - ItJffs043(); -} - -/* * - * @tc.name: IT_JFFS_044 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItJffs044, TestSize.Level0) -{ - ItJffs044(); -} - - -/* * - * @tc.name: ItFsJffs004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs004, TestSize.Level0) -{ - ItFsJffs004(); -} - -/* * - * @tc.name: ItFsJffs006 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs006, TestSize.Level0) -{ - ItFsJffs006(); -} - -/* * - * @tc.name: ItFsJffs008 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs008, TestSize.Level0) -{ - ItFsJffs008(); -} - -/* * - * @tc.name: ItFsJffs009 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs009, TestSize.Level0) -{ - ItFsJffs009(); -} - -/* * - * @tc.name: ItFsJffs011 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs011, TestSize.Level0) -{ - ItFsJffs011(); -} - -/* * - * @tc.name: ItFsJffs012 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs012, TestSize.Level0) -{ - ItFsJffs012(); -} - -/* * - * @tc.name: ItFsJffs013 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs013, TestSize.Level0) -{ - ItFsJffs013(); -} - -/* * - * @tc.name: ItFsJffs014 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs014, TestSize.Level0) -{ - ItFsJffs014(); -} - -/* * - * @tc.name: ItFsJffs015 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs015, TestSize.Level0) -{ - ItFsJffs015(); -} - -/* * - * @tc.name: ItFsJffs016 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs016, TestSize.Level0) -{ - ItFsJffs016(); -} - -/* * - * @tc.name: ItFsJffs017 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs017, TestSize.Level0) -{ - ItFsJffs017(); -} - -/* * - * @tc.name: ItFsJffs018 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs018, TestSize.Level0) -{ - ItFsJffs018(); -} - -/* * - * @tc.name: ItFsJffs019 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs019, TestSize.Level0) -{ - ItFsJffs019(); -} - -/* * - * @tc.name: ItFsJffs020 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs020, TestSize.Level0) -{ - ItFsJffs020(); -} - -/* * - * @tc.name: ItFsJffs023 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs023, TestSize.Level0) -{ - ItFsJffs023(); -} - -/* * - * @tc.name: ItFsJffs024 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs024, TestSize.Level0) -{ - ItFsJffs024(); -} - -/* * - * @tc.name: ItFsJffs025 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs025, TestSize.Level0) -{ - ItFsJffs025(); -} - -/* * - * @tc.name: ItFsJffs029 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs029, TestSize.Level0) -{ - ItFsJffs029(); -} - -/* * - * @tc.name: ItFsJffs030 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs030, TestSize.Level0) -{ - ItFsJffs030(); -} - -/* * - * @tc.name: ItFsJffs031 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs031, TestSize.Level0) -{ - ItFsJffs031(); -} - -/* * - * @tc.name: ItFsJffs032 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs032, TestSize.Level0) -{ - ItFsJffs032(); -} - -/* * - * @tc.name: ItFsJffs033 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs033, TestSize.Level0) -{ - ItFsJffs033(); -} - -/* * - * @tc.name: ItFsJffs037 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs037, TestSize.Level0) -{ - ItFsJffs037(); -} - -/* * - * @tc.name: ItFsJffs038 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs038, TestSize.Level0) -{ - ItFsJffs038(); -} - -/* * - * @tc.name: ItFsJffs039 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs039, TestSize.Level0) -{ - ItFsJffs039(); -} - -/* * - * @tc.name: ItFsJffs040 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs040, TestSize.Level0) -{ - ItFsJffs040(); -} - -/* * - * @tc.name: ItFsJffs041 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs041, TestSize.Level0) -{ - ItFsJffs041(); -} - -/* * - * @tc.name: ItFsJffs042 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs042, TestSize.Level0) -{ - ItFsJffs042(); -} - -/* * - * @tc.name: ItFsJffs043 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs043, TestSize.Level0) -{ - ItFsJffs043(); -} - -/* * - * @tc.name: ItFsJffs044 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs044, TestSize.Level0) -{ - ItFsJffs044(); -} - -/* * - * @tc.name: ItFsJffs045 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs045, TestSize.Level0) -{ - ItFsJffs045(); -} - -/* * - * @tc.name: ItFsJffs046 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs046, TestSize.Level0) -{ - ItFsJffs046(); -} - -/* * - * @tc.name: ItFsJffs048 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs048, TestSize.Level0) -{ - ItFsJffs048(); -} - -/* * - * @tc.name: ItFsJffs049 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs049, TestSize.Level0) -{ - ItFsJffs049(); -} - -/* * - * @tc.name: ItFsJffs050 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs050, TestSize.Level0) -{ - ItFsJffs050(); -} - -/* * - * @tc.name: ItFsJffs053 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs053, TestSize.Level0) -{ - ItFsJffs053(); -} - -/* * - * @tc.name: ItFsJffs055 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs055, TestSize.Level0) -{ - ItFsJffs055(); -} - -/* * - * @tc.name: ItFsJffs056 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs056, TestSize.Level0) -{ - ItFsJffs056(); -} - -/* * - * @tc.name: ItFsJffs057 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs057, TestSize.Level0) -{ - ItFsJffs057(); -} - -/* * - * @tc.name: ItFsJffs059 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs059, TestSize.Level0) -{ - ItFsJffs059(); -} - -/* * - * @tc.name: ItFsJffs060 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs060, TestSize.Level0) -{ - ItFsJffs060(); -} - -/* * - * @tc.name: ItFsJffs061 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs061, TestSize.Level0) -{ - ItFsJffs061(); -} - -/* * - * @tc.name: ItFsJffs062 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs062, TestSize.Level0) -{ - ItFsJffs062(); -} - -/* * - * @tc.name: ItFsJffs063 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs063, TestSize.Level0) -{ - ItFsJffs063(); -} - -/* * - * @tc.name: ItFsJffs064 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs064, TestSize.Level0) -{ - ItFsJffs064(); -} - -/* * - * @tc.name: ItFsJffs066 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs066, TestSize.Level0) -{ - ItFsJffs066(); -} - -/* * - * @tc.name: ItFsJffs068 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs068, TestSize.Level0) -{ - ItFsJffs068(); -} - -/* * - * @tc.name: ItFsJffs069 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs069, TestSize.Level0) -{ - ItFsJffs069(); -} - -/* * - * @tc.name: ItFsJffs070 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs070, TestSize.Level0) -{ - ItFsJffs070(); -} - -/* * - * @tc.name: ItFsJffs077 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs077, TestSize.Level0) -{ - ItFsJffs077(); -} - -/* * - * @tc.name: ItFsJffs078 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs078, TestSize.Level0) -{ - ItFsJffs078(); -} - -/* * - * @tc.name: ItFsJffs079 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs079, TestSize.Level0) -{ - ItFsJffs079(); -} - -/* * - * @tc.name: ItFsJffs081 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs081, TestSize.Level0) -{ - ItFsJffs081(); -} - -/* * - * @tc.name: ItFsJffs082 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs082, TestSize.Level0) -{ - ItFsJffs082(); -} - -/* * - * @tc.name: ItFsJffs083 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs083, TestSize.Level0) -{ - ItFsJffs083(); -} - -/* * - * @tc.name: ItFsJffs084 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs084, TestSize.Level0) -{ - ItFsJffs084(); -} - -/* * - * @tc.name: ItFsJffs085 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs085, TestSize.Level0) -{ - ItFsJffs085(); -} - -/* * - * @tc.name: ItFsJffs088 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs088, TestSize.Level0) -{ - ItFsJffs088(); -} - -/* * - * @tc.name: ItFsJffs090 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs090, TestSize.Level0) -{ - ItFsJffs090(); -} - -/* * - * @tc.name: ItFsJffs093 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs093, TestSize.Level0) -{ - ItFsJffs093(); -} - -/* * - * @tc.name: ItFsJffs096 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs096, TestSize.Level0) -{ - ItFsJffs096(); -} - -/* * - * @tc.name: ItFsJffs099 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs099, TestSize.Level0) -{ - ItFsJffs099(); -} - -/* * - * @tc.name: ItFsJffs100 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs100, TestSize.Level0) -{ - ItFsJffs100(); -} - -/* * - * @tc.name: ItFsJffs104 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs104, TestSize.Level0) -{ - ItFsJffs104(); -} - -/* * - * @tc.name: ItFsJffs116 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs116, TestSize.Level0) -{ - ItFsJffs116(); -} - -/* * - * @tc.name: ItFsJffs117 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs117, TestSize.Level0) -{ - ItFsJffs117(); -} - -/* * - * @tc.name: ItFsJffs118 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs118, TestSize.Level0) -{ - ItFsJffs118(); -} - -/* * - * @tc.name: ItFsJffs119 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs119, TestSize.Level0) -{ - ItFsJffs119(); -} - -/* * - * @tc.name: ItFsJffs120 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs120, TestSize.Level0) -{ - ItFsJffs120(); -} - -/* * - * @tc.name: ItFsJffs121 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs121, TestSize.Level0) -{ - ItFsJffs121(); -} - -/* * - * @tc.name: ItFsJffs123 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs123, TestSize.Level0) -{ - ItFsJffs123(); -} - -/* * - * @tc.name: ItFsJffs126 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs126, TestSize.Level0) -{ - ItFsJffs126(); -} - -/* * - * @tc.name: ItFsJffs127 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs127, TestSize.Level0) -{ - ItFsJffs127(); -} - -/* * - * @tc.name: ItFsJffs128 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs128, TestSize.Level0) -{ - ItFsJffs128(); -} - -/* * - * @tc.name: ItFsJffs129 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs129, TestSize.Level0) -{ - ItFsJffs129(); -} - -/* * - * @tc.name: ItFsJffs130 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs130, TestSize.Level0) -{ - ItFsJffs130(); -} - -/* * - * @tc.name: ItFsJffs131 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs131, TestSize.Level0) -{ - ItFsJffs131(); -} - -/* * - * @tc.name: ItFsJffs132 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs132, TestSize.Level0) -{ - ItFsJffs132(); -} - -/* * - * @tc.name: ItFsJffs133 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs133, TestSize.Level0) -{ - ItFsJffs133(); -} - -/* * - * @tc.name: ItFsJffs134 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs134, TestSize.Level0) -{ - ItFsJffs134(); -} - -/* * - * @tc.name: ItFsJffs135 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs135, TestSize.Level0) -{ - ItFsJffs135(); -} - -/* * - * @tc.name: ItFsJffs136 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs136, TestSize.Level0) -{ - ItFsJffs136(); -} - -/* * - * @tc.name: ItFsJffs137 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs137, TestSize.Level0) -{ - ItFsJffs137(); -} - -/* * - * @tc.name: ItFsJffs138 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs138, TestSize.Level0) -{ - ItFsJffs138(); -} - -/* * - * @tc.name: ItFsJffs139 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs139, TestSize.Level0) -{ - ItFsJffs139(); -} - -/* * - * @tc.name: ItFsJffs140 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs140, TestSize.Level0) -{ - ItFsJffs140(); -} - -/* * - * @tc.name: ItFsJffs141 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs141, TestSize.Level0) -{ - ItFsJffs141(); -} - -/* * - * @tc.name: ItFsJffs142 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs142, TestSize.Level0) -{ - ItFsJffs142(); -} - -/* * - * @tc.name: ItFsJffs143 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs143, TestSize.Level0) -{ - ItFsJffs143(); -} - -/* * - * @tc.name: ItFsJffs144 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs144, TestSize.Level0) -{ - ItFsJffs144(); -} - -/* * - * @tc.name: ItFsJffs145 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs145, TestSize.Level0) -{ - ItFsJffs145(); -} - -/* * - * @tc.name: ItFsJffs146 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs146, TestSize.Level0) -{ - ItFsJffs146(); -} - -/* * - * @tc.name: ItFsJffs147 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs147, TestSize.Level0) -{ - ItFsJffs147(); -} - -/* * - * @tc.name: ItFsJffs148 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs148, TestSize.Level0) -{ - ItFsJffs148(); -} - -/* * - * @tc.name: ItFsJffs149 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs149, TestSize.Level0) -{ - ItFsJffs149(); -} - -/* * - * @tc.name: ItFsJffs150 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs150, TestSize.Level0) -{ - ItFsJffs150(); -} - -/* * - * @tc.name: ItFsJffs151 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs151, TestSize.Level0) -{ - ItFsJffs151(); -} - -/* * - * @tc.name: ItFsJffs152 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs152, TestSize.Level0) -{ - ItFsJffs152(); -} - -/* * - * @tc.name: ItFsJffs153 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs153, TestSize.Level0) -{ - ItFsJffs153(); -} - -/* * - * @tc.name: ItFsJffs154 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs154, TestSize.Level0) -{ - ItFsJffs154(); -} - -/* * - * @tc.name: ItFsJffs155 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs155, TestSize.Level0) -{ - ItFsJffs155(); -} - -/* * - * @tc.name: ItFsJffs156 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs156, TestSize.Level0) -{ - ItFsJffs156(); -} - -/* * - * @tc.name: ItFsJffs157 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs157, TestSize.Level0) -{ - ItFsJffs157(); -} - -/* * - * @tc.name: ItFsJffs158 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs158, TestSize.Level0) -{ - ItFsJffs158(); -} - -/* * - * @tc.name: ItFsJffs159 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs159, TestSize.Level0) -{ - ItFsJffs159(); -} - -/* * - * @tc.name: ItFsJffs160 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs160, TestSize.Level0) -{ - ItFsJffs160(); -} - -/* * - * @tc.name: ItFsJffs161 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs161, TestSize.Level0) -{ - ItFsJffs161(); -} - -/* * - * @tc.name: ItFsJffs162 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs162, TestSize.Level0) -{ - ItFsJffs162(); -} - -/* * - * @tc.name: ItFsJffs163 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs163, TestSize.Level0) -{ - ItFsJffs163(); -} - -/* * - * @tc.name: ItFsJffs164 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs164, TestSize.Level0) -{ - ItFsJffs164(); -} - -/* * - * @tc.name: ItFsJffs165 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs165, TestSize.Level0) -{ - ItFsJffs165(); -} - -/* * - * @tc.name: ItFsJffs166 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs166, TestSize.Level0) -{ - ItFsJffs166(); -} - -/* * - * @tc.name: ItFsJffs167 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs167, TestSize.Level0) -{ - ItFsJffs167(); -} - -/* * - * @tc.name: ItFsJffs168 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs168, TestSize.Level0) -{ - ItFsJffs168(); -} - -/* * - * @tc.name: ItFsJffs169 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs169, TestSize.Level0) -{ - ItFsJffs169(); -} - -/* * - * @tc.name: ItFsJffs170 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs170, TestSize.Level0) -{ - ItFsJffs170(); -} - -/* * - * @tc.name: ItFsJffs171 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs171, TestSize.Level0) -{ - ItFsJffs171(); -} - -/* * - * @tc.name: ItFsJffs172 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs172, TestSize.Level0) -{ - ItFsJffs172(); -} - -/* * - * @tc.name: ItFsJffs173 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs173, TestSize.Level0) -{ - ItFsJffs173(); -} - -/* * - * @tc.name: ItFsJffs175 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs175, TestSize.Level0) -{ - ItFsJffs175(); -} - -/* * - * @tc.name: ItFsJffs176 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs176, TestSize.Level0) -{ - ItFsJffs176(); -} - -/* * - * @tc.name: ItFsJffs177 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs177, TestSize.Level0) -{ - ItFsJffs177(); -} - -/* * - * @tc.name: ItFsJffs178 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs178, TestSize.Level0) -{ - ItFsJffs178(); -} - -/* * - * @tc.name: ItFsJffs179 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs179, TestSize.Level0) -{ - ItFsJffs179(); -} - -/* * - * @tc.name: ItFsJffs180 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs180, TestSize.Level0) -{ - ItFsJffs180(); -} - -/* * - * @tc.name: ItFsJffs182 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs182, TestSize.Level0) -{ - ItFsJffs182(); -} - -/* * - * @tc.name: ItFsJffs183 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs183, TestSize.Level0) -{ - ItFsJffs183(); -} - -/* * - * @tc.name: ItFsJffs184 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs184, TestSize.Level0) -{ - ItFsJffs184(); -} - -/* * - * @tc.name: ItFsJffs185 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs185, TestSize.Level0) -{ - ItFsJffs185(); -} - -/* * - * @tc.name: ItFsJffs187 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs187, TestSize.Level0) -{ - ItFsJffs187(); -} - -/* * - * @tc.name: ItFsJffs188 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs188, TestSize.Level0) -{ - ItFsJffs188(); -} - -/* * - * @tc.name: ItFsJffs189 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs189, TestSize.Level0) -{ - ItFsJffs189(); -} - -/* * - * @tc.name: ItFsJffs190 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs190, TestSize.Level0) -{ - ItFsJffs190(); -} - -/* * - * @tc.name: ItFsJffs191 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs191, TestSize.Level0) -{ - ItFsJffs191(); -} - -/* * - * @tc.name: ItFsJffs192 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs192, TestSize.Level0) -{ - ItFsJffs192(); -} - -/* * - * @tc.name: ItFsJffs193 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs193, TestSize.Level0) -{ - ItFsJffs193(); -} - -/* * - * @tc.name: ItFsJffs194 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs194, TestSize.Level0) -{ - ItFsJffs194(); -} - -/* * - * @tc.name: ItFsJffs195 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs195, TestSize.Level0) -{ - ItFsJffs195(); -} - -/* * - * @tc.name: ItFsJffs196 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs196, TestSize.Level0) -{ - ItFsJffs196(); -} - -/* * - * @tc.name: ItFsJffs197 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs197, TestSize.Level0) -{ - ItFsJffs197(); -} - -/* * - * @tc.name: ItFsJffs198 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs198, TestSize.Level0) -{ - ItFsJffs198(); -} - -/* * - * @tc.name: ItFsJffs199 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs199, TestSize.Level0) -{ - ItFsJffs199(); -} - -/* * - * @tc.name: ItFsJffs200 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs200, TestSize.Level0) -{ - ItFsJffs200(); -} - -/* * - * @tc.name: ItFsJffs202 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs202, TestSize.Level0) -{ - ItFsJffs202(); -} - -/* * - * @tc.name: ItFsJffs203 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs203, TestSize.Level0) -{ - ItFsJffs203(); -} - -/* * - * @tc.name: ItFsJffs204 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs204, TestSize.Level0) -{ - ItFsJffs204(); -} - -/* * - * @tc.name: ItFsJffs205 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs205, TestSize.Level0) -{ - ItFsJffs205(); -} - -/* * - * @tc.name: ItFsJffs206 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs206, TestSize.Level0) -{ - ItFsJffs206(); -} - -/* * - * @tc.name: ItFsJffs207 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs207, TestSize.Level0) -{ - ItFsJffs207(); -} - -/* * - * @tc.name: ItFsJffs208 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs208, TestSize.Level0) -{ - ItFsJffs208(); -} - -/* * - * @tc.name: ItFsJffs209 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs209, TestSize.Level0) -{ - ItFsJffs209(); -} - -/* * - * @tc.name: ItFsJffs210 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs210, TestSize.Level0) -{ - ItFsJffs210(); -} - -/* * - * @tc.name: ItFsJffs211 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs211, TestSize.Level0) -{ - ItFsJffs211(); -} - -/* * - * @tc.name: ItFsJffs212 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs212, TestSize.Level0) -{ - ItFsJffs212(); -} - -/* * - * @tc.name: ItFsJffs213 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs213, TestSize.Level0) -{ - ItFsJffs213(); -} - -/* * - * @tc.name: ItFsJffs214 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs214, TestSize.Level0) -{ - ItFsJffs214(); -} - -/* * - * @tc.name: ItFsJffs215 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs215, TestSize.Level0) -{ - ItFsJffs215(); -} - -/* * - * @tc.name: ItFsJffs216 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs216, TestSize.Level0) -{ - ItFsJffs216(); -} - -/* * - * @tc.name: ItFsJffs217 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs217, TestSize.Level0) -{ - ItFsJffs217(); -} - -/* * - * @tc.name: ItFsJffs218 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs218, TestSize.Level0) -{ - ItFsJffs218(); -} - -/* * - * @tc.name: ItFsJffs219 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs219, TestSize.Level0) -{ - ItFsJffs219(); -} - -/* * - * @tc.name: ItFsJffs220 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs220, TestSize.Level0) -{ - ItFsJffs220(); -} - -/* * - * @tc.name: ItFsJffs221 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs221, TestSize.Level0) -{ - ItFsJffs221(); -} - -/* * - * @tc.name: ItFsJffs222 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs222, TestSize.Level0) -{ - ItFsJffs222(); -} - -/* * - * @tc.name: ItFsJffs223 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs223, TestSize.Level0) -{ - ItFsJffs223(); -} - -/* * - * @tc.name: ItFsJffs224 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs224, TestSize.Level0) -{ - ItFsJffs224(); -} - -/* * - * @tc.name: ItFsJffs225 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs225, TestSize.Level0) -{ - ItFsJffs225(); -} - -/* * - * @tc.name: ItFsJffs226 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs226, TestSize.Level0) -{ - ItFsJffs226(); -} - -/* * - * @tc.name: ItFsJffs227 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs227, TestSize.Level0) -{ - ItFsJffs227(); -} - -/* * - * @tc.name: ItFsJffs228 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs228, TestSize.Level0) -{ - ItFsJffs228(); -} - -/* * - * @tc.name: ItFsJffs229 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs229, TestSize.Level0) -{ - ItFsJffs229(); -} - -/* * - * @tc.name: ItFsJffs230 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs230, TestSize.Level0) -{ - ItFsJffs230(); -} - -/* * - * @tc.name: ItFsJffs231 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs231, TestSize.Level0) -{ - ItFsJffs231(); -} - -/* * - * @tc.name: ItFsJffs232 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs232, TestSize.Level0) -{ - ItFsJffs232(); -} - -/* * - * @tc.name: ItFsJffs233 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs233, TestSize.Level0) -{ - ItFsJffs233(); -} - -/* * - * @tc.name: ItFsJffs234 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs234, TestSize.Level0) -{ - ItFsJffs234(); -} - -/* * - * @tc.name: ItFsJffs235 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs235, TestSize.Level0) -{ - ItFsJffs235(); -} - -/* * - * @tc.name: ItFsJffs236 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs236, TestSize.Level0) -{ - ItFsJffs236(); -} - -/* * - * @tc.name: ItFsJffs237 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs237, TestSize.Level0) -{ - ItFsJffs237(); -} - -/* * - * @tc.name: ItFsJffs238 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs238, TestSize.Level0) -{ - ItFsJffs238(); -} - -/* * - * @tc.name: ItFsJffs239 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs239, TestSize.Level0) -{ - ItFsJffs239(); -} - -/* * - * @tc.name: ItFsJffs240 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs240, TestSize.Level0) -{ - ItFsJffs240(); -} - -/* * - * @tc.name: ItFsJffs241 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs241, TestSize.Level0) -{ - ItFsJffs241(); -} - -/* * - * @tc.name: ItFsJffs242 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs242, TestSize.Level0) -{ - ItFsJffs242(); -} - -/* * - * @tc.name: ItFsJffs243 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs243, TestSize.Level0) -{ - ItFsJffs243(); -} - -/* * - * @tc.name: ItFsJffs244 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs244, TestSize.Level0) -{ - ItFsJffs244(); -} - -/* * - * @tc.name: ItFsJffs245 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs245, TestSize.Level0) -{ - ItFsJffs245(); -} - -/* * - * @tc.name: ItFsJffs246 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs246, TestSize.Level0) -{ - ItFsJffs246(); -} - -/* * - * @tc.name: ItFsJffs247 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs247, TestSize.Level0) -{ - ItFsJffs247(); -} - -/* * - * @tc.name: ItFsJffs248 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs248, TestSize.Level0) -{ - ItFsJffs248(); -} - -/* * - * @tc.name: ItFsJffs249 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs249, TestSize.Level0) -{ - ItFsJffs249(); -} - -/* * - * @tc.name: ItFsJffs250 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs250, TestSize.Level0) -{ - ItFsJffs250(); -} - -/* * - * @tc.name: ItFsJffs251 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs251, TestSize.Level0) -{ - ItFsJffs251(); -} - -/* * - * @tc.name: ItFsJffs252 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs252, TestSize.Level0) -{ - ItFsJffs252(); -} - -/* * - * @tc.name: ItFsJffs253 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs253, TestSize.Level0) -{ - ItFsJffs253(); -} - -/* * - * @tc.name: ItFsJffs254 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs254, TestSize.Level0) -{ - ItFsJffs254(); -} - -/* * - * @tc.name: ItFsJffs255 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs255, TestSize.Level0) -{ - ItFsJffs255(); -} - -/* * - * @tc.name: ItFsJffs256 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs256, TestSize.Level0) -{ - ItFsJffs256(); -} - -/* * - * @tc.name: ItFsJffs257 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs257, TestSize.Level0) -{ - ItFsJffs257(); -} - -/* * - * @tc.name: ItFsJffs258 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs258, TestSize.Level0) -{ - ItFsJffs258(); -} - -/* * - * @tc.name: ItFsJffs259 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs259, TestSize.Level0) -{ - ItFsJffs259(); -} - -/* * - * @tc.name: ItFsJffs260 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs260, TestSize.Level0) -{ - ItFsJffs260(); -} - -/* * - * @tc.name: ItFsJffs261 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs261, TestSize.Level0) -{ - ItFsJffs261(); -} - -/* * - * @tc.name: ItFsJffs262 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs262, TestSize.Level0) -{ - ItFsJffs262(); -} - -/* * - * @tc.name: ItFsJffs263 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs263, TestSize.Level0) -{ - ItFsJffs263(); -} - -/* * - * @tc.name: ItFsJffs264 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs264, TestSize.Level0) -{ - ItFsJffs264(); -} - -/* * - * @tc.name: ItFsJffs265 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs265, TestSize.Level0) -{ - ItFsJffs265(); -} - -/* * - * @tc.name: ItFsJffs266 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs266, TestSize.Level0) -{ - ItFsJffs266(); -} - -/* * - * @tc.name: ItFsJffs267 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs267, TestSize.Level0) -{ - ItFsJffs267(); -} - -/* * - * @tc.name: ItFsJffs268 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs268, TestSize.Level0) -{ - ItFsJffs268(); -} - -/* * - * @tc.name: ItFsJffs269 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs269, TestSize.Level0) -{ - ItFsJffs269(); -} - -/* * - * @tc.name: ItFsJffs270 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs270, TestSize.Level0) -{ - ItFsJffs270(); -} - -/* * - * @tc.name: ItFsJffs271 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs271, TestSize.Level0) -{ - ItFsJffs271(); -} - -/* * - * @tc.name: ItFsJffs272 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs272, TestSize.Level0) -{ - ItFsJffs272(); -} - -/* * - * @tc.name: ItFsJffs273 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs273, TestSize.Level0) -{ - ItFsJffs273(); -} - -/* * - * @tc.name: ItFsJffs274 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs274, TestSize.Level0) -{ - ItFsJffs274(); -} - -/* * - * @tc.name: ItFsJffs275 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs275, TestSize.Level0) -{ - ItFsJffs275(); -} - -/* * - * @tc.name: ItFsJffs276 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs276, TestSize.Level0) -{ - ItFsJffs276(); -} - -/* * - * @tc.name: ItFsJffs277 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs277, TestSize.Level0) -{ - ItFsJffs277(); -} - -/* * - * @tc.name: ItFsJffs278 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs278, TestSize.Level0) -{ - ItFsJffs278(); -} - -/* * - * @tc.name: ItFsJffs279 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs279, TestSize.Level0) -{ - ItFsJffs279(); -} - -/* * - * @tc.name: ItFsJffs280 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs280, TestSize.Level0) -{ - ItFsJffs280(); -} - -/* * - * @tc.name: ItFsJffs281 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs281, TestSize.Level0) -{ - ItFsJffs281(); -} - -/* * - * @tc.name: ItFsJffs282 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs282, TestSize.Level0) -{ - ItFsJffs282(); -} - -/* * - * @tc.name: ItFsJffs283 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs283, TestSize.Level0) -{ - ItFsJffs283(); -} - -/* * - * @tc.name: ItFsJffs284 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs284, TestSize.Level0) -{ - ItFsJffs284(); -} - -/* * - * @tc.name: ItFsJffs285 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs285, TestSize.Level0) -{ - ItFsJffs285(); -} - -/* * - * @tc.name: ItFsJffs288 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs288, TestSize.Level0) -{ - ItFsJffs288(); -} - -/* * - * @tc.name: ItFsJffs289 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs289, TestSize.Level0) -{ - ItFsJffs289(); -} - -/* * - * @tc.name: ItFsJffs290 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs290, TestSize.Level0) -{ - ItFsJffs290(); -} - -/* * - * @tc.name: ItFsJffs291 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs291, TestSize.Level0) -{ - ItFsJffs291(); -} - -/* * - * @tc.name: ItFsJffs292 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs292, TestSize.Level0) -{ - ItFsJffs292(); -} - -/* * - * @tc.name: ItFsJffs293 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs293, TestSize.Level0) -{ - ItFsJffs293(); -} - -/* * - * @tc.name: ItFsJffs294 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs294, TestSize.Level0) -{ - ItFsJffs294(); -} - -/* * - * @tc.name: ItFsJffs295 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs295, TestSize.Level0) -{ - ItFsJffs295(); -} - -/* * - * @tc.name: ItFsJffs296 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs296, TestSize.Level0) -{ - ItFsJffs296(); -} - -/* * - * @tc.name: ItFsJffs297 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs297, TestSize.Level0) -{ - ItFsJffs297(); -} - -/* * - * @tc.name: ItFsJffs298 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs298, TestSize.Level0) -{ - ItFsJffs298(); -} - -/* * - * @tc.name: ItFsJffs299 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs299, TestSize.Level0) -{ - ItFsJffs299(); -} - -/* * - * @tc.name: ItFsJffs300 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs300, TestSize.Level0) -{ - ItFsJffs300(); -} - -/* * - * @tc.name: ItFsJffs301 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs301, TestSize.Level0) -{ - ItFsJffs301(); -} - -/* * - * @tc.name: ItFsJffs302 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs302, TestSize.Level0) -{ - ItFsJffs302(); -} - -/* * - * @tc.name: ItFsJffs303 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs303, TestSize.Level0) -{ - ItFsJffs303(); -} - -/* * - * @tc.name: ItFsJffs304 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs304, TestSize.Level0) -{ - ItFsJffs304(); -} - -/* * - * @tc.name: ItFsJffs305 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs305, TestSize.Level0) -{ - ItFsJffs305(); -} - -/* * - * @tc.name: ItFsJffs306 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs306, TestSize.Level0) -{ - ItFsJffs306(); -} - -/* * - * @tc.name: ItFsJffs307 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs307, TestSize.Level0) -{ - ItFsJffs307(); -} - -/* * - * @tc.name: ItFsJffs308 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs308, TestSize.Level0) -{ - ItFsJffs308(); -} - -/* * - * @tc.name: ItFsJffs309 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs309, TestSize.Level0) -{ - ItFsJffs309(); -} - -/* * - * @tc.name: ItFsJffs310 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs310, TestSize.Level0) -{ - ItFsJffs310(); -} - -/* * - * @tc.name: ItFsJffs311 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs311, TestSize.Level0) -{ - ItFsJffs311(); -} - -/* * - * @tc.name: ItFsJffs312 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs312, TestSize.Level0) -{ - ItFsJffs312(); -} - -/* * - * @tc.name: ItFsJffs313 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs313, TestSize.Level0) -{ - ItFsJffs313(); -} - -/* * - * @tc.name: ItFsJffs314 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs314, TestSize.Level0) -{ - ItFsJffs314(); -} - -/* * - * @tc.name: ItFsJffs315 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs315, TestSize.Level0) -{ - ItFsJffs315(); -} - -/* * - * @tc.name: ItFsJffs316 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs316, TestSize.Level0) -{ - ItFsJffs316(); -} - -/* * - * @tc.name: ItFsJffs317 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs317, TestSize.Level0) -{ - ItFsJffs317(); -} - -/* * - * @tc.name: ItFsJffs318 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs318, TestSize.Level0) -{ - ItFsJffs318(); -} - -/* * - * @tc.name: ItFsJffs319 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs319, TestSize.Level0) -{ - ItFsJffs319(); -} - -/* * - * @tc.name: ItFsJffs320 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs320, TestSize.Level0) -{ - ItFsJffs320(); -} - -/* * - * @tc.name: ItFsJffs321 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs321, TestSize.Level0) -{ - ItFsJffs321(); -} - -/* * - * @tc.name: ItFsJffs322 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs322, TestSize.Level0) -{ - ItFsJffs322(); -} - -/* * - * @tc.name: ItFsJffs323 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs323, TestSize.Level0) -{ - ItFsJffs323(); -} - -/* * - * @tc.name: ItFsJffs324 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs324, TestSize.Level0) -{ - ItFsJffs324(); -} - -/* * - * @tc.name: ItFsJffs325 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs325, TestSize.Level0) -{ - ItFsJffs325(); -} - -/* * - * @tc.name: ItFsJffs326 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs326, TestSize.Level0) -{ - ItFsJffs326(); -} - -/* * - * @tc.name: ItFsJffs327 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs327, TestSize.Level0) -{ - ItFsJffs327(); -} - -/* * - * @tc.name: ItFsJffs328 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs328, TestSize.Level0) -{ - ItFsJffs328(); -} - -/* * - * @tc.name: ItFsJffs329 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs329, TestSize.Level0) -{ - ItFsJffs329(); -} - -/* * - * @tc.name: ItFsJffs330 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs330, TestSize.Level0) -{ - ItFsJffs330(); -} - -/* * - * @tc.name: ItFsJffs331 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs331, TestSize.Level0) -{ - ItFsJffs331(); -} - -/* * - * @tc.name: ItFsJffs332 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs332, TestSize.Level0) -{ - ItFsJffs332(); -} - -/* * - * @tc.name: ItFsJffs333 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs333, TestSize.Level0) -{ - ItFsJffs333(); -} - -/* * - * @tc.name: ItFsJffs334 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs334, TestSize.Level0) -{ - ItFsJffs334(); -} - -/* * - * @tc.name: ItFsJffs335 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs335, TestSize.Level0) -{ - ItFsJffs335(); -} - -/* * - * @tc.name: ItFsJffs336 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs336, TestSize.Level0) -{ - ItFsJffs336(); -} - -/* * - * @tc.name: ItFsJffs337 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs337, TestSize.Level0) -{ - ItFsJffs337(); -} - -/* * - * @tc.name: ItFsJffs338 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs338, TestSize.Level0) -{ - ItFsJffs338(); -} - -/* * - * @tc.name: ItFsJffs339 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs339, TestSize.Level0) -{ - ItFsJffs339(); -} - -/* * - * @tc.name: ItFsJffs340 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs340, TestSize.Level0) -{ - ItFsJffs340(); -} - -/* * - * @tc.name: ItFsJffs342 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs342, TestSize.Level0) -{ - ItFsJffs342(); -} - -/* * - * @tc.name: ItFsJffs343 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs343, TestSize.Level0) -{ - ItFsJffs343(); -} - -/* * - * @tc.name: ItFsJffs344 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs344, TestSize.Level0) -{ - ItFsJffs344(); -} - -/* * - * @tc.name: ItFsJffs346 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs346, TestSize.Level0) -{ - ItFsJffs346(); -} - -/* * - * @tc.name: ItFsJffs352 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs352, TestSize.Level0) -{ - ItFsJffs352(); -} - -/* * - * @tc.name: ItFsJffs353 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs353, TestSize.Level0) -{ - ItFsJffs353(); -} - -/* * - * @tc.name: ItFsJffs354 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs354, TestSize.Level0) -{ - ItFsJffs354(); -} - -/* * - * @tc.name: ItFsJffs355 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs355, TestSize.Level0) -{ - ItFsJffs355(); -} - -/* * - * @tc.name: ItFsJffs356 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs356, TestSize.Level0) -{ - ItFsJffs356(); -} - -/* * - * @tc.name: ItFsJffs357 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs357, TestSize.Level0) -{ - ItFsJffs357(); -} - -/* * - * @tc.name: ItFsJffs358 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs358, TestSize.Level0) -{ - ItFsJffs358(); -} - -/* * - * @tc.name: ItFsJffs359 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs359, TestSize.Level0) -{ - ItFsJffs359(); -} - -/* * - * @tc.name: ItFsJffs360 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs360, TestSize.Level0) -{ - ItFsJffs360(); -} - -/* * - * @tc.name: ItFsJffs361 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs361, TestSize.Level0) -{ - ItFsJffs361(); -} - -/* * - * @tc.name: ItFsJffs362 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs362, TestSize.Level0) -{ - ItFsJffs362(); -} - -/* * - * @tc.name: ItFsJffs364 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs364, TestSize.Level0) -{ - ItFsJffs364(); -} - -/* * - * @tc.name: ItFsJffs365 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs365, TestSize.Level0) -{ - ItFsJffs365(); -} - -/* * - * @tc.name: ItFsJffs366 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs366, TestSize.Level0) -{ - ItFsJffs366(); -} - -/* * - * @tc.name: ItFsJffs367 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs367, TestSize.Level0) -{ - ItFsJffs367(); -} - -/* * - * @tc.name: ItFsJffs368 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs368, TestSize.Level0) -{ - ItFsJffs368(); -} - -/* * - * @tc.name: ItFsJffs369 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs369, TestSize.Level0) -{ - ItFsJffs369(); -} - -/* * - * @tc.name: ItFsJffs370 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs370, TestSize.Level0) -{ - ItFsJffs370(); -} - -/* * - * @tc.name: ItFsJffs371 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs371, TestSize.Level0) -{ - ItFsJffs371(); -} - -/* * - * @tc.name: ItFsJffs372 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs372, TestSize.Level0) -{ - ItFsJffs372(); -} - -/* * - * @tc.name: ItFsJffs373 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs373, TestSize.Level0) -{ - ItFsJffs373(); -} - -/* * - * @tc.name: ItFsJffs374 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs374, TestSize.Level0) -{ - ItFsJffs374(); -} - -/* * - * @tc.name: ItFsJffs375 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs375, TestSize.Level0) -{ - ItFsJffs375(); -} - -/* * - * @tc.name: ItFsJffs376 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs376, TestSize.Level0) -{ - ItFsJffs376(); -} - -/* * - * @tc.name: ItFsJffs377 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs377, TestSize.Level0) -{ - ItFsJffs377(); -} - -/* * - * @tc.name: ItFsJffs378 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs378, TestSize.Level0) -{ - ItFsJffs378(); -} - -/* * - * @tc.name: ItFsJffs379 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs379, TestSize.Level0) -{ - ItFsJffs379(); -} - -/* * - * @tc.name: ItFsJffs380 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs380, TestSize.Level0) -{ - ItFsJffs380(); -} - -/* * - * @tc.name: ItFsJffs381 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs381, TestSize.Level0) -{ - ItFsJffs381(); -} - -/* * - * @tc.name: ItFsJffs382 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs382, TestSize.Level0) -{ - ItFsJffs382(); -} - -/* * - * @tc.name: ItFsJffs383 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs383, TestSize.Level0) -{ - ItFsJffs383(); -} - -/* * - * @tc.name: ItFsJffs384 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs384, TestSize.Level0) -{ - ItFsJffs384(); -} - -/* * - * @tc.name: ItFsJffs385 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs385, TestSize.Level0) -{ - ItFsJffs385(); -} - -/* * - * @tc.name: ItFsJffs386 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs386, TestSize.Level0) -{ - ItFsJffs386(); -} - -/* * - * @tc.name: ItFsJffs387 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs387, TestSize.Level0) -{ - ItFsJffs387(); -} - -/* * - * @tc.name: ItFsJffs388 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs388, TestSize.Level0) -{ - ItFsJffs388(); -} - -/* * - * @tc.name: ItFsJffs389 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs389, TestSize.Level0) -{ - ItFsJffs389(); -} - -/* * - * @tc.name: ItFsJffs390 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs390, TestSize.Level0) -{ - ItFsJffs390(); -} - -/* * - * @tc.name: ItFsJffs391 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs391, TestSize.Level0) -{ - ItFsJffs391(); -} - -/* * - * @tc.name: ItFsJffs392 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs392, TestSize.Level0) -{ - ItFsJffs392(); -} - -/* * - * @tc.name: ItFsJffs393 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs393, TestSize.Level0) -{ - ItFsJffs393(); -} - -/* * - * @tc.name: ItFsJffs394 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs394, TestSize.Level0) -{ - ItFsJffs394(); -} - -/* * - * @tc.name: ItFsJffs395 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs395, TestSize.Level0) -{ - ItFsJffs395(); -} - -/* * - * @tc.name: ItFsJffs396 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs396, TestSize.Level0) -{ - ItFsJffs396(); -} - -/* * - * @tc.name: ItFsJffs397 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs397, TestSize.Level0) -{ - ItFsJffs397(); -} - -/* * - * @tc.name: ItFsJffs398 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs398, TestSize.Level0) -{ - ItFsJffs398(); -} - -/* * - * @tc.name: ItFsJffs399 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs399, TestSize.Level0) -{ - ItFsJffs399(); -} - -/* * - * @tc.name: ItFsJffs400 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs400, TestSize.Level0) -{ - ItFsJffs400(); -} - -/* * - * @tc.name: ItFsJffs401 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs401, TestSize.Level0) -{ - ItFsJffs401(); -} - -/* * - * @tc.name: ItFsJffs402 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs402, TestSize.Level0) -{ - ItFsJffs402(); -} - -/* * - * @tc.name: ItFsJffs403 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs403, TestSize.Level0) -{ - ItFsJffs403(); -} - -/* * - * @tc.name: ItFsJffs404 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs404, TestSize.Level0) -{ - ItFsJffs404(); -} - -/* * - * @tc.name: ItFsJffs405 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs405, TestSize.Level0) -{ - ItFsJffs405(); -} - -/* * - * @tc.name: ItFsJffs406 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs406, TestSize.Level0) -{ - ItFsJffs406(); -} - -/* * - * @tc.name: ItFsJffs407 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs407, TestSize.Level0) -{ - ItFsJffs407(); -} - -/* * - * @tc.name: ItFsJffs408 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs408, TestSize.Level0) -{ - ItFsJffs408(); -} - -/* * - * @tc.name: ItFsJffs409 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs409, TestSize.Level0) -{ - ItFsJffs409(); -} - -/* * - * @tc.name: ItFsJffs410 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs410, TestSize.Level0) -{ - ItFsJffs410(); -} - -/* * - * @tc.name: ItFsJffs411 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs411, TestSize.Level0) -{ - ItFsJffs411(); -} - -/* * - * @tc.name: ItFsJffs412 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs412, TestSize.Level0) -{ - ItFsJffs412(); -} - -/* * - * @tc.name: ItFsJffs413 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs413, TestSize.Level0) -{ - ItFsJffs413(); -} - -/* * - * @tc.name: ItFsJffs414 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs414, TestSize.Level0) -{ - ItFsJffs414(); -} - -/* * - * @tc.name: ItFsJffs415 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs415, TestSize.Level0) -{ - ItFsJffs415(); -} - -/* * - * @tc.name: ItFsJffs416 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs416, TestSize.Level0) -{ - ItFsJffs416(); -} - -/* * - * @tc.name: ItFsJffs417 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs417, TestSize.Level0) -{ - ItFsJffs417(); -} - -/* * - * @tc.name: ItFsJffs418 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs418, TestSize.Level0) -{ - ItFsJffs418(); -} - -/* * - * @tc.name: ItFsJffs419 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs419, TestSize.Level0) -{ - ItFsJffs419(); -} - -/* * - * @tc.name: ItFsJffs420 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs420, TestSize.Level0) -{ - ItFsJffs420(); -} - -/* * - * @tc.name: ItFsJffs421 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs421, TestSize.Level0) -{ - ItFsJffs421(); -} - -/* * - * @tc.name: ItFsJffs422 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs422, TestSize.Level0) -{ - ItFsJffs422(); -} - -/* * - * @tc.name: ItFsJffs423 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs423, TestSize.Level0) -{ - ItFsJffs423(); -} - -/* * - * @tc.name: ItFsJffs424 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs424, TestSize.Level0) -{ - ItFsJffs424(); -} - -/* * - * @tc.name: ItFsJffs425 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs425, TestSize.Level0) -{ - ItFsJffs425(); -} - -/* * - * @tc.name: ItFsJffs426 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs426, TestSize.Level0) -{ - ItFsJffs426(); -} - -/* * - * @tc.name: ItFsJffs427 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs427, TestSize.Level0) -{ - ItFsJffs427(); -} - -/* * - * @tc.name: ItFsJffs428 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs428, TestSize.Level0) -{ - ItFsJffs428(); -} - -/* * - * @tc.name: ItFsJffs429 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs429, TestSize.Level0) -{ - ItFsJffs429(); -} - -/* * - * @tc.name: ItFsJffs430 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs430, TestSize.Level0) -{ - ItFsJffs430(); -} - -/* * - * @tc.name: ItFsJffs431 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs431, TestSize.Level0) -{ - ItFsJffs431(); -} - -/* * - * @tc.name: ItFsJffs432 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs432, TestSize.Level0) -{ - ItFsJffs432(); -} - -/* * - * @tc.name: ItFsJffs433 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs433, TestSize.Level0) -{ - ItFsJffs433(); -} - -/* * - * @tc.name: ItFsJffs434 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs434, TestSize.Level0) -{ - ItFsJffs434(); -} - -/* * - * @tc.name: ItFsJffs435 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs435, TestSize.Level0) -{ - ItFsJffs435(); -} - -/* * - * @tc.name: ItFsJffs454 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs454, TestSize.Level0) -{ - ItFsJffs454(); -} - -/* * - * @tc.name: ItFsJffs455 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs455, TestSize.Level0) -{ - ItFsJffs455(); -} - -/* * - * @tc.name: ItFsJffs456 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs456, TestSize.Level0) -{ - ItFsJffs456(); -} - -/* * - * @tc.name: ItFsJffs457 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs457, TestSize.Level0) -{ - ItFsJffs457(); -} - -/* * - * @tc.name: ItFsJffs458 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs458, TestSize.Level0) -{ - ItFsJffs458(); -} - -/* * - * @tc.name: ItFsJffs459 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs459, TestSize.Level0) -{ - ItFsJffs459(); -} - -/* * - * @tc.name: ItFsJffs460 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs460, TestSize.Level0) -{ - ItFsJffs460(); -} - -/* * - * @tc.name: ItFsJffs461 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs461, TestSize.Level0) -{ - ItFsJffs461(); -} - -/* * - * @tc.name: ItFsJffs462 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs462, TestSize.Level0) -{ - ItFsJffs462(); -} - -/* * - * @tc.name: ItFsJffs487 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs487, TestSize.Level0) -{ - ItFsJffs487(); -} - -/* * - * @tc.name: ItFsJffs488 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs488, TestSize.Level0) -{ - ItFsJffs488(); -} - -/* * - * @tc.name: ItFsJffs489 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs489, TestSize.Level0) -{ - ItFsJffs489(); -} - -/* * - * @tc.name: ItFsJffs490 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs490, TestSize.Level0) -{ - ItFsJffs490(); -} - -/* * - * @tc.name: ItFsJffs491 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs491, TestSize.Level0) -{ - ItFsJffs491(); -} - -/* * - * @tc.name: ItFsJffs492 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs492, TestSize.Level0) -{ - ItFsJffs492(); -} - -/* * - * @tc.name: ItFsJffs493 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs493, TestSize.Level0) -{ - ItFsJffs493(); -} - -/* * - * @tc.name: ItFsJffs494 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs494, TestSize.Level0) -{ - ItFsJffs494(); -} - -/* * - * @tc.name: ItFsJffs496 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs496, TestSize.Level0) -{ - ItFsJffs496(); -} - -/* * - * @tc.name: ItFsJffs497 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs497, TestSize.Level0) -{ - ItFsJffs497(); -} - -/* * - * @tc.name: ItFsJffs498 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs498, TestSize.Level0) -{ - ItFsJffs498(); -} - -/* * - * @tc.name: ItFsJffs499 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs499, TestSize.Level0) -{ - ItFsJffs499(); -} - -/* * - * @tc.name: ItFsJffs500 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs500, TestSize.Level0) -{ - ItFsJffs500(); -} - -/* * - * @tc.name: ItFsJffs501 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs501, TestSize.Level0) -{ - ItFsJffs501(); -} - -/* * - * @tc.name: ItFsJffs502 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs502, TestSize.Level0) -{ - ItFsJffs502(); -} - -/* * - * @tc.name: ItFsJffs503 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs503, TestSize.Level0) -{ - ItFsJffs503(); -} - -/* * - * @tc.name: ItFsJffs504 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs504, TestSize.Level0) -{ - ItFsJffs504(); -} - -/* * - * @tc.name: ItFsJffs505 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs505, TestSize.Level0) -{ - ItFsJffs505(); -} - -/* * - * @tc.name: ItFsJffs506 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs506, TestSize.Level0) -{ - ItFsJffs506(); -} - -/* * - * @tc.name: ItFsJffs507 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs507, TestSize.Level0) -{ - ItFsJffs507(); -} - -/* * - * @tc.name: ItFsJffs508 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs508, TestSize.Level0) -{ - ItFsJffs508(); -} - -/* * - * @tc.name: ItFsJffs509 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs509, TestSize.Level0) -{ - ItFsJffs509(); -} - -/* * - * @tc.name: ItFsJffs510 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs510, TestSize.Level0) -{ - ItFsJffs510(); -} - -/* * - * @tc.name: ItFsJffs511 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs511, TestSize.Level0) -{ - ItFsJffs511(); -} - -/* * - * @tc.name: ItFsJffs512 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs512, TestSize.Level0) -{ - ItFsJffs512(); -} - -/* * - * @tc.name: ItFsJffs513 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs513, TestSize.Level0) -{ - ItFsJffs513(); -} - -/* * - * @tc.name: ItFsJffs514 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs514, TestSize.Level0) -{ - ItFsJffs514(); -} - -/* * - * @tc.name: ItFsJffs515 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs515, TestSize.Level0) -{ - ItFsJffs515(); -} - -/* * - * @tc.name: ItFsJffs516 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs516, TestSize.Level0) -{ - ItFsJffs516(); -} - -/* * - * @tc.name: ItFsJffs517 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs517, TestSize.Level0) -{ - ItFsJffs517(); -} - -/* * - * @tc.name: ItFsJffs518 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs518, TestSize.Level0) -{ - ItFsJffs518(); -} - -/* * - * @tc.name: ItFsJffs519 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs519, TestSize.Level0) -{ - ItFsJffs519(); -} - -/* * - * @tc.name: ItFsJffs520 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs520, TestSize.Level0) -{ - ItFsJffs520(); -} - -/* * - * @tc.name: ItFsJffs521 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs521, TestSize.Level0) -{ - ItFsJffs521(); -} - -/* * - * @tc.name: ItFsJffs522 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs522, TestSize.Level0) -{ - ItFsJffs522(); -} - -/* * - * @tc.name: ItFsJffs523 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs523, TestSize.Level0) -{ - ItFsJffs523(); -} - -/* * - * @tc.name: ItFsJffs524 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs524, TestSize.Level0) -{ - ItFsJffs524(); -} - -/* * - * @tc.name: ItFsJffs526 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs526, TestSize.Level0) -{ - ItFsJffs526(); -} - -/* * - * @tc.name: ItFsJffs528 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs528, TestSize.Level0) -{ - ItFsJffs528(); -} - -/* * - * @tc.name: ItFsJffs529 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs529, TestSize.Level0) -{ - ItFsJffs529(); -} - -/* * - * @tc.name: ItFsJffs530 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs530, TestSize.Level0) -{ - ItFsJffs530(); -} - -/* * - * @tc.name: ItFsJffs531 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs531, TestSize.Level0) -{ - ItFsJffs531(); -} - -/* * - * @tc.name: ItFsJffs532 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs532, TestSize.Level0) -{ - ItFsJffs532(); -} - -/* * - * @tc.name: ItFsJffs533 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs533, TestSize.Level0) -{ - ItFsJffs533(); -} - -/* * - * @tc.name: ItFsJffs534 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs534, TestSize.Level0) -{ - ItFsJffs534(); -} - -/* * - * @tc.name: ItFsJffs541 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs541, TestSize.Level0) -{ - ItFsJffs541(); -} - -/* * - * @tc.name: ItFsJffs542 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs542, TestSize.Level0) -{ - ItFsJffs542(); -} - -/* * - * @tc.name: ItFsJffs543 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs543, TestSize.Level0) -{ - ItFsJffs543(); -} - -/* * - * @tc.name: ItFsJffs544 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs544, TestSize.Level0) -{ - ItFsJffs544(); -} - -/* * - * @tc.name: ItFsJffs545 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs545, TestSize.Level0) -{ - ItFsJffs545(); -} - -/* * - * @tc.name: ItFsJffs546 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs546, TestSize.Level0) -{ - ItFsJffs546(); -} - -/* * - * @tc.name: ItFsJffs547 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs547, TestSize.Level0) -{ - ItFsJffs547(); -} - -/* * - * @tc.name: ItFsJffs548 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs548, TestSize.Level0) -{ - ItFsJffs548(); -} - -/* * - * @tc.name: ItFsJffs549 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs549, TestSize.Level0) -{ - ItFsJffs549(); -} - -/* * - * @tc.name: ItFsJffs550 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs550, TestSize.Level0) -{ - ItFsJffs550(); -} - -/* * - * @tc.name: ItFsJffs551 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs551, TestSize.Level0) -{ - ItFsJffs551(); -} - -/* * - * @tc.name: ItFsJffs552 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs552, TestSize.Level0) -{ - ItFsJffs552(); -} - -/* * - * @tc.name: ItFsJffs553 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs553, TestSize.Level0) -{ - ItFsJffs553(); -} - -/* * - * @tc.name: ItFsJffs554 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs554, TestSize.Level0) -{ - ItFsJffs554(); -} - -/* * - * @tc.name: ItFsJffs555 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs555, TestSize.Level0) -{ - ItFsJffs555(); -} - -/* * - * @tc.name: ItFsJffs556 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs556, TestSize.Level0) -{ - ItFsJffs556(); -} - -/* * - * @tc.name: ItFsJffs557 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs557, TestSize.Level0) -{ - ItFsJffs557(); -} - -/* * - * @tc.name: ItFsJffs560 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs560, TestSize.Level0) -{ - ItFsJffs560(); -} - -/* * - * @tc.name: ItFsJffs562 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs562, TestSize.Level0) -{ - ItFsJffs562(); -} - -/* * - * @tc.name: ItFsJffs563 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs563, TestSize.Level0) -{ - ItFsJffs563(); -} - -/* * - * @tc.name: ItFsJffs564 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs564, TestSize.Level0) -{ - ItFsJffs564(); -} - -/* * - * @tc.name: ItFsJffs565 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs565, TestSize.Level0) -{ - ItFsJffs565(); -} - -/* * - * @tc.name: ItFsJffs566 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs566, TestSize.Level0) -{ - ItFsJffs566(); -} - -/* * - * @tc.name: ItFsJffs567 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs567, TestSize.Level0) -{ - ItFsJffs567(); -} - -/* * - * @tc.name: ItFsJffs568 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs568, TestSize.Level0) -{ - ItFsJffs568(); -} - -/* * - * @tc.name: ItFsJffs569 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs569, TestSize.Level0) -{ - ItFsJffs569(); // the second param in stat64 is NULL -} - -/* * - * @tc.name: ItFsJffs570 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs570, TestSize.Level0) -{ - ItFsJffs570(); // the second param in stat64 is NULL -} - -/* * - * @tc.name: ItFsJffs571 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs571, TestSize.Level0) -{ - ItFsJffs571(); -} - -/* * - * @tc.name: ItFsJffs572 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs572, TestSize.Level0) -{ - ItFsJffs572(); // the second param in fstat64 is NULL -} - -/* * - * @tc.name: ItFsJffs573 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs573, TestSize.Level0) -{ - ItFsJffs573(); // the second param in fstat64 is NULL -} - -/* * - * @tc.name: ItFsJffs574 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs574, TestSize.Level0) -{ - ItFsJffs574(); -} - -/* * - * @tc.name: ItFsJffs124 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs124, TestSize.Level0) -{ - ItFsJffs124(); -} - -/* * - * @tc.name: ItFsJffs125 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs125, TestSize.Level0) -{ - ItFsJffs125(); -} - -/* * - * @tc.name: ItFsJffs583 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs583, TestSize.Level0) -{ - ItFsJffs583(); -} - -/* * - * @tc.name: ItFsJffs584 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs584, TestSize.Level0) -{ - ItFsJffs584(); -} - -/* * - * @tc.name: ItFsJffs586 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs586, TestSize.Level0) -{ - ItFsJffs586(); -} - -/* * - * @tc.name: ItFsJffs589 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs589, TestSize.Level0) -{ - ItFsJffs589(); -} - -/* * - * @tc.name: ItFsJffs591 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs591, TestSize.Level0) -{ - ItFsJffs591(); -} - -/* * - * @tc.name: ItFsJffs592 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs592, TestSize.Level0) -{ - ItFsJffs592(); -} - -/* * - * @tc.name: ItFsJffs593 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs593, TestSize.Level0) -{ - ItFsJffs593(); -} - -/* * - * @tc.name: ItFsJffs594 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs594, TestSize.Level0) -{ - ItFsJffs594(); -} - -/* * - * @tc.name: ItFsJffs595 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs595, TestSize.Level0) -{ - ItFsJffs595(); -} - -/* * - * @tc.name: ItFsJffs596 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs596, TestSize.Level0) -{ - ItFsJffs596(); -} - -/* * - * @tc.name: ItFsJffs603 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs603, TestSize.Level0) -{ - ItFsJffs603(); -} - -/* * - * @tc.name: ItFsJffs636 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs636, TestSize.Level0) -{ - ItFsJffs636(); -} - -/* * - * @tc.name: ItFsJffs643 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs643, TestSize.Level0) -{ - ItFsJffs643(); -} - -/* * - * @tc.name: ItFsJffs644 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs644, TestSize.Level0) -{ - ItFsJffs644(); -} - -/* * - * @tc.name: ItFsJffs645 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs645, TestSize.Level0) -{ - ItFsJffs645(); -} - -/* * - * @tc.name: ItFsJffs646 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs646, TestSize.Level0) -{ - ItFsJffs646(); -} - -/* * - * @tc.name: ItFsJffs648 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs648, TestSize.Level0) -{ - ItFsJffs648(); -} - -/* * - * @tc.name: ItFsJffs649 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs649, TestSize.Level0) -{ - ItFsJffs649(); -} - -/* * - * @tc.name: ItFsJffs650 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs650, TestSize.Level0) -{ - ItFsJffs650(); -} - -/* * - * @tc.name: ItFsJffs651 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs651, TestSize.Level0) -{ - ItFsJffs651(); -} - -/* * - * @tc.name: ItFsJffs652 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs652, TestSize.Level0) -{ - ItFsJffs652(); -} - -/* * - * @tc.name: ItFsJffs653 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs653, TestSize.Level0) -{ - ItFsJffs653(); -} - -/* * - * @tc.name: ItFsJffs654 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs654, TestSize.Level0) -{ - ItFsJffs654(); -} - -/* * - * @tc.name: ItFsJffs655 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs655, TestSize.Level0) -{ - ItFsJffs655(); -} - -/* * - * @tc.name: ItFsJffs656 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs656, TestSize.Level0) -{ - ItFsJffs656(); -} - -/* * - * @tc.name: ItFsJffs663 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs663, TestSize.Level0) -{ - ItFsJffs663(); -} - -/* * - * @tc.name: ItFsJffs664 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs664, TestSize.Level0) -{ - ItFsJffs664(); -} - -/* * - * @tc.name: ItFsJffs665 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs665, TestSize.Level0) -{ - ItFsJffs665(); -} - -/* * - * @tc.name: ItFsJffs666 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs666, TestSize.Level0) -{ - ItFsJffs666(); -} - -/* * - * @tc.name: ItFsJffs668 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs668, TestSize.Level0) -{ - ItFsJffs668(); -} - -/* * - * @tc.name: ItFsJffs669 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs669, TestSize.Level0) -{ - ItFsJffs669(); -} - -/* * - * @tc.name: ItFsJffs670 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs670, TestSize.Level0) -{ - ItFsJffs670(); -} - -/* * - * @tc.name: ItFsJffs671 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs671, TestSize.Level0) -{ - ItFsJffs671(); -} - -/* * - * @tc.name: ItFsJffs672 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs672, TestSize.Level0) -{ - ItFsJffs672(); -} - -/* * - * @tc.name: ItFsJffs673 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs673, TestSize.Level0) -{ - ItFsJffs673(); -} - -/* * - * @tc.name: ItFsJffs674 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs674, TestSize.Level0) -{ - ItFsJffs674(); -} - -/* * - * @tc.name: ItFsJffs675 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs675, TestSize.Level0) -{ - ItFsJffs675(); -} - -/* * - * @tc.name: ItFsJffs676 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs676, TestSize.Level0) -{ - ItFsJffs676(); -} - -/* * - * @tc.name: ItFsJffs690 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs690, TestSize.Level0) -{ - ItFsJffs690(); -} - -/* * - * @tc.name: ItFsJffs694 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs694, TestSize.Level0) -{ - ItFsJffs694(); -} - -/* * - * @tc.name: ItFsJffs696 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs696, TestSize.Level0) -{ - ItFsJffs696(); -} - -/* * - * @tc.name: ItFsJffs697 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs697, TestSize.Level0) -{ - ItFsJffs697(); -} - -/* * - * @tc.name: ItFsJffs700 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs700, TestSize.Level0) -{ - ItFsJffs700(); -} - -/* * - * @tc.name: ItFsJffs701 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs701, TestSize.Level0) -{ - ItFsJffs701(); -} - -/* * - * @tc.name: ItFsJffs807 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs807, TestSize.Level0) -{ - ItFsJffs807(); // jffs dir1 rename dir2,dir2 have more than two files,rename failed -} - -/* * - * @tc.name: ItFsJffs808 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs808, TestSize.Level0) -{ - ItFsJffs808(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLink001, TestSize.Level0) -{ - ItFsTestLink001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLink002, TestSize.Level0) -{ - ItFsTestLink002(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLink003, TestSize.Level0) -{ - ItFsTestLink003(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLinkat001, TestSize.Level0) -{ - ItFsTestLinkat001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLinkat002, TestSize.Level0) -{ - ItFsTestLinkat002(); -} - -HWTEST_F(VfsJffsTest, ItFsTestLinkat003, TestSize.Level0) -{ - ItFsTestLinkat003(); -} - -HWTEST_F(VfsJffsTest, ItFsTestReadlink001, TestSize.Level0) -{ - ItFsTestReadlink001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestSymlink001, TestSize.Level0) -{ - ItFsTestSymlink001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestSymlink002, TestSize.Level0) -{ - ItFsTestSymlink002(); -} - -HWTEST_F(VfsJffsTest, ItFsTestSymlink003, TestSize.Level0) -{ - ItFsTestSymlink003(); -} - -HWTEST_F(VfsJffsTest, ItFsTestSymlinkat001, TestSize.Level0) -{ - ItFsTestSymlinkat001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestMountRdonly001, TestSize.Level0) -{ - ItFsTestMountRdonly001(); -} - -HWTEST_F(VfsJffsTest, ItFsTestMountRdonly002, TestSize.Level0) -{ - ItFsTestMountRdonly002(); -} - -HWTEST_F(VfsJffsTest, ItFsTestMountRdonly003, TestSize.Level0) -{ - ItFsTestMountRdonly003(); -} - -#endif -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: It_Test_Dac_001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItTestDac001, TestSize.Level0) -{ - ItTestDac001(); -} - -/* * - * @tc.name: ItFsJffs001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs001, TestSize.Level0) -{ - ItFsJffs001(); -} - -/* * - * @tc.name: ItFsJffs002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs002, TestSize.Level0) -{ - ItFsJffs002(); -} - -/* * - * @tc.name: ItFsJffs003 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs003, TestSize.Level0) -{ - ItFsJffs003(); -} - -/* * - * @tc.name: ItFsJffs005 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs005, TestSize.Level0) -{ - ItFsJffs005(); -} - -/* * - * @tc.name: ItFsJffs021 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs021, TestSize.Level0) -{ - ItFsJffs021(); -} - -/* * - * @tc.name: ItFsJffs022 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs022, TestSize.Level0) -{ - ItFsJffs022(); -} - -/* * - * @tc.name: ItFsJffs026 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs026, TestSize.Level0) -{ - ItFsJffs026(); -} - -/* * - * @tc.name: ItFsJffs027 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs027, TestSize.Level0) -{ - ItFsJffs027(); -} - -/* * - * @tc.name: ItFsJffs095 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs095, TestSize.Level0) -{ - ItFsJffs095(); -} - -/* * - * @tc.name: ItFsJffs535 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffs535, TestSize.Level0) -{ - ItFsJffs535(); -} - -#endif - -#if defined(LOSCFG_USER_TEST_PRESSURE) -/* * - * @tc.name: ItFsJffsPRESSURE_001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure001, TestSize.Level0) -{ - ItFsJffsPressure001(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure002, TestSize.Level0) -{ - ItFsJffsPressure002(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_003 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure003, TestSize.Level0) -{ - ItFsJffsPressure003(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure004, TestSize.Level0) -{ - ItFsJffsPressure004(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_005 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure005, TestSize.Level0) -{ - ItFsJffsPressure005(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_006 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure006, TestSize.Level0) -{ - ItFsJffsPressure006(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_007 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure007, TestSize.Level0) -{ - ItFsJffsPressure007(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_008 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure008, TestSize.Level0) -{ - ItFsJffsPressure008(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_009 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure009, TestSize.Level0) -{ - ItFsJffsPressure009(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_010 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure010, TestSize.Level0) -{ - ItFsJffsPressure010(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_011 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure011, TestSize.Level0) -{ - ItFsJffsPressure011(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_012 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure012, TestSize.Level0) -{ - ItFsJffsPressure012(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_014 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure014, TestSize.Level0) -{ - ItFsJffsPressure014(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_015 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure015, TestSize.Level0) -{ - ItFsJffsPressure015(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_016 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure016, TestSize.Level0) -{ - ItFsJffsPressure016(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_017 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure017, TestSize.Level0) -{ - ItFsJffsPressure017(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_018 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure018, TestSize.Level0) -{ - ItFsJffsPressure018(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_019 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure019, TestSize.Level0) -{ - ItFsJffsPressure019(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_020 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure020, TestSize.Level0) -{ - ItFsJffsPressure020(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_021 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure021, TestSize.Level0) -{ - ItFsJffsPressure021(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_022 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure022, TestSize.Level0) -{ - ItFsJffsPressure022(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_023 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure023, TestSize.Level0) -{ - ItFsJffsPressure023(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_025 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure025, TestSize.Level0) -{ - ItFsJffsPressure025(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_026 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure026, TestSize.Level0) -{ - ItFsJffsPressure026(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_027 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure027, TestSize.Level0) -{ - ItFsJffsPressure027(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_028 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure028, TestSize.Level0) -{ - ItFsJffsPressure028(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_030 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure030, TestSize.Level0) -{ - ItFsJffsPressure030(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_031 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure031, TestSize.Level0) -{ - ItFsJffsPressure031(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_032 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure032, TestSize.Level0) -{ - ItFsJffsPressure032(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_033 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure033, TestSize.Level0) -{ - ItFsJffsPressure033(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_034 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure034, TestSize.Level0) -{ - ItFsJffsPressure034(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_035 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure035, TestSize.Level0) -{ - ItFsJffsPressure035(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_036 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure036, TestSize.Level0) -{ - ItFsJffsPressure036(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_037 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure037, TestSize.Level0) -{ - ItFsJffsPressure037(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_038 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure038, TestSize.Level0) -{ - ItFsJffsPressure038(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_039 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure039, TestSize.Level0) -{ - ItFsJffsPressure039(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_040 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure040, TestSize.Level0) -{ - ItFsJffsPressure040(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_041 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure041, TestSize.Level0) -{ - ItFsJffsPressure041(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_042 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure042, TestSize.Level0) -{ - ItFsJffsPressure042(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_043 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure043, TestSize.Level0) -{ - ItFsJffsPressure043(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_044 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure044, TestSize.Level0) -{ - ItFsJffsPressure044(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_045 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure045, TestSize.Level0) -{ - ItFsJffsPressure045(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_046 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure046, TestSize.Level0) -{ - ItFsJffsPressure046(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_047 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure047, TestSize.Level0) -{ - ItFsJffsPressure047(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_048 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure048, TestSize.Level0) -{ - ItFsJffsPressure048(); // Time-consuming -} - -/* * - * @tc.name: ItFsJffsPRESSURE_049 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure049, TestSize.Level0) -{ - ItFsJffsPressure049(); // Time-consuming -} - -/* * - * @tc.name: ItFsJffsPRESSURE_051 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure051, TestSize.Level0) -{ - ItFsJffsPressure051(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_052 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure052, TestSize.Level0) -{ - ItFsJffsPressure052(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_053 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure053, TestSize.Level0) -{ - ItFsJffsPressure053(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_301 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure301, TestSize.Level0) -{ - ItFsJffsPressure301(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_302 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure302, TestSize.Level0) -{ - ItFsJffsPressure302(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_303 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure303, TestSize.Level0) -{ - ItFsJffsPressure303(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_304 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure304, TestSize.Level0) -{ - ItFsJffsPressure304(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_305 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure305, TestSize.Level0) -{ - ItFsJffsPressure305(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_306 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure306, TestSize.Level0) -{ - ItFsJffsPressure306(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_307 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure307, TestSize.Level0) -{ - ItFsJffsPressure307(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_308 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure308, TestSize.Level0) -{ - ItFsJffsPressure308(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_309 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure309, TestSize.Level0) -{ - ItFsJffsPressure309(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_310 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure310, TestSize.Level0) -{ - ItFsJffsPressure310(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_311 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure311, TestSize.Level0) -{ - ItFsJffsPressure311(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_312 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure312, TestSize.Level0) -{ - ItFsJffsPressure312(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_313 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure313, TestSize.Level0) -{ - ItFsJffsPressure313(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_314 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure314, TestSize.Level0) -{ - ItFsJffsPressure314(); -} - -/* * - * @tc.name: ItFsJffsPRESSURE_315 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPressure315, TestSize.Level0) -{ - ItFsJffsPressure315(); -} - - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread001, TestSize.Level0) -{ - ItFsJffsMultipthread001(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread002, TestSize.Level0) -{ - ItFsJffsMultipthread002(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_003 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread003, TestSize.Level0) -{ - ItFsJffsMultipthread003(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread004, TestSize.Level0) -{ - ItFsJffsMultipthread004(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_005 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread005, TestSize.Level0) -{ - ItFsJffsMultipthread005(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_006 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread006, TestSize.Level0) -{ - ItFsJffsMultipthread006(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_007 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread007, TestSize.Level0) -{ - ItFsJffsMultipthread007(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_008 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread008, TestSize.Level0) -{ - ItFsJffsMultipthread008(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_009 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread009, TestSize.Level0) -{ - ItFsJffsMultipthread009(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_010 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread010, TestSize.Level0) -{ - ItFsJffsMultipthread010(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_011 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread011, TestSize.Level0) -{ - ItFsJffsMultipthread011(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_012 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread012, TestSize.Level0) -{ - ItFsJffsMultipthread012(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_013 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread013, TestSize.Level0) -{ - ItFsJffsMultipthread013(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_014 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread014, TestSize.Level0) -{ - ItFsJffsMultipthread014(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_015 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread015, TestSize.Level0) -{ - ItFsJffsMultipthread015(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_016 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread016, TestSize.Level0) -{ - ItFsJffsMultipthread016(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_017 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread017, TestSize.Level0) -{ - ItFsJffsMultipthread017(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_018 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread018, TestSize.Level0) -{ - ItFsJffsMultipthread018(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_019 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread019, TestSize.Level0) -{ - ItFsJffsMultipthread019(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_020 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread020, TestSize.Level0) -{ - ItFsJffsMultipthread020(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_021 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread021, TestSize.Level0) -{ - ItFsJffsMultipthread021(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_022 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread022, TestSize.Level0) -{ - ItFsJffsMultipthread022(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_023 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread023, TestSize.Level0) -{ - ItFsJffsMultipthread023(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_024 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread024, TestSize.Level0) -{ - ItFsJffsMultipthread024(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_025 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread025, TestSize.Level0) -{ - ItFsJffsMultipthread025(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_026 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread026, TestSize.Level0) -{ - ItFsJffsMultipthread026(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_027 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread027, TestSize.Level0) -{ - ItFsJffsMultipthread027(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_028 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread028, TestSize.Level0) -{ - ItFsJffsMultipthread028(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_029 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread029, TestSize.Level0) -{ - ItFsJffsMultipthread029(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_030 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread030, TestSize.Level0) -{ - ItFsJffsMultipthread030(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_031 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread031, TestSize.Level0) -{ - ItFsJffsMultipthread031(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_032 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread032, TestSize.Level0) -{ - ItFsJffsMultipthread032(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_033 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread033, TestSize.Level0) -{ - ItFsJffsMultipthread033(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_034 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread034, TestSize.Level0) -{ - ItFsJffsMultipthread034(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_035 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread035, TestSize.Level0) -{ - ItFsJffsMultipthread035(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_036 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread036, TestSize.Level0) -{ - ItFsJffsMultipthread036(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_037 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread037, TestSize.Level0) -{ - ItFsJffsMultipthread037(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_038 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread038, TestSize.Level0) -{ - ItFsJffsMultipthread038(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_039 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread039, TestSize.Level0) -{ - ItFsJffsMultipthread039(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_040 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread040, TestSize.Level0) -{ - ItFsJffsMultipthread040(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_041 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread041, TestSize.Level0) -{ - ItFsJffsMultipthread041(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_042 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread042, TestSize.Level0) -{ - ItFsJffsMultipthread042(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_043 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread043, TestSize.Level0) -{ - ItFsJffsMultipthread043(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_044 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread044, TestSize.Level0) -{ - ItFsJffsMultipthread044(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_045 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread045, TestSize.Level0) -{ - ItFsJffsMultipthread045(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_046 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread046, TestSize.Level0) -{ - ItFsJffsMultipthread046(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_047 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread047, TestSize.Level0) -{ - ItFsJffsMultipthread047(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_048 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread048, TestSize.Level0) -{ - ItFsJffsMultipthread048(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_049 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread049, TestSize.Level0) -{ - ItFsJffsMultipthread049(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_050 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread050, TestSize.Level0) -{ - ItFsJffsMultipthread050(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_051 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread051, TestSize.Level0) -{ - ItFsJffsMultipthread051(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_052 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread052, TestSize.Level0) -{ - ItFsJffsMultipthread052(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_053 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread053, TestSize.Level0) -{ - ItFsJffsMultipthread053(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_054 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread054, TestSize.Level0) -{ - ItFsJffsMultipthread054(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_055 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread055, TestSize.Level0) -{ - ItFsJffsMultipthread055(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_056 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread056, TestSize.Level0) -{ - ItFsJffsMultipthread056(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_057 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread057, TestSize.Level0) -{ - ItFsJffsMultipthread057(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_058 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread058, TestSize.Level0) -{ - ItFsJffsMultipthread058(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_059 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread059, TestSize.Level0) -{ - ItFsJffsMultipthread059(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_060 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread060, TestSize.Level0) -{ - ItFsJffsMultipthread060(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_061 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread061, TestSize.Level0) -{ - ItFsJffsMultipthread061(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_062 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread062, TestSize.Level0) -{ - ItFsJffsMultipthread062(); -} - -/* * - * @tc.name: ItFsJffsMULTIPTHREAD_063 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsMultipthread063, TestSize.Level0) -{ - ItFsJffsMultipthread063(); -} - - -/* * - * @tc.name: ItFsJffsPERFORMANCE_013 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance013, TestSize.Level0) -{ - ItFsJffsPerformance013(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_001 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance001, TestSize.Level0) -{ - ItFsJffsPerformance001(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_002 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance002, TestSize.Level0) -{ - ItFsJffsPerformance002(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_003 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance003, TestSize.Level0) -{ - ItFsJffsPerformance003(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_004 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance004, TestSize.Level0) -{ - ItFsJffsPerformance004(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_005 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance005, TestSize.Level0) -{ - ItFsJffsPerformance005(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_006 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance006, TestSize.Level0) -{ - ItFsJffsPerformance006(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_008 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance008, TestSize.Level0) -{ - ItFsJffsPerformance008(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_009 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance009, TestSize.Level0) -{ - ItFsJffsPerformance009(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_010 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance010, TestSize.Level0) -{ - ItFsJffsPerformance010(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_011 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance011, TestSize.Level0) -{ - ItFsJffsPerformance011(); -} - -/* * - * @tc.name: ItFsJffsPERFORMANCE_012 - * @tc.desc: function for VfsJffsTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(VfsJffsTest, ItFsJffsPerformance012, TestSize.Level0) -{ - ItFsJffsPerformance012(); -} - -#endif -} diff --git a/testsuites/unittest_old/fs/proc/BUILD.gn b/testsuites/unittest_old/fs/proc/BUILD.gn deleted file mode 100644 index 4360c3d0..00000000 --- a/testsuites/unittest_old/fs/proc/BUILD.gn +++ /dev/null @@ -1,80 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "//kernel/liteos_a/test/unittest/fs/proc", -] - -sources_entry = [ - "../../common/osTest.cpp", - "It_vfs_proc.cpp", -] - -sources_smoke = [] - -sources_full = [ - "full/It_vfs_proc_001.cpp", - "full/It_vfs_proc_002.cpp", - "full/It_vfs_proc_003.cpp", - "full/It_vfs_proc_004.cpp", - "full/It_vfs_proc_005.cpp", - "full/It_vfs_proc_006.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_fs_procfs_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_fs_procfs_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_old/fs/proc/It_vfs_proc.cpp b/testsuites/unittest_old/fs/proc/It_vfs_proc.cpp deleted file mode 100644 index a4d42574..00000000 --- a/testsuites/unittest_old/fs/proc/It_vfs_proc.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -#include "It_vfs_proc.h" - -VOID ItSuiteVfsProc(VOID) -{ -#if defined(LOSCFG_USER_TEST_SMOKE) -#endif - -#if defined(LOSCFG_USER_TEST_FULL) - ItFsProc001(); - ItFsProc002(); - ItFsProc003(); - ItFsProc004(); - ItFsProc005(); - ItFsProc006(); -#endif - -#if defined(LOSCFG_USER_TEST_LLT) -#endif - -#if defined(LOSCFG_USER_TEST_PRESSURE) -#ifndef LOSCFG_KERNEL_SMP -#endif -#endif -} diff --git a/testsuites/unittest_old/fs/proc/It_vfs_proc.h b/testsuites/unittest_old/fs/proc/It_vfs_proc.h deleted file mode 100644 index 0b58bdfd..00000000 --- a/testsuites/unittest_old/fs/proc/It_vfs_proc.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "osTest.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define PROC_PATH_NAME "/proc/test" -#define PROC_MAIN_DIR "/proc" -#define PROC_MOUNT_DIR "/proc" -#define MOUNT_DIR_PATH "/proc/mounts" -#define UPTIME_DIR_PATH "/proc/uptime" -#define VMM_DIR_PATH "/proc/vmm" -#define PROCESS_DIR_PATH "/proc/process" -#define PROC_DEV_PATH NULL -#define PROC_CHINESE_NAME1 "这是一个中文å" -#define PROC_FILESYS_TYPE "procfs" - -#define PROC_NAME_LIMITTED_SIZE 300 -#define PROC_NO_ERROR 0 -#define PROC_IS_ERROR -1 - -#if defined(LOSCFG_USER_TEST_SMOKE) -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -VOID ItFsProc001(VOID); -VOID ItFsProc002(VOID); -VOID ItFsProc003(VOID); -VOID ItFsProc004(VOID); -VOID ItFsProc005(VOID); -VOID ItFsProc006(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_LLT) -#endif - -#if defined(LOSCFG_USER_TEST_PRESSURE) -#endif - - diff --git a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_001.cpp b/testsuites/unittest_old/fs/proc/full/It_vfs_proc_001.cpp deleted file mode 100644 index 6139ab41..00000000 --- a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_001.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR readbuf[PROC_NAME_LIMITTED_SIZE] = ""; - - fd = open(MOUNT_DIR_PATH, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = memset_s(readbuf, PROC_NAME_LIMITTED_SIZE, 0, PROC_NAME_LIMITTED_SIZE); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, PROC_NAME_LIMITTED_SIZE - 1); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - fd = open(VMM_DIR_PATH, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = memset_s(readbuf, PROC_NAME_LIMITTED_SIZE, 0, PROC_NAME_LIMITTED_SIZE); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, ret, EXIT1); - len = read(fd, readbuf, PROC_NAME_LIMITTED_SIZE - 1); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - fd = open(PROCESS_DIR_PATH, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = memset_s(readbuf, PROC_NAME_LIMITTED_SIZE, 0, PROC_NAME_LIMITTED_SIZE); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, ret, EXIT1); - len = read(fd, readbuf, PROC_NAME_LIMITTED_SIZE - 1); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc001(VOID) -{ - TEST_ADD_CASE("ItFsProc001", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_002.cpp b/testsuites/unittest_old/fs/proc/full/It_vfs_proc_002.cpp deleted file mode 100644 index c186e792..00000000 --- a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_002.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - CHAR readbuf[PROC_NAME_LIMITTED_SIZE] = ""; - - fd = open(UPTIME_DIR_PATH, O_RDONLY); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - ret = memset_s(readbuf, PROC_NAME_LIMITTED_SIZE, 0, PROC_NAME_LIMITTED_SIZE); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, ret, EXIT1); - len = read(fd, readbuf, PROC_NAME_LIMITTED_SIZE - 1); - ICUNIT_GOTO_NOT_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc002(VOID) -{ - TEST_ADD_CASE("ItFsProc002", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_003.cpp b/testsuites/unittest_old/fs/proc/full/It_vfs_proc_003.cpp deleted file mode 100644 index 9852a0c2..00000000 --- a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_003.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - - fd = open(MOUNT_DIR_PATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "test", strlen("test")); - ICUNIT_GOTO_EQUAL(len, -EPERM, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc003(VOID) -{ - TEST_ADD_CASE("ItFsProc003", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_004.cpp b/testsuites/unittest_old/fs/proc/full/It_vfs_proc_004.cpp deleted file mode 100644 index c7733a32..00000000 --- a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_004.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - - fd = open(UPTIME_DIR_PATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "test", strlen("test")); - ICUNIT_GOTO_EQUAL(len, -EPERM, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc004(VOID) -{ - TEST_ADD_CASE("ItFsProc004", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_005.cpp b/testsuites/unittest_old/fs/proc/full/It_vfs_proc_005.cpp deleted file mode 100644 index 8a71e138..00000000 --- a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_005.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - - fd = open(UPTIME_DIR_PATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "test", strlen("test")); - ICUNIT_GOTO_EQUAL(len, -EPERM, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc005(VOID) -{ - TEST_ADD_CASE("ItFsProc005", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_006.cpp b/testsuites/unittest_old/fs/proc/full/It_vfs_proc_006.cpp deleted file mode 100644 index 7c43a903..00000000 --- a/testsuites/unittest_old/fs/proc/full/It_vfs_proc_006.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_proc.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd, ret, len; - - fd = open(PROCESS_DIR_PATH, O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT1); - - len = write(fd, "test", strlen("test")); - ICUNIT_GOTO_EQUAL(len, -EPERM, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, PROC_NO_ERROR, fd, EXIT1); - - return PROC_NO_ERROR; - -EXIT1: - close(fd); - - return PROC_NO_ERROR; -} - -VOID ItFsProc006(VOID) -{ - TEST_ADD_CASE("ItFsProc006", TestCase, TEST_VFS, TEST_PROC, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/BUILD.gn b/testsuites/unittest_old/fs/vfat/BUILD.gn deleted file mode 100644 index be521447..00000000 --- a/testsuites/unittest_old/fs/vfat/BUILD.gn +++ /dev/null @@ -1,229 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "//kernel/liteos_a/testsuites/unittest/fs/vfs", - "//kernel/liteos_a/testsuites/unittest/fs/vfat", -] - -sources_entry = [ - "../../common/osTest.cpp", - "VfsFatTest.cpp", -] - -sources_smoke = [ "smoke/It_vfs_fat_026.cpp" ] - -sources_pressure = [ - "pressure/It_fs_fat_performance_001.cpp", - "pressure/It_fs_fat_performance_002.cpp", - "pressure/It_fs_fat_performance_003.cpp", - "pressure/It_fs_fat_performance_004.cpp", - "pressure/It_fs_fat_performance_005.cpp", - "pressure/It_fs_fat_performance_006.cpp", - "pressure/It_fs_fat_performance_007.cpp", - "pressure/It_fs_fat_performance_008.cpp", - "pressure/It_fs_fat_performance_013.cpp", - "pressure/It_fs_fat_performance_014.cpp", - "pressure/It_fs_fat_performance_015.cpp", - "pressure/It_fs_fat_performance_016.cpp", - - "pressure/It_fs_fat_pressure_029.cpp", - "pressure/It_fs_fat_pressure_030.cpp", - "pressure/It_fs_fat_pressure_031.cpp", - "pressure/It_fs_fat_pressure_038.cpp", - "pressure/It_fs_fat_pressure_040.cpp", - "pressure/It_fs_fat_pressure_041.cpp", - "pressure/It_fs_fat_pressure_042.cpp", - "pressure/It_fs_fat_pressure_301.cpp", - "pressure/It_fs_fat_pressure_302.cpp", - "pressure/It_fs_fat_pressure_303.cpp", - "pressure/It_fs_fat_pressure_305.cpp", - "pressure/It_fs_fat_pressure_306.cpp", - "pressure/It_fs_fat_pressure_309.cpp", - - "pressure/It_vfs_fat_mutipthread_003.cpp", - "pressure/It_vfs_fat_mutipthread_004.cpp", - "pressure/It_vfs_fat_mutipthread_005.cpp", - "pressure/It_vfs_fat_mutipthread_006.cpp", - "pressure/It_vfs_fat_mutipthread_008.cpp", - "pressure/It_vfs_fat_mutipthread_009.cpp", - "pressure/It_vfs_fat_mutipthread_010.cpp", - "pressure/It_vfs_fat_mutipthread_012.cpp", - "pressure/It_vfs_fat_mutipthread_014.cpp", - "pressure/It_vfs_fat_mutipthread_016.cpp", - "pressure/It_vfs_fat_mutipthread_017.cpp", - "pressure/It_vfs_fat_mutipthread_018.cpp", - "pressure/It_vfs_fat_mutipthread_019.cpp", - "pressure/It_vfs_fat_mutipthread_020.cpp", - "pressure/It_vfs_fat_mutipthread_021.cpp", - "pressure/It_vfs_fat_mutipthread_022.cpp", - "pressure/It_vfs_fat_mutipthread_023.cpp", - "pressure/It_vfs_fat_mutipthread_024.cpp", - "pressure/It_vfs_fat_mutipthread_027.cpp", - "pressure/It_vfs_fat_mutipthread_029.cpp", - "pressure/It_vfs_fat_mutipthread_030.cpp", - "pressure/It_vfs_fat_mutipthread_032.cpp", - "pressure/It_vfs_fat_mutipthread_033.cpp", - "pressure/It_vfs_fat_mutipthread_035.cpp", - "pressure/It_vfs_fat_mutipthread_036.cpp", - "pressure/It_vfs_fat_mutipthread_038.cpp", - "pressure/It_vfs_fat_mutipthread_039.cpp", - "pressure/It_vfs_fat_mutipthread_040.cpp", - "pressure/It_vfs_fat_mutipthread_041.cpp", - "pressure/It_vfs_fat_mutipthread_042.cpp", - "pressure/It_vfs_fat_mutipthread_043.cpp", - "pressure/It_vfs_fat_mutipthread_044.cpp", - "pressure/It_vfs_fat_mutipthread_045.cpp", - "pressure/It_vfs_fat_mutipthread_046.cpp", - "pressure/It_vfs_fat_mutipthread_047.cpp", - "pressure/It_vfs_fat_mutipthread_048.cpp", - "pressure/It_vfs_fat_mutipthread_049.cpp", - "pressure/It_vfs_fat_mutipthread_050.cpp", -] - -sources_full = [ - "full/It_vfs_fat_066.cpp", - "full/It_vfs_fat_068.cpp", - "full/It_vfs_fat_072.cpp", - "full/It_vfs_fat_073.cpp", - "full/It_vfs_fat_074.cpp", - "full/It_vfs_fat_496.cpp", - "full/It_vfs_fat_497.cpp", - "full/It_vfs_fat_498.cpp", - "full/It_vfs_fat_499.cpp", - "full/It_vfs_fat_500.cpp", - "full/It_vfs_fat_501.cpp", - "full/It_vfs_fat_502.cpp", - "full/It_vfs_fat_503.cpp", - "full/It_vfs_fat_504.cpp", - "full/It_vfs_fat_506.cpp", - "full/It_vfs_fat_507.cpp", - "full/It_vfs_fat_508.cpp", - "full/It_vfs_fat_509.cpp", - "full/It_vfs_fat_510.cpp", - "full/It_vfs_fat_511.cpp", - "full/It_vfs_fat_512.cpp", - "full/It_vfs_fat_513.cpp", - "full/It_vfs_fat_514.cpp", - "full/It_vfs_fat_515.cpp", - "full/It_vfs_fat_516.cpp", - "full/It_vfs_fat_517.cpp", - "full/It_vfs_fat_518.cpp", - "full/It_vfs_fat_519.cpp", - "full/It_vfs_fat_662.cpp", - "full/It_vfs_fat_663.cpp", - "full/It_vfs_fat_664.cpp", - "full/It_vfs_fat_665.cpp", - "full/It_vfs_fat_666.cpp", - "full/It_vfs_fat_667.cpp", - "full/It_vfs_fat_668.cpp", - "full/It_vfs_fat_669.cpp", - "full/It_vfs_fat_670.cpp", - "full/It_vfs_fat_671.cpp", - "full/It_vfs_fat_672.cpp", - "full/It_vfs_fat_673.cpp", - "full/It_vfs_fat_674.cpp", - "full/It_vfs_fat_675.cpp", - "full/It_vfs_fat_676.cpp", - "full/It_vfs_fat_677.cpp", - "full/It_vfs_fat_678.cpp", - "full/It_vfs_fat_679.cpp", - "full/It_vfs_fat_680.cpp", - "full/It_vfs_fat_681.cpp", - "full/It_vfs_fat_682.cpp", - "full/It_vfs_fat_683.cpp", - "full/It_vfs_fat_684.cpp", - "full/It_vfs_fat_685.cpp", - "full/It_vfs_fat_686.cpp", - "full/It_vfs_fat_687.cpp", - "full/It_vfs_fat_692.cpp", - "full/It_vfs_fat_693.cpp", - "full/It_vfs_fat_694.cpp", - "full/It_vfs_fat_870.cpp", - "full/It_vfs_fat_872.cpp", - "full/It_vfs_fat_873.cpp", - "full/It_vfs_fat_874.cpp", - "full/It_vfs_fat_875.cpp", - "full/It_vfs_fat_902.cpp", - "full/It_vfs_fat_903.cpp", - "full/It_vfs_fat_904.cpp", - "full/It_vfs_fat_909.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_fs_vfat_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 - sources_pressure = [] - sources += sources_pressure - configs = [ "../..:public_config_for_door" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_fs_vfat_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 - sources_pressure = [] - sources += sources_pressure - configs = [ "../..:public_config_for_all" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) { - unittest("liteos_a_fs_vfat_unittest_pressure") { - output_extension = "bin" - output_dir = "$root_out_dir/test/unittest/kernel" - include_dirs = common_include_dirs - sources = sources_entry - sources_smoke = [] - sources += sources_smoke - sources_full = [] - sources += sources_full - sources += sources_pressure - configs = [ "../..:public_config_for_pressure" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} diff --git a/testsuites/unittest_old/fs/vfat/It_vfs_fat.h b/testsuites/unittest_old/fs/vfat/It_vfs_fat.h deleted file mode 100644 index e863e1fc..00000000 --- a/testsuites/unittest_old/fs/vfat/It_vfs_fat.h +++ /dev/null @@ -1,337 +0,0 @@ -/* - * 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. - */ - -#ifndef IT_VFS_FAT_H -#define IT_VFS_FAT_H - -#include "osTest.h" -#include "sys/uio.h" -#include "utime.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef _GNU_SOURCE -struct timeval { - time_t tv_sec; - suseconds_t tv_usec; -}; -#endif -#define F_RDO 0x01 /* Read only */ -#define F_HID 0x02 /* Hidden */ -#define F_SYS 0x04 /* System */ -#define F_ARC 0x20 /* Archive */ -#define NAME_MAX 255 - -extern int Chattr(const char *path, mode_t mode); // -using off_t = off64_t; - -#define SD_MOUNT_DIR "/vs/sd" -#define FAT_MOUNT_DIR SD_MOUNT_DIR -#define FAT_MAIN_DIR SD_MOUNT_DIR -#define FAT_PATH_NAME "/vs/sd/test" -#define FAT_PATH_NAME0 "/vs/sd/test0" -#define FAT_PATH_NAME1 "/vs/sd/test1" -#define FAT_PATH_NAME2 "/vs/sd/test2" -#define FAT_PATH_NAME00 "/vs/sd/test0/test00" -#define FAT_PATH_NAME11 "/vs/sd/test1/test11" -#define FAT_PATH_NAME22 "/vs/sd/test2/test22" -#define FAT_PATH_NAME_0 "/vs/sd/test/test0" -#define FAT_PATH_NAME_01 "/vs/sd/test/test0/test1" -#define FAT_DEV_PATH "/dev/mmcblk0" -#define FAT_DEV_PATH1 "/dev/mmcblk0p0" -#define FAT_FILESYS_TYPE "vfat" -#define FAT_CHINESE_NAME1 "úÃ" - -#define FAT_FALLOCATE_KEEP_SIZE 0x1 // FALLOC_FL_KEEP_SIZE -#define FAT_FALLOCATE_NO_KEEP_SIZE 0 - -#define FAT_NAME_LIMITTED_SIZE 300 -#define FAT_FILE_LIMITTED_NUM 200 -#define FAT_STANDARD_NAME_LENGTH 50 -#define FAT_SHORT_ARRAY_LENGTH 10 -#define FAT_LONG_ARRAY_LENGTH 100 -#define MAX_DEF_BUF_NUM 21 -#define FIX_DATA_LEN 524288 -#define MAX_BUFFER_LEN FIX_DATA_LEN // 9000000 //the mem is not enough -#define CAL_THRESHOLD_VALUE 0x1900000 -#define FAT_WR_CAP_SIZE_TEST 0x1900000 // the size is 25MB for each speed calculation -#define MAX_THREAD_NUM 10 -#define FAT_PTHREAD_PRIORITY_TEST1 4 -#define CONFIG_NFILE_DESCRIPTORS 512 - -#define PRINTF_OUT dprintf -#define PRINTF_HELP() \ - do { \ - PRINTF_OUT(" usage: testfile [rand/fix/quit] [file size] [file num] [write/fwrite]\n"); \ - } while (0); - -#define FILE_SIZE (500 * BYTES_PER_MBYTES) -#define FAT_PERFORMANCE_FILE_SIZE (500 * BYTES_PER_MBYTES) -#define INTERFACE_TYPE 0 // 0:use fwrite and fread for test -#define FAT_WR_TYPE_TEST1 0 // 0:use fwrite and fread for test -#define FAT_WR_TYPE_TEST2 1 // 0:use fwrite and fread for test -#define FAT_FILE_FIX_WRITE_SIZE 5 * BYTES_PER_MBYTES - -/* These are same as the value in the fs/vfat/include/ff.h */ -#define FAT_FILE_SYSTEMTYPE_FAT 0x01 // FM_FAT -#define FAT_FILE_SYSTEMTYPE_FAT32 0x02 // FM_FAT32 -#define FAT_FILE_SYSTEMTYPE_EXFAT 0x04 // FM_EXFAT -#define FAT_FILE_SYSTEMTYPE_ANY 0x07 // FM_ANY -#define FAT_FILE_SYSTEMTYPE_SFD 0x08 // FM_SFD - -/* For the different test scenes:FAT32 and EXFAT */ -#define FAT_FILE_SYSTEMTYPE_AUTO g_fatFilesystem - -#define FAT_MAX_NUM_TEST 1000 -#define FAT_MOUNT_CYCLES_TEST 10000 -#define FAT_PRESSURE_CYCLES 10 -#define FAT_MAXIMUM_OPERATIONS 10 -#define FAT_MAXIMUM_SIZES 10 -#define FAT_FILEMUM_NUM 100 -#define FAT_MAX_THREADS 3 -#define FAT_NO_ERROR 0 -#define FAT_IS_ERROR -1 -#define FAT_TO_NULL NULL -#define FAT_LONG_FILESIZE 5 -#define FAT_CREATFILE_NUM 5 -#define FAT_MIDDLE_CYCLES 10 -#define FAT_MAX_CYCLES 100 - -#define BYTES_PER_KBYTES 1024 -#define BYTES_PER_MBYTES (1024 * 1024) -#define US_PER_SEC 1000000 - -#endif - -extern INT32 g_fatFilesMax; -extern INT32 g_fatFlag; -extern INT32 g_fatFlagF01; -extern INT32 g_fatFlagF02; -extern INT32 g_fatFd; -extern FILE *g_fatFfd; - -extern DIR *g_fatDir; - -extern INT32 g_fatFd11[FAT_MAXIMUM_SIZES]; -extern INT32 g_fatFd12[FAT_MAXIMUM_SIZES][FAT_MAXIMUM_SIZES]; - -extern CHAR g_fatPathname1[FAT_STANDARD_NAME_LENGTH]; -extern CHAR g_fatPathname2[FAT_STANDARD_NAME_LENGTH]; -extern CHAR g_fatPathname3[FAT_STANDARD_NAME_LENGTH]; - -extern CHAR g_fatPathname6[FAT_NAME_LIMITTED_SIZE]; -extern CHAR g_fatPathname7[FAT_NAME_LIMITTED_SIZE]; -extern CHAR g_fatPathname8[FAT_NAME_LIMITTED_SIZE]; - -extern CHAR g_fatPathname11[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE]; -extern CHAR g_fatPathname12[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE]; -extern CHAR g_fatPathname13[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE]; - -extern UINT32 g_fatMuxHandle1; -extern UINT32 g_fatMuxHandle2; - -extern pthread_mutex_t g_vfatGlobalLock1; -extern pthread_mutex_t g_vfatGlobalLock2; - -VOID FatStrcat2(char *pathname, char *str, int len); -INT32 FatScandirFree(struct dirent **namelist, int n); -VOID FatStatPrintf(struct stat sb); -VOID FatStatfsPrintf(struct statfs buf); - -INT32 FixWrite(CHAR *path, INT64 file_size, INT32 write_size, INT32 interface_type); -INT32 FixRead(CHAR *path, INT64 file_size, INT32 read_size, INT32 interface_type); -INT32 RandWrite(CHAR *path, INT64 file_size, INT32 interface_type); -INT32 RandRead(CHAR *path, INT64 file_size, INT32 interface_type); - -extern INT32 g_grandSize[MAX_DEF_BUF_NUM]; -extern struct iovec g_fatIov[FAT_SHORT_ARRAY_LENGTH]; - -extern UINT32 g_testTaskId01; -extern UINT32 g_testTaskId02; -extern UINT32 g_fatFilesystem; - -extern const INT32 CAL_THRESHOLD; -extern INT32 FatDeleteFile(int fd, char *pathname); - -#if defined(LOSCFG_USER_TEST_SMOKE) -VOID ItFsFat026(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -VOID ItFsFat066(VOID); -VOID ItFsFat068(VOID); -VOID ItFsFat072(VOID); -VOID ItFsFat073(VOID); -VOID ItFsFat074(VOID); -VOID ItFsFat496(VOID); -VOID ItFsFat497(VOID); -VOID ItFsFat498(VOID); -VOID ItFsFat499(VOID); -VOID ItFsFat500(VOID); -VOID ItFsFat501(VOID); -VOID ItFsFat502(VOID); -VOID ItFsFat503(VOID); -VOID ItFsFat504(VOID); -VOID ItFsFat506(VOID); -VOID ItFsFat507(VOID); -VOID ItFsFat508(VOID); -VOID ItFsFat509(VOID); -VOID ItFsFat510(VOID); -VOID ItFsFat511(VOID); -VOID ItFsFat512(VOID); -VOID ItFsFat513(VOID); -VOID ItFsFat514(VOID); -VOID ItFsFat515(VOID); -VOID ItFsFat516(VOID); -VOID ItFsFat517(VOID); -VOID ItFsFat518(VOID); -VOID ItFsFat519(VOID); -VOID ItFsFat662(VOID); -VOID ItFsFat663(VOID); -VOID ItFsFat664(VOID); -VOID ItFsFat665(VOID); -VOID ItFsFat666(VOID); -VOID ItFsFat667(VOID); -VOID ItFsFat668(VOID); -VOID ItFsFat669(VOID); -VOID ItFsFat670(VOID); -VOID ItFsFat671(VOID); -VOID ItFsFat672(VOID); -VOID ItFsFat673(VOID); -VOID ItFsFat674(VOID); -VOID ItFsFat675(VOID); -VOID ItFsFat676(VOID); -VOID ItFsFat677(VOID); -VOID ItFsFat678(VOID); -VOID ItFsFat679(VOID); -VOID ItFsFat680(VOID); -VOID ItFsFat681(VOID); -VOID ItFsFat682(VOID); -VOID ItFsFat683(VOID); -VOID ItFsFat684(VOID); -VOID ItFsFat685(VOID); -VOID ItFsFat686(VOID); -VOID ItFsFat687(VOID); -VOID ItFsFat692(VOID); -VOID ItFsFat693(VOID); -VOID ItFsFat694(VOID); -VOID ItFsFat870(VOID); -VOID ItFsFat872(VOID); -VOID ItFsFat873(VOID); -VOID ItFsFat874(VOID); -VOID ItFsFat875(VOID); -VOID ItFsFat902(VOID); -VOID ItFsFat903(VOID); -VOID ItFsFat904(VOID); -VOID ItFsFat909(VOID); - -#endif - -#if defined(LOSCFG_USER_TEST_PRESSURE) -VOID ItFsFatMutipthread003(VOID); -VOID ItFsFatMutipthread004(VOID); -VOID ItFsFatMutipthread005(VOID); -VOID ItFsFatMutipthread006(VOID); -VOID ItFsFatMutipthread008(VOID); -VOID ItFsFatMutipthread009(VOID); -VOID ItFsFatMutipthread010(VOID); -VOID ItFsFatMutipthread012(VOID); -VOID ItFsFatMutipthread014(VOID); -VOID ItFsFatMutipthread016(VOID); -VOID ItFsFatMutipthread017(VOID); -VOID ItFsFatMutipthread018(VOID); -VOID ItFsFatMutipthread019(VOID); -VOID ItFsFatMutipthread020(VOID); -VOID ItFsFatMutipthread021(VOID); -VOID ItFsFatMutipthread022(VOID); -VOID ItFsFatMutipthread023(VOID); -VOID ItFsFatMutipthread024(VOID); -VOID ItFsFatMutipthread027(VOID); -VOID ItFsFatMutipthread029(VOID); -VOID ItFsFatMutipthread030(VOID); -VOID ItFsFatMutipthread032(VOID); -VOID ItFsFatMutipthread033(VOID); -VOID ItFsFatMutipthread035(VOID); -VOID ItFsFatMutipthread036(VOID); -VOID ItFsFatMutipthread038(VOID); -VOID ItFsFatMutipthread039(VOID); -VOID ItFsFatMutipthread040(VOID); -VOID ItFsFatMutipthread041(VOID); -VOID ItFsFatMutipthread042(VOID); -VOID ItFsFatMutipthread043(VOID); -VOID ItFsFatMutipthread044(VOID); -VOID ItFsFatMutipthread045(VOID); -VOID ItFsFatMutipthread046(VOID); -VOID ItFsFatMutipthread047(VOID); -VOID ItFsFatMutipthread048(VOID); -VOID ItFsFatMutipthread049(VOID); -VOID ItFsFatMutipthread050(VOID); - -VOID ItFsFatPressure029(VOID); -VOID ItFsFatPressure030(VOID); -VOID ItFsFatPressure031(VOID); -VOID ItFsFatPressure038(VOID); -VOID ItFsFatPressure040(VOID); -VOID ItFsFatPressure041(VOID); -VOID ItFsFatPressure042(VOID); - -VOID ItFsFatPressure301(VOID); -VOID ItFsFatPressure302(VOID); -VOID ItFsFatPressure303(VOID); -VOID ItFsFatPressure305(VOID); -VOID ItFsFatPressure306(VOID); -VOID ItFsFatPressure309(VOID); - -VOID ItFsFatPerformance013(VOID); -VOID ItFsFatPerformance014(VOID); -VOID ItFsFatPerformance015(VOID); -VOID ItFsFatPerformance016(VOID); -VOID ItFsFatPerformance001(VOID); -VOID ItFsFatPerformance002(VOID); -VOID ItFsFatPerformance003(VOID); -VOID ItFsFatPerformance004(VOID); -VOID ItFsFatPerformance005(VOID); -VOID ItFsFatPerformance006(VOID); -VOID ItFsFatPerformance007(VOID); -VOID ItFsFatPerformance008(VOID); - -#endif diff --git a/testsuites/unittest_old/fs/vfat/VfsFatTest.cpp b/testsuites/unittest_old/fs/vfat/VfsFatTest.cpp deleted file mode 100644 index b87e7f31..00000000 --- a/testsuites/unittest_old/fs/vfat/VfsFatTest.cpp +++ /dev/null @@ -1,1466 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "It_vfs_fat.h" - -#define MS_PER_SEC 1000 - -struct iovec g_fatIov[FAT_SHORT_ARRAY_LENGTH]; - -const INT32 CAL_THRESHOLD = CAL_THRESHOLD_VALUE; -INT32 g_grandSize[MAX_DEF_BUF_NUM] = { - 29, 30290, 3435, 235, 12345, 80, 9845, - 564, 34862, 123, 267890, 36, 6788, 86, - 234567, 1232, 514, 50, 678, 9864, 333333 -}; - -INT32 g_fatFilesMax = 10; -INT32 g_fatFlag = 0; -INT32 g_fatFlagF01 = 0; -INT32 g_fatFlagF02 = 0; -INT32 g_fatFd = 0; -DIR *g_fatDir = nullptr; -UINT32 g_fatMuxHandle1 = 0; -UINT32 g_fatMuxHandle2 = 0; -pthread_mutex_t g_vfatGlobalLock1; -pthread_mutex_t g_vfatGlobalLock2; - -INT32 g_fatFd11[FAT_MAXIMUM_SIZES]; -INT32 g_fatFd12[FAT_MAXIMUM_SIZES][FAT_MAXIMUM_SIZES]; - -CHAR g_fatPathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; -CHAR g_fatPathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; -CHAR g_fatPathname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - -CHAR g_fatPathname6[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME; -CHAR g_fatPathname7[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME; -CHAR g_fatPathname8[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME; - -CHAR g_fatPathname11[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE] = { 0 }; -CHAR g_fatPathname12[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE] = { 0 }; -CHAR g_fatPathname13[FAT_MAXIMUM_SIZES][FAT_NAME_LIMITTED_SIZE] = { 0 }; - -FILE *g_fatFfd; - -INT32 FatDeleteFile(int fd, char *pathname) -{ - int ret; - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -INT32 FixWrite(CHAR *path, INT64 file_size, INT32 write_size, INT32 interface_type) -{ - INT32 ret; - INT32 fd = -1; - INT64 total = 0; - INT64 perTime; - INT64 totalSize = 0; - INT64 totalTime = 0; - INT32 cycleCount = 0; - INT32 taskId; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - CHAR *pid = NULL; - CHAR *writeBuf = NULL; - FILE *file = NULL; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - writeBuf = (CHAR *)malloc(write_size); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, nullptr, writeBuf, EXIT); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - fd = open(path, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd < 0) { - printf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "w+b"); - if (file == nullptr) { - printf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - printf("fix_Write TaskID:%3d,open %s ,task %lld ms ,\n", taskId, path, perTime / MS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - if (interface_type == 1) { - ret = write(fd, writeBuf, write_size); - if (ret <= 0) { - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - goto EXIT1; - } - printf("fix_write fail,path = %s,ret=:%d ,errno=:%d!\n", path, ret, errno); - goto EXIT1; - } - } else { - ret = fwrite(writeBuf, 1, write_size, file); - if (ret <= 0 || ret != write_size) { - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - } - printf("fix_fwrite error! %s ,path=:%s, ret = %d,\n", strerror(errno), path, ret); - - goto EXIT2; - } - } - total += ret; - totalSize += ret; - if (total >= CAL_THRESHOLD) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * US_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - if (interface_type == 1) { - printf("fix_Write TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - } else { - printf("fix_fwrite TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - } - total = 0; - gettimeofday(&testTime1, 0); - } - - if (file_size <= totalSize) { - break; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * US_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - printf("\nfix_Write TaskID:%3d,total write=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, - totalTime, testSpeed); - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } else { - ret = fclose(file); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("fix_Write TaskID:%3d,sucess to fclose the %s ,task:%lld ms,\n", taskId, path, perTime / MS_PER_SEC); - - free(writeBuf); - - return FAT_NO_ERROR; -EXIT2: - fclose(file); - goto EXIT; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return FAT_NO_ERROR; -} - -INT32 FixRead(CHAR *path, INT64 file_size, INT32 read_size, INT32 interface_type) -{ - INT32 fd, taskId, ret; - INT32 cycleCount = 0; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - FILE *file = NULL; - CHAR *readBuf = NULL; - CHAR *pid = NULL; - DOUBLE testSpeed; - struct timeval testTime1; - struct timeval testTime2; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - readBuf = (CHAR *)malloc(read_size); - ICUNIT_ASSERT_NOT_EQUAL(readBuf, nullptr, readBuf); - - gettimeofday(&testTime1, 0); - - if (interface_type == 1) { - fd = open(path, O_RDWR, S_IRUSR | S_IWUSR); - if (fd < 0) { - printf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "rb"); - if (file == nullptr) { - printf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("fix_Read TaskID:%3d,open %s , task:%lld ms,\n", taskId, path, perTime / MS_PER_SEC); - - gettimeofday(&testTime1, 0); - - while (1) { - if (interface_type == 1) { - ret = read(fd, readBuf, read_size); - if (ret < 0) { - printf("ret = %d,%s read fail!-->(X),\n", ret, path); - goto EXIT1; - } - if (!ret) { - printf("warning: read ret = 0,\n"); - goto EXIT1; - } - } else { - ret = fread(readBuf, 1, read_size, file); - if (ret <= 0) { - if (feof(file) == 1) { - printf("feof of %s,\n", path); - } else { - printf("fread error!,\n"); - goto EXIT2; - } - } - } - total += ret; - totalSize += ret; - - if (total >= CAL_THRESHOLD) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * US_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - printf("fix_Read TaskID:%3d,times %d, read %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (file_size <= totalSize) { - break; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * US_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - printf("\nfix_Read TaskID:%3d,total read=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, totalTime, - testSpeed); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - ret = close(fd); - if (ret < 0) { - printf("fail to close %s!\n", strerror(errno)); - } - } else { - ret = fclose(file); - if (ret < 0) { - printf("fail to fclose %s!\n", strerror(errno)); - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("fix_Read TaskID:%3d, fclose %s!,task:%lld ms,\n", taskId, path, perTime / MS_PER_SEC); - - ret = remove(path); - if (ret < 0) { - printf("fail to remove %s!\n", strerror(errno)); - } - - printf("Read TaskID:%3d,sucess to fread the %s,\n", taskId, path); - free(readBuf); - return 0; -EXIT2: - fclose(file); -EXIT1: - close(fd); - - free(readBuf); - return FAT_NO_ERROR; -} - -INT32 RandWrite(CHAR *path, INT64 file_size, INT32 interface_type) -{ - INT32 ret, i, fd; - INT32 cycleCount = 0; - INT32 taskId; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - CHAR *writeBuf = NULL; - CHAR *pid = NULL; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - FILE *file = NULL; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - writeBuf = (CHAR *)malloc(MAX_BUFFER_LEN); - ICUNIT_GOTO_NOT_EQUAL(writeBuf, nullptr, writeBuf, EXIT); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - fd = open(path, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); - if (fd < 0) { - printf("Task_%d fail to open %s,\n", taskId, path); - goto EXIT1; - } - } else { - file = fopen(path, "w+b"); - if (file == nullptr) { - printf("Task_%d fail to fopen %s,\n", taskId, path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - printf("RandWrite TaskID:%3d,open %s , cost:%lld ms,\n", taskId, path, perTime / MS_PER_SEC); - - gettimeofday(&testTime1, 0); - - i = 0; - - while (1) { - if (interface_type == 1) { - ret = write(fd, writeBuf, g_grandSize[i]); - if (ret <= 0) { - printf("ret = %d,%s write fail!-->(X),\n", ret, path); - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - goto EXIT1; - } - goto EXIT1; - } - } else { - ret = fwrite(writeBuf, 1, g_grandSize[i], file); - if (ret <= 0 || ret != g_grandSize[i]) { - if (errno == ENOSPC) { - printf("No space !! %s,\n", strerror(errno)); - } - printf("rand_Write TaskID:%3d,fwrite error! %s , ret = %d,\n", taskId, strerror(errno), ret); - goto EXIT2; - } - } - - total += ret; - totalSize += ret; - if (total >= CAL_THRESHOLD) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - testSpeed = total * 1.0; - testSpeed = testSpeed * US_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - printf("rand_Write TaskID:%3d,%d time write, write %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", - taskId, cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (file_size <= totalSize) { - break; - } - if (++i >= MAX_DEF_BUF_NUM) - i = 0; - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * US_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - printf("--------------------------------\n"); - printf("rand_Write TaskID:%3d,total write=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, totalTime, - testSpeed); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - ret = close(fd); - if (ret < 0) { - printf("rand_Write TaskID:%3d,fail to close %s!\n", taskId, strerror(errno)); - goto EXIT1; - } - } else { - ret = fclose(file); - if (ret < 0) { - printf("rand_Write TaskID:%3d,fail to fclose %s!\n", taskId, strerror(errno)); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf("rand_Write TaskID:%3d,sucess to fclose the %s ,task %lld,\n", taskId, path, perTime / MS_PER_SEC); - - free(writeBuf); - - return FAT_NO_ERROR; -EXIT2: - fclose(file); - goto EXIT; -EXIT1: - close(fd); -EXIT: - free(writeBuf); - return FAT_NO_ERROR; -} - -INT32 RandRead(CHAR *path, INT64 file_size, INT32 interface_type) -{ - INT32 ret, fd, i; - INT32 cycleCount = 0; - INT32 taskId; - INT64 total = 0; - INT64 totalSize = 0; - INT64 perTime; - INT64 totalTime = 0; - struct timeval testTime1; - struct timeval testTime2; - DOUBLE testSpeed; - CHAR *pid = NULL; - CHAR *readBuf = NULL; - FILE *file = NULL; - - taskId = strlen(path); - pid = path + taskId - 1; - taskId = atoi(pid); - - readBuf = (CHAR *)malloc(MAX_BUFFER_LEN); - ICUNIT_GOTO_NOT_EQUAL(readBuf, nullptr, readBuf, EXIT); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - fd = open(path, O_RDWR, S_IRUSR | S_IWUSR); - if (-1 == fd) { - printf("fail to open %s\n", path); - goto EXIT1; - } - } else { - file = fopen(path, "rb"); - if (file == nullptr) { - printf("fail to fopen %s\n", path); - goto EXIT2; - } - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - printf("RandRead, open %s , task:%lld ms,\n", path, perTime / MS_PER_SEC); - - i = 0; - gettimeofday(&testTime1, 0); - - while (1) { - if (interface_type == 1) { - ret = read(fd, readBuf, g_grandSize[i]); - if (ret < 0) { - printf("ret = %d,%s read fail!-->(X)\n", ret, path); - goto EXIT1; - } - if (!ret) { - printf("warning: read ret = 0,\n"); - } - } else { - ret = fread(readBuf, 1, g_grandSize[i], file); - if (ret <= 0) { - if (feof(file) == 1) { - printf("feof of %s\n", path); - } else { - printf("fread error!\n"); - goto EXIT2; - } - } - } - total += ret; - totalSize += ret; - - if (total >= CAL_THRESHOLD) { - gettimeofday(&testTime2, 0); - - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = total * 1.0; - testSpeed = testSpeed * US_PER_SEC / perTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - - printf("rand_Read TaskID:%3d, times %d, read %lldbytes, cost %lld usecs, speed: %0.3lfMB/s,\n", taskId, - cycleCount++, total, perTime, testSpeed); - - total = 0; - gettimeofday(&testTime1, 0); - } - - if (file_size <= totalSize) { - break; - } - if (++i >= MAX_DEF_BUF_NUM) - i = 0; - } - - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - totalTime += perTime; - - testSpeed = totalSize * 1.0; - testSpeed = testSpeed * US_PER_SEC / totalTime; - testSpeed = testSpeed / BYTES_PER_KBYTES / BYTES_PER_KBYTES; - printf("--------------------------------\n"); - printf("rand_Read TaskID:%3d ,total read=%lld , time=%lld,arv speed =%0.3lfMB/s ,\n", taskId, totalSize, totalTime, - testSpeed); - - gettimeofday(&testTime1, 0); - if (interface_type == 1) { - ret = close(fd); - if (ret < 0) { - printf("fail to close %s!\n", strerror(errno)); - } - } else { - ret = fclose(file); - if (ret < 0) { - printf("fail to fclose %s!\n", strerror(errno)); - } - } - gettimeofday(&testTime2, 0); - perTime = (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + (testTime2.tv_usec - testTime1.tv_usec); - - printf(" rand_Read TaskID:%3d,fclose %s!,task:%lld ms,\n", taskId, path, perTime / MS_PER_SEC); - - ret = remove(path); - if (ret < 0) { - printf("fail to fclose %s!\n", strerror(errno)); - } - - printf("rand_Read TaskID:%3d,sucess to fread the %s,\n", taskId, path); - - free(readBuf); - return FAT_NO_ERROR; - -EXIT2: - fclose(file); - goto EXIT1; -EXIT1: - close(fd); -EXIT: - free(readBuf); - return FAT_NO_ERROR; -} - -VOID FatStrcat2(char *pathname, char *str, int len) -{ - (void)memset_s(pathname, len, 0, len); - (void)strcpy_s(pathname, len, FAT_PATH_NAME); - (void)strcat_s(pathname, len, str); -} - -INT32 FatScandirFree(struct dirent **namelist, int n) -{ - if (n < 0 || namelist == nullptr) { - return -1; - } else if (n == 0) { - free(namelist); - namelist = nullptr; - return 0; - } - while (n--) { - free(namelist[n]); - } - free(namelist); - namelist = nullptr; - - return 0; -} - -VOID FatStatPrintf(struct stat sb) -{ -#if VFS_STAT_PRINTF == 1 - - printf("File type: "); - - switch (sb.st_mode & S_IFMT) { - case S_IFBLK: - printf("block device\n"); - break; - case S_IFCHR: - printf("character device\n"); - break; - case S_IFDIR: - printf("directory\n"); - break; - case S_IFIFO: - printf("FIFO/pipe\n"); - break; - case S_IFLNK: - printf("symlink\n"); - break; - case S_IFREG: - printf("regular file\n"); - break; - case S_IFSOCK: - printf("socket\n"); - break; - default: - printf("unknown?\n"); - break; - } - - switch (sb.st_mode & S_IRWXU) { - case S_IRUSR: - printf("Owners have read permission\n"); - break; - case S_IWUSR: - printf("Owners have write permission\n"); - break; - case S_IXUSR: - printf("Owners have execute permissions\n"); - break; - default: - break; - } - - switch (sb.st_mode & S_IRWXG) { - case S_IRGRP: - printf("Group has read permission\n"); - break; - case S_IWGRP: - printf("Group has write permission\n"); - break; - case S_IXGRP: - printf("Group has execute permission\n"); - break; - default: - break; - } - - switch (sb.st_mode & S_IRWXO) { - case S_IROTH: - printf("Other have read permission\n"); - break; - case S_IWOTH: - printf("Other has write permission\n"); - break; - case S_IXOTH: - printf("Other has execute permission\n"); - break; - default: - break; - } - - printf("I-node number: %ld\n", (long)sb.st_ino); - printf("Mode: %lo (octal)\n", (unsigned long)sb.st_mode); - printf("Link count: %ld\n", (long)sb.st_nlink); - printf("Ownership: UID=%ld GID=%ld\n", (long)sb.st_uid, (long)sb.st_gid); - - printf("Preferred I/O block size: %ld bytes\n", (long)sb.st_blksize); - printf("File size: %lld bytes\n", (long long)sb.st_size); - printf("Blocks allocated: %lld\n", (long long)sb.st_blocks); - - printf("Last status change: %s", ctime(&sb.st_ctime)); - printf("Last file access: %s", ctime(&sb.st_atime)); - printf("Last file modification: %s\n\n", ctime(&sb.st_mtime)); - -#endif - return; -} - -VOID FatStatfsPrintf(struct statfs buf) -{ -#if VFS_STATFS_PRINTF == 1 - printf("type of file system : 0x%x\n", buf.f_type); - printf("optimal transfer block size : %ld\n", (long)buf.f_bsize); - printf("total data blocks in file system : %ld\n", (long)buf.f_blocks); - printf("free blocks in fs : %ld\n", (long)buf.f_bfree); - printf("free blocks available to unprivileged user : %ld\n", (long)buf.f_bavail); - printf("total file nodes in file system : %ld\n", (long)buf.f_files); - - printf("free file nodes in fs : %ld\n", (long)buf.f_ffree); - printf("file system id : %d\n", buf.f_fsid.__val[0]); - printf("maximum length of filenames : 0x%x\n", buf.f_namelen); - printf("fragment size: %d\n\n", buf.f_frsize); - -#endif - - return; -} - -using namespace testing::ext; -namespace OHOS { -class VfsFatTest : public testing::Test { -public: - static void SetUpTestCase(void) - { - INT32 ret = 0; - sleep(3); // 3s - - ret = mkdir("/vs/", S_IRWXU | S_IRWXG | S_IRWXO); - if (ret != 0) { - perror("mkdir mount dir"); - } - - ret = mkdir(FAT_MOUNT_DIR, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret != 0) { - perror("mkdir mount dir"); - } - - g_fatFilesystem = 2; - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, nullptr); - ASSERT_EQ(0, ret); - } - static void TearDownTestCase(void) - { - umount(FAT_MOUNT_DIR); - } -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -HWTEST_F(VfsFatTest, ItFsFat026, TestSize.Level0) -{ - ItFsFat026(); -} -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -HWTEST_F(VfsFatTest, ItFsFat066, TestSize.Level0) -{ - ItFsFat066(); -} - -HWTEST_F(VfsFatTest, ItFsFat068, TestSize.Level0) -{ - ItFsFat068(); -} - -HWTEST_F(VfsFatTest, ItFsFat072, TestSize.Level0) -{ - ItFsFat072(); -} - -HWTEST_F(VfsFatTest, ItFsFat073, TestSize.Level0) -{ - ItFsFat073(); -} - -HWTEST_F(VfsFatTest, ItFsFat074, TestSize.Level0) -{ - ItFsFat074(); -} - -HWTEST_F(VfsFatTest, ItFsFat496, TestSize.Level0) -{ - ItFsFat496(); -} - -HWTEST_F(VfsFatTest, ItFsFat497, TestSize.Level0) -{ - ItFsFat497(); -} - -HWTEST_F(VfsFatTest, ItFsFat498, TestSize.Level0) -{ - ItFsFat498(); -} - -HWTEST_F(VfsFatTest, ItFsFat499, TestSize.Level0) -{ - ItFsFat499(); -} - -HWTEST_F(VfsFatTest, ItFsFat500, TestSize.Level0) -{ - ItFsFat500(); -} - -HWTEST_F(VfsFatTest, ItFsFat501, TestSize.Level0) -{ - ItFsFat501(); -} - -HWTEST_F(VfsFatTest, ItFsFat502, TestSize.Level0) -{ - ItFsFat502(); -} - -HWTEST_F(VfsFatTest, ItFsFat503, TestSize.Level0) -{ - ItFsFat503(); -} - -HWTEST_F(VfsFatTest, ItFsFat504, TestSize.Level0) -{ - ItFsFat504(); -} - -HWTEST_F(VfsFatTest, ItFsFat506, TestSize.Level0) -{ - ItFsFat506(); -} - -HWTEST_F(VfsFatTest, ItFsFat507, TestSize.Level0) -{ - ItFsFat507(); -} - -HWTEST_F(VfsFatTest, ItFsFat508, TestSize.Level0) -{ - ItFsFat508(); -} - -HWTEST_F(VfsFatTest, ItFsFat509, TestSize.Level0) -{ - ItFsFat509(); -} - -HWTEST_F(VfsFatTest, ItFsFat510, TestSize.Level0) -{ - ItFsFat510(); -} - -HWTEST_F(VfsFatTest, ItFsFat511, TestSize.Level0) -{ - ItFsFat511(); -} - -HWTEST_F(VfsFatTest, ItFsFat512, TestSize.Level0) -{ - ItFsFat512(); -} - -HWTEST_F(VfsFatTest, ItFsFat513, TestSize.Level0) -{ - ItFsFat513(); -} - -HWTEST_F(VfsFatTest, ItFsFat514, TestSize.Level0) -{ - ItFsFat514(); -} - -HWTEST_F(VfsFatTest, ItFsFat515, TestSize.Level0) -{ - ItFsFat515(); -} - -HWTEST_F(VfsFatTest, ItFsFat516, TestSize.Level0) -{ - ItFsFat516(); -} - -HWTEST_F(VfsFatTest, ItFsFat517, TestSize.Level0) -{ - ItFsFat517(); -} - -HWTEST_F(VfsFatTest, ItFsFat518, TestSize.Level0) -{ - ItFsFat518(); -} - -HWTEST_F(VfsFatTest, ItFsFat519, TestSize.Level0) -{ - ItFsFat519(); -} - -HWTEST_F(VfsFatTest, ItFsFat662, TestSize.Level0) -{ - ItFsFat662(); -} - -HWTEST_F(VfsFatTest, ItFsFat663, TestSize.Level0) -{ - ItFsFat663(); -} - -HWTEST_F(VfsFatTest, ItFsFat664, TestSize.Level0) -{ - ItFsFat664(); -} - -HWTEST_F(VfsFatTest, ItFsFat665, TestSize.Level0) -{ - ItFsFat665(); -} - -HWTEST_F(VfsFatTest, ItFsFat666, TestSize.Level0) -{ - ItFsFat666(); -} - -HWTEST_F(VfsFatTest, ItFsFat667, TestSize.Level0) -{ - ItFsFat667(); -} - -HWTEST_F(VfsFatTest, ItFsFat668, TestSize.Level0) -{ - ItFsFat668(); -} - -HWTEST_F(VfsFatTest, ItFsFat669, TestSize.Level0) -{ - ItFsFat669(); -} - -HWTEST_F(VfsFatTest, ItFsFat670, TestSize.Level0) -{ - ItFsFat670(); -} - -HWTEST_F(VfsFatTest, ItFsFat671, TestSize.Level0) -{ - ItFsFat671(); -} - -HWTEST_F(VfsFatTest, ItFsFat672, TestSize.Level0) -{ - ItFsFat672(); -} - -HWTEST_F(VfsFatTest, ItFsFat673, TestSize.Level0) -{ - ItFsFat673(); -} - -HWTEST_F(VfsFatTest, ItFsFat674, TestSize.Level0) -{ - ItFsFat674(); -} - -HWTEST_F(VfsFatTest, ItFsFat675, TestSize.Level0) -{ - ItFsFat675(); -} - -HWTEST_F(VfsFatTest, ItFsFat676, TestSize.Level0) -{ - ItFsFat676(); -} - -HWTEST_F(VfsFatTest, ItFsFat677, TestSize.Level0) -{ - ItFsFat677(); -} - -HWTEST_F(VfsFatTest, ItFsFat678, TestSize.Level0) -{ - ItFsFat678(); -} - -HWTEST_F(VfsFatTest, ItFsFat679, TestSize.Level0) -{ - ItFsFat679(); -} - -HWTEST_F(VfsFatTest, ItFsFat680, TestSize.Level0) -{ - ItFsFat680(); -} - -HWTEST_F(VfsFatTest, ItFsFat681, TestSize.Level0) -{ - ItFsFat681(); -} - -HWTEST_F(VfsFatTest, ItFsFat682, TestSize.Level0) -{ - ItFsFat682(); -} - -HWTEST_F(VfsFatTest, ItFsFat683, TestSize.Level0) -{ - ItFsFat683(); -} - -HWTEST_F(VfsFatTest, ItFsFat684, TestSize.Level0) -{ - ItFsFat684(); -} - -HWTEST_F(VfsFatTest, ItFsFat685, TestSize.Level0) -{ - ItFsFat685(); -} - -HWTEST_F(VfsFatTest, ItFsFat686, TestSize.Level0) -{ - ItFsFat686(); -} - -HWTEST_F(VfsFatTest, ItFsFat687, TestSize.Level0) -{ - ItFsFat687(); -} - -HWTEST_F(VfsFatTest, ItFsFat692, TestSize.Level0) -{ - ItFsFat692(); -} - -HWTEST_F(VfsFatTest, ItFsFat693, TestSize.Level0) -{ - ItFsFat693(); -} - -HWTEST_F(VfsFatTest, ItFsFat694, TestSize.Level0) -{ - ItFsFat694(); -} - -HWTEST_F(VfsFatTest, ItFsFat870, TestSize.Level0) -{ - ItFsFat870(); -} - -HWTEST_F(VfsFatTest, ItFsFat872, TestSize.Level0) -{ - ItFsFat872(); -} - -HWTEST_F(VfsFatTest, ItFsFat873, TestSize.Level0) -{ - ItFsFat873(); -} - -HWTEST_F(VfsFatTest, ItFsFat874, TestSize.Level0) -{ - ItFsFat874(); -} - -HWTEST_F(VfsFatTest, ItFsFat875, TestSize.Level0) -{ - ItFsFat875(); -} - -HWTEST_F(VfsFatTest, ItFsFat902, TestSize.Level0) -{ - ItFsFat902(); -} - -HWTEST_F(VfsFatTest, ItFsFat903, TestSize.Level0) -{ - ItFsFat903(); -} - -HWTEST_F(VfsFatTest, ItFsFat904, TestSize.Level0) -{ - ItFsFat904(); -} - -HWTEST_F(VfsFatTest, ItFsFat909, TestSize.Level0) -{ - ItFsFat909(); // plug and unplug during writing or reading -} - -#endif // LOSCFG_USER_TEST_FULL - -#if defined(LOSCFG_USER_TEST_PRESSURE) -HWTEST_F(VfsFatTest, ItFsFatPressure040, TestSize.Level0) -{ - ItFsFatPressure040(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread046, TestSize.Level0) -{ - ItFsFatMutipthread046(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread047, TestSize.Level0) -{ - ItFsFatMutipthread047(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure030, TestSize.Level0) -{ - ItFsFatPressure030(); // time too long -} - -#if (FAT_FILE_SYSTEMTYPE_AUTO == FAT_FILE_SYSTEMTYPE_FAT32) -HWTEST_F(VfsFatTest, ItFsFatPressure031, TestSize.Level0) -{ - ItFsFatPressure031(); -} -#endif - -HWTEST_F(VfsFatTest, ItFsFatPressure038, TestSize.Level0) -{ - ItFsFatPressure038(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure041, TestSize.Level0) -{ - ItFsFatPressure041(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure042, TestSize.Level0) -{ - ItFsFatPressure042(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure301, TestSize.Level0) -{ - ItFsFatPressure301(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure302, TestSize.Level0) -{ - ItFsFatPressure302(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure303, TestSize.Level0) -{ - ItFsFatPressure303(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure305, TestSize.Level0) -{ - ItFsFatPressure305(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure306, TestSize.Level0) -{ - ItFsFatPressure306(); -} - -HWTEST_F(VfsFatTest, ItFsFatPressure309, TestSize.Level0) -{ - ItFsFatPressure309(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread003, TestSize.Level0) -{ - ItFsFatMutipthread003(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread004, TestSize.Level0) -{ - ItFsFatMutipthread004(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread005, TestSize.Level0) -{ - ItFsFatMutipthread005(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread006, TestSize.Level0) -{ - ItFsFatMutipthread006(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread008, TestSize.Level0) -{ - ItFsFatMutipthread008(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread009, TestSize.Level0) -{ - ItFsFatMutipthread009(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread010, TestSize.Level0) -{ - ItFsFatMutipthread010(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread012, TestSize.Level0) -{ - ItFsFatMutipthread012(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread014, TestSize.Level0) -{ - ItFsFatMutipthread014(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread016, TestSize.Level0) -{ - ItFsFatMutipthread016(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread017, TestSize.Level0) -{ - ItFsFatMutipthread017(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread018, TestSize.Level0) -{ - ItFsFatMutipthread018(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread019, TestSize.Level0) -{ - ItFsFatMutipthread019(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread020, TestSize.Level0) -{ - ItFsFatMutipthread020(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread021, TestSize.Level0) -{ - ItFsFatMutipthread021(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread022, TestSize.Level0) -{ - ItFsFatMutipthread022(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread023, TestSize.Level0) -{ - ItFsFatMutipthread023(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread024, TestSize.Level0) -{ - ItFsFatMutipthread024(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread027, TestSize.Level0) -{ - ItFsFatMutipthread027(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread029, TestSize.Level0) -{ - ItFsFatMutipthread029(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread030, TestSize.Level0) -{ - ItFsFatMutipthread030(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread032, TestSize.Level0) -{ - ItFsFatMutipthread032(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread033, TestSize.Level0) -{ - ItFsFatMutipthread033(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread035, TestSize.Level0) -{ - ItFsFatMutipthread035(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread036, TestSize.Level0) -{ - ItFsFatMutipthread036(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread038, TestSize.Level0) -{ - ItFsFatMutipthread038(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread039, TestSize.Level0) -{ - ItFsFatMutipthread039(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread040, TestSize.Level0) -{ - ItFsFatMutipthread040(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread041, TestSize.Level0) -{ - ItFsFatMutipthread041(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread042, TestSize.Level0) -{ - ItFsFatMutipthread042(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread043, TestSize.Level0) -{ - ItFsFatMutipthread043(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread044, TestSize.Level0) -{ - ItFsFatMutipthread044(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread045, TestSize.Level0) -{ - ItFsFatMutipthread045(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread048, TestSize.Level0) -{ - ItFsFatMutipthread048(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread049, TestSize.Level0) -{ - ItFsFatMutipthread049(); -} - -HWTEST_F(VfsFatTest, ItFsFatMutipthread050, TestSize.Level0) -{ - ItFsFatMutipthread050(); -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance013, TestSize.Level0) -{ - ItFsFatPerformance013(); -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance014, TestSize.Level0) -{ - ItFsFatPerformance014(); -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance015, TestSize.Level0) -{ - ItFsFatPerformance015(); -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance016, TestSize.Level0) -{ - ItFsFatPerformance016(); // Multi-threaded takes time to delete directory files When the fourth -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance001, TestSize.Level0) -{ - ItFsFatPerformance001(); // rand fwrite and fread for one pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance006, TestSize.Level0) -{ - ItFsFatPerformance006(); // rand fwrite and fread for three pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance002, TestSize.Level0) -{ - ItFsFatPerformance002(); // fix fwrite and fread for one pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance005, TestSize.Level0) -{ - ItFsFatPerformance005(); // fix fwrite and fread for three pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance003, TestSize.Level0) -{ - ItFsFatPerformance003(); // rand write and read for one pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance004, TestSize.Level0) -{ - ItFsFatPerformance004(); // fix write and read for one pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance007, TestSize.Level0) -{ - ItFsFatPerformance007(); // rand write and read for three pthread -} - -HWTEST_F(VfsFatTest, ItFsFatPerformance008, TestSize.Level0) -{ - ItFsFatPerformance008(); // fix write and read for three pthread -} - -#endif // LOSCFG_USER_TEST_PRESSURE -} // namespace OHOS diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_066.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_066.cpp deleted file mode 100644 index 85ab925e..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_066.cpp +++ /dev/null @@ -1,333 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static const int CLUSTER_SIZE4 = 4; -static const int CLUSTER_SIZE8 = 8; -static const int CLUSTER_SIZE16 = 16; -static const int CLUSTER_SIZE32 = 32; -static const int CLUSTER_SIZE64 = 64; -static const int CLUSTER_SIZE128 = 128; -static const int CLUSTER_SIZE255 = 255; -static const int CLUSTER_SIZE256 = 256; -static const int SECTOR_SIZE = 512; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - struct stat buf = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(NULL, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (g_fatFilesystem != FAT_FILE_SYSTEMTYPE_EXFAT) - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE64 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE16, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE16 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE32, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE32 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE64, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE64 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE128, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE128 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE4, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE4 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 1, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(buf.st_blksize, SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE255, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE256, FAT_FILE_SYSTEMTYPE_AUTO); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - else { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - } - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = remove(FAT_PATH_NAME); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = mkdir(FAT_PATH_NAME, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = access(FAT_PATH_NAME, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(FAT_PATH_NAME, &buf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(buf.st_blksize, CLUSTER_SIZE8 * SECTOR_SIZE, buf.st_blksize, EXIT1); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); -EXIT1: - rmdir(FAT_PATH_NAME); - - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_066 -* -@tspec The function test for filesystem -* -@ttitle Format the SD card with some different parameters -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. use access to check the directory whether is existed -3. format the SD card with different parameters; -4. repeat the above process several times. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat066(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_066", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_068.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_068.cpp deleted file mode 100644 index 8058543d..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_068.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static const int CLUSTER_SIZE = 8; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_MAIN_DIR; - DIR *dir = NULL; - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - for (i = 0; i < FAT_PRESSURE_CYCLES; i++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - closedir(dir); -EXIT: - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_068 -* -@ttitle Repeat mount, format, umount, format the same SD card 20 times -* -@ttitle Repeat mount, format, umount, format the same SD card 20 times -* -@tprecon The filesystem module is open -* -@tbrief -1. create a directory; -2. mount, format, umount, format the same SD; -3. repeat the above processre 20 times; -4. format the SD card once more. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat068(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_068", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_072.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_072.cpp deleted file mode 100644 index 304c62b6..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_072.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static const INT32 CLUSTER_SIZE8 = 8; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - DIR *dir = NULL; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - dir = opendir(FAT_MAIN_DIR); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - closedir(dir); -EXIT: - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_072 -* -@tspec The function test for filesystem -* -@ttitle Repeat mount the the file system to the same directory -* -@tprecon The filesystem module is open -* -@tbrief -1. check the filesysterm is existed or not; -2. umount the filesystem; -3. mount the filesystem; -4. repeat mount the the file system to the same directory. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Failed operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat072(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_072", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_073.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_073.cpp deleted file mode 100644 index 77944169..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_073.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static const INT32 CLUSTER_SIZE8 = 8; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - DIR *dir = NULL; - - dir = opendir(FAT_MAIN_DIR); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = format(FAT_DEV_PATH, CLUSTER_SIZE8, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - closedir(dir); -EXIT: - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_073 -* -@tspec The function test for filesystem -* -@ttitle Repeat umount the the same file system -* -@tprecon The filesystem module is open -* -@tbrief -1. check the filesysterm is existed or not; -2. umount the filesystem; -3. repeat umount the filesystem; -4. mount the the file system normally. -* -@texpect -1. Return successed -2. Return successed -3. Return failed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat073(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_073", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_074.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_074.cpp deleted file mode 100644 index 985ff93a..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_074.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd1 = 0; - INT32 i = 0; - INT32 len; - CHAR filebuf[FAT_STANDARD_NAME_LENGTH] = "abcdeabcde"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = "liteos"; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/test"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT1); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < FAT_MOUNT_CYCLES_TEST; i++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, i, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, i, EXIT2); - } - - fd1 = open(pathname1, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT1); - - len = read(fd1, readbuf, FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, filebuf, readbuf, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT1: - close(fd1); - remove(pathname1); -EXIT: - remove(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_074 -* -@tspec The function test for filesystem -* -@ttitle Mount/umount the file system several times -* -@tprecon The filesystem module is open -* -@tbrief -1. create one file and write some data into it; -2. mount/umount the file system several times; -3. open the file and check the file`s content; -4. close and delete the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat074(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_074", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_496.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_496.cpp deleted file mode 100644 index 7b2ee972..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_496.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/589.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat496(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_496", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_497.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_497.cpp deleted file mode 100644 index f60fa2cb..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_497.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/590.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, 0, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat497(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_497", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_498.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_498.cpp deleted file mode 100644 index a819c63b..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_498.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, 1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat498(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_498", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_499.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_499.cpp deleted file mode 100644 index 9045f20e..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_499.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, 0xffff, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat499(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_499", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_500.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_500.cpp deleted file mode 100644 index 46886876..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_500.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/591.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, -1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat500(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_500", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_501.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_501.cpp deleted file mode 100644 index 6b91fa70..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_501.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static const int IOCTL_CMD = 10; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/594.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, IOCTL_CMD, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat501(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_501", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_502.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_502.cpp deleted file mode 100644 index 6432a4b1..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_502.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ - - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/595.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, 0, 1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat502(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_502", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_503.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_503.cpp deleted file mode 100644 index 2b285c87..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_503.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/596.c"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - ret = ioctl(fd, 0, 0xffff); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOSYS, errno, EXIT2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - return FAT_NO_ERROR; -EXIT2: - close(fd); -EXIT1: - unlink(pathname1); -EXIT: - chdir(SD_MOUNT_DIR); - remove(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat503(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_503", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_504.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_504.cpp deleted file mode 100644 index 3900e35b..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_504.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = "/dev/mmcblk0p0"; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - return FAT_NO_ERROR; -EXIT1: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat504(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_504", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_506.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_506.cpp deleted file mode 100644 index 361e8941..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_506.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = "//"; - - ret = umount(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT2); - - ret = mount(FAT_DEV_PATH1, SD_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH1, SD_MOUNT_DIR, "vfat", 0, NULL); -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat506(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_506", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_507.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_507.cpp deleted file mode 100644 index 7e0315e0..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_507.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = "/"; - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat507(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_507", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_508.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_508.cpp deleted file mode 100644 index 3e907bc8..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_508.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[302] = - "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij" - "9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789" - "abcedfghij9876543210abcdeabcde0123456789abcedfghij987654321011111111112222222222"; - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat508(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_508", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_509.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_509.cpp deleted file mode 100644 index 8f8f1839..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_509.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = "+-/*%^@"; - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat509(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_509", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_510.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_510.cpp deleted file mode 100644 index 766f0cd6..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_510.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat510(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_510", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_511.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_511.cpp deleted file mode 100644 index 010bd957..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_511.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ".."; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - chdir(SD_MOUNT_DIR); - rmdir(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat511(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_511", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_512.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_512.cpp deleted file mode 100644 index 073a0f91..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_512.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = "."; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - chdir(SD_MOUNT_DIR); - rmdir(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat512(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_512", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_513.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_513.cpp deleted file mode 100644 index 7074ffe2..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_513.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = "" - ""; - - ret = format(pathname, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat513(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_513", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_514.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_514.cpp deleted file mode 100644 index fb87cdce..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_514.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - rmdir(pathname1); - return FAT_NO_ERROR; -} - -VOID ItFsFat514(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_514", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_515.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_515.cpp deleted file mode 100644 index b1318048..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_515.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -VOID ItFsFat515(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_515", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_516.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_516.cpp deleted file mode 100644 index 093c1d2b..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_516.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 err; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = "/dev/nandblk0"; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = "/dev/spinor"; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = "/dev/uartdev-0"; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = "/dev/mmcblk"; - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - printf("errno = %d\n", errno); - err = errno; - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(err, ENODEV, err, EXIT); - - ret = format(pathname2, 0, FAT_FILE_SYSTEMTYPE_AUTO); - err = errno; - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(err, ENODEV, err, EXIT); - - ret = format(pathname3, 0, FAT_FILE_SYSTEMTYPE_AUTO); - err = errno; - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(err, ENODEV, err, EXIT); - - ret = format(pathname4, 0, FAT_FILE_SYSTEMTYPE_AUTO); - err = errno; - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(err, ENODEV, err, EXIT); - - return FAT_NO_ERROR; -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFat516(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_516", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_517.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_517.cpp deleted file mode 100644 index b35ca4d3..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_517.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_DEV_PATH; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(pathname1, -1, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - rmdir(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat517(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_517", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_518.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_518.cpp deleted file mode 100644 index f70dec37..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_518.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_DEV_PATH; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(pathname1, 0XFFFC, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - rmdir(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat518(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_518", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_519.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_519.cpp deleted file mode 100644 index cedf3d17..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_519.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_DEV_PATH; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = format(pathname1, 0, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT1); - - ret = access(pathname2, F_OK); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT: - rmdir(pathname2); - return FAT_NO_ERROR; -} - -VOID ItFsFat519(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_519", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_662.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_662.cpp deleted file mode 100644 index 0088b214..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_662.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static const off_t LEN = 20971520; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd, 1, 0, LEN); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_662 -* -@tspec The function test for fallocate and fallocate64 -* -@ttitle The function test for fallocate and fallocate64 with the fd has been closed for the first parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the close to close the file; -3. use the fallocate and fallocate64 to apply the space; -4. N/A. -* -@texpect -1. Return successed -2. Return successed -3. Failed operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat662(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_662", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_663.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_663.cpp deleted file mode 100644 index 237bff00..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_663.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret < 0 && errno != EEXIST) { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_DIRECTORY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_663 -* -@tspec The function test for fallocate and fallocate64 -* -@ttitle The function test for fallocate and fallocate64 that the fd open wth the directory -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open a directory; -2. use the fallocate and fallocate64 to apply the space; -3. delete the directory; -4. N/A. -* -@texpect -1. Return successed -2. Return failed -3. Sucessful operation -4. N/A -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat663(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_663", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_664.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_664.cpp deleted file mode 100644 index 2ad46e15..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_664.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - struct statfs buf4 = { 0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = fallocate(fd, -1, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, -1, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ret = fallocate(fd, FAT_FALLOCATE_NO_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_NO_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = statfs(pathname1, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - FatStatfsPrintf(buf4); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_664 -* -@tspec The API test for fallocate and fallocate64 -* -@ttitle The API test for fallocate and fallocate64 with -1 and 0 for the second parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate and fallocate64 to apply the space with -1 and 0 for the second parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat664(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_664", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_665.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_665.cpp deleted file mode 100644 index f74c2bc8..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_665.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static const int WRONG_MODE = 10; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, WRONG_MODE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, WRONG_MODE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_665 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 10 for the second parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 10 for the second parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat665(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_665", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_666.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_666.cpp deleted file mode 100644 index e5b78848..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_666.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, 0xffff, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, 0xffff, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_666 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 0xffff for the second parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 0xffff for the second parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat666(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_666", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_667.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_667.cpp deleted file mode 100644 index ed4e181e..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_667.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, -1, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, -1, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_667 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with -1 for the third parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with -1 for the third parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat667(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_667", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_668.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_668.cpp deleted file mode 100644 index 0009f023..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_668.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static const off_t OFFSET = 10; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, OFFSET, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, OFFSET, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_668 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 10 for the third parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 10 for the third parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat668(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_668", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_669.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_669.cpp deleted file mode 100644 index ab9ef5d0..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_669.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0xffff, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0xffff, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_669 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 0xffff for the third parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 0xffff for the third parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat669(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_669", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_670.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_670.cpp deleted file mode 100644 index 5cbe92ea..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_670.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_670 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 0 for the fourth parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 0 for the fourth parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat670(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_670", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_671.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_671.cpp deleted file mode 100644 index 56c0a02c..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_671.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, -1); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, -1); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_671 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with -1 for the fourth parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with -1 for the fourth parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return failed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat671(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_671", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_672.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_672.cpp deleted file mode 100644 index b53c0fb5..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_672.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0xffff); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0xffff); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_672 -* -@tspec The API test for fallocate -* -@ttitle The API test for fallocate with 50 for the fourth parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate to apply the space with 50 for the fourth parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat672(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_672", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_673.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_673.cpp deleted file mode 100644 index cbbe013a..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_673.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret = 0; - INT32 len = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0xffffffff); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0xffffffffffffffff); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0xffff); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_673 -* -@tspec The API test for fallocate fallocate64 -* -@ttitle The API test for fallocate fallocate64 with 0xffff for the fourth parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with 0xffff for the fourth parameter; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat673(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_673", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_674.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_674.cpp deleted file mode 100644 index 347cbdec..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_674.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, (size - 1)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, (size - 1)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_674 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle The function test for fallocate fallocate64 with the length smaller than write -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with the length smaller than write; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat674(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_674", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_675.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_675.cpp deleted file mode 100644 index acecb835..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_675.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_675 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle The function test for fallocate fallocate64 with the length equals to write -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with the length equals to write; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat675(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_675", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_676.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_676.cpp deleted file mode 100644 index d03a1537..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_676.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_676 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle The function test for fallocate fallocate64 with the length is 2GB -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with the length is 2GB; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat676(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_676", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_677.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_677.cpp deleted file mode 100644 index aa088c0a..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_677.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_677 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle The function test for fallocate fallocate64 with the length is 2GB+1 -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with the length is 2GB+1; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat677(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_677", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_678.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_678.cpp deleted file mode 100644 index b285cb10..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_678.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, 0x7FFFFFFF); // 2GB-1 - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT1); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_678 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle The function test for fallocate fallocate64 with the length is 2GB-1 -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the function fallocate fallocate64 to apply the space with the length is 2GB-1; -3. close the file; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat678(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_678", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_679.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_679.cpp deleted file mode 100644 index dfbc27cf..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_679.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, -size, size); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, -size, size); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - off = lseek(fd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, size, off, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_679 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle Fallocate allocates space while the offset + length is equal to the size of the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate fallocate64 to allocates space while the offset + length is equal to the size of the file -; -3. compare the file size before and after fallocate fallocate64; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat679(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_679", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_680.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_680.cpp deleted file mode 100644 index dfb5affb..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_680.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size + FAT_STANDARD_NAME_LENGTH); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, -size, FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf3.st_size, size, buf3.st_size, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size + FAT_STANDARD_NAME_LENGTH); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, -size, FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf3.st_size, size, buf3.st_size, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_680 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle Fallocate allocates space while the offset + length is more than the size of the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate fallocate64 to allocates space while the offset + length is more than the size of the file -; -3. compare the file size before and after fallocate fallocate64; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat680(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_680", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_681.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_681.cpp deleted file mode 100644 index ce5e4637..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_681.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = "lala"; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct statfs buf3 = { 0 }; - struct stat buf4 = { 0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lala", readbuf, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf4); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf3); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - ICUNIT_GOTO_EQUAL(buf4.st_size, 0, buf4.st_size, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "lala", readbuf, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf4); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf3); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - ICUNIT_GOTO_EQUAL(buf4.st_size, 0, buf4.st_size, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_681 -* -@tspec The function test for fallocate fallocate64 -* -@ttitle Read the file then use the fallocate fallocate64 -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. write something in the file and then read it; -3. compare the file size before and after fallocate fallocate64; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat681(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_681", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_682.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_682.cpp deleted file mode 100644 index 8bf5d85a..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_682.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf3.st_size, 10, buf3.st_size, EXIT1); // file size 10 bytes - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(readbuf, writebuf, readbuf, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_682 -* -@tspec The function test for fallocate -* -@ttitle Fallocate the read_only file then check whether the file size is changed -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one read_only file; -2. use the function fallocate to apply the space ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat682(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_682", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_683.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_683.cpp deleted file mode 100644 index 84d56068..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_683.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR const writebuf[FAT_STANDARD_NAME_LENGTH] = "0123456789"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - off_t off; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - ICUNIT_GOTO_EQUAL(buf3.st_size, 10, buf3.st_size, EXIT1); // file size 10 bytes - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - ICUNIT_GOTO_EQUAL(buf3.st_size, 10, buf3.st_size, EXIT1); // file size 10 bytes - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, -1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_683 -* -@tspec The function test for fallocate -* -@ttitle Fallocate the write_only file then check whether the file size is changed -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one write_only file; -2. use the function fallocate to apply the space ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat683(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_683", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_684.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_684.cpp deleted file mode 100644 index 1311af13..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_684.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static const off_t LEN = 10; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 i = 0; - INT32 size = 0x4000000; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct statfs buf1 = { 0 }; - struct statfs buf3 = { 0 }; - struct stat buf5 = { 0 }; - struct stat buf6 = { 0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf5); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, LEN); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf3); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < FAT_SHORT_ARRAY_LENGTH; i++) { - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = ftruncate(fd, 0x400); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = ftruncate64(fd, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = ftruncate64(fd, 0x400); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname1, &buf6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf6); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) - ICUNIT_GOTO_EQUAL(buf6.st_size, 0, buf6.st_size, EXIT1); - else - ICUNIT_GOTO_EQUAL(buf6.st_size, 0x400, buf6.st_size, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, LEN, size); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_VFAT_684 -* -@tspec The function test for fallocate -* -@ttitle Fallocate apply space for the same file fd multiple times -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one file; -2. use the function fallocate to apply the space for the same file fd multiple times; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat684(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_684", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_685.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_685.cpp deleted file mode 100644 index 6c97584f..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_685.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - struct stat buf3 = { 0 }; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf3); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size - 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size - 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - ICUNIT_GOTO_EQUAL(buf3.st_size, size, buf3.st_size, EXIT1); - - len = write(fd, writebuf, size); - ICUNIT_GOTO_EQUAL(len, size, len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_685 -* -@tspec The function test for fallocate -* -@ttitle Fallocate allocates space while the offset + length is smaller than the size of the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate to allocates space while the offset + length is smaller than the size of the file ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat685(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_685", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_686.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_686.cpp deleted file mode 100644 index 5aea9458..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_686.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static const int SIZE_DIVIDER = 2; - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - writebuf = (CHAR *)malloc(size + 1); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size + 1, 0, size + 1); - ret = memset_s(writebuf, size + 1, 0x61, size); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), - (strlen(writebuf) - (strlen(writebuf) / SIZE_DIVIDER))); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), strlen(writebuf)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), - (strlen(writebuf) - (strlen(writebuf) / 2))); // divid the size by 2, get half size - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), strlen(writebuf)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, (strlen(writebuf) / SIZE_DIVIDER), 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_686 -* -@tspec The function test for fallocate -* -@ttitle Fallocate allocates space while the postion is in the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate to allocates space while the postion is in the file ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat686(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_686", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_687.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_687.cpp deleted file mode 100644 index ea64c118..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_687.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 size = 0xffff; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *writebuf = NULL; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - off_t off; - - writebuf = (CHAR *)malloc(size); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); - (void)memset_s(writebuf, size, 0x61, size); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, strlen(writebuf), -FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, off, strlen(writebuf)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, strlen(writebuf), off, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, strlen(writebuf), -FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - - ret = fallocate64(fd, FAT_FALLOCATE_KEEP_SIZE, off, strlen(writebuf)); - if (g_fatFilesystem == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - len = write(fd, writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(writebuf), len, EXIT1); - - off = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT1); - - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_STANDARD_NAME_LENGTH - 1, len, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(writebuf); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - free(writebuf); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_687 -* -@tspec The function test for fallocate -* -@ttitle Fallocate allocates space while the postion is end of the file -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one non-empty file; -2. use the function fallocate to allocates space while the postion is end of the file ; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat687(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_687", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_692.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_692.cpp deleted file mode 100644 index a25200d9..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_692.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 size = 0x4000000; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EACCES, errno, EXIT1); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_692 -* -@tspec The function test for fallocate -* -@ttitle Fallocate apply space while the file is O_RDONLY -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one file; -2. use the function fallocate to apply the space while the file is O_RDONLY; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat692(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_692", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_693.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_693.cpp deleted file mode 100644 index 18056591..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_693.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 size = 0x4000000; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct statfs buf1 = { 0 }; - struct stat buf2 = { 0 }; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = fallocate(fd, FAT_FALLOCATE_KEEP_SIZE, 0, size); - if (FAT_FILE_SYSTEMTYPE_AUTO == FAT_FILE_SYSTEMTYPE_EXFAT) { - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EPERM, errno, EXIT1); - } else { - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatfsPrintf(buf1); - - ret = stat(pathname1, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf2); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_693 -* -@tspec The function test for fallocate -* -@ttitle Fallocate apply space while the file is O_WRONLY -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to open one file; -2. use the function fallocate to apply the space while the file is O_WRONLY; -3. compare the file size before and after fallocate; -4. close and remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat693(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_693", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_694.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_694.cpp deleted file mode 100644 index ff64a20f..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_694.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = ftruncate(fd, 0x400); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = ftruncate64(fd, 0x400); - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - close(fd); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_VFAT_694 -* -@tspec The API test for truncate -* -@ttitle The API test for truncate with the fd has been closed for the first parameter -* -@tprecon The filesystem module is open -* -@tbrief -1. use the open to create one file; -2. use the close to close the file; -3. use the truncate to recover the space; -4. remove the file. -* -@texpect -1. Return successed -2. Return successed -3. Return failed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat694(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_694", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_870.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_870.cpp deleted file mode 100644 index 76bd8ff4..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_870.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = NULL; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - struct stat64 buf1 = { 0 }; - struct stat64 buf2 = { 0 }; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, 0, 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite, BYTES_PER_MBYTES, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - ret = memset_s(bufWrite2, 16 * BYTES_PER_KBYTES, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT3); - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16 * BYTES_PER_KBYTES = 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16 * BYTES_PER_KBYTES = 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16 * BYTES_PER_KBYTES = 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16 * BYTES_PER_KBYTES = 16kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES, bufWrite2); // BYTES_PER_MBYTES = 1MB - } - - for (i = 0; i < 4; i++) { // loop 4 times - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES, bufWrite1); // 8 * BYTES_PER_MBYTES = 8MB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES, bufWrite1); // 8 * BYTES_PER_MBYTES = 8MB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFd = open64(g_fatPathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd, FAT_IS_ERROR, g_fatFd, EXIT2); - - while (1) { - ret = write(g_fatFd, bufWrite, strlen(bufWrite)); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write - printf("The biggest file size is smaller than the 4GB\n"); - goto EXIT2; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - if (g_testCount >= 256 + 1) { // write more than 256 times for 4GB // write more than 256 times for 4GB - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - g_testCount++; - } - - ret = stat64(g_fatPathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = fstat64(g_fatFd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT2); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT2); - - ICUNIT_GOTO_EQUAL(buf1.st_size, (off64_t)g_testCount * 8 * BYTES_PER_MBYTES, // 8 mb per write - buf1.st_size, EXIT2); - - free(bufWrite); - - ret = close(g_fatFd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - close(g_fatFd); -EXIT0: - remove(g_fatPathname1); -EXIT: - remove(pathname); - return FAT_NO_ERROR; -} - -/* * - * @defgroup los_fsoperationbigfile æ“作超过2G大å°çš„文件 - */ - -/* * - * @ingroup los_fsoperationbigfile - * @par type: void - * API test - * @brief function æ“作超过2G大å°çš„文件 - * @par description:write the file size to 2GB and function it - * @par precon: task moudle open - * @par step: see decription - * create 2GB file \n - * function this file - * @par expect: nothing - * create file successful \n - * operator it successful,return successed - * @par prior: void - */ - -VOID ItFsFat870(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_870", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_872.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_872.cpp deleted file mode 100644 index 2d3eb15a..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_872.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - off64_t ret1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES, 0, 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // 16 * 4 * 256 = 16K - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - } - - for (j = 0; j < 16; j++) { // 16 * 4 * 16K = 1M - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - } - - for (i = 0; i < 4; i++) { // 4 * 2 * 1M = 8M - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFfd = fopen64(g_fatPathname1, "w+"); - ICUNIT_GOTO_NOT_EQUAL(g_fatFfd, nullptr, g_fatFfd, EXIT2); - - while (1) { - ret = fwrite(bufWrite, strlen(bufWrite), 1, g_fatFfd); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write - printf("The biggest file size is smaller than the 4GB"); - goto EXIT2; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - if (g_testCount >= 256 + 1) { // write more than 256 times for 4GB - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - g_testCount++; - } - - ret = fseeko64(g_fatFfd, -1, SEEK_END); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret1 = ftello64(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret1, (off64_t)(g_testCount * 8 * BYTES_PER_MBYTES - 1), ret1, // 8 mb - EXIT2); // 8 * BYTES_PER_MBYTES = 8MB - - ret = fseeko64(g_fatFfd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret1 = ftello64(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret1, (off64_t)(g_testCount * 8 * BYTES_PER_MBYTES - 1), ret1, // 8 mb - EXIT2); // 8 * BYTES_PER_MBYTES = 8MB - - ret = fseeko64(g_fatFfd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret1 = ftello64(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret1, 0, ret1, EXIT2); - - free(bufWrite); - - ret = fclose(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - fclose(g_fatFfd); -EXIT0: - remove(g_fatPathname1); -EXIT: - remove(pathname); - return FAT_NO_ERROR; -} - -/* * - * @ingroup los_fsoperationbigfile - * @par type: void - * API test - * @brief ftello64 æ“作超过2G大å°çš„文件 - * @par description: write the file size to 2GB and ftello64 it - * @par precon: task moudle open - * @par step: see below - * create 2GB file \n - * ftello64 this file - * @par expect: see below - * create file successful \n - * operator it successful,return successed - * @par prior: nothing - */ - -VOID ItFsFat872(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_872", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_873.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_873.cpp deleted file mode 100644 index 9c4344e2..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_873.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES, 0, 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // 16 * 4 * 256 = 16K - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - } - - for (j = 0; j < 16; j++) { // 16 * 4 * 16K = 1M - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - } - - for (i = 0; i < 4; i++) { // 4 * 2 * 1M = 8M - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFfd = fopen64(g_fatPathname1, "w+"); - ICUNIT_GOTO_NOT_EQUAL(g_fatFfd, nullptr, g_fatFfd, EXIT2); - - while (1) { - ret = fwrite(bufWrite, strlen(bufWrite), 1, g_fatFfd); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write - printf("The biggest file size is smaller than the 4GB,count = :%d,%d", g_testCount, errno); - goto EXIT2; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - if (g_testCount >= 256 + 1) { // write more than 256 times for 4GB - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - g_testCount++; - } - - free(bufWrite); - - ret = fclose(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - g_fatFfd = fopen64(g_fatPathname1, "w+"); - ICUNIT_GOTO_NOT_EQUAL(g_fatFfd, nullptr, g_fatFfd, EXIT2); - - ret = fclose(g_fatFfd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - fclose(g_fatFfd); -EXIT0: - remove(g_fatPathname1); -EXIT: - remove(pathname); - return FAT_NO_ERROR; -} - -/* * - * @ingroup los_fsoperationbigfile - * @par type: void - * API test - * @brief fopen64 æ“作超过2G大å°çš„文件 - * @par description: write the file size to 2GB and fopen64 it - * @par precon: task moudle open - * @par step: see below - * create 2GB file \n - * fopen64 this file - * @par expect: see below - * create file successful \n - * operator it successful,return successed - * @par prior: nothing - */ - -VOID ItFsFat873(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_873", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_874.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_874.cpp deleted file mode 100644 index 59a59dd0..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_874.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 len; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = NULL; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - CHAR *readbuf = NULL; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES, 0, 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // 16 * 4 * 256 = 16K - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - } - - for (j = 0; j < 16; j++) { // 16 * 4 * 16K = 1M - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - } - - for (i = 0; i < 4; i++) { // 4 * 2 * 1M = 8M - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFd = open64(g_fatPathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd, FAT_IS_ERROR, g_fatFd, EXIT2); - - while (1) { - ret = write(g_fatFd, bufWrite, strlen(bufWrite)); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write - printf("The biggest file size is smaller than the 4GB"); - goto EXIT2; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - if (g_testCount >= 256 + 1) { // write more than 256 times for 4GB - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - g_testCount++; - } - - readbuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(readbuf, NULL, readbuf, EXIT2); - (void)memset_s(readbuf, 0xffff + 1, 0, 0xffff + 1); - - len = pread64(g_fatFd, readbuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT2); - - (void)memset_s(readbuf, 0xffff + 1, 0, 0xffff + 1); - - len = pread64(g_fatFd, readbuf, 0xffff, 1000); // offset is 1000 - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT2); - - (void)memset_s(readbuf, 0xffff + 1, 0, 0xffff + 1); - - len = pread64(g_fatFd, readbuf, 0xffff, - (off64_t)(g_testCount * 8 * // 8mb per write - BYTES_PER_MBYTES)); // 8M * 8 * BYTES_PER_MBYTES * times = file size, get to file end - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - free(readbuf); - free(bufWrite); - - ret = close(g_fatFd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - free(bufWrite1); -EXIT2: - free(readbuf); - free(bufWrite); -EXIT1: - close(g_fatFd); -EXIT0: - remove(g_fatPathname1); -EXIT: - remove(pathname); - return FAT_NO_ERROR; -} - -/* * - * @ingroup los_fsoperationbigfile - * @par type: void - * API test - * @brief pread64 æ“作超过2G大å°çš„文件 - * @par description: write the file size to 2GB and pread64 it - * @par precon: task moudle open - * @par step: see below - * create 2GB file \n - * pread64 this file - * @par expect: see below - * create file successful \n - * operator it successful,return successed - * @par prior: nothing - */ - -VOID ItFsFat874(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_874", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_875.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_875.cpp deleted file mode 100644 index 78ffdccb..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_875.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 len; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = NULL; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - CHAR *writebuf = NULL; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES, 0, 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // 16 * 4 * 256 = 16K - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb // 16 * BYTES_PER_KBYTES = 16KB - } - - for (j = 0; j < 16; j++) { // 16 * 4 * 16K = 1M - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); // BYTES_PER_MBYTES = 1MB - } - - for (i = 0; i < 4; i++) { // 4 * 2 * 1M = 8M - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, bufWrite1); // 8 * BYTES_PER_KBYTES = 8KB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFd = open64(g_fatPathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd, FAT_IS_ERROR, g_fatFd, EXIT2); - - while (1) { - ret = write(g_fatFd, bufWrite, strlen(bufWrite)); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write - printf("The biggest file size is smaller than the 4GB"); - goto EXIT2; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - if (g_testCount >= 256 + 1) { // write more than 256 times for 4GB - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // BYTES_PER_KBYTES MB/GB, 8MB per write - break; - } - g_testCount++; - } - - writebuf = (CHAR *)malloc(0xffff + 1); - ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT2); - (void)memset_s(writebuf, 0xffff + 1, 0, 0xffff + 1); - - for (i = 0; i < 256; i++) { // loop 256 times - (void)strcat_s(writebuf, 0xffff + 1, filebuf); - } - writebuf[0xffff] = '\0'; - - len = pwrite64(g_fatFd, writebuf, 0xffff, 0); - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT2); - - len = pwrite64(g_fatFd, writebuf, 0xffff, 10000); // offset = 10000 - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT2); - - len = pwrite64(g_fatFd, writebuf, 0xffff, - (off64_t)(g_testCount * 8 * BYTES_PER_MBYTES - 1)); // 8M * 8 * BYTES_PER_MBYTES * times to get to file end - ICUNIT_GOTO_EQUAL(len, 0xffff, len, EXIT2); - - free(writebuf); - free(bufWrite); - - ret = close(g_fatFd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - free(bufWrite1); -EXIT2: - free(writebuf); - free(bufWrite); -EXIT1: - close(g_fatFd); -EXIT0: - remove(g_fatPathname1); -EXIT: - remove(pathname); - return FAT_NO_ERROR; -} - -/* * - * @ingroup los_fsoperationbigfile - * @par type: void - * API test - * @brief pwrite64 æ“作超过2G大å°çš„文件 - * @par description: write the file size to 2GB and pwrite64 it - * @par precon: task moudle open - * @par step: see below - * create 2GB file \n - * pwrite64 this file - * @par expect: see below - * create file successful \n - * operator it successful,return successed - * @par prior: nothing - */ - -VOID ItFsFat875(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_875", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_902.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_902.cpp deleted file mode 100644 index 6a1e17a8..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_902.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat64 buf1 = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 fstype is 2 FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat64(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT1); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat64(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/dir"); - - ret = stat64(pathname1, &buf1); - ICUNIT_GOTO_NOT_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT2); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - return FAT_NO_ERROR; -EXIT2: - rmdir(pathname1); -EXIT1: - rmdir(FAT_PATH_NAME); -EXIT: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFat902(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_902", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_903.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_903.cpp deleted file mode 100644 index c10cb3cd..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_903.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR buffile[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat64 buf1 = { 0 }; - struct stat64 buf2 = { 0 }; - struct stat64 buf3 = { 0 }; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/dir"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(buffile, FAT_STANDARD_NAME_LENGTH, "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = stat64(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = fstat64(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat64(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT); - - FatDeleteFile(fd, buffile); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - format(FAT_DEV_PATH, 8, 0); // cluster size 8, 0 for auto - return FAT_NO_ERROR; -} - -VOID ItFsFat903(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_903", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_904.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_904.cpp deleted file mode 100644 index e3cc1716..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_904.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = 0; - INT32 ret; - INT32 len; - INT32 fd1 = 0; - INT32 fd2 = 0; - INT32 fd3 = 0; - CHAR filebuf[20] = "abcdeabcde"; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat buf1 = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT0); - - ret = format(FAT_DEV_PATH, 0, 2); // cluster size 0, 2 for FAT32, will fail - if (ret != 0) { - perror("format sd card"); - } - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test1"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fallocate(fd, 1, 0, 1 << 10); // fallocate 1 << 10 for 1KB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - - close(fd); - - fd = open(pathname1, O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fallocate(fd, 1, 0, 1 << 20); // fallocate 1 << 20 for 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT); - - ret = ftruncate(fd, 0xffff); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test2"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = ftruncate(fd1, 1 << 20); // ftruncate 1 << 20 to 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test3"); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, FAT_IS_ERROR, fd2, EXIT1); - - ret = fallocate(fd2, 1, 0, 10); // fallocate to 10 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd2, 1, 0, 10); // fallocate to 10 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate(fd2, 1, 10, 20); // fallocate to 10 + 20 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test4"); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT3); - - ret = ftruncate(fd3, 1 << 20); // ftruncate 1 << 20 for 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatPrintf(buf1); - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_REMOVE); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_REMOVE); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_REMOVE); - - ret = format(FAT_DEV_PATH, 0, 2); // cluster size 0, 2 for FAT32 - if (ret != 0) { - perror("format sd card"); - } - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_MOUNT_REMOVE); - - (void)strncpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_PATH_NAME, sizeof(FAT_PATH_NAME)); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test1"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fallocate(fd, 1, 0, 1 << 10); // fallocate 1 << 10 for 1KB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - - close(fd); - - fd = open(pathname1, O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fallocate64(fd, 1, 0, 1 << 20); // fallocate 1 << 20 for 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT); - - ret = ftruncate64(fd, 0xffff); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test2"); - fd1 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT2); - - len = write(fd1, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT1); - - ret = ftruncate64(fd1, 1 << 20); // ftruncate 1 << 20 for 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(buf1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test3"); - fd2 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd2, FAT_IS_ERROR, fd2, EXIT1); - - ret = fallocate64(fd2, 1, 0, 10); // fallocate 10 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd2, 1, 0, 10); // fallocate 10 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = fallocate64(fd2, 1, 10, 20); // fallocate 10 + 20 bytes - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "test4"); - fd3 = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd1, FAT_IS_ERROR, fd1, EXIT3); - - ret = ftruncate64(fd3, 1 << 20); // fallocate 1 << 20 for 1MB - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatPrintf(buf1); - ret = close(fd3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = close(fd2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_REMOVE); - - ret = remove(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_REMOVE); - - return FAT_NO_ERROR; - -EXIT3: - close(fd3); -EXIT1: - close(fd2); -EXIT2: - close(fd1); -EXIT: - close(fd); -EXIT_REMOVE: - remove(pathname1); - - return FAT_NO_ERROR; - -EXIT_MOUNT_REMOVE: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - remove(pathname1); -EXIT0: - return FAT_NO_ERROR; -} -VOID ItFsFat904(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_904", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_909.cpp b/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_909.cpp deleted file mode 100644 index 28ce4c79..00000000 --- a/testsuites/unittest_old/fs/vfat/full/It_vfs_fat_909.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 i, j, k, ret, len; - INT32 fd = -1; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - off_t off; - CHAR readbuf[2000] = ""; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat buf1 = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_MOUNT); - - ret = format(FAT_DEV_PATH, 0, 0x02); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_MOUNT); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT_MOUNT); - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, - BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // 256 * BYTES_PER_KBYTES * 4 = 1MB - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname, FAT_STANDARD_NAME_LENGTH, "testfile.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT2); - - for (j = 0; j < 100; j++) { // д100M - ret = write(fd, bufWrite, strlen(bufWrite)); - printf("\n write times = : %d\n", j + 1); // j+1µÈÓÚ10×óÓÒʱ£¬²å°ÎSD¿¨ - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTES, ret, EXIT2); // not equal to 1M - - off = lseek(fd, 0, SEEK_CUR); - ICUNIT_GOTO_EQUAL(off, (BYTES_PER_MBYTES * (j + 1)), off, EXIT2); // from 1M to 4G - } - - off = lseek(fd, 64, SEEK_SET); // 64 byte - ICUNIT_GOTO_EQUAL(off, 64, off, EXIT2); // 64 byte - - for (k = 0; k < 500; k++) { // ¶Á500´Î - len = read(fd, readbuf, BYTES_PER_KBYTES); // read BYTES_PER_KBYTES bytes - printf("\n read times = : %d\n", k + 1); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_KBYTES, len, EXIT2); // make sure BYTES_PER_KBYTES bytes - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = stat(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - free(bufWrite); - - return FAT_NO_ERROR; - - free(bufWrite); -EXIT2: - close(fd); -EXIT1: - unlink(pathname); -EXIT: - rmdir(pathname1); -EXIT_MOUNT: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - free(bufWrite); -EXIT0: - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_909 -* - @tspec function test -* - @ttitle Insert and remove SD card during reading and writing -* - @tbrief -1. Create a new file and open it -2. Unplug the SD card when writing 10M -3. View serial port printing status and file status. -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFat909(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_909", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_001.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_001.cpp deleted file mode 100644 index 807c552f..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_001.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = RandWrite(fileName, FILE_SIZE, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = RandRead(fileName, FILE_SIZE, 0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId = 0; - pthread_attr_t attr; - - g_testCount = 0; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - while (g_testCount < 2) { // each thread add 2 at g_testCount - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance001(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_001", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_002.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_002.cpp deleted file mode 100644 index 1511fdba..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_002.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = FixWrite(fileName, FILE_SIZE, FIX_DATA_LEN, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = FixRead(fileName, FILE_SIZE, FIX_DATA_LEN, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId = 0; - pthread_attr_t attr; - - printf("Single-Task frite and fread ,The test for SD is started!\n"); - - g_testCount = 0; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - while (g_testCount < 2) { // each thread add 2 at g_testCount - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance002(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_002", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_003.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_003.cpp deleted file mode 100644 index 1cba2554..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_003.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = RandWrite(fileName, FILE_SIZE, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = RandRead(fileName, FILE_SIZE, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId; - pthread_attr_t attr; - - g_testCount = 0; - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - while (g_testCount < 2) { // each thread add 2 at g_testCount - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance003(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_003", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_004.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_004.cpp deleted file mode 100644 index 89b688c6..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_004.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = FixWrite(fileName, FILE_SIZE, FIX_DATA_LEN, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = FixRead(fileName, FILE_SIZE, FIX_DATA_LEN, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret; - pthread_t threadId; - pthread_attr_t attr; - - g_testCount = 0; - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - ret = pthread_create(&threadId, &attr, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, FAT_NO_ERROR, ret); - - while (g_testCount < 2) { // each thread add 2 at g_testCount - sleep(1); - } - - ret = pthread_join(threadId, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - pthread_join(threadId, NULL); - pthread_attr_destroy(&attr); - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance004(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_004", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_005.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_005.cpp deleted file mode 100644 index d121e938..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_005.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = FixWrite(fileName, FILE_SIZE, FIX_DATA_LEN, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = FixRead(fileName, FILE_SIZE, FIX_DATA_LEN, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[FAT_MAX_THREADS]; - pthread_attr_t attr; - - printf("Multiple-Task frite and fread ,The test for SD is started!\n"); - - g_testCount = 0; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)(i + 1)); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - while (g_testCount < FAT_MAX_THREADS * 2) { // each thread add 2 at g_testCount - sleep(1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } -EXIT: - pthread_attr_destroy(&attr); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance005(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_005", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_006.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_006.cpp deleted file mode 100644 index 310bf23f..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_006.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = RandWrite(fileName, FILE_SIZE, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = RandRead(fileName, FILE_SIZE, INTERFACE_TYPE); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - - g_testCount = 0; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < 3; i++) { // creat 3 threads - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - while (g_testCount < 6) { // 6 threads each add 2 at g_testCount - sleep(1); - } - - for (i = 0; i < 3; i++) { // join the 3 child threads - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - for (i = 0; i < 3; i++) { // wait for 3 threads ok - pthread_join(threadId[i], NULL); - } -EXIT: - pthread_attr_destroy(&attr); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance006(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_006", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_007.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_007.cpp deleted file mode 100644 index 60095884..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_007.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = RandWrite(fileName, FILE_SIZE, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = RandRead(fileName, FILE_SIZE, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - - g_testCount = 0; - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < 3; i++) { // create 3 child threads - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - while (g_testCount < 6) { // 6 threads each add 2 at g_testCount - sleep(1); - } - - for (i = 0; i < 3; i++) { // join 3 child thread - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - for (i = 0; i < 3; i++) { // join all 3 child thread - pthread_join(threadId[i], NULL); - } -EXIT: - pthread_attr_destroy(&attr); - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance007(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_007", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_008.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_008.cpp deleted file mode 100644 index 27def38d..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_008.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - CHAR fileName[FAT_STANDARD_NAME_LENGTH] = ""; - time_t tTime; - struct tm stTime; - - g_testCount++; - - time(&tTime); - localtime_r(&tTime, &stTime); - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - strftime(g_fatPathname1, FAT_STANDARD_NAME_LENGTH - 1, "%Y-%m-%d_%H.%M.%S", &stTime); - (void)snprintf_s(fileName, FAT_STANDARD_NAME_LENGTH - 1, FAT_STANDARD_NAME_LENGTH - 1, "/vs/sd/%s_#%d", - g_fatPathname1, (INT32)arg); - - (void)snprintf_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH - 1, "testfile#%d", (INT32)arg); - prctl(PR_SET_NAME, (unsigned long)g_fatPathname1, 0, 0, 0); - - ret = FixWrite(fileName, FILE_SIZE, FIX_DATA_LEN, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = FixRead(fileName, FILE_SIZE, FIX_DATA_LEN, 1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - return FAT_NO_ERROR; - -EXIT: - return FAT_NO_ERROR; - g_testCount = 0; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_t threadId[3]; - pthread_attr_t attr; - - g_testCount = 0; - - ret = PosixPthreadInit(&attr, 4); // level 4 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < 3; i++) { // create 3 child threads - ret = pthread_create(&threadId[i], &attr, PthreadF01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - while (g_testCount < 6) { // 6 threads each add 2 at g_testCount - sleep(1); - } - - for (i = 0; i < 3; i++) { // join all 3 child threads - pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT1: - for (i = 0; i < 3; i++) { // join all 3 child threads - pthread_join(threadId[i], NULL); - } -EXIT: - pthread_attr_destroy(&attr); - return FAT_NO_ERROR; -} - -VOID ItFsFatPerformance008(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_008", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_013.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_013.cpp deleted file mode 100644 index 5476439c..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_013.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, index, len; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR pathname0[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname0[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB // 1M - ICUNIT_ASSERT_NOT_EQUAL(bufWrite, NULL, bufWrite); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB // 1M - - for (i = 0; i < 200 * 4; i++) { // append 200 * 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(pathname0, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(pathname0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { - (void)snprintf_s(bufname0, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(bufname0, O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd[index], FAT_IS_ERROR, fd[index], EXIT2); - - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - index++; - } - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(bufname0, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(bufname0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - free(bufWrite); - return FAT_NO_ERROR; -EXIT3: - for (i = index; i >= 0; i--) { - (void)snprintf_s(bufname0, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(bufname0); - } -EXIT2: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT1: - closedir(dir); -EXIT: - chdir(SD_MOUNT_DIR); - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PERFORMANCE_013 -* -@tspec The function test for filesystem -* -@ttitle How long does it take to delete a directory -* -@tprecon The filesystem module is open -* -@tbrief -1. Create a directory with 200 files -2.200Kb per file -3.delete the file box directory -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPerformance013(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_013", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_014.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_014.cpp deleted file mode 100644 index 2db2c7b6..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_014.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" -#define MS_NOSYNC 2 - -static UINT32 TestCase(VOID) -{ - INT32 ret, i, len; - INT32 index = 0; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - DIR *dir = NULL; - struct timeval testTime1; - struct timeval testTime2; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - umount(FAT_MOUNT_DIR); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, MS_NOSYNC, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT4); - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL(bufWrite, NULL, bufWrite); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 200 * 4; i++) { // append 200 * 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = chdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { - (void)snprintf_s(bufname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index); - fd[index] = open(bufname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd[index], FAT_IS_ERROR, fd[index], EXIT2); - - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - index++; - } - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - sync(); - for (i = index; i >= 0; i--) { - (void)snprintf_s(bufname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - ret = chdir(SD_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - free(bufWrite); - return FAT_NO_ERROR; -EXIT4: - umount(FAT_MOUNT_DIR); -EXIT3: - for (i = index; i >= 0; i--) { - (void)snprintf_s(bufname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(bufname1); - } -EXIT2: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT1: - closedir(dir); -EXIT: - chdir(SD_MOUNT_DIR); - rmdir(FAT_PATH_NAME); -EXIT0: - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PERFORMANCE_014 -* -@tspec The function test for filesystem -* -@ttitle How long does it take to delete a directory -* -@tprecon The filesystem module is open -* -@tbrief -1.The fourth parameter of mount is changed to MS_NOSYNC -2.Create a directory with 200 files -3.200Kb per file -4.delete the file box directory -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPerformance014(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_014", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_015.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_015.cpp deleted file mode 100644 index d42ae750..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_015.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - sync(); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - sync(); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); -EXIT: - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - sync(); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname); - } - free(bufWrite); -EXIT: - rmdir(bufname); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, NULL); // 2nd thread id - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there are 3 child threads - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_PERFORMANCE_015 -* - @tspec function test -* - @ttitle Multi-threaded takes time to delete directory files -* - @tbrief -1. Create 200 files per directory; -2. The size of each file is 300K; -3. Call the gettimeofday() to get the time; -4. Delete files and directories; -5. Call the gettimeofday() to get the time and View the time of serial port printing. -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatPerformance015(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_015", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_016.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_016.cpp deleted file mode 100644 index c6f64ce2..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_performance_016.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(pathname); - } -EXIT: - free(bufWrite); - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(pathname); - } -EXIT: - free(bufWrite); - rmdir(bufname); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[FAT_FILE_LIMITTED_NUM] = {}; - INT32 flag = 0; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - struct timeval testTime1; - struct timeval testTime2; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 4; i++) { // append 4 times to 1M - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - index = 0; - for (i = 0; i < FAT_FILE_LIMITTED_NUM; i++) { // 200 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_NAME_LIMITTED_SIZE; j++) { // 300K - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - gettimeofday(&testTime1, 0); - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - gettimeofday(&testTime2, 0); - printf("FF--%s:%d, time: %lld\n", __func__, __LINE__, - (testTime2.tv_sec - testTime1.tv_sec) * US_PER_SEC + // US_PER_SEC - (testTime2.tv_usec - testTime1.tv_usec)); - - g_testCount++; - free(bufWrite); - - return NULL; -EXIT2: - close(fd[index]); -EXIT1: - for (; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname); - } -EXIT: - free(bufWrite); - rmdir(bufname); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // 2nd thread id - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // 3 threads - - return FAT_NO_ERROR; -EXIT3: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - goto EXIT; - - chdir("/"); - umount(FAT_MOUNT_DIR); -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_PERFORMANCE_016 -* - @tspec function test -* - @ttitle Multi-threaded takes time to delete directory files -* - @tbrief -1. Create 200 files per directory; -2. The size of each file is 300K; -3. Call the gettimeofday() to get the time; -4. Delete files and directories; -5. Call the gettimeofday() to get the time and View the time of serial port printing. -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatPerformance016(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PERFORMANCE_016", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PERFORMANCE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_029.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_029.cpp deleted file mode 100644 index c5886fa0..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_029.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 i = 0; - INT32 k; - off_t off; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - g_fatFlagF01++; - - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - (void)memset_s(g_fatPathname2, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)memset_s(g_fatPathname12[i], FAT_STANDARD_NAME_LENGTH, 0, FAT_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", i); - (void)strcat_s(g_fatPathname2, FAT_SHORT_ARRAY_LENGTH, pathname1); - (void)strcat_s(g_fatPathname2, FAT_SHORT_ARRAY_LENGTH, bufname); - (void)strcat_s(g_fatPathname2, FAT_SHORT_ARRAY_LENGTH, ".txt"); - (void)strcpy_s(g_fatPathname12[i], FAT_SHORT_ARRAY_LENGTH, g_fatPathname2); - g_fatFd11[i] = open(g_fatPathname12[i], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[i], -1, g_fatFd11[i], EXIT1); - - if (i % FAT_SHORT_ARRAY_LENGTH == 9) { // meet i = 9 close the fat fd - for (k = (i / FAT_SHORT_ARRAY_LENGTH) * FAT_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_fatFd11[k]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - } - } - - ICUNIT_GOTO_NOT_EQUAL((g_testCount % 2), 0, g_testCount, EXIT1); // 2 for even or not - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - g_fatFd11[i] = open(g_fatPathname12[i], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[i], -1, g_fatFd11[i], EXIT1); - - off = lseek(g_fatFd11[i], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 1 * BYTES_PER_MBYTES, off, EXIT1); // 1 * BYTES_PER_MBYTES = 1M - - if (i % FAT_SHORT_ARRAY_LENGTH == 9) { // meet i = 9 close the fat fd - for (k = (i / FAT_SHORT_ARRAY_LENGTH) * FAT_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_fatFd11[k]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - } - } - - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - ret = unlink(g_fatPathname12[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_fatFlag++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - return NULL; -EXIT1: - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - close(g_fatFd11[i]); - } -EXIT: - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - unlink(g_fatPathname12[i]); - } - g_testCount = 0; - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 len; - INT32 i = 0; - INT32 j = 0; - INT32 k = 0; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = "liteos"; - CHAR *bufWrite = nullptr; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - bufWrite = (CHAR *)malloc(1 * BYTES_PER_MBYTES + 1); // 1 * BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < 1 * 32 * 4; i++) { // 4K * 2 * 32 * 4 = 1M - for (j = 0; j < 4; j++) { // 256 * 4 * 4 = 4K - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - } - - for (j = 0; j < 4; j++) { // 256 * 4 * 4 = 4K - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite, 1 * BYTES_PER_MBYTES + 1, filebuf); - } - } - - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - g_fatFd11[i] = open(g_fatPathname12[i], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[i], -1, g_fatFd11[i], EXIT2); - - len = read(g_fatFd11[i], readbuf, FAT_STANDARD_NAME_LENGTH); - ICUNIT_GOTO_EQUAL(len, 0, len, EXIT2); - - off = lseek(g_fatFd11[i], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT2); - - len = write(g_fatFd11[i], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, 1 * BYTES_PER_MBYTES, len, EXIT2); // BYTES_PER_MBYTES = 1MB - - if (i % FAT_SHORT_ARRAY_LENGTH == 9) { // meet i = 9 close the fat fd - for (k = (i / FAT_SHORT_ARRAY_LENGTH) * FAT_SHORT_ARRAY_LENGTH; k <= i; k++) { - ret = close(g_fatFd11[k]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - } - } - - ICUNIT_GOTO_EQUAL((g_testCount % 2), 0, g_testCount, EXIT2); // 2 for even or not - - free(bufWrite); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - return NULL; -EXIT2: - free(bufWrite); -EXIT1: - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - close(g_fatFd11[i]); - } -EXIT: - for (i = 0; i < FAT_MAXIMUM_SIZES; i++) { - unlink(g_fatPathname12[i]); - } - g_testCount = 0; - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = nullptr; - struct dirent *ptr = nullptr; - pthread_t newThread1, newThread2; - pthread_attr_t attr1, attr2; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - g_fatFlagF02 = 0; - - g_testCount = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - ret = PosixPthreadInit(&attr1, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newThread2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(1); - - ret = PosixPthreadDestroy(&attr2, newThread2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newThread1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2); - - dir = opendir(FAT_PATH_NAME); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newThread2); -EXIT1: - PosixPthreadDestroy(&attr1, newThread1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_029 -* -@tspec The Pressure test -* -@ttitle Create, read ,write and delete the 1000 files -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task create 1000 files; -3. the second task read ,write these files; -4. delete all the directories; -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure029(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_029", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_030.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_030.cpp deleted file mode 100644 index 2dd2486b..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_030.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 len; - INT32 i = 0; - INT32 j = 0; - INT32 fd = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[258] = "abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = NULL; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - struct stat buf1[FAT_PRESSURE_CYCLES][FAT_SHORT_ARRAY_LENGTH] = { 0 }; - - g_fatFlag = 0; - - bufWrite = (CHAR *)malloc(5 * BYTES_PER_MBYTES + 1); // 5 * BYTES_PER_MBYTES = 5MB - ICUNIT_ASSERT_NOT_EQUAL(bufWrite, NULL, 0); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 5 * BYTES_PER_MBYTES + 1); // 5 * BYTES_PER_MBYTES = 5MB - - bufWrite1 = (CHAR *)malloc(256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT); - (void)memset_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, 0, // 256 kb - 256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT1); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb - } - - for (i = 0; i < 4; i++) { // loop 4 times - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb - (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb - } - for (i = 0; i < 5; i++) { // loop 5 times - (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1); - } - free(bufWrite1); - free(bufWrite2); - - for (i = 0; i < FAT_PRESSURE_CYCLES; i++) { - printf("Loop %d a\n", i + 1); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - printf("Loop %d b\n", i + 1); - - for (j = 0; j < 819; j++) { // loop 819 times - fd = open(pathname, O_NONBLOCK | O_RDWR | O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, 5 * BYTES_PER_MBYTES, len, EXIT); // 5 * BYTES_PER_MBYTES = 5MB - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - printf("Loop %d c\n", i + 1); - - for (j = 0; j < 4; j++) { // loop 4 times - fd = open(pathname, O_NONBLOCK | O_RDWR | O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL(len, 256, len, EXIT); // should write 256 bytes - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - printf("Loop %d d\n", i + 1); - - for (j = 0; j < 10; j++) { // loop 10 times - fd = open(pathname, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, fd, EXIT); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname, &buf1[i][j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - ret = remove(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_fatFlag++; - - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - - free(bufWrite); - - return FAT_NO_ERROR; -EXIT1: - free(bufWrite1); -EXIT: - free(bufWrite); - close(fd); - remove(pathname); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_030 -* -@tspec The Pressure test -* -@ttitle write the file to 4GB -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task write the file to 4GB; -3. the second task write one byte to the file once more; -4. delete the files; -* -@texpect -1. Return successed -2. Return successed -3. Return failure -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure030(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_030", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_031.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_031.cpp deleted file mode 100644 index 38e6b42d..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_031.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 len = 0; - INT32 i = 0; - INT32 j = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - off64_t off64Num1, off64Num2; - struct stat64 statbuf1; - - bufWrite = (CHAR *)malloc(8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 8 * BYTES_PER_MBYTES + 1, 0, // 8 * BYTES_PER_MBYTES = 8MB - 8 * BYTES_PER_MBYTES + 1); // 8 * BYTES_PER_MBYTES = 8MB - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, filebuf); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, filebuf); - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 4; i++) { // loop 4 times - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES, bufWrite1); // 8 * BYTES_PER_MBYTES = 8MB - (void)strcat_s(bufWrite, 8 * BYTES_PER_MBYTES, bufWrite1); // 8 * BYTES_PER_MBYTES = 8MB - } - - free(bufWrite1); - free(bufWrite2); - - g_testCount++; - g_fatFlagF01++; - - (void)memset_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(g_fatPathname1, FAT_STANDARD_NAME_LENGTH, "/031.txt"); - - g_fatFd = open64(g_fatPathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd, FAT_IS_ERROR, g_fatFd, EXIT2); - - while (1) { - ret = write(g_fatFd, bufWrite, strlen(bufWrite)); - if (ret <= 0) { - if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 8 MB per write, write 4 * BYTES_PER_KBYTES MB size - printf("The biggest file size is smaller than the 4GB"); - goto EXIT; - } - printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, - g_testCount * 8, // 8MB per write - (g_testCount * 8) * 1.0 / BYTES_PER_KBYTES); // 8 MB per write, BYTES_PER_KBYTES MB/GB - break; - } - g_testCount++; - } - - ret = stat64(g_fatPathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - off64Num1 = lseek64(g_fatFd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off64Num1, statbuf1.st_size, off64Num1, EXIT2); - - len = write(g_fatFd, bufWrite, strlen(bufWrite)); - printf("len=:%d,errno=:%d\t", len, errno); - - free(bufWrite); - - off64Num2 = lseek64(g_fatFd, 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off64Num2, off64Num1, off64Num2, EXIT1); - - ret = close(g_fatFd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - g_fatFlag++; - - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - close(g_fatFd); -EXIT: - errno = 0; - ret = remove(g_fatPathname1); - g_testCount = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, len, fd; - off64_t off64; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - DIR *dir = nullptr; - struct dirent *ptr = nullptr; - pthread_t newThread1; - pthread_attr_t attr1; - struct stat64 statbuf1; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, TASK_PRIO_TEST - 5); // level 5 lower - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_join(newThread1, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - fd = open64(g_fatPathname1, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT3); - - ret = stat64(g_fatPathname1, &statbuf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - off64 = lseek64(fd, -FAT_SHORT_ARRAY_LENGTH, SEEK_END); - ICUNIT_GOTO_EQUAL(off64, statbuf1.st_size - FAT_SHORT_ARRAY_LENGTH, off64, EXIT3); - - (void)memset_s(readbuf, FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - len = read(fd, readbuf, FAT_STANDARD_NAME_LENGTH - 1); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH, len, EXIT3); - ICUNIT_GOTO_STRING_EQUAL(readbuf, "alalalalal", readbuf, EXIT3); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = remove(g_fatPathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT2); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - close(fd); - remove(g_fatPathname1); - goto EXIT; -EXIT2: - closedir(dir); - goto EXIT; -EXIT1: - pthread_join(newThread1, NULL); - pthread_attr_destroy(&attr1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_031 -* -@tspec The Pressure test -* -@ttitle write the file to 4GB -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task write the file to 4GB; -3. the second task write one byte to the file once more; -4. delete the files; -* -@texpect -1. Return successed -2. Return successed -3. Return failure -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure031(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_031", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_038.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_038.cpp deleted file mode 100644 index 1b6a6f3b..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_038.cpp +++ /dev/null @@ -1,389 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static CHAR g_fat1650Pathname4[FAT_SHORT_ARRAY_LENGTH][FAT_SHORT_ARRAY_LENGTH][FAT_NAME_LIMITTED_SIZE] = {0, }; -static CHAR g_fat1650Pathname5[FAT_SHORT_ARRAY_LENGTH][FAT_SHORT_ARRAY_LENGTH][FAT_NAME_LIMITTED_SIZE] = {0, }; -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 len; - INT32 i = 0; - INT32 j = 0; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *bufRead = nullptr; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)memset_s(g_fatPathname6, FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)strcat_s(g_fatPathname6, FAT_NAME_LIMITTED_SIZE, pathname1); - - g_testCount++; - g_fatFlagF01++; - - for (i = 0; i < FAT_SHORT_ARRAY_LENGTH; i++) { - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); - - (void)memset_s(g_fatPathname11[i], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", i); - (void)strcat_s(g_fatPathname6, FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcpy_s(g_fatPathname11[i], FAT_NAME_LIMITTED_SIZE, g_fatPathname6); - - ret = mkdir(g_fatPathname11[i], S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - for (j = 0; j < FAT_SHORT_ARRAY_LENGTH; j++) { - (void)memset_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, strlen(bufname)); - (void)memset_s(g_fat1650Pathname4[i][j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(g_fat1650Pathname5[i][j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", j); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, g_fatPathname6); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, ".txt"); - (void)strcpy_s(g_fat1650Pathname4[i][j], FAT_NAME_LIMITTED_SIZE, g_fatPathname7); - - (void)memset_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, g_fatPathname6); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname7, FAT_NAME_LIMITTED_SIZE, ".cpp"); - (void)strcpy_s(g_fat1650Pathname5[i][j], FAT_NAME_LIMITTED_SIZE, g_fatPathname7); - - g_fatFd12[i][j] = - open(g_fat1650Pathname4[i][j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd12[i][j], -1, g_fatFd12[i][j], EXIT1); - - ret = close(g_fatFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - bufRead = (CHAR *)malloc(10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_NOT_EQUAL(bufRead, NULL, 0, EXIT1); - (void)memset_s(bufRead, 10 * BYTES_PER_MBYTES + 1, 0, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - - for (i = 0; i < 10; i++) { // loop 10 times - for (j = 0; j < 10; j++) { // loop 10 times - g_fatFd12[i][j] = open(g_fat1650Pathname4[i][j], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd12[i][j], -1, g_fatFd12[i][j], EXIT2); - - len = read(g_fatFd12[i][j], bufRead, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_EQUAL(len, 10 * BYTES_PER_MBYTES, len, EXIT2); // 10 * BYTES_PER_MBYTES = 10MB - - ret = close(g_fatFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - } - - free(bufRead); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_fatFlag++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - return NULL; -EXIT2: - free(bufRead); -EXIT1: - for (i = 0; i < 10; i++) { // loop 10 times - for (j = 0; j < 10; j++) { // loop 10 times - close(g_fatFd12[i][j]); - } - } -EXIT: - for (i = 9; i >= 0; i--) { // loop 9 + 1 times - for (j = 9; j >= 0; j--) { // loop 9 + 1 times - remove(g_fat1650Pathname4[i][j]); - remove(g_fat1650Pathname5[i][j]); - } - - remove(g_fatPathname11[i]); - } - g_testCount = 0; - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 i = 0; - INT32 j = 0; - INT32 len; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - bufWrite = (CHAR *)malloc(10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 10 * BYTES_PER_MBYTES + 1, 0, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - - bufWrite1 = (CHAR *)malloc(512 * BYTES_PER_KBYTES + 1); // 512 * BYTES_PER_KBYTES = 512KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, 512 * BYTES_PER_KBYTES + 1, 0, // 512 kb - 512 * BYTES_PER_KBYTES + 1); // 512 * BYTES_PER_KBYTES = 512KB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 8; j++) { // loop 8 times - (void)strcat_s(bufWrite1, 512 * BYTES_PER_KBYTES + 1, bufWrite2); // 512 kb - (void)strcat_s(bufWrite1, 512 * BYTES_PER_KBYTES + 1, bufWrite2); // 512 kb - (void)strcat_s(bufWrite1, 512 * BYTES_PER_KBYTES + 1, bufWrite2); // 512 kb - (void)strcat_s(bufWrite1, 512 * BYTES_PER_KBYTES + 1, bufWrite2); // 512 kb - } - - for (i = 0; i < 10; i++) { // loop 10 times - (void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES + 1, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB - (void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES + 1, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB - } - free(bufWrite1); - free(bufWrite2); - for (i = 0; i < 10; i++) { // loop 10 times - for (j = 0; j < 10; j++) { // loop 10 times - g_fatFd12[i][j] = open(g_fat1650Pathname4[i][j], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd12[i][j], -1, g_fatFd12[i][j], EXIT2); - - len = write(g_fatFd12[i][j], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, 10 * BYTES_PER_MBYTES, len, EXIT2); // 10 * BYTES_PER_MBYTES = 10MB - - ret = close(g_fatFd12[i][j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - } - free(bufWrite); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - for (i = 0; i < 10; i++) { // loop 10 times - for (j = 0; j < 10; j++) { // loop 10 times - ret = rename(g_fat1650Pathname4[i][j], g_fat1650Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - for (i = 9; i >= 0; i--) { // loop 9 + 1 times - for (j = 9; j >= 0; j--) { // loop 9 + 1 times - ret = remove(g_fat1650Pathname5[i][j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - ret = remove(g_fatPathname11[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_fatFlagF02++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - for (i = 0; i < 10; i++) { // loop 10 times - for (j = 0; j < 10; j++) { // loop 10 times - close(g_fatFd12[i][j]); - } - } -EXIT: - for (i = 9; i >= 0; i--) { // loop 9 + 1 times - for (j = 9; j >= 0; j--) { // loop 9 + 1 times - remove(g_fat1650Pathname4[i][j]); - remove(g_fat1650Pathname5[i][j]); - } - remove(g_fatPathname11[i]); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - g_testCount = 0; - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = nullptr; - struct dirent *ptr = nullptr; - pthread_t newThread1, newThread2; - pthread_attr_t attr1, attr2; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - g_fatFlagF02 = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newThread2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(FAT_SHORT_ARRAY_LENGTH); - - ret = PosixPthreadDestroy(&attr2, newThread2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newThread1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT); - - dir = opendir(FAT_PATH_NAME); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newThread2); -EXIT1: - PosixPthreadDestroy(&attr1, newThread1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_038 -* -@tspec The Pressure test -* -@ttitle Create the 10-level directory and create 10 subdirectories while creating the directory -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task create the 10-level directory ; -3. the another task create 10 subdirectories while creating the directory; -4. delete the directories and files; -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure038(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_038", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_040.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_040.cpp deleted file mode 100644 index b220052e..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_040.cpp +++ /dev/null @@ -1,418 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 j = 0; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - g_fatFlagF01++; - ret = format(FAT_DEV_PATH1, 0, 0); - ICUNIT_GOTO_NOT_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - for (j = 0; j < 4; j++) { // loop 4 times - (void)memset_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(g_fatPathname13[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_STANDARD_NAME_LENGTH); - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", j); - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_fatPathname13[j], FAT_NAME_LIMITTED_SIZE, pathname); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname13[j], FAT_NAME_LIMITTED_SIZE, bufname); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, ".txt"); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, ".cpp"); - (void)strcat_s(g_fatPathname13[j], FAT_NAME_LIMITTED_SIZE, ".jpg"); - - g_fatFd11[j] = open(g_fatPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 100 * BYTES_PER_MBYTES, off, // 100mb - EXIT2); - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[3], 0, SEEK_END); // fd 3 - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT2); // 256 * BYTES_PER_KBYTES = 256KB - - for (j = 0; j < 4; j++) { // loop 4 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < FAT_MOUNT_CYCLES_TEST; j++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < FAT_MOUNT_CYCLES_TEST; j++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - for (j = 0; j < 4; j++) { // loop 4 times - ret = access(g_fatPathname13[j], F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - g_fatFlag++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - return NULL; -EXIT3: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT2: - for (j = 0; j < 4; j++) { // loop 4 times - close(g_fatFd11[j]); - } - - for (j = 0; j < 4; j++) { // loop 4 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - remove(g_fatPathname13[j]); - } -EXIT: - g_testCount = 0; - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 j = 0; - UINT64 len; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - CHAR *bufWrite3 = NULL; - CHAR *bufWrite4 = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - bufWrite1 = (CHAR *)malloc(FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, 0, - FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite3 = (CHAR *)malloc(256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, 0, EXIT4); - (void)memset_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, 0, 256 * BYTES_PER_KBYTES + 1); // 256 kb - - bufWrite4 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite4, NULL, 0, EXIT5); - (void)memset_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 4; j++) { // loop 4 times - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES + 1, bufWrite2); - } - - free(bufWrite4); - - g_testCount++; - - for (j = 0; j < FAT_SHORT_ARRAY_LENGTH; j++) { - len = write(g_fatFd11[0], bufWrite1, strlen(bufWrite1)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES, len, EXIT5); // BYTES_PER_MBYTES = 1MB - } - - len = write(g_fatFd11[1], bufWrite1, strlen(bufWrite1)); - ICUNIT_GOTO_EQUAL(len, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES, len, EXIT5); // BYTES_PER_MBYTES = 1MB - - len = write(g_fatFd11[2], bufWrite2, strlen(bufWrite2)); // fd11 2 - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTES, len, EXIT5); - - len = write(g_fatFd11[3], bufWrite3, strlen(bufWrite3)); // fd 3 - ICUNIT_GOTO_EQUAL(len, 256 * BYTES_PER_KBYTES, len, EXIT5); // 256 * BYTES_PER_KBYTES = 256KB - - free(bufWrite1); - free(bufWrite2); - free(bufWrite3); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < 4; j++) { // loop 4 times - ret = rename(g_fatPathname11[j], g_fatPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < 4; j++) { // loop 4 times - ret = rename(g_fatPathname12[j], g_fatPathname13[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < 4; j++) { // loop 4 times - g_fatFd11[j] = open(g_fatPathname13[j], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 100 * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 100 MB - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[3], 0, SEEK_END); // fd 3 - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT2); // 256 * BYTES_PER_KBYTES = 256KB - - for (j = 0; j < 4; j++) { // loop 4 times - ret = close(g_fatFd11[j]); - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(g_fatPathname13[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_fatFlagF02++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - return NULL; -EXIT5: - free(bufWrite3); -EXIT4: - free(bufWrite1); -EXIT3: - free(bufWrite1); -EXIT2: - for (j = 0; j < 4; j++) { // loop 4 times - close(g_fatFd11[j]); - } -EXIT1: - for (j = 0; j < 4; j++) { // loop 4 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - remove(g_fatPathname13[j]); - } - - g_testCount = 0; - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newThread1, newThread2; - pthread_attr_t attr1, attr2; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - g_fatFlagF02 = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newThread2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(FAT_SHORT_ARRAY_LENGTH); - - ret = PosixPthreadDestroy(&attr2, newThread2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newThread1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2); - - dir = opendir(FAT_PATH_NAME); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newThread2); -EXIT1: - PosixPthreadDestroy(&attr1, newThread1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_040 -* -@tspec The Pressure test -* -@ttitle After the creation of four documents 1000 umount / mount 1,000 months after the renaming documents umount / -mount -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task create 4 files ; -3. the another task rename the files and mount/umount the filesysterm; -4. delete the files; -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure040(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_040", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_041.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_041.cpp deleted file mode 100644 index 96583215..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_041.cpp +++ /dev/null @@ -1,413 +0,0 @@ -/* - * 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. - */ - - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 j = 0; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = "/vs/sd/fat_1655"; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - g_fatFlagF01++; - - for (j = 0; j < 4; j++) { // loop 4 times - (void)memset_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); - - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", j); - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, pathname2); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, bufname); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, ".txt"); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, ".txt"); - - g_fatFd11[j] = open(g_fatPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 100 * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 100 MB - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, FAT_SHORT_ARRAY_LENGTH * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[3], 0, SEEK_END); // fd 3 - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT2); // 256 * BYTES_PER_KBYTES = 256KB - - for (j = 0; j < 4; j++) { // loop 4 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < FAT_MAXIMUM_OPERATIONS; j++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < FAT_MAXIMUM_OPERATIONS; j++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - for (j = 0; j < 4; j++) { // loop 4 times - ret = access(g_fatPathname12[j], F_OK); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - g_fatFlag++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - return NULL; -EXIT3: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); -EXIT2: - for (j = 0; j < 4; j++) { // loop 4 times - close(g_fatFd11[j]); - } - - for (j = 0; j < 4; j++) { // loop 4 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - } -EXIT: - g_testCount = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 j = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = "/vs/sd/fat_1655"; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - CHAR *bufWrite3 = NULL; - CHAR *bufWrite4 = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - bufWrite1 = (CHAR *)malloc(10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, 0, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - - bufWrite2 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite3 = (CHAR *)malloc(256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, 0, EXIT4); - (void)memset_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, 0, 256 * BYTES_PER_KBYTES + 1); // 256 kb - - bufWrite4 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite4, NULL, 0, EXIT5); - (void)memset_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 4; j++) { // loop 4 times - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - } - - free(bufWrite4); - - g_testCount++; - - for (j = 0; j < 10; j++) { // loop 10 times - ret = write(g_fatFd11[0], bufWrite1, strlen(bufWrite1)); - ICUNIT_GOTO_EQUAL(ret, 10 * BYTES_PER_MBYTES, ret, EXIT5); // 10 * BYTES_PER_MBYTES = 10MB - } - - ret = write(g_fatFd11[1], bufWrite1, strlen(bufWrite1)); - ICUNIT_GOTO_EQUAL(ret, 10 * BYTES_PER_MBYTES, ret, EXIT5); // 10 * BYTES_PER_MBYTES = 10MB - - ret = write(g_fatFd11[2], bufWrite2, strlen(bufWrite2)); // fd 2 - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTES, ret, EXIT5); // BYTES_PER_MBYTES = 1MB - - ret = write(g_fatFd11[3], bufWrite3, strlen(bufWrite3)); // fd 3 - ICUNIT_GOTO_EQUAL(ret, 256 * BYTES_PER_KBYTES, ret, EXIT5); // 256 * BYTES_PER_KBYTES = 256KB - - free(bufWrite1); - free(bufWrite2); - free(bufWrite3); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < 4; j++) { // loop 4 times - g_fatFd11[j] = open(g_fatPathname12[j], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 100 * BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 100 MB - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10 * BYTES_PER_MBYTES, off, EXIT2); // 10 mb - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[3], 0, SEEK_END); // fd 3 - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT2); // 256 * BYTES_PER_KBYTES = 256KB - - for (j = 0; j < 4; j++) { // loop 4 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(g_fatPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - ret = remove(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - g_fatFlagF02++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - return NULL; -EXIT5: - free(bufWrite3); -EXIT4: - free(bufWrite2); -EXIT3: - free(bufWrite1); -EXIT2: - for (j = 0; j < 4; j++) { // loop 4 times - close(g_fatFd11[j]); - } -EXIT1: - for (j = 0; j < 4; j++) { // loop 4 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - } - - g_testCount = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = nullptr; - struct dirent *ptr = nullptr; - pthread_t newThread1, newThread2; - pthread_attr_t attr1, attr2; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - g_fatFlagF02 = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newThread2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - sleep(5); // sleep 5s - - ret = PosixPthreadDestroy(&attr2, newThread2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newThread1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - - dir = opendir(FAT_PATH_NAME); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newThread2); -EXIT1: - PosixPthreadDestroy(&attr1, newThread1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_041 -* -@tspec The Pressure test -* -@ttitle After the creation of four documents 1000 umount / mount 1,000 months after renaming the directory -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task create 4 files ; -3. the another task rename the directory and mount/umount the filesysterm; -4. delete the files; -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure041(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_041", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_042.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_042.cpp deleted file mode 100644 index 2efbe904..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_042.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 ret; - INT32 len; - INT32 j = 0; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = "123456"; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR *bufRead1 = NULL; - CHAR *bufRead2 = NULL; - CHAR *bufRead3 = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - g_fatFlagF01++; - - for (j = 0; j < 3; j++) { // loop 3 times - (void)memset_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, 0, FAT_NAME_LIMITTED_SIZE); - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); - - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", j); - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, pathname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, pathname2); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, bufname); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, bufname); - - (void)strcat_s(g_fatPathname11[j], FAT_NAME_LIMITTED_SIZE, ".txt"); - (void)strcat_s(g_fatPathname12[j], FAT_NAME_LIMITTED_SIZE, ".cpp"); - - g_fatFd11[j] = open(g_fatPathname11[j], O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - bufRead1 = (CHAR *)malloc(10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_NOT_EQUAL(bufRead1, NULL, 0, EXIT2); - (void)memset_s(bufRead1, 10 * BYTES_PER_MBYTES + 1, 0, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - - bufRead2 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufRead2, NULL, 0, EXIT3); - (void)memset_s(bufRead2, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufRead3 = (CHAR *)malloc(256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - ICUNIT_GOTO_NOT_EQUAL(bufRead3, NULL, 0, EXIT4); - (void)memset_s(bufRead3, 256 * BYTES_PER_KBYTES + 1, 0, 256 * BYTES_PER_KBYTES + 1); // 256 kb - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 10 * BYTES_PER_MBYTES, off, EXIT5); // 10 mb - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT5); - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT5); // 256 kb - - off = lseek(g_fatFd11[0], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT5); - - off = lseek(g_fatFd11[1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT5); - - off = lseek(g_fatFd11[2], 0, SEEK_SET); // fd 2 - ICUNIT_GOTO_EQUAL(off, 0, off, EXIT5); - - len = read(g_fatFd11[0], bufRead1, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_EQUAL(len, 10 * BYTES_PER_MBYTES, len, EXIT5); - - len = read(g_fatFd11[1], bufRead2, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTES, len, EXIT5); - - len = read(g_fatFd11[2], bufRead3, 256 * BYTES_PER_KBYTES + 1); // 256 kb - ICUNIT_GOTO_EQUAL(len, 256 * BYTES_PER_KBYTES, len, EXIT5); // 256 kb - - for (j = 0; j < 3; j++) { // loop 3 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT5); - } - - for (j = 0; j < 3; j++) { // loop 3 times - g_fatFd11[j] = open(g_fatPathname11[j], O_NONBLOCK | O_TRUNC | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT5); - } - - len = write(g_fatFd11[0], bufRead2, strlen(bufRead2)); - ICUNIT_GOTO_EQUAL(len, BYTES_PER_MBYTES, len, EXIT5); - - len = write(g_fatFd11[1], bufRead3, strlen(bufRead3)); - ICUNIT_GOTO_EQUAL(len, 256 * BYTES_PER_KBYTES, len, EXIT5); // 256 kb - - len = write(g_fatFd11[2], bufRead1, strlen(bufRead1)); // fd 2 - ICUNIT_GOTO_EQUAL(len, 10 * BYTES_PER_MBYTES, len, EXIT5); // 10 mb - - for (j = 0; j < 3; j++) { // loop 3 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT5); - } - - free(bufRead1); - free(bufRead2); - free(bufRead3); - - g_fatFlag++; - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - return NULL; -EXIT5: - free(bufRead3); -EXIT4: - free(bufRead2); -EXIT3: - free(bufRead1); -EXIT2: - for (j = 0; j < 3; j++) { // loop 3 times - close(g_fatFd11[j]); - } - - for (j = 0; j < 3; j++) { // loop 3 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - } -EXIT: - g_testCount = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 ret; - INT32 j = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[260] = "abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123" - "456789abcedfghij9876550210abcdeabcde0123456789abcedfghij9876550210abcdeabcde0123456789abcedfgh" - "ij9876550210abcdeabcde0123456789abcedfghij9876550210lalalalalalalala"; - CHAR *bufWrite1 = NULL; - CHAR *bufWrite2 = NULL; - CHAR *bufWrite3 = NULL; - CHAR *bufWrite4 = NULL; - off_t off; - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - bufWrite1 = (CHAR *)malloc(10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, 0, 10 * BYTES_PER_MBYTES + 1); // 10 * BYTES_PER_MBYTES = 10MB - - bufWrite2 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite3 = (CHAR *)malloc(256 * BYTES_PER_KBYTES + 1); // 256 * BYTES_PER_KBYTES = 256KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, 0, EXIT4); - (void)memset_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, 0, 256 * BYTES_PER_KBYTES + 1); // 256 kb - - bufWrite4 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite4, NULL, 0, EXIT5); - (void)memset_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite4, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 4; j++) { // loop 4 times - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - (void)strcat_s(bufWrite3, 256 * BYTES_PER_KBYTES + 1, bufWrite4); // 256 kb - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - (void)strcat_s(bufWrite2, BYTES_PER_MBYTES + 1, bufWrite3); - } - - for (j = 0; j < 2; j++) { // loop 2 times - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb - } - - free(bufWrite4); - - g_testCount++; - - ret = write(g_fatFd11[0], bufWrite1, strlen(bufWrite1)); - ICUNIT_GOTO_EQUAL(ret, 10 * BYTES_PER_MBYTES, ret, EXIT5); // 10 * BYTES_PER_MBYTES = 10MB - - ret = write(g_fatFd11[1], bufWrite2, strlen(bufWrite2)); - ICUNIT_GOTO_EQUAL(ret, BYTES_PER_MBYTES, ret, EXIT5); // BYTES_PER_MBYTES = 1MB - - ret = write(g_fatFd11[2], bufWrite3, strlen(bufWrite3)); // fd 2 - ICUNIT_GOTO_EQUAL(ret, 256 * BYTES_PER_KBYTES, ret, EXIT5); // 256 * BYTES_PER_KBYTES = 256KB - - free(bufWrite1); - free(bufWrite2); - free(bufWrite3); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(1); - - ret = pthread_mutex_lock(&g_vfatGlobalLock1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (j = 0; j < 3; j++) { // loop 3 times - ret = rename(g_fatPathname11[j], g_fatPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - for (j = 0; j < FAT_MOUNT_CYCLES_TEST; j++) { - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT7); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT7); - } - - for (j = 0; j < 3; j++) { // loop 3 times - g_fatFd11[j] = open(g_fatPathname12[j], O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(g_fatFd11[j], -1, g_fatFd11[j], EXIT2); - } - - off = lseek(g_fatFd11[0], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, BYTES_PER_MBYTES, off, EXIT2); // BYTES_PER_MBYTES = 1MB - - off = lseek(g_fatFd11[1], 0, SEEK_END); - ICUNIT_GOTO_EQUAL(off, 256 * BYTES_PER_KBYTES, off, EXIT2); // 256 * BYTES_PER_KBYTES = 256KB - - off = lseek(g_fatFd11[2], 0, SEEK_END); // the 2 nd fd - ICUNIT_GOTO_EQUAL(off, 10 * BYTES_PER_MBYTES, off, EXIT2); // 10 mb - - for (j = 0; j < 3; j++) { // loop 3 times - ret = close(g_fatFd11[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = unlink(g_fatPathname12[j]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_fatFlagF02++; - - ret = rmdir(pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - - LosTaskDelay(2); // delay 2 s - - return NULL; -EXIT7: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, "vfat", 0, NULL); - goto EXIT2; - - free(bufWrite4); -EXIT5: - free(bufWrite3); -EXIT4: - free(bufWrite2); -EXIT3: - free(bufWrite1); -EXIT2: - for (j = 0; j < 3; j++) { // loop 3 times - close(g_fatFd11[j]); - } -EXIT1: - for (j = 0; j < 3; j++) { // loop 3 times - remove(g_fatPathname11[j]); - remove(g_fatPathname12[j]); - } -EXIT: - g_testCount = 0; - remove(pathname2); - (void)pthread_mutex_unlock(&g_vfatGlobalLock1); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = NULL; - struct dirent *ptr = NULL; - pthread_t newThread1, newThread2; - pthread_attr_t attr1, attr2; - - g_fatFlag = 0; - g_fatFlagF01 = 0; - g_fatFlagF02 = 0; - - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - while ((g_fatFlag < FAT_PRESSURE_CYCLES) && (g_fatFlag == g_fatFlagF01)) { - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newThread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = PosixPthreadInit(&attr2, 20); // level 20 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newThread2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - LosTaskDelay(10); // delay 10 s - - ret = PosixPthreadDestroy(&attr2, newThread2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newThread1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - printf("\tg_fatFlag=:%d\t", g_fatFlag); - } - printf("\n"); - ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2); - - dir = opendir(FAT_PATH_NAME); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); - - ptr = readdir(dir); - ICUNIT_GOTO_EQUAL(ptr, NULL, ptr, EXIT3); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - closedir(dir); - goto EXIT; -EXIT2: - PosixPthreadDestroy(&attr2, newThread2); -EXIT1: - PosixPthreadDestroy(&attr1, newThread1); -EXIT: - rmdir(FAT_PATH_NAME); - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_PRESSURE_042 -* -@tspec The Pressure test -* -@ttitle After the creation of four documents 1000 umount / mount 1,000 months after read and write -* -@tprecon The filesystem module is open -* -@tbrief -1. create two tasks; -2. the first task create 3 files ; -3. the another task read and write the files and mount/umount the filesysterm; -4. delete the files; -* -@texpect -1. Return successed -2. Return successed -3. Return successed -4. Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFatPressure042(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_042", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_301.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_301.cpp deleted file mode 100644 index 06aa1e13..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_301.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = -1; - INT32 len; - INT32 i = FAT_SHORT_ARRAY_LENGTH; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR buffile[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[20 + 1] = "12345678901234567890"; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - struct statfs buf4 = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/cdir"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(buffile, FAT_STANDARD_NAME_LENGTH, "/cdir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf1); - - ret = statfs(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT); - - while (i--) { - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(filebuf), len, EXIT); - } - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf3); - - ret = statfs(buffile, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf4); - - ICUNIT_GOTO_EQUAL(buf3.f_type, 0x4d44, buf3.f_type, EXIT); - ICUNIT_GOTO_EQUAL(buf4.f_type, 0x4d44, buf4.f_type, EXIT); - ICUNIT_GOTO_EQUAL(buf3.f_namelen, 0xFF, buf3.f_namelen, EXIT); - ICUNIT_GOTO_EQUAL(buf4.f_namelen, 0xFF, buf4.f_namelen, EXIT); - ICUNIT_GOTO_EQUAL(buf3.f_bsize, 4096, buf3.f_bsize, EXIT); // 4096 for size 4k - ICUNIT_GOTO_EQUAL(buf4.f_bsize, 4096, buf4.f_bsize, EXIT); // 4096 for size 4k - - i = 250; // loop time 250 - while (i--) { - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(filebuf), len, EXIT); - } - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf3); - - ret = statfs(buffile, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatfsPrintf(buf4); - - FatDeleteFile(fd, buffile); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - return FAT_NO_ERROR; -EXIT: - format(FAT_DEV_PATH, 8, 0); // cluster size 8, 0 for auto -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure301(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_301", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} \ No newline at end of file diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_302.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_302.cpp deleted file mode 100644 index 01d621b7..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_302.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR buffile[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 n = 103; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/dir"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(buffile, FAT_STANDARD_NAME_LENGTH, "/dir/files"); - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - while (n--) { - len = write(fd, "0123456789012345678901234567890123456789", 40); // write 40 bytes - ICUNIT_GOTO_EQUAL(len, 40, len, EXIT); // len must be 40 - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(buffile, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ICUNIT_GOTO_EQUAL(buf1.st_blocks, buf2.st_blocks, buf1.st_blocks, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_size, buf2.st_size, buf1.st_size, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_mode, buf2.st_mode, buf1.st_mode, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT); - - FatDeleteFile(fd, buffile); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - format(FAT_DEV_PATH, 8, 0); // cluster size 8, 0 for auto - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure302(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_302", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_303.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_303.cpp deleted file mode 100644 index c2996ca6..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_303.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 fd = -1; - INT32 ret, len; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - INT32 n = 256; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/dir"); - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - (void)strcat_s(pathname3, FAT_STANDARD_NAME_LENGTH, "/dir/files"); - fd = open(pathname3, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - while (n--) { - len = write(fd, "01234567890123456789012345", 16); // len 16 - ICUNIT_GOTO_EQUAL(len, 16, len, EXIT); - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = stat(pathname3, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - fd = open(pathname3, O_NONBLOCK | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT); - - ret = fstat(fd, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ICUNIT_GOTO_EQUAL(buf1.st_size, 16 * 256, buf1.st_size, EXIT); // 16 * 256 = 4k - ICUNIT_GOTO_EQUAL(buf2.st_size, 16 * 256, buf2.st_size, EXIT); // 16 * 256 = 4k - ICUNIT_GOTO_EQUAL(buf1.st_blocks, 1, buf1.st_blocks, EXIT); - ICUNIT_GOTO_EQUAL(buf2.st_blocks, 1, buf2.st_blocks, EXIT); - - ICUNIT_GOTO_EQUAL(buf1.st_mode & S_IFMT, S_IFREG, buf1.st_mode & S_IFMT, EXIT); - ICUNIT_GOTO_EQUAL(buf2.st_mode & S_IFMT, S_IFREG, buf2.st_mode & S_IFMT, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_blksize, buf2.st_blksize, buf1.st_blksize, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_ino, buf2.st_ino, buf1.st_ino, EXIT); - ICUNIT_GOTO_EQUAL(buf1.st_mtim.tv_nsec, buf2.st_mtim.tv_nsec, buf1.st_mtim.tv_nsec, EXIT); - - FatDeleteFile(fd, pathname3); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT: - format(FAT_DEV_PATH, 8, 0); // cluster size 8, 0 for auto - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure303(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_303", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_305.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_305.cpp deleted file mode 100644 index 8b1bc1e4..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_305.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - DIR *dir = NULL; - DIR *dir1[50]; - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - while (i < 50) { // loop 50 times - dir1[i] = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT2); - - i++; - } - - for (i = 0; i < 50; i++) { // loop 50 times - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - return FAT_NO_ERROR; -EXIT3: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - goto EXIT; -EXIT2: - for (; i >= 0; i--) { - closedir(dir1[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure305(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_305", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_306.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_306.cpp deleted file mode 100644 index 4069af0b..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_306.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR pathname2[50][FAT_STANDARD_NAME_LENGTH] = {FAT_PATH_NAME, }; - CHAR bufname[FAT_SHORT_ARRAY_LENGTH] = ""; - DIR *dir = NULL; - DIR *dir1[50] = {NULL, }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT4); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT4); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT4); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - for (i = 0; i < 50; i++) { // loop 50 times - (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); - (void)memset_s(pathname2[i], FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH); - (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", i); - FatStrcat2(pathname2[i], bufname, FAT_STANDARD_NAME_LENGTH); - - ret = mkdir(pathname2[i], S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < 50; i++) { // loop 50 times - dir1[i] = opendir(pathname2[i]); - ICUNIT_GOTO_NOT_EQUAL(dir1[i], NULL, dir1[i], EXIT3); - } - - for (i = 0; i < 50; i++) { // loop 50 times - ret = closedir(dir1[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - } - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - for (i = 0; i < 50; i++) { // loop 50 times - ret = remove(pathname2[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - } - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT4: - mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - goto EXIT; -EXIT3: - for (i = 0; i < 50; i++) { // loop 50 times - closedir(dir1[i]); - } -EXIT2: - for (i = 0; i < 50; i++) { // loop 50 times - remove(pathname2[i]); - } -EXIT1: - closedir(dir); -EXIT: - remove(pathname1); -EXIT0: - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure306(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_306", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_309.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_309.cpp deleted file mode 100644 index 199f82f0..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_fs_fat_pressure_309.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - - -#include "It_vfs_fat.h" - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 i = 0; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_MAIN_DIR; - DIR *dir = NULL; - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = mount(FAT_DEV_PATH1, FAT_MOUNT_DIR, "vfat", 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - dir = opendir(pathname1); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < 20; i++) { // loop 20 times - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = format(FAT_DEV_PATH, 8, 2); // cluster size 8 2 for FAT32 - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - } - - ret = format(FAT_DEV_PATH, 8, 0); // cluster size 8, 0 for auto - ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT2: - mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - goto EXIT; -EXIT1: - closedir(dir); -EXIT: - return FAT_NO_ERROR; -} - -VOID ItFsFatPressure309(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_PRESSURE_309", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL3, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_003.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_003.cpp deleted file mode 100644 index 05798938..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_003.cpp +++ /dev/null @@ -1,546 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100 - len = write(fd1[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100 - len = write(fd1[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100 - len = write(fd1[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd1[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd1[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_003 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread003(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_003", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_004.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_004.cpp deleted file mode 100644 index ca68b6b7..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_004.cpp +++ /dev/null @@ -1,509 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - printf("In %s,line %d\n", __FUNCTION__, __LINE__); - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file_%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file_%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - printf("In %s,line %d\n", __FUNCTION__, __LINE__); - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(10); // delay 10 s - printf("pthread_f02 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file_%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file_%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 fd1[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - printf("In %s,line %d\n", __FUNCTION__, __LINE__); - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - printf("In %s,line %d, i =%d\n", __FUNCTION__, __LINE__, i); - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file_%d.txt", - index1); - fd1[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - len = write(fd1[index1], writebuf, strlen(writebuf)); - - ret = close(fd1[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is excecuting\n"); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file_%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd1[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file_%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_004 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread004(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_004", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_005.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_005.cpp deleted file mode 100644 index adcbf5df..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_005.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len; - INT32 flag = 0; - INT32 fd = -1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - printf("pthread_f01 is excecuting\n"); - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file0.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 kb - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - free(bufWrite); - - printf("pthread_f01 exiting\n"); - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len; - INT32 flag = 0; - INT32 fd = -1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - printf("pthread_f02 is excecuting\n"); - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file1.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 kb - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f02 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - free(bufWrite); - - printf("pthread_f02 exiting\n"); - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len; - INT32 flag = 0; - INT32 fd = -1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - printf("pthread_f03 is excecuting\n"); - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file2.txt"); - fd = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 kb - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f03 is excecuting\n"); - - ret = lseek(fd, 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - len = read(fd, readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - g_testCount++; - - free(bufWrite); - - printf("pthread_f03 exiting\n"); - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - close(fd); -EXIT: - unlink(pathname); - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_005 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread005(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_005", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_006.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_006.cpp deleted file mode 100644 index 4a3212f6..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_006.cpp +++ /dev/null @@ -1,710 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR *bufWrite3 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - index = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 k - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - bufWrite3 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, NULL, EXIT); - (void)memset_s(bufWrite3, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite3, BYTES_PER_MBYTES + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test0/test00/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index1], bufWrite3, strlen(bufWrite3)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f01 is excecuting\n"); - - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test0/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite3); - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(pathname); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test0/test00/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR *bufWrite3 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - index = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 k - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f02 is excecuting\n"); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - bufWrite3 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, NULL, EXIT); - (void)memset_s(bufWrite3, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite3, BYTES_PER_MBYTES + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test1/test11/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index1], bufWrite3, strlen(bufWrite3)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite3); - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(pathname); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test1/test11/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR *bufWrite1 = nullptr; - CHAR *bufWrite2 = nullptr; - CHAR *bufWrite3 = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); - (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb - - bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); - (void)memset_s(bufWrite1, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - bufWrite2 = (CHAR *)malloc(16 * BYTES_PER_KBYTES + 1); // 16 * BYTES_PER_KBYTES = 16KB - ICUNIT_GOTO_NOT_EQUAL(bufWrite2, NULL, 0, EXIT3); - (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16 kb - } - - for (j = 0; j < 16; j++) { // loop 16 times - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - (void)strcat_s(bufWrite1, BYTES_PER_MBYTES + 1, bufWrite2); - } - - for (i = 0; i < 2; i++) { // loop 2 times - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1); - } - - free(bufWrite1); - free(bufWrite2); - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - index = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < (8 * BYTES_PER_KBYTES / 8); j++) { // 8 k - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - bufWrite3 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite3, NULL, NULL, EXIT); - (void)memset_s(bufWrite3, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite3, BYTES_PER_MBYTES + 1, filebuf); - } - - index1 = 0; - for (i = 0; i < FAT_LONG_FILESIZE; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test2/test22/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index1], bufWrite3, strlen(bufWrite3)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = lseek(fd[index1], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index1], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite3); - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT3: - free(bufWrite1); -EXIT2: - free(bufWrite); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/vs/sd/test2/test22/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_006 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread006(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_006", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_008.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_008.cpp deleted file mode 100644 index 619eb952..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_008.cpp +++ /dev/null @@ -1,555 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_STANDARD_NAME_LENGTH; i++) { // 50 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // д100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite); - index1 = FAT_STANDARD_NAME_LENGTH; - for (i = FAT_STANDARD_NAME_LENGTH; i < FAT_MAX_CYCLES; i++) { // 50 ¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // write 4 bytes - if (len <= 0) { - flag = 1; - break; - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - return NULL; - - free(bufWrite); -EXIT1: - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_STANDARD_NAME_LENGTH; i++) { // 50 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // д100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite); - index1 = FAT_STANDARD_NAME_LENGTH; - for (i = FAT_STANDARD_NAME_LENGTH; i < FAT_MAX_CYCLES; i++) { // 50 ¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // write 4 bytes - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - return NULL; - - free(bufWrite); -EXIT1: - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test1/file%d.txt", i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len; - INT32 index = 0; - INT32 index1 = 0; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "1111"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_STANDARD_NAME_LENGTH; i++) { // 50 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // д100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - free(bufWrite); - index1 = FAT_STANDARD_NAME_LENGTH; - for (i = FAT_STANDARD_NAME_LENGTH; i < FAT_MAX_CYCLES; i++) { // 50 ¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", - index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - len = write(fd[index1], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, 4, len, EXIT1); // write 4 bytes - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - - return NULL; - -EXIT1: - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index1; i >= FAT_STANDARD_NAME_LENGTH; i--) { - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test2/file%d.txt", i); - unlink(pathname1); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/vs/sd/test0/file%d.txt", i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_008 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread008(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_008", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_009.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_009.cpp deleted file mode 100644 index 6959b2a1..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_009.cpp +++ /dev/null @@ -1,404 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // 100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100 - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - struct stat buf1 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100 - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - -EXIT1: - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - unlink(pathname); - } - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_009 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread009(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_009", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_010.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_010.cpp deleted file mode 100644 index a7e1f733..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_010.cpp +++ /dev/null @@ -1,574 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < 5; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 256; j++) { // дÂú256 - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 5; // index1 should set to 5 - for (i = 5; i < FAT_MIDDLE_CYCLES; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < 128; j++) { // дÂú128 - len = write(fd[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - - free(bufWrite); - - return NULL; - - free(bufWrite); -EXIT1: - for (i = index1; i >= 5; i--) { // loop until 5 - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file%d.txt", - i); - unlink(pathname); - } - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < 5; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 256; j++) { // дÂú256 - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 5; // index1 should set to 5 - for (i = 5; i < FAT_MIDDLE_CYCLES; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < 128; j++) { // дÂú128 - len = write(fd[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f02 is excecuting\n"); - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - - free(bufWrite); -EXIT1: - for (i = index1; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file%d.txt", - i); - unlink(pathname); - } - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 index1 = 0; - INT32 fd[10] = {}; - INT32 flag = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME2; - CHAR buffile2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - struct stat buf1 = { 0 }; - struct stat buf2 = { 0 }; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < 5; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < 256; j++) { // дÂú256 - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - ret = stat(buffile, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf1); - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 5; // index1 should set to 5 - for (i = 5; i < FAT_MIDDLE_CYCLES; i++) { // 5 ¸öÎļþ - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", index1); - fd[index1] = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index1] == -1) { - break; - } - - for (j = 0; j < 128; j++) { // дÂú128 - len = write(fd[index1], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd[index1]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - if (flag == 0) { - index1--; - } - - ret = stat(buffile2, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - FatStatPrintf(buf2); - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", i); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; - - free(bufWrite); -EXIT1: - for (i = index1; i >= 5; i--) { // loop until 5 - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file%d.txt", - i); - unlink(pathname); - } - - for (i = index1; i >= 5; i--) { // loop until 5 - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file%d.txt", i); - unlink(pathname1); - } - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_010 -* - @tspec function test -* - @ttitle multithreading reads the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously read this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread010(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_010", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_012.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_012.cpp deleted file mode 100644 index 4dd8e105..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_012.cpp +++ /dev/null @@ -1,630 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag; - INT32 index = 0; - INT32 index1 = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/ttest%d", - index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag; - INT32 index = 0; - INT32 index1 = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 50 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/ttest%d", i); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // 10M - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag; - INT32 index = 0; - INT32 index1 = 0; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME2; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 50 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - index1 = 0; - for (i = 0; i < 100; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/ttest%d", - index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // 10M - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_012 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread012(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_012", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_014.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_014.cpp deleted file mode 100644 index 23824d53..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_014.cpp +++ /dev/null @@ -1,633 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME0; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/ttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test00/ttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME1; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/ttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test11/ttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR buffile[FAT_NAME_LIMITTED_SIZE] = FAT_PATH_NAME2; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf = { 0 }; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // 3s - printf("pthread_f03 is excecuting\n"); - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/ttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - ret = stat(buffile, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test22/ttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/ttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_014 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread014(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_014", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_016.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_016.cpp deleted file mode 100644 index 7880ef62..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_016.cpp +++ /dev/null @@ -1,666 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/tttest%d", - index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/tttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/tttest%d", - index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/tttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i, j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR writebuf[FAT_STANDARD_NAME_LENGTH] = "0000"; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/tttest%d", - index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - - len = write(fd1, writebuf, strlen(writebuf)); // four byte - if (len <= 0) { - flag = 1; - break; - } - - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/tttest_%d", - index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/tttest%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/tttest_%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_016 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread016(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_016", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_017.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_017.cpp deleted file mode 100644 index 06d41d21..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_017.cpp +++ /dev/null @@ -1,447 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/testdir%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/testdir_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/testdir_%d", - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/testdir%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/testdir_%d", - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test1%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test01_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test01_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test1%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test01_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_017 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread017(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_017", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_018.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_018.cpp deleted file mode 100644 index c66e24f0..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_018.cpp +++ /dev/null @@ -1,646 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/tttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test00/tttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test0/test00/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3s - printf("pthread_f02 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/tttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test11/tttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 fd1 = -1; - INT32 i = 0; - INT32 j, ret, len, flag, index, index1; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname3[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname4[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname5[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f03 is excecuting\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - index1 = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100 dir - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/tttest%d", index1); - ret = mkdir(pathname3, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - fd1 = open(pathname4, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd1 == -1) { - break; - } - ret = close(fd1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname5, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/tttest_%d", index1); - ret = rename(pathname3, pathname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index1++; - } - - if (flag == 0) { - index1--; - } - - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "//file.txt"); - ret = unlink(pathname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd1); - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test22/tttest%d", - i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname4); - rmdir(pathname3); - - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - i = 0; - for (i = index1; i >= 0; i--) { - (void)snprintf_s(pathname3, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/tttest_%d", i); - (void)strcpy_s(pathname4, FAT_STANDARD_NAME_LENGTH, pathname3); - (void)strcat_s(pathname4, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname4); - ret = rmdir(pathname3); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/test_%d", i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ret = rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test It_vfs_fat_mutipthread_001 -* - @tspec function test -* - @ttitle multithreading writes the same file at the same time -* - @tbrief -1. Create a file to open -2. Create three threads to simultaneously write to this file. -3 Check the contents of the file -4. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread018(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_018", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_019.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_019.cpp deleted file mode 100644 index 8e71f3bf..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_019.cpp +++ /dev/null @@ -1,448 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f01 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, nullptr); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/file2%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f02 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/file2%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/test1/file3%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is excecuting\n"); - break; - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/test1/file3_%d.txt", index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/test1/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test/test0/test1/file3_%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - (void)strcat_s(bufname2, FAT_STANDARD_NAME_LENGTH, "/test0"); - (void)strcat_s(bufname3, FAT_STANDARD_NAME_LENGTH, "/test0/test1"); - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 1); // fd 2 level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_019 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread019(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_019", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_020.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_020.cpp deleted file mode 100644 index 0299cc5c..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_020.cpp +++ /dev/null @@ -1,444 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is excecuting\n"); - break; - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_020 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread020(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_020", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_021.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_021.cpp deleted file mode 100644 index 29116342..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_021.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - break; - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f03 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_021 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread021(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_021", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_022.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_022.cpp deleted file mode 100644 index 6369422a..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_022.cpp +++ /dev/null @@ -1,469 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, NULL, EXIT0); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, nullptr); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); -EXIT0: - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file2%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f02 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file2%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test1/test11/file2%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file3%d.txt", index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f03 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file3_%d.txt", index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file3_%d.txt", i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, - "/bin/vs/sd/test2/test22/file3_%d.txt", i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME00; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname4[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME11; - CHAR bufname5[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - CHAR bufname6[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME22; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname4, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname5, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname6, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname6); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname5); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname2); - rmdir(bufname1); - rmdir(bufname4); - rmdir(bufname3); - rmdir(bufname6); - rmdir(bufname5); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_022 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread022(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_022", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_023.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_023.cpp deleted file mode 100644 index 06b7a1fb..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_023.cpp +++ /dev/null @@ -1,445 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test0/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test1/file2%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f03 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test2/file3_%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_023 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread023(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_023", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_024.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_024.cpp deleted file mode 100644 index ad6d4e27..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_024.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - printf("pthread_f01 is excecuting\n"); - break; - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file1%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is excecuting\n"); - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file2%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0000"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3%d.txt", - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - printf("pthread_f03 is excecuting\n"); - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); // four bytes - if (len <= 0) { - flag = 1; - break; - } - break; - default: - flag = 1; - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "/bin/vs/sd/test/file3_%d.txt", - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_024 -* - @tspec function test -* - @ttitleMultithreading deletes the same file at the same time -* - @tbrief -1. Create a file -2. Create three threads to delete this file. -3. Delete all files and threads; -* - @ tprior 1 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread024(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_024", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_027.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_027.cpp deleted file mode 100644 index 0e36a7b0..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_027.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_027 -* - @tspec pressure test -* - @ttitle multithreaded open, write, read, offset, close the 100M file -* - @tbrief -1. In the peer directory -2. Three threads -3. Same priority -4. 100 files per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ -VOID ItFsFatMutipthread027(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_027", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_029.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_029.cpp deleted file mode 100644 index bc67be1e..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_029.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_029 -* - @tspec pressure test -* - @ttitle multithreaded open, write, read, offset, close the 100M file -* - @tbrief -1. In the different levels of directory -2. Three threads -3. Same priority -4. 100 files per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread029(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_029", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_030.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_030.cpp deleted file mode 100644 index 40a2180e..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_030.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME2, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_030 -* - @tspec pressure test -* - @ttitle multithreaded open, search, close the 100M file -* - @tbrief -1. In the peer directory -2. Three threads -3. Same priority -4. 100 files per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread030(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_030", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_032.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_032.cpp deleted file mode 100644 index 5d9a68a3..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_032.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", FAT_PATH_NAME_0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - - return NULL; -} - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_032 -* - @tspec pressure test -* - @ttitle multithreaded open, search, close the 10b file -* - @tbrief -1. In the different levels of directory -2. Three threads -3. Same priority -4. 100 files per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread032(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_032", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_033.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_033.cpp deleted file mode 100644 index b5ac0acd..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_033.cpp +++ /dev/null @@ -1,423 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME0, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME1, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME1, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME1, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME2, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME2, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME2, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_033 -* - @tspec pressure test -* - @ttitle multithreaded open, search, close the 100 directory -* - @tbrief -1. In the peer directory -2. Three threads -3. Same priority -4. 100 directory per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread033(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_033", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_035.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_035.cpp deleted file mode 100644 index 623acc00..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_035.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_0, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index, offset; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - DIR *dir = NULL; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_01, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - dir = opendir(pathname); - ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT1); - offset = telldir(dir); - ICUNIT_GOTO_EQUAL(offset, FAT_NO_ERROR, offset, EXIT1); - - ret = closedir(dir); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - closedir(dir); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_035 -* - @tspec pressure test -* - @ttitle multithreaded open, search, close the 100M directory -* - @tbrief -1. In the different levels of directory -2. Three threads -3. Same priority -4. 100 directory per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread035(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_035", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_036.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_036.cpp deleted file mode 100644 index 16e66e5a..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_036.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME0, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME0, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME1, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME1, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME1, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME1, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME1, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME2, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME2, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME2, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test%d", FAT_PATH_NAME2, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test_%d", FAT_PATH_NAME2, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_036 -* - @tspec pressure test -* - @ttitle multithreaded creat, rename, remove the 100M directory -* - @tbrief -1. In the peer directory -2. Three threads -3. Same priority -4. 100 directory per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread036(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_036", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_038.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_038.cpp deleted file mode 100644 index 0a43ba6c..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_038.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test1%d", FAT_PATH_NAME, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(3); // delay 3 s - printf("pthread_f01 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test1_%d", FAT_PATH_NAME, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test1_%d", FAT_PATH_NAME, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test1%d", FAT_PATH_NAME, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test1_%d", FAT_PATH_NAME, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test2%d", FAT_PATH_NAME_0, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(5); // delay 5 s - printf("pthread_f02 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test2_%d", FAT_PATH_NAME_0, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test2_%d", FAT_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test2%d", FAT_PATH_NAME_0, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test2_%d", FAT_PATH_NAME_0, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 fd = -1; - INT32 i, j, ret, len, flag, index; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname2[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test3%d", FAT_PATH_NAME_01, - index); - ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); - if (ret == -1) { - break; - } - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd == -1) { - break; - } - - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd, bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - - LosTaskDelay(7); // delay 7 s - printf("pthread_f03 is executing\n"); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname2, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test3_%d", FAT_PATH_NAME_01, - index); - ret = rename(pathname, pathname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test3_%d", FAT_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - ret = unlink(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = rmdir(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - close(fd); - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test3%d", FAT_PATH_NAME_01, i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/test3_%d", FAT_PATH_NAME_01, - i); - (void)strcpy_s(pathname1, FAT_STANDARD_NAME_LENGTH, pathname); - (void)strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/file.txt"); - unlink(pathname1); - rmdir(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_038 -* - @tspec pressure test -* - @ttitle multithreaded creat, rename, remove the 100M directory -* - @tbrief -1. In the different levels of directory -2. Three threads -3. Same priority -4. 100 directory per thread -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread038(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_038", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_039.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_039.cpp deleted file mode 100644 index bd35dc08..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_039.cpp +++ /dev/null @@ -1,438 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_039 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the same directory -2. Three threads -3. Same priority -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread039(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_039", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_040.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_040.cpp deleted file mode 100644 index a2dc3b99..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_040.cpp +++ /dev/null @@ -1,456 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_040 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the peer directory -2. Three threads -3. Same priority -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread040(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_040", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_041.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_041.cpp deleted file mode 100644 index 19f31f2d..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_041.cpp +++ /dev/null @@ -1,456 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_041 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the different levels of directory -2. Three threads -3. Same priority -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread041(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_041", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_042.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_042.cpp deleted file mode 100644 index 161ac289..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_042.cpp +++ /dev/null @@ -1,459 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 1); // fd 2 level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_042 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the peer directory -2. Three threads -3. different priority - pthread_f01 high - pthread_f02 middle - pthread_f03 low -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread042(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_042", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_043.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_043.cpp deleted file mode 100644 index a003fa33..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_043.cpp +++ /dev/null @@ -1,441 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)(void) snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 1); // fd 2 level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_043 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the same directory -2. Three threads -3. different priority - pthread_f01 high - pthread_f02 middle - pthread_f03 low -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread043(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_043", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_044.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_044.cpp deleted file mode 100644 index 14b9f3a3..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_044.cpp +++ /dev/null @@ -1,458 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 1); // fd 2 level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_044 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the different levels of directory -2. Three threads -3. different priority - pthread_f01 high - pthread_f02 middle - pthread_f03 low -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ -VOID ItFsFatMutipthread044(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_044", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_045.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_045.cpp deleted file mode 100644 index 64d81794..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_045.cpp +++ /dev/null @@ -1,459 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_045 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the peer directory -2. Three threads -3. different priority - pthread_f01 middle - pthread_f02 low - pthread_f03 high -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread045(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_045", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_046.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_046.cpp deleted file mode 100644 index 3bf81ed5..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_046.cpp +++ /dev/null @@ -1,379 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - index--; - ICUNIT_GOTO_NOT_EQUAL(fd[index], -1, fd[index], EXIT1); - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - index++; - } - - for (i = index - 1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - g_testCount++; - free(bufWrite); - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - index--; - ICUNIT_GOTO_NOT_EQUAL(fd[index], -1, fd[index], EXIT1); - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - index++; - } - - for (i = index - 1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - index--; - ICUNIT_GOTO_NOT_EQUAL(fd[index], -1, fd[index], EXIT1); - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - ICUNIT_GOTO_EQUAL(len, strlen(bufWrite), len, EXIT1); - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - ICUNIT_GOTO_EQUAL(len, strlen(writebuf), len, EXIT1); - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME, index); - - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - index++; - } - - for (i = index - 1; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - free(bufWrite); - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_046 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the same directory -2. Three threads -3. different priority - pthread_f01 middle - pthread_f02 low - pthread_f03 high -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ -VOID ItFsFatMutipthread046(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_046", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_047.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_047.cpp deleted file mode 100644 index 4b68477a..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_047.cpp +++ /dev/null @@ -1,459 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 3); // fd 2 level less for 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_045 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the different levels of directory -2. Three threads -3. different priority - pthread_f01 middle - pthread_f02 low - pthread_f03 high -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread047(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_047", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_048.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_048.cpp deleted file mode 100644 index deb6fa9b..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_048.cpp +++ /dev/null @@ -1,460 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - printf("%s_%d, read ret = %d, errno = %d(%s)\n", __func__, __LINE__, len, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME0, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME1, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME2, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME2, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME0; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME1; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME2; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_048 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the peer directory -2. Three threads -3. different priority - pthread_f01 low - pthread_f02 high - pthread_f03 middle -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread048(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_048", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_049.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_049.cpp deleted file mode 100644 index 84a307c4..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_049.cpp +++ /dev/null @@ -1,441 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_049 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the same directory -2. Three threads -3. different priority - pthread_f01 low - pthread_f02 high - pthread_f03 middle -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread049(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_049", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_050.cpp b/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_050.cpp deleted file mode 100644 index 38f4ab95..00000000 --- a/testsuites/unittest_old/fs/vfat/pressure/It_vfs_fat_mutipthread_050.cpp +++ /dev/null @@ -1,459 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" - -static VOID *PthreadF01(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR readbuf[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f01 is executing\n"); - - ret = lseek(fd[index], 0, SEEK_SET); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - len = read(fd[index], readbuf, 10); // read 10 bytes - ICUNIT_GOTO_EQUAL(len, 10, len, EXIT1); // len must be 10 - ICUNIT_ASSERT_STRING_EQUAL_RET(readbuf, "0123456789", readbuf, NULL); - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file1%d.txt", FAT_PATH_NAME, - i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF02(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - struct stat statbuf; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f02 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = stat(pathname, &statbuf); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - FatStatPrintf(statbuf); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file2%d.txt", - FAT_PATH_NAME_0, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} - -static VOID *PthreadF03(void *arg) -{ - INT32 i, j, ret, len, flag, index; - INT32 fd[100] = {}; - CHAR pathname[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = ""; - CHAR filebuf[260] = "01234567890123456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123" - "456789abcedfghij9876543210abcdeabcde0123456789abcedfghij9876543210abcdeabcde0123456789abcedfgh" - "ij9876543210abcdeabcde0123456789abcedfghij9876543210lalalalalalalala"; - CHAR writebuf[20] = "0123456789"; - CHAR *bufWrite = nullptr; - - flag = 0; - bufWrite = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - ICUNIT_ASSERT_NOT_EQUAL_NULL(bufWrite, NULL, NULL); - (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB - - for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb - (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf); - } - - index = 0; - for (i = 0; i < FAT_MAX_CYCLES; i++) { // 100¸öÎļþ - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3%d.txt", - FAT_PATH_NAME_01, index); - fd[index] = open(pathname, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); - if (fd[index] == -1) { - break; - } - switch (index % 3) { // mod 3 - case 0: - for (j = 0; j < FAT_MAX_CYCLES; j++) { // дÂú100M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(3); // delay 3 s - break; - case 1: - for (j = 0; j < FAT_MIDDLE_CYCLES; j++) { // дÂú10M - len = write(fd[index], bufWrite, strlen(bufWrite)); - if (len <= 0) { - flag = 1; - break; - } - } - LosTaskDelay(5); // delay 5 s - break; - case 2: // the 2 nd case - len = write(fd[index], writebuf, strlen(writebuf)); - if (len <= 0) { - flag = 1; - break; - } - LosTaskDelay(7); // delay 7 s - break; - default: - break; - } - - printf("pthread_f03 is executing\n"); - - ret = close(fd[index]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - (void)snprintf_s(pathname1, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, index); - ret = rename(pathname, pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - if (flag == 1) { - break; - } - index++; - } - - if (flag == 0) { - index--; - } - - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - ret = unlink(pathname); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - } - - g_testCount++; - - free(bufWrite); - - return NULL; -EXIT1: - for (i = index; i >= 0; i--) { - close(fd[i]); - } - unlink(pathname); -EXIT: - for (i = index; i >= 0; i--) { - (void)snprintf_s(pathname, FAT_STANDARD_NAME_LENGTH, FAT_STANDARD_NAME_LENGTH, "%s/file3_%d.txt", - FAT_PATH_NAME_01, i); - unlink(pathname); - } - g_testCount = 0; - free(bufWrite); - return NULL; -} -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - CHAR bufname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR bufname2[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_0; - CHAR bufname3[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME_01; - pthread_attr_t attr[FAT_MAX_THREADS]; - pthread_t threadId[FAT_MAX_THREADS]; - - g_testCount = 0; - - ret = mkdir(bufname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname2, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(bufname3, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - ret = PosixPthreadInit(&attr[0], TASK_PRIO_TEST - 1); // level less 1 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[0], &attr[0], PthreadF01, (void *)0); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[1], TASK_PRIO_TEST - 3); // level less 3 - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[1], &attr[1], PthreadF02, (void *)1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr[2], TASK_PRIO_TEST - 2); // 2 less than TASK_PRIO_TEST - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadId[2], &attr[2], PthreadF03, (void *)2); // the no 2 thread - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_join(threadId[i], NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < FAT_MAX_THREADS; i++) { - ret = pthread_attr_destroy(&attr[i]); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - } - - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); // there 3 threads - - ret = rmdir(bufname3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = rmdir(bufname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; - -EXIT1: - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_join(threadId[i], NULL); - } - for (i = 0; i < FAT_MAX_THREADS; i++) { - pthread_attr_destroy(&attr[i]); - } -EXIT: - rmdir(bufname3); - rmdir(bufname2); - rmdir(bufname1); - - return FAT_NO_ERROR; -} - -/* * -* - @test IT_FS_FAT_MUTIPTHREAD_050 -* - @tspec pressure test -* - @ttitle multithreaded operating the files -* - @tbrief -1. In the different levels of directory -2. Three threads -3. different priority - pthread_f01 low - pthread_f02 high - pthread_f03 middle -4. pthread_f01 open, write, read, offset, close files -5. pthread_f02 open, search, close files -6. pthread_f03 create, rename, remove files -7. 100 files per thread include 100M, 10M, 10b -* - @ tprior 4 -* - @ tauto TRUE -* - @ tremark -*/ - -VOID ItFsFatMutipthread050(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_MUTIPTHREAD_050", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL4, TEST_PRESSURE); -} diff --git a/testsuites/unittest_old/fs/vfat/smoke/It_vfs_fat_026.cpp b/testsuites/unittest_old/fs/vfat/smoke/It_vfs_fat_026.cpp deleted file mode 100644 index b19fbe97..00000000 --- a/testsuites/unittest_old/fs/vfat/smoke/It_vfs_fat_026.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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. - */ - -#include "It_vfs_fat.h" -static const int FAT_FORMAT_SEC = 8; -static const int SIZE_4K = 4096; -static const int WRITE_TIME = 250; - -static UINT32 TestCase(VOID) -{ - INT32 ret; - INT32 fd = 0; - INT32 len = 0; - INT32 i = FAT_SHORT_ARRAY_LENGTH; - CHAR pathname1[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR buffile[FAT_STANDARD_NAME_LENGTH] = FAT_PATH_NAME; - CHAR filebuf[FAT_STANDARD_NAME_LENGTH] = "12345678901234567890"; - struct statfs buf1 = { 0 }; - struct statfs buf2 = { 0 }; - struct statfs buf3 = { 0 }; - struct statfs buf4 = { 0 }; - - ret = chdir("/"); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT0); - - ret = umount(FAT_MOUNT_DIR); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = format(FAT_DEV_PATH, FAT_FORMAT_SEC, FAT_FILE_SYSTEMTYPE_AUTO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - ret = strcat_s(pathname1, FAT_STANDARD_NAME_LENGTH, "/dir"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = strcat_s(buffile, FAT_STANDARD_NAME_LENGTH, "/dir/files"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - fd = open(buffile, O_NONBLOCK | O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT3); - - ret = statfs(pathname1, &buf1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf1); - - ret = statfs(buffile, &buf2); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf2); - - ICUNIT_GOTO_EQUAL(buf1.f_type, buf2.f_type, buf1.f_type, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bavail, buf2.f_bavail, buf1.f_bavail, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bsize, buf2.f_bsize, buf1.f_bsize, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_blocks, buf2.f_blocks, buf1.f_blocks, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_bfree, buf2.f_bfree, buf1.f_bfree, EXIT3); - ICUNIT_GOTO_EQUAL(buf1.f_files, buf2.f_files, buf1.f_files, EXIT3); - - while (i--) { - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(filebuf), len, EXIT3); - } - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf3); - - ret = statfs(buffile, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf4); - - ICUNIT_GOTO_EQUAL(buf3.f_type, 0x4d44, buf3.f_type, EXIT3); - ICUNIT_GOTO_EQUAL(buf4.f_type, 0x4d44, buf4.f_type, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.f_namelen, 0xFF, buf3.f_namelen, EXIT3); - ICUNIT_GOTO_EQUAL(buf4.f_namelen, 0xFF, buf4.f_namelen, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.f_bsize, SIZE_4K, buf3.f_bsize, EXIT3); - ICUNIT_GOTO_EQUAL(buf4.f_bsize, SIZE_4K, buf4.f_bsize, EXIT3); - ICUNIT_GOTO_EQUAL(buf3.f_bfree + 1, buf1.f_bfree, buf3.f_bfree + 1, EXIT3); - ICUNIT_GOTO_EQUAL(buf4.f_bfree + 1, buf2.f_bfree, buf4.f_bfree + 1, EXIT3); - - i = WRITE_TIME; - while (i--) { - len = write(fd, filebuf, strlen(filebuf)); - ICUNIT_GOTO_EQUAL((UINT32)len, strlen(filebuf), len, EXIT3); - } - - ret = statfs(pathname1, &buf3); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf3); - - ret = statfs(buffile, &buf4); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - FatStatfsPrintf(buf4); - - ret = close(fd); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); - - ret = unlink(buffile); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); - - ret = rmdir(pathname1); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); - - ret = rmdir(FAT_PATH_NAME); - ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); - - return FAT_NO_ERROR; -EXIT3: - close(fd); -EXIT2: - FatStrcat2(pathname1, "/dir/files", strlen(pathname1)); - remove(pathname1); -EXIT1: - FatStrcat2(pathname1, "/dir", strlen(pathname1)); - remove(pathname1); -EXIT: - remove(FAT_PATH_NAME); -EXIT0: - return FAT_NO_ERROR; -} - -/* * -* -@test IT_FS_FAT_026 -* -@tspec The function test for filesystem -* -@ttitle Use the statfs to view the information for the filesystem -* -@tprecon The filesystem module is open -* -@tbrief -1. create one file; -2. use the statfs to view the information for the filesystem; -3. write the file and view the information once again; -4. delete all the file and directory. -* -@texpect -* -@tprior 1 -* -@tauto TRUE -* -@tremark -* Sucessful operation -* -@tprior 1 -* -@tauto TRUE -* -@tremark -*/ - -VOID ItFsFat026(VOID) -{ - TEST_ADD_CASE("IT_FS_FAT_026", TestCase, TEST_VFS, TEST_VFAT, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/liteipc/BUILD.gn b/testsuites/unittest_old/liteipc/BUILD.gn deleted file mode 100644 index 0d6185cd..00000000 --- a/testsuites/unittest_old/liteipc/BUILD.gn +++ /dev/null @@ -1,77 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../common/include", - "../liteipc", -] - -sources_entry = [ - "../common/osTest.cpp", - "smgr_demo.cpp", - "it_test_liteipc.cpp", -] - -sources_smoke = [ - "smoke/liteipc_test_001.cpp", - "smoke/liteipc_test_002.cpp", -] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_liteipc_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_liteipc_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_old/liteipc/it_test_liteipc.cpp b/testsuites/unittest_old/liteipc/it_test_liteipc.cpp deleted file mode 100644 index 4c425aae..00000000 --- a/testsuites/unittest_old/liteipc/it_test_liteipc.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#include -#include -#include "it_test_liteipc.h" - -using namespace testing::ext; -namespace OHOS { -class LiteIpcTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -/* * - * @tc.name: ItPosixLiteIpc001 - * @tc.desc: function test for liteipc - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(LiteIpcTest, ItPosixLiteIpc001, TestSize.Level0) -{ - ItPosixLiteIpc001(); -} - -/* * - * @tc.name: ItPosixLiteIpc002 - * @tc.desc: function test for liteipc - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(LiteIpcTest, ItPosixLiteIpc002, TestSize.Level0) -{ - ItPosixLiteIpc002(); -} -} \ No newline at end of file diff --git a/testsuites/unittest_old/liteipc/it_test_liteipc.h b/testsuites/unittest_old/liteipc/it_test_liteipc.h deleted file mode 100644 index 586f0dc3..00000000 --- a/testsuites/unittest_old/liteipc/it_test_liteipc.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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. - */ - -#ifndef _IT_TEST_LITEIPC_H -#define _IT_TEST_LITEIPC_H - -#include "osTest.h" -#include "sys/resource.h" - -#define USE_TIMESTAMP 1 - -extern void ItPosixLiteIpc001(void); -extern void ItPosixLiteIpc002(void); - -#endif diff --git a/testsuites/unittest_old/liteipc/liteipc.h b/testsuites/unittest_old/liteipc/liteipc.h deleted file mode 100644 index 2be36686..00000000 --- a/testsuites/unittest_old/liteipc/liteipc.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ - -#ifndef _LITEIPC_H -#define _LITEIPC_H - -#include - -#define LITEIPC_DRIVER "/dev/lite_ipc" - -typedef enum { OBJ_FD, OBJ_PTR, OBJ_SVC } ObjType; - -typedef struct { - uint32_t buffSz; - void *buff; -} BuffPtr; - -typedef struct { - uint32_t handle; - uint32_t token; - uint32_t cookie; -} SvcIdentity; - -typedef union { - uint32_t fd; - BuffPtr ptr; - SvcIdentity svc; -} ObjContent; - -typedef struct { - ObjType type; - ObjContent content; -} SpecialObj; - -typedef enum { MT_REQUEST, MT_REPLY, MT_FAILED_REPLY, MT_DEATH_NOTIFY } MsgType; -typedef enum { CMS_GEN_HANDLE, CMS_REMOVE_HANDLE, CMS_ADD_ACCESS } CmsCmd; - -/* lite ipc ioctl */ -#define IPC_IOC_MAGIC 'i' -#define IPC_SET_CMS _IO(IPC_IOC_MAGIC, 1) -#define IPC_CMS_CMD _IOWR(IPC_IOC_MAGIC, 2, CmsCmdContent) -#define IPC_SET_IPC_THREAD _IO(IPC_IOC_MAGIC, 3) -#define IPC_SEND_RECV_MSG _IOWR(IPC_IOC_MAGIC, 4, IpcContent) - -typedef struct { - CmsCmd cmd; - uint32_t taskID; - uint32_t serviceHandle; -} CmsCmdContent; - -typedef struct { - MsgType type; /**< cmd type, decide the data structure below */ - SvcIdentity target; /**< serviceHandle or targetTaskId, depending on type */ - uint32_t code; - uint32_t flag; -#if (USE_TIMESTAMP == 1) - uint64_t timestamp; -#endif - uint32_t dataSz; /**< size of data */ - void* data; - uint32_t spObjNum; - void* offsets; - uint32_t processID; /**< filled by kernel, processId of sender/reciever */ - uint32_t taskID; /**< filled by kernel, taskId of sender/reciever */ -#ifdef LOSCFG_SECURITY_CAPABILITY - uint32_t userID; - uint32_t gid; -#endif -} IpcMsg; - -#define SEND (1 << 0) -#define RECV (1 << 1) -#define BUFF_FREE (1 << 2) - -typedef struct { - uint32_t flag; - IpcMsg *outMsg; /**< data to send to target */ - IpcMsg *inMsg; /**< data reply by target */ - void *buffToFree; -} IpcContent; - -#endif //_LITEIPC_H \ No newline at end of file diff --git a/testsuites/unittest_old/liteipc/smgr_demo.cpp b/testsuites/unittest_old/liteipc/smgr_demo.cpp deleted file mode 100644 index e8bddda4..00000000 --- a/testsuites/unittest_old/liteipc/smgr_demo.cpp +++ /dev/null @@ -1,296 +0,0 @@ -/* - * 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. - */ - -#include "it_test_liteipc.h" -#include "signal.h" -#include "sys/wait.h" - -#include "unistd.h" -#include "liteipc.h" -#include "stdlib.h" -#include "stdio.h" -#include "string.h" -#include "sys/ioctl.h" -#include "sys/time.h" - -#include "smgr_demo.h" - -ServiceName g_serviceNameMap[MAX_SREVICE_NUM]; -BOOL g_cmsRunningFlag = FALSE; - -static void InitCms() -{ - memset(g_serviceNameMap, 0, sizeof(g_serviceNameMap)); -} - -uint32_t SetCms(int fd) -{ - return ioctl(fd, IPC_SET_CMS, 200); -} - -void SendReply(int fd, IpcMsg *dataIn, uint32_t result, uint32_t serviceHandle) -{ - IpcContent data1; - IpcMsg dataOut; - unsigned int ret; - uint32_t ptr[2]; - - data1.flag = SEND | BUFF_FREE; - data1.buffToFree = dataIn; - data1.outMsg = &dataOut; - memset(data1.outMsg, 0, sizeof(IpcMsg)); - data1.outMsg->type = MT_REPLY; - data1.outMsg->target.handle = dataIn->taskID; - data1.outMsg->target.token = dataIn->target.token; - data1.outMsg->code = dataIn->code; -#if (USE_TIMESTAMP == 1) - data1.outMsg->timestamp = dataIn->timestamp; -#endif - ptr[0] = result; - ptr[1] = serviceHandle; - data1.outMsg->dataSz = 8; - data1.outMsg->data = ptr; - ret = ioctl(fd, IPC_SEND_RECV_MSG, &data1); - if (ret) { - printf("SendReply failed\n"); - } -} - -void FreeBuffer(int fd, IpcMsg *dataIn) -{ - IpcContent data1; - unsigned int ret; - data1.flag = BUFF_FREE; - data1.buffToFree = dataIn; - ret = ioctl(fd, IPC_SEND_RECV_MSG, &data1); - if (ret) { - printf("FreeBuffer failed\n"); - } -} - -static uint32_t SendCmsCmd(int fd, CmsCmdContent *content) -{ - unsigned int ret; - ret = ioctl(fd, IPC_CMS_CMD, content); - if (ret) { - printf("SendCmsCmd failed\n"); - } - return ret; -} - -uint32_t RegService(int fd, char *serviceName, uint32_t nameLen, uint32_t *serviceHandle) -{ - IpcContent data1; - IpcMsg dataIn; - IpcMsg dataOut; - uint32_t ret; - uint32_t *ptr = nullptr; - ServiceName name; - - if (nameLen > NAME_LEN_MAX) { - return -1; - } - memcpy(name.serviceName, serviceName, nameLen); - name.nameLen = nameLen; - - data1.flag = SEND | RECV; - data1.outMsg = &dataOut; - memset(data1.outMsg, 0, sizeof(IpcMsg)); - data1.outMsg->type = MT_REQUEST; - data1.outMsg->target.handle = 0; - data1.outMsg->code = REG_CODE; - data1.outMsg->dataSz = sizeof(ServiceName); - data1.outMsg->data = &name; - - ret = ioctl(fd, IPC_SEND_RECV_MSG, &data1); - if (ret != 0) { - printf("RegService failed\n"); - return ret; - } - ptr = (uint32_t*)(data1.inMsg->data); - *serviceHandle = ptr[1]; - FreeBuffer(fd, data1.inMsg); - return ptr[0]; -} - -uint32_t GetService(int fd, char *serviceName, uint32_t nameLen, uint32_t *serviceHandle) -{ - IpcContent data1; - IpcMsg dataIn; - IpcMsg dataOut; - uint32_t ret; - uint32_t *ptr = nullptr; - ServiceName name; - - if (nameLen > NAME_LEN_MAX) { - return -1; - } - memcpy(name.serviceName, serviceName, nameLen); - name.nameLen = nameLen; - - data1.flag = SEND | RECV; - data1.outMsg = &dataOut; - memset(data1.outMsg, 0, sizeof(IpcMsg)); - data1.outMsg->type = MT_REQUEST; - data1.outMsg->target.handle = 0; - data1.outMsg->code = GET_CODE; - data1.outMsg->dataSz = sizeof(ServiceName); - data1.outMsg->data = &name; - - ret = ioctl(fd, IPC_SEND_RECV_MSG, &data1); - if (ret != 0) { - return ret; - } - ptr = (uint32_t*)(data1.inMsg->data); - *serviceHandle = ptr[1]; - FreeBuffer(fd, data1.inMsg); - return ptr[0]; -} - -static void HandleServiceRegAndGet(int fd, IpcMsg *data) -{ - uint32_t ret, i; - - if (data->code == STOP_CODE) { - g_cmsRunningFlag = FALSE; - return; - } - - ServiceName *info = (ServiceName*)(data->data); - CmsCmdContent content; - if ((info->nameLen == 0) || (info->serviceName == NULL)) { - goto ERROR_EXIT; - } - for (i = 0; i < MAX_SREVICE_NUM; i++) { - if (g_serviceNameMap[i].serviceName != NULL && g_serviceNameMap[i].nameLen == info->nameLen) { - if(memcmp(g_serviceNameMap[i].serviceName, info->serviceName, info->nameLen) == 0) { - break; - } - } - } - printf("recieve service request, code:%d, service name:%s\n", data->code, info->serviceName); - switch (data->code) { - case REG_CODE: - if (i == MAX_SREVICE_NUM) { - content.cmd = CMS_GEN_HANDLE; - content.taskID = data->taskID; - ret = SendCmsCmd(fd, &content); - if (ret) { - goto ERROR_EXIT; - } - if (g_serviceNameMap[content.serviceHandle].serviceName != NULL && g_serviceNameMap[content.serviceHandle].nameLen == info->nameLen) { - printf("the task has already a service named:%s\n", g_serviceNameMap[content.serviceHandle].serviceName); - goto ERROR_REG; - } else { - memcpy(g_serviceNameMap[content.serviceHandle].serviceName, info->serviceName, info->nameLen); - g_serviceNameMap[content.serviceHandle].nameLen = info->nameLen; - SendReply(fd, data, 0, content.serviceHandle); - } - }else { - printf("this service already registed\n"); - goto ERROR_EXIT; - } - break; - case GET_CODE: - if (i == MAX_SREVICE_NUM) { - goto ERROR_EXIT; - }else { - content.cmd = CMS_ADD_ACCESS; - content.taskID = data->taskID; - content.serviceHandle = i; - SendCmsCmd(fd, &content); - SendReply(fd, data, 0, i); - } - break; - default: - break; - } - return; -ERROR_REG: - content.cmd = CMS_REMOVE_HANDLE; - SendCmsCmd(fd, &content); -ERROR_EXIT: - SendReply(fd, data, -1, 0); -} - -static uint32_t CmsLoop(int fd) -{ - IpcContent data1; - IpcMsg dataIn; - IpcMsg dataOut; - uint32_t ret; - g_cmsRunningFlag = TRUE; - while (g_cmsRunningFlag == TRUE) { - data1.flag = RECV; - ret = ioctl(fd, IPC_SEND_RECV_MSG, &data1); - if (ret != 0) { - printf("bad request!\n"); - continue; - } - switch (data1.inMsg->type) { - case MT_REQUEST: - HandleServiceRegAndGet(fd, data1.inMsg); - break; - default: - printf("request not support:%d!\n", data1.inMsg->type); - FreeBuffer(fd, data1.inMsg); - break; - } - } -} - -void StartCms(int fd) -{ - InitCms(); - CmsLoop(fd); -} - -void StopCms(int fd) -{ - IpcContent data1; - IpcMsg dataOut; - int ret; - - data1.flag = SEND; - data1.outMsg = &dataOut; - memset(data1.outMsg, 0, sizeof(IpcMsg)); - data1.outMsg->type = MT_REQUEST; - data1.outMsg->target.handle = 0; - data1.outMsg->code = STOP_CODE; - data1.outMsg->dataSz = 0; - data1.outMsg->data = 0; - - ret = ioctl(fd, IPC_SEND_RECV_MSG, &data1); - if (ret != 0) { - printf("StopCms failed ioctl ret:%d!\n", ret); - } -} - diff --git a/testsuites/unittest_old/liteipc/smgr_demo.h b/testsuites/unittest_old/liteipc/smgr_demo.h deleted file mode 100644 index 06526fa3..00000000 --- a/testsuites/unittest_old/liteipc/smgr_demo.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ - -#include "liteipc.h" - -#define MAX_SREVICE_NUM 100 -#define NAME_LEN_MAX 30 -typedef struct { - char serviceName[NAME_LEN_MAX + 1]; - uint32_t nameLen; -} ServiceName; - -typedef enum { - REG_CODE, - GET_CODE, - STOP_CODE -} SmgrCode; - -void StartCms(int fd); -void StopCms(int fd); -uint32_t RegService(int fd, char *serviceName, uint32_t nameLen, uint32_t *serviceHandle); -uint32_t GetService(int fd, char *serviceName, uint32_t nameLen, uint32_t *serviceHandle); -void SendReply(int fd, IpcMsg *dataIn, uint32_t result, uint32_t serviceHandle); -void FreeBuffer(int fd, IpcMsg *dataIn); - diff --git a/testsuites/unittest_old/liteipc/smoke/liteipc_test_001.cpp b/testsuites/unittest_old/liteipc/smoke/liteipc_test_001.cpp deleted file mode 100644 index 658e68e9..00000000 --- a/testsuites/unittest_old/liteipc/smoke/liteipc_test_001.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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. - */ - -#include "it_test_liteipc.h" -#include "sys/wait.h" - -#include "unistd.h" -#include "stdlib.h" -#include "stdio.h" -#include "string.h" -#include "sys/time.h" -#include "sys/ioctl.h" -#include "fcntl.h" - -#include "liteipc.h" -#include "smgr_demo.h" - -static int LiteIpcTest(void) -{ - unsigned int ret; - IpcContent tmp; - void *retptr = nullptr; - /* testing open liteipc driver with different flag, expecting result is that flag matters nothing */ - int fd = open(LITEIPC_DRIVER, O_WRONLY | O_CLOEXEC); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - ret = close(fd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - fd = open(LITEIPC_DRIVER, O_RDONLY | O_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - ret = close(fd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - fd = open(LITEIPC_DRIVER, O_RDWR | O_SYNC); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - - /* testing mmap liteipc mem pool with different size and flag */ - retptr = mmap(nullptr, 1024 * 4096, PROT_READ, MAP_PRIVATE, fd, 0); - ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr); - //retptr = mmap(nullptr, 0, PROT_READ, MAP_PRIVATE, fd, 0); - //ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr); - retptr = mmap(nullptr, -1, PROT_READ, MAP_PRIVATE, fd, 0); - ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr); - retptr = mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); - ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr); - retptr = mmap(nullptr, 4096, PROT_READ, MAP_SHARED, fd, 0); - ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr); - - retptr = mmap(nullptr, 1, PROT_READ, MAP_PRIVATE, fd, 0); - ICUNIT_ASSERT_NOT_EQUAL((int)(intptr_t)retptr, -1, retptr); - retptr = mmap(nullptr, 4095, PROT_READ, MAP_PRIVATE, fd, 0); - ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr); - - /* testing read/write api */ - char buf[10] = {0}; - ret = read(fd, buf, 10); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = write(fd, buf, 10); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - /* before set cms, testing ioctl cmd */ - ret = ioctl(fd, IPC_CMS_CMD, 0); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = ioctl(fd, IPC_SET_IPC_THREAD, 0); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = ioctl(fd, IPC_SEND_RECV_MSG, 0); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = ioctl(fd, IPC_SEND_RECV_MSG, &tmp); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - sleep(2); - /* after set cms, testing set cms cmd */ - ret = ioctl(fd, IPC_SET_CMS, 200); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - exit(0); - return 0; -} - -static int TestCase(void) -{ - unsigned int ret; - int fd = -1; - void *retptr = nullptr; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); - if (pid == 0) { - LiteIpcTest(); - exit(-1); - } - - sleep(1); - fd = open(LITEIPC_DRIVER, O_RDONLY); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - - retptr = mmap(nullptr, 16 * 4096, PROT_READ, MAP_PRIVATE, fd, 0); - ICUNIT_ASSERT_NOT_EQUAL((int)(intptr_t)retptr, -1, retptr); - ret = ioctl(fd, IPC_SET_CMS, 0); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = ioctl(fd, IPC_SET_CMS, 200); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = ioctl(fd, IPC_SET_CMS, 200); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT); - - return 0; -EXIT: - return 1; -} - -void ItPosixLiteIpc001(void) -{ - TEST_ADD_CASE("ItPosixLiteIpc001", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/liteipc/smoke/liteipc_test_002.cpp b/testsuites/unittest_old/liteipc/smoke/liteipc_test_002.cpp deleted file mode 100644 index 4c397ba5..00000000 --- a/testsuites/unittest_old/liteipc/smoke/liteipc_test_002.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/* - * 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. - */ - -#include "it_test_liteipc.h" -#include "sys/wait.h" - -#include "unistd.h" -#include "liteipc.h" -#include "stdlib.h" -#include "stdio.h" -#include "string.h" -#include "sys/time.h" -#include "sys/ioctl.h" -#include "fcntl.h" - -#include "smgr_demo.h" - -#define NEED_BREAK 1 - -static int g_ipcFd; -char g_serviceName[] = "ohos.testservice"; - -static int CallTestServiceLoop(uint32_t id) -{ - IpcContent data1; - IpcMsg dataIn; - IpcMsg dataOut; - uint32_t ret; - void *retptr = nullptr; - uint32_t num = 0; - uint32_t *ptr = nullptr; - struct timeval test_time; - struct timeval test_time2; - unsigned int serviceHandle; - - printf("i am the client%d process, my process id is %d\n", id, getpid()); - ret = GetService(g_ipcFd, g_serviceName, sizeof(g_serviceName), &serviceHandle); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - retptr = mmap(NULL, 4096, PROT_READ, MAP_PRIVATE, g_ipcFd, 0); - ICUNIT_ASSERT_NOT_EQUAL((int)(intptr_t)retptr, -1, retptr); - ret = GetService(g_ipcFd, g_serviceName, sizeof(g_serviceName), &serviceHandle); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - while (1) { - num++; -#if (NEED_BREAK == 1) - if (num > 50000) { - break; - } -#endif - data1.flag = SEND | RECV; - data1.outMsg = &dataOut; - memset(data1.outMsg, 0, sizeof(IpcMsg)); - data1.outMsg->type = MT_REQUEST; - data1.outMsg->target.handle = serviceHandle; - data1.outMsg->dataSz = 4; - data1.outMsg->data = # - ret = ioctl(g_ipcFd, IPC_SEND_RECV_MSG, &data1); - if (ret != 0) { - printf("client%d CallTestServiceLoop ioctl ret:%d, errno:%d, num:%d\n", id, ret, errno, num); - ICUNIT_ASSERT_EQUAL(errno, ETIME, errno); - goto EXIT; - } else { - ptr = (uint32_t*)(data1.inMsg->data); - ICUNIT_ASSERT_EQUAL(ptr[0], 0, ptr[0]); - ICUNIT_ASSERT_EQUAL(ptr[1], 2 * num, ptr[1]); - FreeBuffer(g_ipcFd, data1.inMsg); - } - } - char tmpBuff[2048]; - data1.flag = SEND | RECV; - data1.outMsg = &dataOut; - memset(data1.outMsg, 0, sizeof(IpcMsg)); - data1.outMsg->type = MT_REQUEST; - data1.outMsg->target.handle = serviceHandle; - data1.outMsg->dataSz = 1024; - data1.outMsg->data = tmpBuff; - ret = ioctl(g_ipcFd, IPC_SEND_RECV_MSG, &data1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - FreeBuffer(g_ipcFd, data1.inMsg); - data1.outMsg->dataSz = 2048; - data1.outMsg->data = tmpBuff; - ret = ioctl(g_ipcFd, IPC_SEND_RECV_MSG, &data1); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - data1.outMsg->spObjNum = 300; - data1.outMsg->offsets = tmpBuff; - ret = ioctl(g_ipcFd, IPC_SEND_RECV_MSG, &data1); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); -EXIT: - exit(0); - return 0; -} - -static void HandleRequest(IpcMsg *data) -{ - uint32_t *ptr = (uint32_t*)data->data; - SendReply(g_ipcFd, data, 0, 2 * ptr[0]); -} - -static int TestServiceLoop(void) -{ - IpcContent data1; - IpcMsg dataIn; - IpcMsg dataOut; - int ret; - void *retptr = nullptr; - struct timeval last_time; - struct timeval test_time; - int cnt = 0; - unsigned int serviceHandle; - - printf("i am the test service process, my process id is %d\n", getpid()); - ret = RegService(g_ipcFd, g_serviceName, sizeof(g_serviceName), &serviceHandle); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - retptr = mmap(NULL, 4096, PROT_READ, MAP_PRIVATE, g_ipcFd, 0); - ICUNIT_ASSERT_NOT_EQUAL((int)(intptr_t)retptr, -1, retptr); - ret = RegService(g_ipcFd, g_serviceName, sizeof(g_serviceName), &serviceHandle); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - gettimeofday(&last_time, 0); - while (1) { - cnt++; -#if (NEED_BREAK == 1) - if (cnt > 100000 - 10) { - printf("TestServiceLoop break!\n"); - break; - } -#endif - data1.flag = RECV; - ret = ioctl(g_ipcFd, IPC_SEND_RECV_MSG, &data1); - if ((cnt % 1000000) == 0) { - gettimeofday(&test_time, 0); - printf("LiteIPC cnt:%d, time used:%d sec\n", cnt, test_time.tv_sec - last_time.tv_sec); - } - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - switch (data1.inMsg->type) { - case MT_REQUEST: - HandleRequest(data1.inMsg); - break; - default: - printf("request not support:%d!\n", data1.inMsg->type); - FreeBuffer(g_ipcFd, data1.inMsg); - break; - } - } - sleep(6); - exit(0); - return 0; -} - -static int LiteIpcTest(void) -{ - - int count = 0; - unsigned int ret; - void *retptr = nullptr; - pid_t farPid, sonPid, pid; - int status; - - retptr = mmap(NULL, 16 * 4096, PROT_READ, MAP_PRIVATE, g_ipcFd, 0); - ICUNIT_GOTO_NOT_EQUAL((int)(intptr_t)retptr, -1, retptr, EXIT1); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT1); - if (pid == 0) { - TestServiceLoop(); - exit(-1); - } - sleep(1);//wait server start - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT1); - if (pid == 0) { - CallTestServiceLoop(1); - exit(-1); - } - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT1); - if (pid == 0) { - CallTestServiceLoop(2); - exit(-1); - } - - ret = waitpid(-1, &status, 0); - printf("waitpid1 ret:%d\n", ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT2); - - ret = waitpid(-1, &status, 0); - printf("waitpid2 ret:%d\n", ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT2); - - ret = waitpid(-1, &status, 0); - printf("waitpid3 ret:%d\n", ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT2); - - return 0; -EXIT1: - return 1; -EXIT2: - printf("EXIT2 status:%d\n", status); - return status; -} - -static int TestCase(void) -{ - int ret; - int status; - g_ipcFd = open(LITEIPC_DRIVER, O_RDWR); - ICUNIT_ASSERT_NOT_EQUAL(g_ipcFd, -1, g_ipcFd); - - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); - if (pid == 0) { - sleep(1);//wait cms start - ret = LiteIpcTest(); - StopCms(g_ipcFd); - if (ret == 0) { - exit(0); - } - if (ret == 1) { - exit(-1); - } - exit(ret); - } - - StartCms(g_ipcFd); - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT); - - return 0; -EXIT: - return 1; -} - -void ItPosixLiteIpc002(void) -{ - TEST_ADD_CASE("ItPosixLiteIpc002", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/mem/shm/BUILD.gn b/testsuites/unittest_old/mem/shm/BUILD.gn deleted file mode 100644 index 449b0b29..00000000 --- a/testsuites/unittest_old/mem/shm/BUILD.gn +++ /dev/null @@ -1,87 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "../../mem/shm", -] - -sources_entry = [ - "../../common/osTest.cpp", - "mem_shm_test.cpp", -] - -sources_smoke = [ "smoke/shm_test_011.cpp" ] - -sources_full = [ - "full/shm_test_001.cpp", - "full/shm_test_002.cpp", - "full/shm_test_003.cpp", - "full/shm_test_004.cpp", - "full/shm_test_005.cpp", - "full/shm_test_006.cpp", - "full/shm_test_007.cpp", - "full/shm_test_008.cpp", - "full/shm_test_009.cpp", - "full/shm_test_010.cpp", - "full/shm_test_012.cpp", - "full/shm_test_013.cpp", - "full/shm_test_014.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_mem_shm_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_mem_shm_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_old/mem/shm/full/it_test_mem_100.cpp b/testsuites/unittest_old/mem/shm/full/it_test_mem_100.cpp deleted file mode 100644 index 05e1a59f..00000000 --- a/testsuites/unittest_old/mem/shm/full/it_test_mem_100.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" -#include "wchar.h" - -#define TEST_STR "abcdefghijk" - -static int TestCase(void) -{ - int flag; - wchar_t res[] = L"abcd"; - wchar_t res1[] = L"mngh"; - wchar_t res2[] = L"abcdmngh"; - wchar_t *p, *pnew; - - pnew = (wchar_t*)malloc(sizeof(wchar_t) * (wcslen(res) + wcslen(res1))); - p = wmempcpy(pnew, res, wcslen(res)); - wmempcpy(p, res1, wcslen(res1)); - flag = wmemcmp(pnew, res2, wcslen(res)); - - p = nullptr; - pnew = nullptr; - free(pnew); - ICUNIT_ASSERT_EQUAL(flag, 0, flag); - - return 0; -} - -void ItTestMem100(void) -{ - TEST_ADD_CASE("it_test_mem_100", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_001.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_001.cpp deleted file mode 100644 index eb085b8b..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_001.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" -#include "pthread.h" - -#define TEXT_SZ 8 -static int g_threadCount = 0; - -struct shared_use_st { - int written; - char text[TEXT_SZ]; -}; - -VOID *ShmReadFunc(VOID *ptr) -{ - void *shm = nullptr; - struct shared_use_st *shared = nullptr; - int shmid; - int ret; - - shmid = shmget((key_t)1234, sizeof(struct shared_use_st), 0666 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL_NULL_VOID(shmid, -1, shmid); - - shm = shmat(shmid, 0, 0); - ICUNIT_ASSERT_NOT_EQUAL_NULL_VOID(shm, INVALID_PTR, shm); - - printf("Memory attached at %p\n", shm); - - shared = (struct shared_use_st *)shm; - while (1) { - if (shared->written == 1) { - printf("You wrote: %s\n", shared->text); - sleep(1); - - shared->written = 0; - if (strncmp(shared->text, "end", 3) == 0) { - break; - } - } else { - sleep(1); - } - } - - ret = shmdt(shm); - ICUNIT_ASSERT_EQUAL_NULL_VOID(ret, 0, ret); - - ret = shmctl(shmid, IPC_RMID, 0); - ICUNIT_ASSERT_EQUAL_NULL_VOID(ret, 0, ret); - - g_threadCount++; - return nullptr; -} - -VOID *ShmWriteFunc(VOID *ptr) -{ - void *shm = nullptr; - struct shared_use_st *shared = nullptr; - char buffer[BUFSIZ + 1] = {'\0'}; - int shmid; - int ret; - static int count = 0; - - shmid = shmget((key_t)1234, sizeof(struct shared_use_st), 0666 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL_NULL_VOID(shmid, -1, shmid); - - shm = shmat(shmid, (void *)0, 0); - ICUNIT_ASSERT_NOT_EQUAL_NULL_VOID(shm, INVALID_PTR, shm); - - printf("Memory attched at %p\n", shm); - - shared = (struct shared_use_st *)shm; - while (1) { - while (shared->written == 1) { - sleep(1); - printf("%s %d, Waiting...\n", __FUNCTION__, __LINE__); - } - - printf("Enter some text: "); - if (count == 0) { - (void)snprintf_s(buffer, BUFSIZ, BUFSIZ + 1, "test"); - } else { - (void)snprintf_s(buffer, BUFSIZ, BUFSIZ + 1, "end"); - } - count++; - (void)strncpy_s(shared->text, TEXT_SZ, buffer, TEXT_SZ - 1); - - shared->written = 1; - if (strncmp(buffer, "end", 3) == 0) { - break; - } - } - - ret = shmdt(shm); - ICUNIT_ASSERT_EQUAL_NULL_VOID(ret, 0, ret); - - sleep(1); - g_threadCount++; - return nullptr; -} - - -static int Testcase(VOID) -{ - pthread_t newPthread[2]; - int curThreadPri, curThreadPolicy; - pthread_attr_t a = { 0 }; - struct sched_param param = { 0 }; - int ret; - int i, j; - - g_threadCount = 0; - - ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - curThreadPri = param.sched_priority; - ret = pthread_attr_init(&a); - param.sched_priority = curThreadPri; - pthread_attr_setschedparam(&a, ¶m); - - ret = pthread_create(&newPthread[0], &a, ShmReadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newPthread[1], &a, ShmWriteFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread[0], nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread[1], nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_threadCount, 2, g_threadCount); - - return 0; -} - -void ItTestShm001(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_001", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_002.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_002.cpp deleted file mode 100644 index c624257f..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_002.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" - -#define SHMID_MAX 192 - -static int Testcase(VOID) -{ - int shmid[SHMID_MAX + 1] = {-1}; - int ret; - int i; - - shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, 0777 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]); - - ret = shmctl(shmid[0], IPC_RMID, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]); - - ret = shmctl(shmid[0], IPC_RMID, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - for (i = 0; i < SHMID_MAX; i++) { - shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(shmid[i], -1, shmid[i]); - } - - shmid[SHMID_MAX] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); - ICUNIT_ASSERT_EQUAL(shmid[SHMID_MAX], -1, shmid[SHMID_MAX]); - - for (i = 0; i < SHMID_MAX; i++) { - ret = shmctl(shmid[i], IPC_RMID, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - - for (i = 0; i < SHMID_MAX; i++) { - ret = shmctl(shmid[i], IPC_RMID, NULL); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - } - - return 0; -} - -void ItTestShm002(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_002", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_003.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_003.cpp deleted file mode 100644 index c9bfaba3..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_003.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" - -static int Testcase(VOID) -{ - int shmid; - int ret; - void *shm = NULL; - void *vaddrPageAlign = NULL; - void *vaddr = NULL; - - shmid = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - shm = shmat(shmid, NULL, 0); - ICUNIT_ASSERT_NOT_EQUAL(shm, INVALID_PTR, shm); - - (void)memset_s(shm, PAGE_SIZE, 0, PAGE_SIZE); - - ret = shmdt(shm); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - vaddrPageAlign = mmap(NULL, PAGE_SIZE * 2, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); - ICUNIT_ASSERT_NOT_EQUAL(vaddrPageAlign, NULL, vaddrPageAlign); - - ret = munmap(vaddrPageAlign, PAGE_SIZE * 2); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - shm = shmat(shmid, vaddrPageAlign, 0); - ICUNIT_ASSERT_EQUAL(shm, vaddrPageAlign, shm); - - (void)memset_s(shm, PAGE_SIZE, 0, PAGE_SIZE); - - ret = shmdt(shm); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - vaddr = (void *)((uintptr_t)vaddrPageAlign + 0x10); - shm = shmat(shmid, vaddr, SHM_REMAP); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - shm = shmat(shmid, vaddr, 0); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - ret = shmctl(shmid, IPC_RMID, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestShm003(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_003", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_004.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_004.cpp deleted file mode 100644 index 3348ea39..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_004.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" - -static int Testcase(VOID) -{ - int shmid; - int ret; - void *shm = NULL; - struct shmid_ds ds = { 0 }; - struct shminfo info = { 0 }; - - shmid = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - shm = shmat(shmid, NULL, 0); - ICUNIT_GOTO_NOT_EQUAL(shm, INVALID_PTR, shm, ERROR_OUT); - - (void)memset_s(shm, PAGE_SIZE, 0, PAGE_SIZE); - - ret = shmctl(shmid, IPC_STAT, &ds); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ICUNIT_GOTO_EQUAL(ds.shm_segsz, PAGE_SIZE, ds.shm_segsz, ERROR_OUT); - ICUNIT_GOTO_EQUAL(ds.shm_nattch, 1, ds.shm_nattch, ERROR_OUT); - ICUNIT_GOTO_EQUAL(ds.shm_cpid, getpid(), ds.shm_cpid, ERROR_OUT); - ICUNIT_GOTO_EQUAL(ds.shm_lpid, getpid(), ds.shm_lpid, ERROR_OUT); - ICUNIT_GOTO_EQUAL(ds.shm_perm.uid, getuid(), ds.shm_perm.uid, ERROR_OUT); - - ret = shmctl(shmid, SHM_STAT, &ds); - // ICUNIT_GOTO_EQUAL(ret, 0x10000, ret, ERROR_OUT); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, ERROR_OUT); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, ERROR_OUT); - - ds.shm_perm.uid = getuid(); - ds.shm_perm.gid = getgid(); - ds.shm_perm.mode = 0; - ret = shmctl(shmid, IPC_SET, &ds); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - ret = shmctl(shmid, IPC_INFO, (struct shmid_ds *)&info); - ICUNIT_GOTO_EQUAL(ret, 192, ret, ERROR_OUT); - ICUNIT_GOTO_EQUAL(info.shmmax, 0x1000000, info.shmmax, ERROR_OUT); - ICUNIT_GOTO_EQUAL(info.shmmin, 1, info.shmmin, ERROR_OUT); - ICUNIT_GOTO_EQUAL(info.shmmni, 192, info.shmmni, ERROR_OUT); - ICUNIT_GOTO_EQUAL(info.shmseg, 128, info.shmseg, ERROR_OUT); - ICUNIT_GOTO_EQUAL(info.shmall, 0x1000, info.shmall, ERROR_OUT); - - ret = shmdt(shm); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, ERROR_OUT); - - ret = shmctl(shmid, IPC_RMID, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; - -ERROR_OUT: - ret = shmctl(shmid, IPC_RMID, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return -1; -} - -void ItTestShm004(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_004", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_005.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_005.cpp deleted file mode 100644 index 2e0da0ce..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_005.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" - -static int Testcase(VOID) -{ - int shmid; - int ret; - void *shm = NULL; - void *vaddrPageAlign = NULL; - void *vaddr = NULL; - - errno = 0; - shmid = shmget(0x111, PAGE_SIZE, 0777 | IPC_EXCL); - ICUNIT_ASSERT_EQUAL(shmid, -1, shmid); - ICUNIT_ASSERT_EQUAL(errno, ENOENT, errno); - - shmid = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - shm = shmat(shmid, NULL, SHM_REMAP); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - shm = shmat(shmid, (const void *)0x100, 0); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - shm = shmat(shmid, NULL, 0); - ICUNIT_ASSERT_NOT_EQUAL(shm, (void *)-1, shm); - - ret = shmdt((const void *)0x100); - ICUNIT_ASSERT_EQUAL(ret, -1, shmid); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = shmdt(shm); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - ret = shmctl(0x111, IPC_RMID, NULL); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = shmctl(shmid, IPC_RMID, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = shmctl(shmid, IPC_RMID, NULL); - ICUNIT_ASSERT_EQUAL(ret, -1, shmid); - ICUNIT_ASSERT_EQUAL(errno, EIDRM, errno); - - return 0; -} - -void ItTestShm005(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_005", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_006.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_006.cpp deleted file mode 100644 index 4b78d6f4..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_006.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" - -static int Testcase(VOID) -{ - const int memSize = PAGE_SIZE; - int ret; - int shmid; - void *shared = NULL; - void *remap = NULL; - - shmid = shmget(IPC_PRIVATE, memSize, 0666 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - shared = shmat(shmid, 0, 0); - ICUNIT_ASSERT_NOT_EQUAL(shared, (void *)-1, shared); - - ret = shmdt(shared); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - remap = shared; - shared = shmat(shmid, remap, SHM_REMAP); - ICUNIT_ASSERT_NOT_EQUAL(shared, (void *)-1, shared); - - ret = shmdt(shared); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - ret = shmctl(shmid, IPC_RMID, NULL); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - return 0; -} - -void ItTestShm006(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_006", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_007.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_007.cpp deleted file mode 100644 index 83e38df7..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_007.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" -#include "sys/types.h" - -static int Testcase(void) -{ - const int memSize = 1024; - int shmid; - char *shared = NULL; - char testStr[] = "hello shmem"; - pid_t pid; - int ret; - int status; - - shmid = shmget((key_t)1234, memSize, 0666 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - ret = fork(); - if (ret == 0) { - usleep(100000); - if ((shared = (char *)shmat(shmid, 0, 0)) == (void *)-1) { - printf("child : error: shmat()\n"); - exit(1); - } - - if (strncmp(shared, testStr, sizeof(testStr)) != 0) { - printf("child : error strncmp() shared = %s\n", shared); - exit(1); - } - - if ((shmdt(shared)) < 0) { - printf("child : error : shmdt()\n"); - exit(1); - } - - if (shmctl(shmid, IPC_RMID, NULL) == -1) { - printf("child : error : shmctl()\n"); - exit(1); - } - - exit(0); - } else { - pid = ret; - usleep(50000); - - shared = (char *)shmat(shmid, 0, 0); - ICUNIT_ASSERT_NOT_EQUAL(shared, (void *)-1, shared); - - ret = strncpy_s(shared, memSize, testStr, sizeof(testStr)); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = shmdt(shared); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - usleep(100000); - - ret = wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 0, status); - } - - return 0; -} - -void ItTestShm007(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_007", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_008.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_008.cpp deleted file mode 100644 index 00bb3759..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_008.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" -#include "sys/types.h" - -static int Testcase(void) -{ - const int memSize = PAGE_SIZE; - int ret; - int shmid; - void *shared = NULL; - - shmid = shmget(IPC_PRIVATE, memSize, SHM_R | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - shared = shmat(shmid, 0, 0); - ICUNIT_ASSERT_EQUAL(shared, (void *)-1, shared); - ICUNIT_ASSERT_EQUAL(errno, EACCES, errno); - - shared = shmat(shmid, 0, SHM_RDONLY); - ICUNIT_ASSERT_NOT_EQUAL(shared, (void *)-1, shared); - - ret = shmdt(shared); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - ret = shmctl(shmid, IPC_RMID, NULL); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - return 0; -} - -void ItTestShm008(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_008", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_009.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_009.cpp deleted file mode 100644 index a8aeb1d0..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_009.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" -#include "sys/types.h" -#include -#include -#include -#include -#include -#include -#include -#include - -static int *g_shmptr = NULL; - -static void ChildProcess(void) -{ - struct sched_param param; - - param.sched_priority = sched_get_priority_max(SCHED_RR); - if(sched_setparam(getpid(), ¶m) != 0) { - printf("An error occurs when calling sched_setparam()"); - return; - } - - /* to avoid blocking */ - alarm(2); - while(1); -} - -static void TestProcess(void) -{ - /* to avoid blocking */ - alarm(5); - - while(1) { - (*g_shmptr)++; - sched_yield(); - } -} - -static void ExitChildren(int sig) -{ - exit(0); -} - -static void KillChildren(int childPid) -{ - kill(childPid, SIGTERM); - sleep(1); //wait for kill child finish. -} - -static int Testcase(void) -{ - int childPid, oldcount, newcount, shmid; - struct sched_param param = {0}; - struct sched_param paramCopy = {0}; - int processPolicy = 0; - int threadPrio = 0; - int ret; - int pid; - - void *ptr = (void *)signal(SIGTERM, ExitChildren); - ICUNIT_ASSERT_NOT_EQUAL(ptr, NULL, ptr); - - shmid = shmget(IPC_PRIVATE, sizeof(int), IPC_CREAT | 0600); - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - g_shmptr = (int *)shmat(shmid, 0, 0); - ICUNIT_ASSERT_NOT_EQUAL(g_shmptr, (int *)-1, g_shmptr); - - *g_shmptr = 0; - - processPolicy = sched_getscheduler(getpid()); - ret = sched_getparam(getpid(), ¶mCopy); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - param.sched_priority = (sched_get_priority_min(SCHED_RR) + - sched_get_priority_max(SCHED_RR)) / 2; - ret = sched_setscheduler(getpid(), SCHED_RR, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_getschedparam(pthread_self(), &processPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - threadPrio = param.sched_priority; - ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - childPid = fork(); - ICUNIT_GOTO_NOT_EQUAL(childPid, -1, childPid, OUT_SCHEDULER); - - if (childPid == 0) { - TestProcess(); - exit(0); - } - sleep(1); - - param.sched_priority = sched_get_priority_min(SCHED_RR); - oldcount = *g_shmptr; - ret = sched_setparam(childPid, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, OUT_SCHEDULER); - - ret = 1; - newcount = *g_shmptr; - ICUNIT_GOTO_NOT_EQUAL(oldcount, newcount, newcount, OUT); - - ret = 0; -OUT: - KillChildren(childPid); - pid = waitpid(childPid, NULL, 0); - ICUNIT_ASSERT_EQUAL(pid, childPid, pid); - (void)sched_setparam(getpid(), ¶mCopy); -OUT_SCHEDULER: - (void)sched_setscheduler(getpid(), processPolicy, ¶mCopy); - param.sched_priority = threadPrio; - pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - - ret = shmdt(g_shmptr); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - ret = shmctl(shmid, IPC_RMID, NULL); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - return ret; -} - -void ItTestShm009(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_009", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_010.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_010.cpp deleted file mode 100644 index 73a9b537..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_010.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" -#include "sys/types.h" - -static int Testcase(void) -{ - const int memSize = 1024; - int shmid; - int ret; - int status; - - ret = fork(); - if (ret == 0) { - usleep(10000); - shmid = shmget((key_t)1234, memSize, 0666 | IPC_CREAT); - if (shmid < 0) { - if (errno == EACCES) { - exit(1); - } - } - - exit(0); - } else { - shmid = shmget((key_t)1234, memSize, 0000 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - usleep(20000); - ret = shmctl(shmid, IPC_RMID, NULL); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 1, status); - } - - return 0; -} - -void ItTestShm010(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_010", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_012.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_012.cpp deleted file mode 100644 index 474e4ebb..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_012.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" -#include "sys/types.h" - -#define SHMNAME "shm_ram" -#define OPEN_FLAG (O_RDWR | O_CREAT | O_EXCL) -#define OPEN_MODE 00777 - -static int Testcase(void) -{ - int fd = shm_open(SHMNAME, OPEN_FLAG, OPEN_MODE); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - - errno = 0; - fd = shm_open(SHMNAME, OPEN_FLAG, OPEN_MODE); - ICUNIT_ASSERT_EQUAL(fd, -1, fd); - ICUNIT_ASSERT_EQUAL(errno, EEXIST, errno); - - errno = 0; - fd = shm_open("SHM_RAM", O_RDONLY, OPEN_MODE); - ICUNIT_ASSERT_EQUAL(fd, -1, fd); - ICUNIT_ASSERT_EQUAL(errno, ENOENT, errno); - - errno = 0; - fd = shm_open("..../1.txt/123", OPEN_FLAG, OPEN_MODE); - ICUNIT_ASSERT_EQUAL(fd, -1, fd); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - errno = 0; - fd = shm_open("SHM_RAM", OPEN_FLAG, 0); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - int ret = shm_unlink(SHMNAME); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = shm_unlink("SHM_RAM"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - errno = 0; - ret = shm_unlink("shm_ram_unlink"); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, ENOENT, errno); - - return 0; -} - -void ItTestShm012(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_012", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_013.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_013.cpp deleted file mode 100644 index 72375cfe..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_013.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" -#include "sys/types.h" - -static int testcase(void) -{ - int shmfd; - int ret; - int count; - int pageSize = getpagesize(); - char *writebuf = NULL; - char *readbuf = NULL; - - shmfd = shm_open("test_1", O_RDWR | O_CREAT | O_EXCL, 0644); - ICUNIT_ASSERT_NOT_EQUAL(shmfd, -1, shmfd); - - writebuf = (char*)malloc(pageSize); - readbuf = (char*)malloc(pageSize); - ICUNIT_ASSERT_NOT_EQUAL(readbuf, NULL, readbuf); - ICUNIT_ASSERT_NOT_EQUAL(writebuf, NULL, writebuf); - memset_s(writebuf, pageSize, 0xf, pageSize); - - count = write(shmfd, writebuf, pageSize); - ICUNIT_ASSERT_EQUAL(count, pageSize, count); - - ret = lseek(shmfd, 0, SEEK_SET); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - count = read(shmfd, readbuf, pageSize); - ICUNIT_ASSERT_EQUAL(count, pageSize, count); - free(readbuf); - free(writebuf); - close(shmfd); - ret = shm_unlink("test_1"); - return 0; -} - -void it_test_shm_013(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_013", testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/shm/full/shm_test_014.cpp b/testsuites/unittest_old/mem/shm/full/shm_test_014.cpp deleted file mode 100644 index c2277474..00000000 --- a/testsuites/unittest_old/mem/shm/full/shm_test_014.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" -#include "sys/types.h" - -#define SHMNAME "shm_ram" - -static int testcase(void) -{ - int shmfd; - int ret; - int count; - int pageSize = getpagesize(); - char *writebuf = NULL; - char *readbuf = NULL; - - errno = 0; - shmfd = shm_open("test_2", O_RDONLY, 00664); - ICUNIT_ASSERT_EQUAL(shmfd, -1, shmfd); - ICUNIT_ASSERT_EQUAL(errno, 2, errno); - - shmfd = shm_open("test_2", O_RDONLY | O_CREAT, 00664); - ICUNIT_ASSERT_NOT_EQUAL(shmfd, -1, shmfd); - writebuf = (char*)malloc(pageSize); - ICUNIT_ASSERT_NOT_EQUAL(writebuf, NULL, writebuf); - readbuf = (char*)malloc(pageSize); - ICUNIT_ASSERT_NOT_EQUAL(readbuf, NULL, readbuf); - memset_s(writebuf, pageSize, 0xf, pageSize); - - errno = 0; - - count = write(shmfd, writebuf, pageSize); - ICUNIT_ASSERT_EQUAL(count, -1, count); - ICUNIT_ASSERT_EQUAL(errno, EACCES, errno); - close(shmfd); - ret = shm_unlink("test_2"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - shmfd = shm_open("test_3", O_WRONLY | O_CREAT, 00664); - ICUNIT_ASSERT_NOT_EQUAL(shmfd, -1, shmfd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - errno = 0; - count = write(shmfd, writebuf, pageSize); - ICUNIT_ASSERT_EQUAL(count, pageSize, count); - - errno = 0; - count = read(shmfd, readbuf, pageSize); - ICUNIT_ASSERT_EQUAL(count, -1, count); - ICUNIT_ASSERT_EQUAL(errno, EACCES, errno); - free(writebuf); - free(readbuf); - close(shmfd); - - ret = shm_unlink("test_3"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void it_test_shm_014(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_014", testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/mem/shm/it_test_shm.h b/testsuites/unittest_old/mem/shm/it_test_shm.h deleted file mode 100644 index 96f5ae7c..00000000 --- a/testsuites/unittest_old/mem/shm/it_test_shm.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_MEM_SHM_H -#define _IT_TEST_MEM_SHM_H - -#include "osTest.h" -#include "sys/shm.h" - -#define INVALID_PTR ((void *)-1) -extern void ItTestShm001(void); -extern void ItTestShm002(void); -extern void ItTestShm003(void); -extern void ItTestShm004(void); -extern void ItTestShm005(void); -extern void ItTestShm006(void); -extern void ItTestShm007(void); -extern void ItTestShm008(void); -extern void ItTestShm009(void); -extern void ItTestShm010(void); -extern void ItTestShm011(void); -extern void ItTestShm012(void); -extern void it_test_shm_013(void); -extern void it_test_shm_014(void); -extern void ItTestMem100(void); - -#endif diff --git a/testsuites/unittest_old/mem/shm/mem_shm_test.cpp b/testsuites/unittest_old/mem/shm/mem_shm_test.cpp deleted file mode 100644 index de30f043..00000000 --- a/testsuites/unittest_old/mem/shm/mem_shm_test.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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. - */ -#include -#include - -#include "it_test_shm.h" - -using namespace testing::ext; -namespace OHOS { -class MemShmTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: it_test_shm_001 - * @tc.desc: function for MemShmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemShmTest, ItTestShm001, TestSize.Level0) -{ - ItTestShm001(); -} - -/* * - * @tc.name: it_test_shm_002 - * @tc.desc: function for MemShmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemShmTest, ItTestShm002, TestSize.Level0) -{ - ItTestShm002(); -} - -/* * - * @tc.name: it_test_shm_003 - * @tc.desc: function for MemShmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemShmTest, ItTestShm003, TestSize.Level0) -{ - ItTestShm003(); -} - -/* * - * @tc.name: it_test_shm_004 - * @tc.desc: function for MemShmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemShmTest, ItTestShm004, TestSize.Level0) -{ - ItTestShm004(); -} - -/* * - * @tc.name: it_test_shm_005 - * @tc.desc: function for MemShmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemShmTest, ItTestShm005, TestSize.Level0) -{ - ItTestShm005(); -} - -/* * - * @tc.name: it_test_shm_006 - * @tc.desc: function for MemShmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemShmTest, ItTestShm006, TestSize.Level0) -{ - ItTestShm006(); -} - -/* * - * @tc.name: it_test_shm_007 - * @tc.desc: function for MemShmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemShmTest, ItTestShm007, TestSize.Level0) -{ - ItTestShm007(); -} - -/* * - * @tc.name: it_test_shm_008 - * @tc.desc: function for MemShmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemShmTest, ItTestShm008, TestSize.Level0) -{ - ItTestShm008(); -} - -/* * - * @tc.name: it_test_shm_009 - * @tc.desc: function for MemShmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemShmTest, ItTestShm009, TestSize.Level0) -{ - ItTestShm009(); -} - -/* * - * @tc.name: it_test_shm_010 - * @tc.desc: function for MemShmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemShmTest, ItTestShm010, TestSize.Level0) -{ - ItTestShm010(); -} -#endif - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: it_test_shm_011 - * @tc.desc: function for MemShmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemShmTest, ItTestShm011, TestSize.Level0) -{ - ItTestShm011(); -} -#endif -} -// namespace OHOS diff --git a/testsuites/unittest_old/mem/shm/smoke/shm_test_011.cpp b/testsuites/unittest_old/mem/shm/smoke/shm_test_011.cpp deleted file mode 100644 index 9f8e4865..00000000 --- a/testsuites/unittest_old/mem/shm/smoke/shm_test_011.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ -#include "it_test_shm.h" -#include "sys/types.h" - -static int Testcase(void) -{ - const int memSize = 1024; - int *shared = NULL; - int shmid; - int ret; - int status; - - shmid = shmget((key_t)IPC_PRIVATE, memSize, 0666 | IPC_CREAT); - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - ret = fork(); - if (ret == 0) { - shared = (int *)shmat(shmid, NULL, 0); - if (shared == (int *)-1) { - exit(1); - } - *shared = 2; - ret = shmdt(shared); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - exit(0); - } else { - usleep(20000); - shared = (int *)shmat(shmid, NULL, 0); - ICUNIT_ASSERT_NOT_EQUAL(shared, (int *)-1, shared); - - ICUNIT_ASSERT_EQUAL(*shared, 2, *shared); - - ret = shmdt(shared); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 0, status); - - ret = shmctl(shmid, IPC_RMID, NULL); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - } - - return 0; -} - -void ItTestShm011(void) -{ - TEST_ADD_CASE("IT_MEM_SHM_011", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/BUILD.gn b/testsuites/unittest_old/mem/vm/BUILD.gn deleted file mode 100644 index 1bfeba6c..00000000 --- a/testsuites/unittest_old/mem/vm/BUILD.gn +++ /dev/null @@ -1,89 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "../../mem/vm", -] - -sources_entry = [ - "../../common/osTest.cpp", - "mem_vm_test.cpp", -] - -sources_smoke = [ - "smoke/mmap_test_001.cpp", - "smoke/mmap_test_002.cpp", - "smoke/mmap_test_003.cpp", - "smoke/mmap_test_004.cpp", - "smoke/mmap_test_005.cpp", - "smoke/mmap_test_006.cpp", - "smoke/mmap_test_007.cpp", - "smoke/mmap_test_008.cpp", - "smoke/mmap_test_009.cpp", - "smoke/mmap_test_010.cpp", - "smoke/mprotect_test_001.cpp", - "smoke/mremap_test_001.cpp", - "smoke/oom_test_001.cpp", - "smoke/open_wmemstream_test_001.cpp", - "smoke/user_copy_test_001.cpp", -] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_mem_vm_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_mem_vm_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_old/mem/vm/it_test_vm.h b/testsuites/unittest_old/mem/vm/it_test_vm.h deleted file mode 100644 index 7537401b..00000000 --- a/testsuites/unittest_old/mem/vm/it_test_vm.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_MEM_VM_H -#define _IT_TEST_MEM_VM_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "osTest.h" - -extern void ItTestMmap001(void); -extern void ItTestMmap002(void); -extern void ItTestMmap003(void); -extern void ItTestMmap004(void); -extern void ItTestMmap005(void); -extern void ItTestMmap006(void); -extern void ItTestMmap007(void); -extern void ItTestMmap008(void); -extern void ItTestMmap009(void); -extern void ItTestMmap010(void); -extern void ItTestMprotect001(void); -extern void ItTestMremap001(void); -extern void ItTestOom001(void); -extern void ItTestUserCopy001(void); -extern void open_wmemstream_test_001(void); -#endif diff --git a/testsuites/unittest_old/mem/vm/mem_vm_test.cpp b/testsuites/unittest_old/mem/vm/mem_vm_test.cpp deleted file mode 100644 index 1f23739d..00000000 --- a/testsuites/unittest_old/mem/vm/mem_vm_test.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* - * 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. - */ -#include -#include - -#include "it_test_vm.h" - -using namespace testing::ext; -namespace OHOS { -class MemVmTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: it_test_mmap_001 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestMmap001, TestSize.Level0) -{ - ItTestMmap001(); -} -#if 0 // need tmpfs -/* * - * @tc.name: it_test_mmap_002 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestMmap002, TestSize.Level0) -{ - ItTestMmap002(); -} - -/* * - * @tc.name: it_test_mmap_003 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestMmap003, TestSize.Level0) -{ - ItTestMmap003(); -} - -/* * - * @tc.name: it_test_mmap_004 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestMmap004, TestSize.Level0) -{ - ItTestMmap004(); -} -#endif - -/* * - * @tc.name: it_test_mmap_005 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestMmap005, TestSize.Level0) -{ - ItTestMmap005(); -} - -/* * - * @tc.name: it_test_mmap_006 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestMmap006, TestSize.Level0) -{ - ItTestMmap006(); -} - -/* * - * @tc.name: it_test_mmap_007 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestMmap007, TestSize.Level0) -{ - ItTestMmap007(); -} - -/* * - * @tc.name: it_test_mmap_008 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestMmap008, TestSize.Level0) -{ - ItTestMmap008(); -} - -/* * - * @tc.name: it_test_mmap_009 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestMmap009, TestSize.Level0) -{ - ItTestMmap009(); -} - -/* * - * @tc.name: it_test_mmap_010 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: DTS202101220LSHEDP1100 - */ -HWTEST_F(MemVmTest, ItTestMmap010, TestSize.Level0) -{ - ItTestMmap010(); -} - -/* * - * @tc.name: it_test_mprotect_001 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestMprotect001, TestSize.Level0) -{ - ItTestMprotect001(); -} - -#ifndef LOSCFG_USER_TEST_SMP -/* * - * @tc.name: it_test_oom_001 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestOom001, TestSize.Level0) -{ - ItTestOom001(); -} - -#endif -/* * - * @tc.name: it_test_mremap_001 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestMremap001, TestSize.Level0) -{ - ItTestMremap001(); -} - -/* * - * @tc.name: it_test_user_copy_001 - * @tc.desc: function for MemVmTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, ItTestUserCopy001, TestSize.Level0) -{ - ItTestUserCopy001(); -} - -/* * - * @tc.name: open_wmemstream_test_001 - * @tc.desc: function for open_wmemstream - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MemVmTest, open_wmemstream_test_001, TestSize.Level0) -{ - open_wmemstream_test_001(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/mem/vm/smoke/mmap_test_001.cpp b/testsuites/unittest_old/mem/vm/smoke/mmap_test_001.cpp deleted file mode 100644 index 1c7f4c4c..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mmap_test_001.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" - -#define MAP_ARRAY_SIZE 9 -#define MAP_FLAGS (MAP_ANONYMOUS | MAP_PRIVATE) - -static const struct { - void *addr; - int ret; - unsigned int flags; -} g_gMmapTests[MAP_ARRAY_SIZE] = { - {(void *)0, 0, MAP_FLAGS}, - {(void *)1, -1, MAP_FLAGS | MAP_FIXED}, - {(void *)(PAGE_SIZE - 1), -1, MAP_FLAGS | MAP_FIXED}, - {(void *)PAGE_SIZE, -1, MAP_FLAGS | MAP_FIXED}, - {(void *)-1, 0, MAP_FLAGS}, - {(void *)(-PAGE_SIZE), -1, MAP_FLAGS | MAP_FIXED}, - {(void *)(-1 - PAGE_SIZE), -1, MAP_FLAGS | MAP_FIXED}, - {(void *)(-1 - PAGE_SIZE - 1), -1, MAP_FLAGS | MAP_FIXED}, - {(void *)(0x1000 * PAGE_SIZE), 0, MAP_FLAGS | MAP_FIXED}, -}; - -static int Testcase(void) -{ - void *p = NULL; - int i; - int ret; - int count = sizeof(g_gMmapTests) / sizeof(g_gMmapTests[0]); - void *array[MAP_ARRAY_SIZE] = {NULL}; - - for (i = 0; i < count; i++) { - p = mmap((void *)g_gMmapTests[i].addr, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, g_gMmapTests[i].flags, -1, - 0); - ret = (p == MAP_FAILED) ? -1 : 0; - ICUNIT_ASSERT_EQUAL(g_gMmapTests[i].ret, ret, p); - array[i] = p; - } - - for (i = 0; i < count; i++) { - if (array[i] == MAP_FAILED) { - continue; - } - ret = munmap(array[i], PAGE_SIZE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - - return 0; -} - -void ItTestMmap001(void) -{ - TEST_ADD_CASE("IT_MEM_MMAP_001", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/mmap_test_002.cpp b/testsuites/unittest_old/mem/vm/smoke/mmap_test_002.cpp deleted file mode 100644 index e121cfa4..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mmap_test_002.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" - -#define MAP_RESERVED0080 0x0080 - -static int CheckedMmap(int prot, int flags, int fd) -{ - void *p = NULL; - int pageSize = getpagesize(); - int ret; - - if (pageSize < 0) { - printf("err: mmap size invalid\n"); - return -1; - } - p = mmap(NULL, pageSize, prot, flags, fd, 0); - if (p == MAP_FAILED) { - return errno; - } else { - ret = munmap(p, pageSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; - } -} - -static int Testcase(void) -{ - int shmfd; - int ret; - int count; - int pageSize = getpagesize(); - char *buf = NULL; - - shmfd = shm_open("/test", O_RDWR | O_CREAT, 0644); - ICUNIT_ASSERT_NOT_EQUAL(shmfd, -1, shmfd); - - if (pageSize <= 0) { - printf("err: malloc size invalid\n"); - return -1; - } - if (pageSize <= 0) { - printf("err: malloc size invalid\n"); - return -1; - } - buf = (char *)malloc(pageSize); - ICUNIT_ASSERT_NOT_EQUAL(buf, NULL, buf); - (void)memset_s(buf, pageSize, 0xf, pageSize); - - count = write(shmfd, buf, pageSize); - ICUNIT_ASSERT_EQUAL(count, pageSize, count); - - free(buf); - - /* Simple MAP_ANONYMOUS */ - ret = CheckedMmap(PROT_READ | PROT_WRITE, MAP_ANONYMOUS, -1); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - /* Simple shm fd shared */ - ret = CheckedMmap(PROT_READ | PROT_WRITE, MAP_SHARED, shmfd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Simple shm fd private */ - ret = CheckedMmap(PROT_READ | PROT_WRITE, MAP_PRIVATE, shmfd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* MAP_ANONYMOUS with extra PROT flags */ - ret = CheckedMmap(PROT_READ | PROT_WRITE | 0x100000, MAP_ANONYMOUS, -1); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - /* Shm fd with garbage PROT */ - ret = CheckedMmap(0xffff, MAP_SHARED, shmfd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Undefined flag. */ - ret = CheckedMmap(PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_RESERVED0080, -1); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - /* Both MAP_SHARED and MAP_PRIVATE */ - ret = CheckedMmap(PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_SHARED, -1); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - /* Shm fd with both SHARED and PRIVATE */ - ret = CheckedMmap(PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_SHARED, shmfd); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - /* At least one of MAP_SHARED or MAP_PRIVATE without ANON */ - ret = CheckedMmap(PROT_READ | PROT_WRITE, 0, shmfd); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - /* MAP_ANONYMOUS with either sharing flag (impacts fork). */ - ret = CheckedMmap(PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = CheckedMmap(PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* MAP_ANONYMOUS should require an fd of -1. */ - ret = CheckedMmap(PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = close(shmfd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -void ItTestMmap002(void) -{ - TEST_ADD_CASE("IT_MEM_MMAP_002", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/mmap_test_003.cpp b/testsuites/unittest_old/mem/vm/smoke/mmap_test_003.cpp deleted file mode 100644 index 2508b381..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mmap_test_003.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" - -#define MAP_TEST_FILE "/dev/shm/test" - -static int Testcase(void) -{ - char *p1 = NULL; - char *p2 = NULL; - char *p3 = NULL; - int fd, pageSize; - int ret; - - pageSize = getpagesize(); - fd = open(MAP_TEST_FILE, O_RDONLY); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - - p1 = (char *)mmap(NULL, pageSize, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); - ICUNIT_ASSERT_NOT_EQUAL(p1, MAP_FAILED, p1); - (void)memset_s(p1, pageSize, 0, pageSize); - - p2 = (char *)mmap(NULL, pageSize, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); - ICUNIT_ASSERT_NOT_EQUAL(p2, MAP_FAILED, p2); - (void)memset_s(p2, pageSize, 0, pageSize); - - ret = memcmp(p1, p2, pageSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - p1[0] = 1; - ICUNIT_ASSERT_EQUAL(p2[0], 0, p2[0]); - - p2[0] = 2; - ICUNIT_ASSERT_EQUAL(p1[0], 1, p1[0]); - - p3 = (char *)mmap(NULL, pageSize, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); - ICUNIT_ASSERT_NOT_EQUAL(p3, MAP_FAILED, p3); - ICUNIT_ASSERT_EQUAL(p3[0], 0xf, p3[0]); - - ret = munmap(p1, pageSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = munmap(p2, pageSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = munmap(p3, pageSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = close(fd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestMmap003(void) -{ - TEST_ADD_CASE("IT_MEM_MMAP_003", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/mmap_test_004.cpp b/testsuites/unittest_old/mem/vm/smoke/mmap_test_004.cpp deleted file mode 100644 index 7ab16a86..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mmap_test_004.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" - -#define MAP_TEST_FILE "/dev/shm/test" - -static int Testcase(void) -{ - char *p1 = NULL; - char *p2 = NULL; - char *p3 = NULL; - int fd, pageSize; - int ret; - - pageSize = getpagesize(); - fd = open(MAP_TEST_FILE, O_RDWR); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - - p1 = (char *)mmap(NULL, pageSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - ICUNIT_ASSERT_NOT_EQUAL(p1, MAP_FAILED, p1); - (void)memset_s(p1, pageSize, 0, pageSize); - - p2 = (char *)mmap(NULL, pageSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - ICUNIT_ASSERT_NOT_EQUAL(p2, MAP_FAILED, p2); - (void)memset_s(p2, pageSize, 0, pageSize); - - ret = memcmp(p1, p2, pageSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - p1[0] = 1; - ICUNIT_ASSERT_EQUAL(p2[0], 1, p2[0]); - - p2[0] = 2; - ICUNIT_ASSERT_EQUAL(p1[0], 2, p1[0]); - - p3 = (char *)mmap(NULL, pageSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - ICUNIT_ASSERT_NOT_EQUAL(p3, MAP_FAILED, p3); - ICUNIT_ASSERT_EQUAL(p3[0], 2, p3[0]); - - ret = munmap(p1, pageSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = munmap(p2, pageSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = munmap(p3, pageSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = close(fd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestMmap004(void) -{ - TEST_ADD_CASE("IT_MEM_MMAP_004", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/mmap_test_005.cpp b/testsuites/unittest_old/mem/vm/smoke/mmap_test_005.cpp deleted file mode 100644 index 3685d3e4..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mmap_test_005.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" - -#define MAP_TEST_FILE "/lib/libc.so" - -static int Testcase(void) -{ - void *map = NULL; - int fd; - - fd = open(MAP_TEST_FILE, O_RDONLY); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - - map = mmap(NULL, 0, PROT_READ, MAP_PRIVATE, fd, 0); - ICUNIT_ASSERT_EQUAL(map, MAP_FAILED, map); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - return 0; -} - -void ItTestMmap005(void) -{ - TEST_ADD_CASE("IT_MEM_MMAP_005", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/mmap_test_006.cpp b/testsuites/unittest_old/mem/vm/smoke/mmap_test_006.cpp deleted file mode 100644 index 4908d614..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mmap_test_006.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" -#define INVALID_FD 0xFFFFFFFF -#define INVALID_VADDR 0xAFFFFFFF -#define VALIDE_ADDR 0x12000000 -#define ADDR_OFFSET 0X123 -#define OVER_LEN 0x40000000 -#define MAP_LEN 0x1000 -#define FLAG_NUM 3 - -static int Testcase(void) -{ - void *mem = NULL; - void *invalueAddr = NULL; - size_t len = MAP_LEN; - char file[] = "/storage/testMmapEINVAL.txt"; - int flags[FLAG_NUM] = {0, MAP_ANON, MAP_PRIVATE | MAP_SHARED}; - int ret, fd; - - fd = open(file, O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - - invalueAddr = (void *)(VALIDE_ADDR | ADDR_OFFSET); - mem = mmap(invalueAddr, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0); - ICUNIT_GOTO_EQUAL(mem, MAP_FAILED, mem, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - mem = mmap((void *)INVALID_VADDR, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0); - ICUNIT_GOTO_EQUAL(mem, MAP_FAILED, mem, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - mem = mmap((void *)INVALID_VADDR, len, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); - ICUNIT_GOTO_NOT_EQUAL(mem, MAP_FAILED, mem, EXIT); - ret = munmap(mem, len); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - len = OVER_LEN; - mem = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - ICUNIT_GOTO_EQUAL(mem, MAP_FAILED, mem, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - len = MAP_LEN; - mem = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, INVALID_FD); - ICUNIT_GOTO_EQUAL(mem, MAP_FAILED, mem, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - len = 0; - mem = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - ICUNIT_GOTO_EQUAL(mem, MAP_FAILED, mem, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - len = MAP_LEN; - for (int i = 0; i < FLAG_NUM; i++) { - mem = mmap(NULL, len, PROT_READ | PROT_WRITE, flags[i], fd, 0); - ICUNIT_GOTO_EQUAL(mem, MAP_FAILED, mem, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - } - -EXIT: - ret = close(fd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = remove(file); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestMmap006(void) -{ - TEST_ADD_CASE("IT_MEM_MMAP_006", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/mmap_test_007.cpp b/testsuites/unittest_old/mem/vm/smoke/mmap_test_007.cpp deleted file mode 100644 index 01dce375..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mmap_test_007.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" - -#define MAP_LEN 0x200000 -#define MAP_ADDR 0x1200000 -#define MAP_OFFSET 0x100000 - -static int Testcase(void) -{ - size_t len = MAP_LEN; - unsigned long fixAddr = MAP_ADDR; - unsigned long before, after; - size_t shinkLen; - unsigned int flags = MAP_ANON | MAP_SHARED | MAP_FIXED; - void *mem = NULL; - void *prev = NULL; - void *next = NULL; - void *belong = NULL; - int ret; - - mem = mmap((void *)fixAddr, len, PROT_READ | PROT_WRITE, flags, -1, 0); - ICUNIT_GOTO_NOT_EQUAL(mem, MAP_FAILED, mem, EXIT); - - before = fixAddr - MAP_OFFSET; - prev = mmap((void *)before, len, PROT_READ | PROT_WRITE, flags, -1, 0); - ICUNIT_GOTO_NOT_EQUAL(prev, MAP_FAILED, prev, EXIT1); - - after = fixAddr + MAP_OFFSET; - next = mmap((void *)after, len, PROT_READ | PROT_WRITE, flags, -1, 0); - ICUNIT_GOTO_NOT_EQUAL(next, MAP_FAILED, next, EXIT2); - - shinkLen = len - MAP_OFFSET; - belong = mmap((void *)after, shinkLen, PROT_READ | PROT_WRITE, flags, -1, 0); - ICUNIT_GOTO_NOT_EQUAL(belong, MAP_FAILED, belong, EXIT3); - - ret = munmap(prev, len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = munmap(next, len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return LOS_OK; - -EXIT1: - ret = munmap(mem, len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return LOS_NOK; -EXIT2: - ret = munmap(mem, len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = munmap(prev, len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return LOS_NOK; -EXIT3: - ret = munmap(prev, len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = munmap(next, len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); -EXIT: - return LOS_NOK; -} - -void ItTestMmap007(void) -{ - TEST_ADD_CASE("IT_MEM_MMAP_007", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/mmap_test_008.cpp b/testsuites/unittest_old/mem/vm/smoke/mmap_test_008.cpp deleted file mode 100644 index 2d024751..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mmap_test_008.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" - -#define MAP_OFFSET 0x1000 -#define MAP_ADDR 0x1200000 -#define MAP_LEN 0x2000 - -static int Testcase(void) -{ - unsigned long fixAddr = MAP_ADDR; - unsigned int len = MAP_LEN; - unsigned int flags = MAP_ANON | MAP_SHARED; - void *mem = NULL; - void *memFix = NULL; - void *memNoFix = NULL; - void *pre = NULL; - void *next = NULL; - void *overlay = NULL; - int ret; - - mem = mmap((void *)fixAddr, len, PROT_READ | PROT_WRITE, flags | MAP_FIXED, -1, 0); - ICUNIT_GOTO_NOT_EQUAL(mem, MAP_FAILED, mem, EXIT); - - memFix = mmap((void *)fixAddr, len, PROT_READ | PROT_WRITE, flags | MAP_FIXED, -1, 0); - ICUNIT_GOTO_NOT_EQUAL(memFix, MAP_FAILED, memFix, EXIT1); - ICUNIT_ASSERT_EQUAL(mem, memFix, mem); - - memNoFix = mmap((void *)fixAddr, len, PROT_READ | PROT_WRITE, flags | MAP_FIXED_NOREPLACE, -1, 0); - ICUNIT_ASSERT_EQUAL(memNoFix, MAP_FAILED, memNoFix); - - memNoFix = mmap((void *)(fixAddr - MAP_OFFSET), len, PROT_READ | PROT_WRITE, flags | MAP_FIXED_NOREPLACE, -1, 0); - ICUNIT_ASSERT_EQUAL(memNoFix, MAP_FAILED, memNoFix); - - memNoFix = mmap((void *)(fixAddr + MAP_OFFSET), len, PROT_READ | PROT_WRITE, flags | MAP_FIXED_NOREPLACE, -1, 0); - ICUNIT_ASSERT_EQUAL(memNoFix, MAP_FAILED, memNoFix); - - memNoFix = mmap((void *)(fixAddr - MAP_OFFSET), len + MAP_OFFSET, PROT_READ | PROT_WRITE, - flags | MAP_FIXED_NOREPLACE, -1, 0); - ICUNIT_ASSERT_EQUAL(memNoFix, MAP_FAILED, memNoFix); - - ret = munmap(mem, len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return LOS_OK; -EXIT1: - ret = munmap(mem, len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return LOS_NOK; -EXIT: - return LOS_NOK; -} - -void ItTestMmap008(void) -{ - TEST_ADD_CASE("IT_MEM_MMAP_008", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/mmap_test_009.cpp b/testsuites/unittest_old/mem/vm/smoke/mmap_test_009.cpp deleted file mode 100644 index 57211386..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mmap_test_009.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ - -#include "it_test_vm.h" - -#define INVALID_PROCESS_ID 100000 -#define MMAP_SIZE 0x1000 -#define PARAM_INIT 0x123 - -/* Test PROT_NONE flag */ -static int Testcase(void) -{ - int ret, param; - int *ptr = NULL; - int status = 0; - pid_t pid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid); - if (pid == 0) { - ptr = (int *)mmap(0, MMAP_SIZE, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0); - ICUNIT_ASSERT_NOT_EQUAL(ptr, MAP_FAILED, ptr); - printf("%d\n", *ptr); - exit(0); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ret = WIFEXITED(status); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = WIFSIGNALED(status); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - ret = WTERMSIG(status); - ICUNIT_ASSERT_EQUAL(ret, SIGUSR2, ret); - - pid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, INVALID_PROCESS_ID, pid); - if (pid == 0) { - ptr = (int *)mmap(0, MMAP_SIZE, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); - ICUNIT_ASSERT_NOT_EQUAL(ptr, MAP_FAILED, ptr); - *ptr = PARAM_INIT; - ret = mprotect(ptr, MMAP_SIZE, PROT_READ); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(*ptr, PARAM_INIT, *ptr); - ret = mprotect(ptr, MMAP_SIZE, PROT_NONE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("%d\n", *ptr); - exit(0); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ret = WIFEXITED(status); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = WIFSIGNALED(status); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - ret = WTERMSIG(status); - ICUNIT_ASSERT_EQUAL(ret, SIGUSR2, ret); - - return 0; -} - -void ItTestMmap009(void) -{ - TEST_ADD_CASE("IT_MEM_MMAP_009", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/mem/vm/smoke/mmap_test_010.cpp b/testsuites/unittest_old/mem/vm/smoke/mmap_test_010.cpp deleted file mode 100644 index d3689038..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mmap_test_010.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ - -#include "it_test_vm.h" - -#define MMAP_SIZE 0x1000 -#define PARAM_INIT 0x123 - -/* Test PROT_WRITE and PROT_EXEC flag only */ -static int Testcase(void) -{ - int ret; - int *ptr = NULL; - - ptr = (int *)mmap(0, MMAP_SIZE, PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); - ICUNIT_ASSERT_NOT_EQUAL(ptr, MAP_FAILED, ptr); - *ptr = PARAM_INIT; - ICUNIT_ASSERT_EQUAL(*ptr, PARAM_INIT, *ptr); - ret = munmap(ptr, MMAP_SIZE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ptr = (int *)mmap(0, MMAP_SIZE, PROT_EXEC, MAP_ANON | MAP_PRIVATE, -1, 0); - ICUNIT_ASSERT_NOT_EQUAL(ptr, MAP_FAILED, ptr); - ICUNIT_ASSERT_EQUAL(*ptr, 0, *ptr); - ret = munmap(ptr, MMAP_SIZE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestMmap010(void) -{ - TEST_ADD_CASE("IT_MEM_MMAP_010", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/mem/vm/smoke/mprotect_test_001.cpp b/testsuites/unittest_old/mem/vm/smoke/mprotect_test_001.cpp deleted file mode 100644 index f700a8f2..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mprotect_test_001.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" - -static int Testcase(void) -{ - char *p = NULL; - int pageSize; - int ret; - - pageSize = getpagesize(); - - ret = mprotect(0, pageSize, PROT_NONE); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = mprotect(0, pageSize, 0xffff); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = mprotect((void *)0x1000, pageSize, PROT_READ | PROT_WRITE); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = mprotect((void *)0xffffff, pageSize, PROT_READ | PROT_WRITE); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - p = (char *)mmap(NULL, pageSize * 3, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - ICUNIT_ASSERT_NOT_EQUAL(p, MAP_FAILED, p); - - ret = mprotect(p, pageSize * 4, PROT_READ | PROT_WRITE); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = mprotect(p, pageSize, PROT_READ | PROT_WRITE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - (void)memset_s(p, pageSize, 0xf, pageSize); - - ret = mprotect(p + pageSize * 2, pageSize, PROT_READ | PROT_WRITE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - (void)memset_s(p + pageSize * 2, pageSize, 0xf, pageSize); - - ret = munmap(p, pageSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestMprotect001(void) -{ - TEST_ADD_CASE("IT_MEM_MPROTECT_001", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/mremap_test_001.cpp b/testsuites/unittest_old/mem/vm/smoke/mremap_test_001.cpp deleted file mode 100644 index 1f2344ed..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/mremap_test_001.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" - -static int Testcase(void) -{ - char *p = NULL; - void *newAddr = NULL; - int pageSize; - int size; - int ret; - - pageSize = getpagesize(); - size = pageSize << 1; - - p = (char *)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - ICUNIT_ASSERT_NOT_EQUAL(p, MAP_FAILED, p); - - /* Parameter check */ - newAddr = mremap(0, 0, 0, 0, 0); - ICUNIT_ASSERT_EQUAL(newAddr, MAP_FAILED, newAddr); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - newAddr = mremap(p, size, size, MREMAP_FIXED, 0); - ICUNIT_ASSERT_EQUAL(newAddr, MAP_FAILED, newAddr); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - /* Shrink a region */ - newAddr = mremap(p, size, pageSize, MREMAP_MAYMOVE, 0); - ICUNIT_ASSERT_EQUAL(newAddr, p, newAddr); - - /* Remap a region by same size */ - newAddr = mremap(p, pageSize, pageSize, MREMAP_MAYMOVE, 0); - ICUNIT_ASSERT_EQUAL(newAddr, p, newAddr); - - /* Expand a region */ - newAddr = mremap(p, pageSize, size, MREMAP_MAYMOVE, 0); - ICUNIT_ASSERT_EQUAL(newAddr, p, newAddr); - - /* New region overlaping with the old one */ - newAddr = mremap(p, size, pageSize, MREMAP_MAYMOVE | MREMAP_FIXED, p + pageSize); - ICUNIT_ASSERT_EQUAL(newAddr, MAP_FAILED, newAddr); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - newAddr = mremap(p, size, size, MREMAP_MAYMOVE | MREMAP_FIXED, p - pageSize); - ICUNIT_ASSERT_EQUAL(newAddr, MAP_FAILED, newAddr); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - newAddr = mremap(p, size, size + pageSize, MREMAP_MAYMOVE | MREMAP_FIXED, p - pageSize); - ICUNIT_ASSERT_EQUAL(newAddr, MAP_FAILED, newAddr); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - /* Remap to new addr */ - newAddr = mremap(p, size, size, MREMAP_MAYMOVE | MREMAP_FIXED, p + size); - ICUNIT_ASSERT_EQUAL(newAddr, p + size, newAddr); - - newAddr = mremap(newAddr, size, size, MREMAP_MAYMOVE | MREMAP_FIXED, (char *)newAddr - size); - ICUNIT_ASSERT_EQUAL(newAddr, p, newAddr); - - ret = munmap(p, size); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestMremap001(void) -{ - TEST_ADD_CASE("IT_MEM_MREMAP_001", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/oom_test_001.cpp b/testsuites/unittest_old/mem/vm/smoke/oom_test_001.cpp deleted file mode 100644 index adec8b50..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/oom_test_001.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" - -#define MAX_MEM_SIZE 0x6000000 -/* test page fault oom */ -static int Testcase(void) -{ - int ret; - int status; - int pid; - unsigned int *ptr = NULL; - - ret = fork(); - if (ret == 0) { - ptr = (unsigned int *)mmap(0, MAX_MEM_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); - ICUNIT_ASSERT_NOT_EQUAL(ptr, MAP_FAILED, ptr); - /* expect oom */ - for (int i = 0; i < MAX_MEM_SIZE / PAGE_SIZE; i++) { - *(ptr + i * PAGE_SIZE / sizeof(unsigned int)) = 0; - } - - /* if we go here, phy mem is enough, should increase the MAX_MEM_SIZE and rerun */ - ICUNIT_ASSERT_EQUAL(1, 0, 1); - } else { - pid = ret; - ret = waitpid(pid, &status, 0); - status = WIFSIGNALED(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 1, status); - } - - return 0; -} - -void ItTestOom001(void) -{ - TEST_ADD_CASE("IT_MEM_OOM_001", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/open_wmemstream_test_001.cpp b/testsuites/unittest_old/mem/vm/smoke/open_wmemstream_test_001.cpp deleted file mode 100644 index cb1e2225..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/open_wmemstream_test_001.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ - -#include "it_test_vm.h" -#include "wchar.h" - -static int testcase(void) -{ - FILE *stream = nullptr; - wchar_t *buf = nullptr; - size_t len = 0; - - stream = open_wmemstream(&buf, &len); - ICUNIT_ASSERT_NOT_EQUAL(stream, nullptr, stream); - - fwprintf(stream, L"hello my world"); - int ret = fflush(stream); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(len, 14, len); - off_t eob = ftello(stream); - ret = fseeko(stream, 0, SEEK_SET); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - fwprintf(stream, L"good-bye"); - ret = fseeko(stream, eob, SEEK_SET); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = fclose(stream); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(len, 8, len); - free(buf); - return 0; -} - -void open_wmemstream_test_001(void) -{ - TEST_ADD_CASE("OPEN_WMEMSTEAM_TEST_001", testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/mem/vm/smoke/user_copy_test_001.cpp b/testsuites/unittest_old/mem/vm/smoke/user_copy_test_001.cpp deleted file mode 100644 index f506db0b..00000000 --- a/testsuites/unittest_old/mem/vm/smoke/user_copy_test_001.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ -#include "it_test_vm.h" -#include "signal.h" - -#define INVALID_USER_VADDR 0x1200000 - -static int Testcase(void) -{ - int ret; - sigset_t oldset; - const char *str = "Hi, OHOS."; - - /* sigprocmask 内核系统调用接å£é€šè¿‡arch_copy_from_useræ‹·è´ç”¨æˆ·å‚æ•° */ - ret = sigprocmask(SIG_BLOCK, (sigset_t *)1, &oldset); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - - ret = sigprocmask(SIG_BLOCK, (sigset_t *)INVALID_USER_VADDR, &oldset); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - - /* sigprocmask 内核系统调用接å£é€šè¿‡arch_copy_to_user将内核å‚æ•°æ‹·è´è‡³ç”¨æˆ· */ - ret = sigprocmask(SIG_BLOCK, (sigset_t *)INVALID_USER_VADDR, (sigset_t *)1); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - - ret = sigprocmask(SIG_BLOCK, (sigset_t *)INVALID_USER_VADDR, (sigset_t *)INVALID_USER_VADDR); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - - ret = sigprocmask(SIG_BLOCK, (sigset_t *)INVALID_USER_VADDR, (sigset_t *)str); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - - return 0; -} - -void ItTestUserCopy001(void) -{ - TEST_ADD_CASE("IT_MEM_USER_COPY_001", Testcase, TEST_LOS, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/BUILD.gn b/testsuites/unittest_old/misc/BUILD.gn deleted file mode 100644 index 96b1af96..00000000 --- a/testsuites/unittest_old/misc/BUILD.gn +++ /dev/null @@ -1,89 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../common/include", - "../misc", -] - -sources_entry = [ - "../common/osTest.cpp", - "misc_test.cpp", -] - -sources_full = [ - "full/misc_test_006.cpp", - "full/misc_test_007.cpp", - "full/misc_test_008.cpp", - "full/misc_test_009.cpp", - "full/misc_test_010.cpp", - "full/misc_test_011.cpp", - "full/misc_test_012.cpp", - "full/misc_test_013.cpp", -] - -sources_smoke = [ - "smoke/misc_test_001.cpp", - "smoke/misc_test_002.cpp", - "smoke/misc_test_003.cpp", - "smoke/misc_test_004.cpp", - "smoke/misc_test_005.cpp", - "smoke/misc_test_014.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_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" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_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" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} diff --git a/testsuites/unittest_old/misc/It_test_misc.h b/testsuites/unittest_old/misc/It_test_misc.h deleted file mode 100644 index 909c1c6d..00000000 --- a/testsuites/unittest_old/misc/It_test_misc.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_MISC_H -#define _IT_TEST_MISC_H - -#include "osTest.h" -#include "getopt.h" -#include "stdlib.h" -#include "err.h" -#include "unistd.h" -#include "search.h" -#define MISC_OK 0 -#define MISC_NOK -1 - -extern VOID ItTestMisc001(VOID); -extern VOID ItTestMisc002(VOID); -extern VOID ItTestMisc003(VOID); -extern VOID ItTestMisc004(VOID); -extern VOID ItTestMisc005(VOID); -extern VOID ItTestMisc006(VOID); -extern VOID ItTestMisc007(VOID); -extern VOID ItTestMisc008(VOID); -extern VOID ItTestMisc009(VOID); -extern VOID ItTestMisc010(VOID); -extern VOID ItTestMisc011(VOID); -extern VOID ItTestMisc012(VOID); -extern VOID ItTestMisc013(VOID); -extern VOID IT_TEST_MISC_014(VOID); - -#endif diff --git a/testsuites/unittest_old/misc/full/misc_test_006.cpp b/testsuites/unittest_old/misc/full/misc_test_006.cpp deleted file mode 100644 index 616edf51..00000000 --- a/testsuites/unittest_old/misc/full/misc_test_006.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" -#include "sys/utsname.h" - -#define INVALID_ADDR_FIRST_PAGE ((struct utsname *)0x1200000) -#define INVALID_ADDR_USER_ADDR ((struct utsname *)0x1000000) -#define INVALID_ADDR_KERNEL_READONLY_ADDR ((struct utsname *)0x4016c75c) - -static UINT32 TestCase(VOID) -{ - int ret; - struct utsname name; - - ret = uname((struct utsname *)NULL); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - - ret = uname(INVALID_ADDR_FIRST_PAGE); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - - ret = uname(INVALID_ADDR_USER_ADDR); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - - ret = uname(INVALID_ADDR_KERNEL_READONLY_ADDR); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - - ret = uname(&name); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -VOID ItTestMisc006(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/full/misc_test_007.cpp b/testsuites/unittest_old/misc/full/misc_test_007.cpp deleted file mode 100644 index c479cfcb..00000000 --- a/testsuites/unittest_old/misc/full/misc_test_007.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -static UINT32 TestCase(VOID) -{ - int ret; - - ret = sysconf(_SC_AIO_LISTIO_MAX); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = sysconf(_SC_ARG_MAX); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - ret = sysconf(_SC_ATEXIT_MAX); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, -1); - - return 0; -} - -VOID ItTestMisc007(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/full/misc_test_008.cpp b/testsuites/unittest_old/misc/full/misc_test_008.cpp deleted file mode 100644 index a2ec7a8b..00000000 --- a/testsuites/unittest_old/misc/full/misc_test_008.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -static UINT32 TestCase(VOID) -{ - char host[100] = {0}; - int ret = 0; - - ret = gethostname(host, sizeof(host)); - - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - printf("host = %s\n", host); - - return 0; -} - -VOID ItTestMisc008(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/full/misc_test_009.cpp b/testsuites/unittest_old/misc/full/misc_test_009.cpp deleted file mode 100644 index cc4c6518..00000000 --- a/testsuites/unittest_old/misc/full/misc_test_009.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -STATIC UINT32 TestCase(VOID) -{ - INT32 ret; - CHAR *hostsFileStream = "127.0.0.1 localhost\n192.168.1.3 hisilicon\n::1 localhost\n"; - CHAR *pathList[] = {"/etc/hosts"}; - CHAR *streamList[] = {hostsFileStream}; - INT32 streamLen[] = {strlen(hostsFileStream)}; - - ret = PrepareFileEnv(pathList, streamList, streamLen, 1); - if (ret != 0) { - printf("error: need some env files, but prepare is not ok"); - (VOID)RecoveryFileEnv(pathList, 1); - return -1; - } - - ret = gethostid(); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, ERROUT); - (VOID)RecoveryFileEnv(pathList, 1); - return 0; - -ERROUT: - (VOID)RecoveryFileEnv(pathList, 1); - return -1; -} - -VOID ItTestMisc009(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/full/misc_test_010.cpp b/testsuites/unittest_old/misc/full/misc_test_010.cpp deleted file mode 100644 index ec0feb9d..00000000 --- a/testsuites/unittest_old/misc/full/misc_test_010.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -static UINT32 TestCase(VOID) -{ - int ret; - int rlimit = 512; - - ret = getdtablesize(); - ICUNIT_ASSERT_EQUAL(ret, rlimit, ret); - - return 0; -} - -VOID ItTestMisc010(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/full/misc_test_011.cpp b/testsuites/unittest_old/misc/full/misc_test_011.cpp deleted file mode 100644 index 1b849ab5..00000000 --- a/testsuites/unittest_old/misc/full/misc_test_011.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -static UINT32 TestCase(VOID) -{ - int ret; - struct rlimit rlim; - int limit = 512; - - errno = 0; - ret = getrlimit(RLIMIT_NOFILE, &rlim); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(rlim.rlim_cur, limit, -1); - ret = getrlimit(RLIMIT_RSS, &rlim); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, -1); - - return 0; -} - -VOID ItTestMisc011(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/full/misc_test_012.cpp b/testsuites/unittest_old/misc/full/misc_test_012.cpp deleted file mode 100644 index 32d5ac87..00000000 --- a/testsuites/unittest_old/misc/full/misc_test_012.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -static UINT32 TestCase(VOID) -{ - int ret; - struct rlimit rlim1; - struct rlimit rlim2 = {10, 10}; - - errno = 0; - ret = setrlimit(RLIMIT_NOFILE, &rlim2); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - ret = getrlimit(RLIMIT_NOFILE, &rlim1); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(rlim1.rlim_cur, rlim2.rlim_cur, ret); - ICUNIT_ASSERT_EQUAL(rlim1.rlim_max, rlim2.rlim_max, ret); - - ret = setrlimit(RLIMIT_FSIZE, &rlim2); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - ret = getrlimit(RLIMIT_FSIZE, &rlim1); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(rlim1.rlim_cur, rlim2.rlim_cur, ret); - ICUNIT_ASSERT_EQUAL(rlim1.rlim_max, rlim2.rlim_max, ret); - - ret = setrlimit(RLIMIT_AS, &rlim2); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, -1); - - ret = setrlimit(RLIMIT_DATA, &rlim2); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, -1); - - ret = setrlimit(-100, &rlim2); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, -1); - - return 0; -} - -VOID ItTestMisc012(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/full/misc_test_013.cpp b/testsuites/unittest_old/misc/full/misc_test_013.cpp deleted file mode 100644 index 07fd2f49..00000000 --- a/testsuites/unittest_old/misc/full/misc_test_013.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" -#include "ulimit.h" - -static UINT32 TestCase(VOID) -{ - long ret; - long size = 200; - long max = 0x7fffffff; - - ret = ulimit(UL_SETFSIZE, size); - ICUNIT_ASSERT_EQUAL(ret, size, -1); - - ret = ulimit(UL_GETFSIZE, size); - ICUNIT_ASSERT_EQUAL(ret, size, ret); - - ret = ulimit(size, size); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, ret); - - ret = ulimit(UL_SETFSIZE, max); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EPERM, ret); - return 0; -} - -VOID ItTestMisc013(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/misc_test.cpp b/testsuites/unittest_old/misc/misc_test.cpp deleted file mode 100644 index bd49e9e1..00000000 --- a/testsuites/unittest_old/misc/misc_test.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "It_test_misc.h" - -using namespace testing::ext; -namespace OHOS { -class MiscTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: IT_TEST_MISC_001 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MiscTest, ItTestMisc001, TestSize.Level0) -{ - ItTestMisc001(); -} - -/* * - * @tc.name: IT_TEST_MISC_002 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MiscTest, ItTestMisc002, TestSize.Level0) -{ - ItTestMisc002(); -} - -/* * - * @tc.name: IT_TEST_MISC_003 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MiscTest, ItTestMisc003, TestSize.Level0) -{ - ItTestMisc003(); -} - -/* * - * @tc.name: IT_TEST_MISC_004 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MiscTest, ItTestMisc004, TestSize.Level0) -{ - ItTestMisc004(); -} - -/* * - * @tc.name: IT_TEST_MISC_005 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MiscTest, ItTestMisc005, TestSize.Level0) -{ - ItTestMisc005(); -} - -/* * - * @tc.name: IT_TEST_MISC_014 - * @tc.desc: function for tmpnam test - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MiscTest, IT_TEST_MISC_014, TestSize.Level0) -{ - IT_TEST_MISC_014(); -} -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: IT_TEST_MISC_006 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MiscTest, ItTestMisc006, TestSize.Level0) -{ - ItTestMisc006(); -} - -/* * - * @tc.name: IT_TEST_MISC_007 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MiscTest, ItTestMisc007, TestSize.Level0) -{ - ItTestMisc007(); -} - -/* * - * @tc.name: IT_TEST_MISC_008 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MiscTest, ItTestMisc008, TestSize.Level0) -{ - ItTestMisc008(); -} - -/* * - * @tc.name: IT_TEST_MISC_009 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MiscTest, ItTestMisc009, TestSize.Level0) -{ - ItTestMisc009(); -} - -/* * - * @tc.name: IT_TEST_MISC_010 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -/*HWTEST_F(MiscTest, ItTestMisc010, TestSize.Level0) -{ - ItTestMisc010(); -}*/ - -/* * - * @tc.name: IT_TEST_MISC_011 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -/*HWTEST_F(MiscTest, ItTestMisc011, TestSize.Level0) -{ - ItTestMisc011(); -}*/ - -/* * - * @tc.name: IT_TEST_MISC_012 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(MiscTest, ItTestMisc012, TestSize.Level0) -{ - ItTestMisc012(); -} - -/* * - * @tc.name: IT_TEST_MISC_013 - * @tc.desc: function for MiscTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -/*HWTEST_F(MiscTest, ItTestMisc013, TestSize.Level0) -{ - ItTestMisc013(); -}*/ -#endif - -} // namespace OHOS diff --git a/testsuites/unittest_old/misc/smoke/misc_test_001.cpp b/testsuites/unittest_old/misc/smoke/misc_test_001.cpp deleted file mode 100644 index a2d2a75e..00000000 --- a/testsuites/unittest_old/misc/smoke/misc_test_001.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -#define TEST_MEMSIZE 8 -static UINT32 TestCase(VOID) -{ - VOID *ptr = NULL; - - ptr = valloc(TEST_MEMSIZE); - ICUNIT_GOTO_NOT_EQUAL(ptr, NULL, ptr, EXIT); - - free(ptr); - - return MISC_OK; -EXIT: - free(ptr); - return MISC_NOK; -} - -VOID ItTestMisc001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/smoke/misc_test_002.cpp b/testsuites/unittest_old/misc/smoke/misc_test_002.cpp deleted file mode 100644 index 44680381..00000000 --- a/testsuites/unittest_old/misc/smoke/misc_test_002.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -#define TEST_OK "success" -#define STR_LEN 20 - -static VOID Vwarnfuc(const char *format, ...) -{ - va_list arglist; - - va_start(arglist, format); - vwarn(format, arglist); - va_end(arglist); -} - -static UINT32 TestCase(VOID) -{ - CHAR ptr[STR_LEN] = TEST_OK; - Vwarnfuc("%s", ptr); - return 0; -} - -VOID ItTestMisc002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/smoke/misc_test_003.cpp b/testsuites/unittest_old/misc/smoke/misc_test_003.cpp deleted file mode 100644 index 1269a61c..00000000 --- a/testsuites/unittest_old/misc/smoke/misc_test_003.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -#define TEST_OK "success" -#define STR_LEN 20 - -static VOID Vwarnxfuc(const char *format, ...) -{ - va_list arglist; - - va_start(arglist, format); - vwarnx(format, arglist); - va_end(arglist); -} - -static UINT32 TestCase(VOID) -{ - CHAR ptr[STR_LEN] = TEST_OK; - Vwarnxfuc("%s", ptr); - return 0; -} - -VOID ItTestMisc003(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/smoke/misc_test_004.cpp b/testsuites/unittest_old/misc/smoke/misc_test_004.cpp deleted file mode 100644 index f692d95f..00000000 --- a/testsuites/unittest_old/misc/smoke/misc_test_004.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -#define TEST_OK "success" -#define STR_LEN 20 - -static VOID Verrfuc(INT32 fpid, const char *format, ...) -{ - va_list arglist; - - va_start(arglist, format); - verr(fpid, format, arglist); - va_end(arglist); -} - -static UINT32 TestCase(VOID) -{ - CHAR ptr[STR_LEN] = TEST_OK; - INT32 fpid; - - fpid = fork(); - if (fpid == 0) { - Verrfuc(fpid, "%s", ptr); - } - usleep(20); - return 0; -} - -VOID ItTestMisc004(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/smoke/misc_test_005.cpp b/testsuites/unittest_old/misc/smoke/misc_test_005.cpp deleted file mode 100644 index e377ae48..00000000 --- a/testsuites/unittest_old/misc/smoke/misc_test_005.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -#define TEST_OK "success" -#define STR_LEN 20 - -static VOID Verrxfuc(INT32 fpid, const char *format, ...) -{ - va_list arglist; - - va_start(arglist, format); - verrx(fpid, format, arglist); - va_end(arglist); -} - -static UINT32 TestCase(VOID) -{ - CHAR ptr[STR_LEN] = TEST_OK; - INT32 fpid; - - fpid = fork(); - if (fpid == 0) { - Verrxfuc(fpid, "%s", ptr); - } - usleep(20); - return 0; -} - -VOID ItTestMisc005(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/misc/smoke/misc_test_014.cpp b/testsuites/unittest_old/misc/smoke/misc_test_014.cpp deleted file mode 100644 index 1dffbe51..00000000 --- a/testsuites/unittest_old/misc/smoke/misc_test_014.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -static UINT32 TestCase(VOID) -{ - char *name1 = nullptr; - char name2[100] = { 0 }; - char name3[100] = "hello"; - int ret; - - name1 = tmpnam(NULL); - ICUNIT_ASSERT_NOT_EQUAL(name1, nullptr, -1); - ret = strncmp(name1, "/tmp/tmpnam_", 12); - ICUNIT_ASSERT_EQUAL(ret, 0, -1); - - tmpnam(name2); - ICUNIT_ASSERT_NOT_EQUAL(name2[0], 0, -1); - ret = strncmp(name2, "/tmp/tmpnam_", 12); - ICUNIT_ASSERT_EQUAL(ret, 0, -1); - - tmpnam(name2); - ret = strncmp(name2, "/tmp/tmpnam_", 12); - ICUNIT_ASSERT_EQUAL(ret, 0, -1); - - return LOS_OK; -} - -VOID IT_TEST_MISC_014(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/BUILD.gn b/testsuites/unittest_old/net/netdb/BUILD.gn deleted file mode 100644 index a2f423f6..00000000 --- a/testsuites/unittest_old/net/netdb/BUILD.gn +++ /dev/null @@ -1,106 +0,0 @@ -# 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("net_local_config") { - if (LOSCFG_USER_TEST_NET_NETDB == true) { - cflags = [ "-DLOSCFG_USER_TEST_NET_NETDB" ] - cflags_cc = cflags - } -} - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "net_netdb_test.cpp", -] - -sources_smoke = [ - "smoke/net_netdb_test_001.cpp", - "smoke/net_netdb_test_013.cpp", -] - -sources_full = [ - "full/net_netdb_test_002.cpp", - "full/net_netdb_test_003.cpp", - "full/net_netdb_test_004.cpp", - "full/net_netdb_test_005.cpp", - "full/net_netdb_test_006.cpp", - "full/net_netdb_test_007.cpp", - "full/net_netdb_test_008.cpp", - "full/net_netdb_test_009.cpp", - "full/net_netdb_test_010.cpp", - "full/net_netdb_test_011.cpp", - "full/net_netdb_test_012.cpp", - "full/net_netdb_test_014.cpp", - "full/net_netdb_test_015.cpp", - "full/net_netdb_test_016.cpp", - "full/net_netdb_test_017.cpp", - "full/net_netdb_test_018.cpp", - "full/net_netdb_test_019.cpp", - "full/net_netdb_test_020.cpp", - "full/net_netdb_test_021.cpp", - "full/net_netdb_test_022.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_net_netdb_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 += [ ":net_local_config" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_net_netdb_unittest") { - output_extension = "bin" - output_dir = "$root_out_dir/test/unittest/kernel" - include_dirs = common_include_dirs - sources = sources_entry - sources += sources_full - sources += sources_smoke - configs = [ "../..:public_config_for_all" ] - configs += [ ":net_local_config" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_002.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_002.cpp deleted file mode 100644 index bb124c5c..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_002.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ - - -#include "lt_net_netdb.h" - -static int AddrInfoTest(void) -{ - // Prerequisite: correct DNS servers must be configured. - struct addrinfo *addr = NULL; - int ret = getaddrinfo("example.com", "ftp", NULL, &addr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - freeaddrinfo(addr); - - ret = getaddrinfo("local", "ftp", NULL, &addr); - ICUNIT_ASSERT_EQUAL(ret, EAI_AGAIN, ret); - - ret = getaddrinfo("localhost", "fp", NULL, &addr); - ICUNIT_ASSERT_EQUAL(ret, EAI_SERVICE, ret); - - const char *p = gai_strerror(EAI_AGAIN); - ICUNIT_ASSERT_NOT_EQUAL(p, NULL, -1); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest002(void) -{ - TEST_ADD_CASE(__FUNCTION__, AddrInfoTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_003.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_003.cpp deleted file mode 100644 index 229c3ad5..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_003.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ - - -#include "lt_net_netdb.h" - -static int IfAddrsTest(void) -{ - // Prerequisite: correct DNS servers must be configured. - struct ifaddrs *addr = NULL; - int ret = getifaddrs(&addr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_NOT_EQUAL(addr, NULL, -1); - - freeifaddrs(addr); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest003(void) -{ - TEST_ADD_CASE(__FUNCTION__, IfAddrsTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_004.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_004.cpp deleted file mode 100644 index aeea1cc3..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_004.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - - -#include "lt_net_netdb.h" - -static int GetHostByAddrTest(void) -{ - struct in_addr ia; - int length = 4; - ia.s_addr = inet_addr("127.0.0.1"); - struct hostent *addr = gethostbyaddr(&ia, sizeof ia, AF_INET); - ICUNIT_ASSERT_NOT_EQUAL(addr, NULL, -1); - ICUNIT_ASSERT_EQUAL(addr->h_addrtype, AF_INET, addr->h_addrtype); - ICUNIT_ASSERT_STRING_EQUAL(addr->h_name, "localhost", -1); - ICUNIT_ASSERT_EQUAL(addr->h_length, length, -1); - - ia.s_addr = inet_addr("100.109.180.184"); - addr = gethostbyaddr(&ia, sizeof ia, AF_INET); - ICUNIT_ASSERT_NOT_EQUAL(addr, NULL, -1); - ICUNIT_ASSERT_EQUAL(addr->h_addrtype, AF_INET, addr->h_addrtype); - ICUNIT_ASSERT_STRING_EQUAL(addr->h_name, "szvphisprb93341", -1); - ICUNIT_ASSERT_STRING_EQUAL(addr->h_aliases[0], "szvphisprb93341", -1); - - errno = 0; - ia.s_addr = inet_addr("127.0.0.0"); - addr = gethostbyaddr(&ia, sizeof ia, AF_INET); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - return ICUNIT_SUCCESS; - return ICUNIT_SUCCESS; -} - -void NetNetDbTest004(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetHostByAddrTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_005.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_005.cpp deleted file mode 100644 index 7fe49c76..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_005.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "lt_net_netdb.h" - -static int GetHostByAddrRTest(void) -{ - struct in_addr ia; - struct hostent addr, *result = NULL; - char buf[1024]; - char buf1[1]; - int err, ret; - int length = 4; - - ia.s_addr = inet_addr("127.0.0.1"); - ret = gethostbyaddr_r(&ia, sizeof ia, AF_INET, &addr, buf, sizeof buf, &result, &err); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_NOT_EQUAL(result, NULL, -1); - ICUNIT_ASSERT_EQUAL(result->h_addrtype, AF_INET, result->h_addrtype); - ICUNIT_ASSERT_STRING_EQUAL(result->h_name, "localhost", -1); - ICUNIT_ASSERT_EQUAL(result->h_length, length, -1); - - errno = 0; - ia.s_addr = inet_addr("127.0.0.0"); - ret = gethostbyaddr_r(&ia, sizeof ia, AF_INET, &addr, buf, sizeof buf, &result, &err); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = gethostbyaddr_r(&ia, sizeof ia, AF_INET, &addr, buf, sizeof buf, &result, &err); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = gethostbyaddr_r(&ia, sizeof ia, AF_INET, &addr, buf1, sizeof buf1, &result, &err); - ICUNIT_ASSERT_EQUAL(ret, ERANGE, ret); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest005(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetHostByAddrRTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_006.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_006.cpp deleted file mode 100644 index b9932e81..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_006.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - - -#include "lt_net_netdb.h" - -static int GetHostByNameTest(void) -{ - struct hostent *addr = gethostbyname("localhost"); - ICUNIT_ASSERT_NOT_EQUAL(addr, NULL, -1); - ICUNIT_ASSERT_EQUAL(strcmp(addr->h_name, "localhost"), 0, -1); - ICUNIT_ASSERT_EQUAL(addr->h_addrtype, AF_INET, addr->h_addrtype); - ICUNIT_ASSERT_NOT_EQUAL(addr->h_length, 0, addr->h_length); - - addr = gethostbyname("127.0.0.1"); - ICUNIT_ASSERT_NOT_EQUAL(addr, NULL, -1); - ICUNIT_ASSERT_EQUAL(strcmp(addr->h_name, "127.0.0.1"), 0, -1); - ICUNIT_ASSERT_EQUAL(addr->h_addrtype, AF_INET, addr->h_addrtype); - ICUNIT_ASSERT_NOT_EQUAL(addr->h_length, 0, addr->h_length); - - addr = gethostbyname("lo"); - ICUNIT_ASSERT_EQUAL(addr, NULL, -1); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest006(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetHostByNameTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_007.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_007.cpp deleted file mode 100644 index 712e5b97..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_007.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - - -#include "lt_net_netdb.h" - -static int GetHostByNameRTest(void) -{ - struct hostent addr, *result = NULL; - char buf[1024]; - char buf1[1]; - int err, ret; - - ret = gethostbyname_r("localhost", &addr, buf, sizeof buf, &result, &err); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_NOT_EQUAL(result, NULL, -1); - ICUNIT_ASSERT_EQUAL(strcmp(result->h_name, "localhost"), 0, -1); - ICUNIT_ASSERT_EQUAL(result->h_addrtype, AF_INET, result->h_addrtype); - ICUNIT_ASSERT_NOT_EQUAL(result->h_length, 0, result->h_length); - - ret = gethostbyname_r("127.0.0.1", &addr, buf, sizeof buf, &result, &err); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_NOT_EQUAL(result, NULL, -1); - ICUNIT_ASSERT_EQUAL(strcmp(result->h_name, "127.0.0.1"), 0, -1); - ICUNIT_ASSERT_EQUAL(result->h_addrtype, AF_INET, result->h_addrtype); - ICUNIT_ASSERT_NOT_EQUAL(result->h_length, 0, result->h_length); - - ret = gethostbyname_r("127.0.0.1", &addr, buf1, sizeof buf1, &result, &err); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = gethostbyname_r("127.0.0.0.0", &addr, buf, sizeof buf, &result, &err); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = gethostbyname_r("lo", &addr, buf, sizeof buf, &result, &err); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest007(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetHostByNameRTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_008.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_008.cpp deleted file mode 100644 index 6a9d44e6..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_008.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ - - -#include "lt_net_netdb.h" - -static int GetHostByName2Test(void) -{ - struct hostent *addr = gethostbyname2("localhost", AF_INET); - ICUNIT_ASSERT_NOT_EQUAL(addr, NULL, -1); - ICUNIT_ASSERT_EQUAL(strcmp(addr->h_name, "localhost"), 0, -1); - ICUNIT_ASSERT_EQUAL(addr->h_addrtype, AF_INET, addr->h_addrtype); - ICUNIT_ASSERT_NOT_EQUAL(addr->h_length, 0, addr->h_length); - - addr = gethostbyname2("127.0.0.1", AF_INET); - ICUNIT_ASSERT_NOT_EQUAL(addr, NULL, -1); - ICUNIT_ASSERT_EQUAL(strcmp(addr->h_name, "127.0.0.1"), 0, -1); - ICUNIT_ASSERT_EQUAL(addr->h_addrtype, AF_INET, addr->h_addrtype); - ICUNIT_ASSERT_NOT_EQUAL(addr->h_length, 0, addr->h_length); - - addr = gethostbyname2("127.0.0.1", AF_INET6); - ICUNIT_ASSERT_EQUAL(addr, NULL, -1); - addr = gethostbyname2("localh", AF_INET); - ICUNIT_ASSERT_EQUAL(addr, NULL, -1); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest008(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetHostByName2Test, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_009.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_009.cpp deleted file mode 100644 index c14bc9b7..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_009.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ - -#include "lt_net_netdb.h" - -static int GetHostByName2RTest(void) -{ - struct hostent addr, *result = NULL; - char buf[1024]; - char buf1[1]; - int err, ret; - - ret = gethostbyname2_r("localhost", AF_INET, &addr, buf, sizeof buf, &result, &err); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_NOT_EQUAL(result, NULL, -1); - ICUNIT_ASSERT_EQUAL(strcmp(result->h_name, "localhost"), 0, -1); - ICUNIT_ASSERT_EQUAL(result->h_addrtype, AF_INET, result->h_addrtype); - ICUNIT_ASSERT_NOT_EQUAL(result->h_length, 0, result->h_length); - - ret = gethostbyname2_r("127.0.0.1", AF_INET, &addr, buf, sizeof buf, &result, &err); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_NOT_EQUAL(result, NULL, -1); - ICUNIT_ASSERT_EQUAL(strcmp(result->h_name, "127.0.0.1"), 0, -1); - ICUNIT_ASSERT_EQUAL(result->h_addrtype, AF_INET, result->h_addrtype); - ICUNIT_ASSERT_NOT_EQUAL(result->h_length, 0, result->h_length); - - ret = gethostbyname2_r("127.0.0.1", AF_INET, &addr, buf1, sizeof buf1, &result, &err); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = gethostbyname2_r("127.0.0.1.1", AF_INET, &addr, buf, sizeof buf, &result, &err); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = gethostbyname2_r("lo", AF_INET, &addr, buf, sizeof buf, &result, &err); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest009(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetHostByName2RTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_010.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_010.cpp deleted file mode 100644 index efd6b88b..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_010.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ - - -#include "lt_net_netdb.h" - -static int NameInfoTest(void) -{ - char host[256], serv[256]; - struct sockaddr_in addr; - addr.sin_family = AF_INET; - addr.sin_port = htons(22); - addr.sin_addr.s_addr = inet_addr("127.0.0.1"); - int ret = getnameinfo((struct sockaddr*)&addr, sizeof addr, host, sizeof host, serv, sizeof serv, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest010(void) -{ - TEST_ADD_CASE(__FUNCTION__, NameInfoTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_011.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_011.cpp deleted file mode 100644 index b6b7f191..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_011.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ - - -#include "lt_net_netdb.h" - -static int GetServByPortTest(void) -{ - // refer to the `/etc/services' file. - struct servent *se1 = nullptr; - struct servent *se = getservbyport(htons(22), "tcp"); - ICUNIT_ASSERT_NOT_EQUAL(se, NULL, -1); - ICUNIT_ASSERT_STRING_EQUAL(se->s_name, "ssh", -1); - ICUNIT_ASSERT_STRING_EQUAL(se->s_proto, "tcp", -1); - ICUNIT_ASSERT_STRING_EQUAL(se->s_aliases[0], "ssh", -1); - - se1 = getservbyport(htons(22), "tp"); - ICUNIT_ASSERT_EQUAL(se1, nullptr, -1); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest011(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetServByPortTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_012.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_012.cpp deleted file mode 100644 index 0e9ad90e..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_012.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ - - -#include "lt_net_netdb.h" - -static int GetServByPortRTest(void) -{ - // refer to the `/etc/services' file. - struct servent se, *result = NULL; - char buf[1024]; - char buf1[2]; - - int ret = getservbyport_r(htons(22), "udp", &se, buf, sizeof buf, &result); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_NOT_EQUAL(result, NULL, -1); - ICUNIT_ASSERT_STRING_EQUAL(se.s_name, "ssh", -1); - ICUNIT_ASSERT_STRING_EQUAL(se.s_proto, "udp", -1); - ICUNIT_ASSERT_STRING_EQUAL(se.s_aliases[0], "ssh", -1); - ICUNIT_ASSERT_STRING_EQUAL(result->s_name, "ssh", -1); - ICUNIT_ASSERT_STRING_EQUAL(result->s_proto, "udp", -1); - ICUNIT_ASSERT_STRING_EQUAL(result->s_aliases[0], "ssh", -1); - - ret = getservbyport_r(htons(22), "udp", &se, buf1, sizeof buf1, &result); - ICUNIT_ASSERT_EQUAL(ret, ERANGE, ret); - - ret = getservbyport_r(htons(22), "ud", &se, buf, sizeof buf, &result); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest012(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetServByPortRTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_014.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_014.cpp deleted file mode 100644 index d4f0caaa..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_014.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ - -#include "lt_net_netdb.h" -#include - -static int IfNameIndexTest(void) -{ - struct if_nameindex *idx = if_nameindex(); - ICUNIT_ASSERT_NOT_EQUAL(idx, NULL, -1); - - if_freenameindex(idx); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest014(void) -{ - TEST_ADD_CASE(__FUNCTION__, IfNameIndexTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_015.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_015.cpp deleted file mode 100644 index 95e675b4..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_015.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * opyright (c) 2021-2021, 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 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "lt_net_netdb.h" -#include - -static int IfNameToIndexTest(void) -{ - int ret; - char if_name[20]; - char *str = nullptr; - - ret = if_nametoindex("lo"); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, -1); - - str = if_indextoname(ret, if_name); - ICUNIT_ASSERT_NOT_EQUAL(str, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(if_name, "lo", -1); - - str = if_indextoname(3, if_name); - ICUNIT_ASSERT_EQUAL(str, nullptr, -1); - ICUNIT_ASSERT_EQUAL(errno, ENXIO, errno); - - ret = if_nametoindex("eth1"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(errno, ENODEV, errno); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest015(void) -{ - TEST_ADD_CASE(__FUNCTION__, IfNameToIndexTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_016.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_016.cpp deleted file mode 100644 index 652db1ed..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_016.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * opyright (c) 2021-2021, 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 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "lt_net_netdb.h" - -static int GetServByNameTest(void) -{ - struct servent *se1 = nullptr; - struct servent *se2 = nullptr; - - se1 = getservbyname("discard", "tcp"); - ICUNIT_ASSERT_NOT_EQUAL(se1, NULL, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_name, "discard", -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_proto, "tcp", -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_aliases[0], "discard", -1); - - se1 = getservbyname("ssh", "tcp"); - ICUNIT_ASSERT_NOT_EQUAL(se1, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_name, "ssh", -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_proto, "tcp", -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_aliases[0], "ssh", -1); - - se2 = getservbyname("cho", "udp"); - ICUNIT_ASSERT_EQUAL(se2, nullptr, -1); - - se2 = getservbyname("systat", "udp"); - ICUNIT_ASSERT_EQUAL(se2, nullptr, -1); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest016(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetServByNameTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_017.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_017.cpp deleted file mode 100644 index 81908c55..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_017.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * opyright (c) 2021-2021, 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 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "lt_net_netdb.h" - -static int GetServByNameRTest(void) -{ - struct servent se; - struct servent *result = NULL; - char buf1[1024] = { 0 }; - char buf2[2] = { 0 }; - int ret; - - errno = 0; - ret = getservbyname_r("ssh", "tcp", &se, buf1, sizeof buf1, &result); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_NOT_EQUAL(result, NULL, -1); - ICUNIT_ASSERT_STRING_EQUAL(se.s_name, "ssh", -1); - ICUNIT_ASSERT_STRING_EQUAL(se.s_proto, "tcp", -1); - ICUNIT_ASSERT_STRING_EQUAL(se.s_aliases[0], "ssh", -1); - ICUNIT_ASSERT_STRING_EQUAL(result->s_name, "ssh", -1); - ICUNIT_ASSERT_STRING_EQUAL(result->s_proto, "tcp", -1); - ICUNIT_ASSERT_STRING_EQUAL(result->s_aliases[0], "ssh", -1); - - ret = getservbyname_r("ssh", "tcp", &se, buf2, sizeof buf2, &result); - ICUNIT_ASSERT_EQUAL(ret, ERANGE, ret); - - ret = getservbyname_r("ssh", "tp", &se, buf1, sizeof buf1, &result); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = getservbyname_r("sh", "tcp", &se, buf1, sizeof buf1, &result); - ICUNIT_ASSERT_EQUAL(ret, ENOENT, ret); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest017(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetServByNameRTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_018.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_018.cpp deleted file mode 100644 index 3f816dc8..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_018.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * opyright (c) 2021-2021, 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 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "lt_net_netdb.h" - -static int GetServEntTest(void) -{ - struct servent *se1 = nullptr; - struct servent *se2 = nullptr; - struct servent *se3 = nullptr; - - se1 = getservent(); - ICUNIT_ASSERT_NOT_EQUAL(se1, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_name, "tcpmux", -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_proto, "tcp", -1); - ICUNIT_ASSERT_EQUAL(se1->s_port, ntohs(1), -1); - - endservent(); - se2 = getservent(); - ICUNIT_ASSERT_NOT_EQUAL(se2, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_name, se2->s_name, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_proto, se2->s_proto, -1); - ICUNIT_ASSERT_EQUAL(se1->s_port, se2->s_port, -1); - - setservent(0); - se3 = getservent(); - ICUNIT_ASSERT_NOT_EQUAL(se3, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_name, se3->s_name, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->s_proto, se3->s_proto, -1); - ICUNIT_ASSERT_EQUAL(se1->s_port, se3->s_port, -1); - - se3 = getservent(); - ICUNIT_ASSERT_NOT_EQUAL(se3, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se3->s_name, "echo", -1); - ICUNIT_ASSERT_STRING_EQUAL(se3->s_proto, "tcp", -1); - ICUNIT_ASSERT_EQUAL(se3->s_port, ntohs(7), -1); - - se3 = getservent(); - ICUNIT_ASSERT_NOT_EQUAL(se3, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se3->s_name, "echo", -1); - ICUNIT_ASSERT_STRING_EQUAL(se3->s_proto, "udp", -1); - ICUNIT_ASSERT_EQUAL(se3->s_port, ntohs(7), -1); - - se3 = getservent(); - ICUNIT_ASSERT_NOT_EQUAL(se3, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se3->s_name, "discard", -1); - ICUNIT_ASSERT_STRING_EQUAL(se3->s_proto, "tcp", -1); - ICUNIT_ASSERT_EQUAL(se3->s_port, ntohs(9), -1); - ICUNIT_ASSERT_STRING_EQUAL(se3->s_aliases[0], "sink", -1); - return ICUNIT_SUCCESS; -} - -void NetNetDbTest018(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetServEntTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_019.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_019.cpp deleted file mode 100644 index 53c9b08a..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_019.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * opyright (c) 2021-2021, 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 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "lt_net_netdb.h" - -static int GetHostEntTest(void) -{ - struct hostent *se1 = nullptr; - struct hostent *se2 = nullptr; - struct hostent *se3 = nullptr; - int type = 2; - int length1 = 4; - int length2 = 16; - - se1 = gethostent(); - ICUNIT_ASSERT_NOT_EQUAL(se1, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->h_name, "localhost", -1); - ICUNIT_ASSERT_EQUAL(se1->h_addrtype, type, -1); - ICUNIT_ASSERT_EQUAL(se1->h_length, length1, -1); - - endhostent(); - se2 = gethostent(); - ICUNIT_ASSERT_NOT_EQUAL(se2, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->h_name, se2->h_name, -1); - ICUNIT_ASSERT_EQUAL(se1->h_addrtype, se2->h_addrtype, -1); - ICUNIT_ASSERT_EQUAL(se1->h_length, se2->h_length, -1); - - sethostent(0); - se3 = gethostent(); - ICUNIT_ASSERT_NOT_EQUAL(se3, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->h_name, se3->h_name, -1); - ICUNIT_ASSERT_EQUAL(se1->h_addrtype, se3->h_addrtype, -1); - ICUNIT_ASSERT_EQUAL(se1->h_length, se3->h_length, -1); - - se3 = gethostent(); - ICUNIT_ASSERT_NOT_EQUAL(se3, nullptr, -1); - ICUNIT_ASSERT_EQUAL(se3->h_addrtype, AF_INET6, -1); - ICUNIT_ASSERT_STRING_EQUAL(se3->h_name, "localhost", -1); - ICUNIT_ASSERT_EQUAL(se3->h_length, length2, -1); - - se3 = gethostent(); - ICUNIT_ASSERT_NOT_EQUAL(se3, nullptr, -1); - ICUNIT_ASSERT_EQUAL(se3->h_addrtype, AF_INET, -1); - ICUNIT_ASSERT_STRING_EQUAL(se3->h_name, "szvphisprb93341", -1); - ICUNIT_ASSERT_STRING_EQUAL(se3->h_aliases[0], "szvphisprb93341.huawei.com", -1); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest019(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetHostEntTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_020.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_020.cpp deleted file mode 100644 index a08a22f0..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_020.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * opyright (c) 2021-2021, 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 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "lt_net_netdb.h" - -static int GetNetEntTest(void) -{ - struct netent *se1 = nullptr; - struct netent *se2 = nullptr; - struct netent *se3 = nullptr; - - se1 = getnetent(); - ICUNIT_ASSERT_NOT_EQUAL(se1, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->n_name, "link-local", -1); - ICUNIT_ASSERT_EQUAL(se1->n_addrtype, 2, -1); - ICUNIT_ASSERT_EQUAL(se1->n_net, inet_network("169.254.0.0"), -1); - - endnetent(); - se2 = getnetent(); - ICUNIT_ASSERT_NOT_EQUAL(se2, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->n_name, se2->n_name, -1); - ICUNIT_ASSERT_EQUAL(se1->n_addrtype, se2->n_addrtype, -1); - ICUNIT_ASSERT_EQUAL(se1->n_net, se2->n_net, -1); - - setnetent(0); - se3 = getnetent(); - ICUNIT_ASSERT_NOT_EQUAL(se3, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->n_name, se3->n_name, -1); - ICUNIT_ASSERT_EQUAL(se1->n_addrtype, se3->n_addrtype, -1); - ICUNIT_ASSERT_EQUAL(se1->n_net, se3->n_net, -1); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest020(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetNetEntTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_021.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_021.cpp deleted file mode 100644 index 0e4254b3..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_021.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * opyright (c) 2021-2021, 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 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "lt_net_netdb.h" - -static int GetNetBynametTest(void) -{ - struct netent *se1 = nullptr; - struct netent *se2 = nullptr; - struct netent *se3 = nullptr; - - se1 = getnetbyname("link-local"); - ICUNIT_ASSERT_NOT_EQUAL(se1, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->n_name, "link-local", -1); - ICUNIT_ASSERT_EQUAL(se1->n_addrtype, 2, -1); - ICUNIT_ASSERT_EQUAL(se1->n_net, inet_network("169.254.0.0"), -1); - - se2 = getnetbyname("link"); - ICUNIT_ASSERT_EQUAL(se2, nullptr, -1); - - se3 = getnetbyname("hs"); - ICUNIT_ASSERT_EQUAL(se3, nullptr, -1); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest021(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetNetBynametTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/full/net_netdb_test_022.cpp b/testsuites/unittest_old/net/netdb/full/net_netdb_test_022.cpp deleted file mode 100644 index 3bf0f9b1..00000000 --- a/testsuites/unittest_old/net/netdb/full/net_netdb_test_022.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * opyright (c) 2021-2021, 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 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "lt_net_netdb.h" - -static int GetNetByAddrtTest(void) -{ - struct netent *se1 = nullptr; - struct netent *se2 = nullptr; - struct netent *se3 = nullptr; - - se1 = getnetbyaddr(inet_network("169.254.0.0"), AF_INET); - ICUNIT_ASSERT_NOT_EQUAL(se1, nullptr, -1); - ICUNIT_ASSERT_STRING_EQUAL(se1->n_name, "link-local", -1); - ICUNIT_ASSERT_EQUAL(se1->n_addrtype, 2, -1); - ICUNIT_ASSERT_EQUAL(se1->n_net, inet_network("169.254.0.0"), -1); - - se2 = getnetbyaddr(inet_network("169.254.0.1"), AF_INET); - ICUNIT_ASSERT_EQUAL(se2, nullptr, -1); - - se3 = getnetbyaddr(inet_network("169.254.0.1"), AF_INET6); - ICUNIT_ASSERT_EQUAL(se3, nullptr, -1); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest022(void) -{ - TEST_ADD_CASE(__FUNCTION__, GetNetByAddrtTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/lt_net_netdb.h b/testsuites/unittest_old/net/netdb/lt_net_netdb.h deleted file mode 100644 index d60a83cc..00000000 --- a/testsuites/unittest_old/net/netdb/lt_net_netdb.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#ifndef NET_RESOLV_LT_NET_NETDB_H_ -#define NET_RESOLV_LT_NET_NETDB_H_ - -#include -#include -#include -#include -#include -#include - -void NetNetDbTest001(void); -void NetNetDbTest002(void); -void NetNetDbTest003(void); -void NetNetDbTest004(void); -void NetNetDbTest005(void); -void NetNetDbTest006(void); -void NetNetDbTest007(void); -void NetNetDbTest008(void); -void NetNetDbTest009(void); -void NetNetDbTest010(void); -void NetNetDbTest011(void); -void NetNetDbTest012(void); -void NetNetDbTest013(void); -void NetNetDbTest014(void); -void NetNetDbTest015(void); -void NetNetDbTest016(void); -void NetNetDbTest017(void); -void NetNetDbTest018(void); -void NetNetDbTest019(void); -void NetNetDbTest020(void); -void NetNetDbTest021(void); -void NetNetDbTest022(void); - -#endif /* NET_RESOLV_LT_NET_NETDB_H_ */ diff --git a/testsuites/unittest_old/net/netdb/net_netdb_test.cpp b/testsuites/unittest_old/net/netdb/net_netdb_test.cpp deleted file mode 100644 index 84761e3f..00000000 --- a/testsuites/unittest_old/net/netdb/net_netdb_test.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "lt_net_netdb.h" - -using namespace testing::ext; -namespace OHOS { -class NetDbTest : public testing::Test { -public: - static void SetUpTestCase(void) - { - struct sched_param param = { 0 }; - int currThreadPolicy, ret; - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - param.sched_priority = TASK_PRIO_TEST; - ret = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - } - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) && defined(LOSCFG_USER_TEST_NET_NETDB) -/* * - * @tc.name: NetNetDbTest001 - * @tc.desc: function for NetDbTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetDbTest, NetNetDbTest001, TestSize.Level0) -{ - NetNetDbTest001(); -} - -/* * - * @tc.name: NetNetDbTest013 - * @tc.desc: function for NetDbTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetDbTest, NetNetDbTest013, TestSize.Level0) -{ - NetNetDbTest013(); -} - -#endif -} diff --git a/testsuites/unittest_old/net/netdb/smoke/net_netdb_test_001.cpp b/testsuites/unittest_old/net/netdb/smoke/net_netdb_test_001.cpp deleted file mode 100644 index 1e0b53af..00000000 --- a/testsuites/unittest_old/net/netdb/smoke/net_netdb_test_001.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - - -#include "lt_net_netdb.h" - -static int ProtoentTest(void) -{ - setprotoent(1); - - // refer to the `/etc/protocols' file. - struct protoent *prot = getprotobyname("icmp"); - ICUNIT_ASSERT_NOT_EQUAL(prot, NULL, -1); - ICUNIT_ASSERT_EQUAL(prot->p_proto, 1, prot->p_proto); - - prot = getprotobynumber(1); - ICUNIT_ASSERT_NOT_EQUAL(prot, NULL, -1); - ICUNIT_ASSERT_EQUAL(strcmp(prot->p_name, "icmp"), 0, -1); - - prot = getprotoent(); - ICUNIT_ASSERT_NOT_EQUAL(prot, NULL, -1); - - endprotoent(); - return ICUNIT_SUCCESS; -} - -void NetNetDbTest001(void) -{ - TEST_ADD_CASE(__FUNCTION__, ProtoentTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/netdb/smoke/net_netdb_test_013.cpp b/testsuites/unittest_old/net/netdb/smoke/net_netdb_test_013.cpp deleted file mode 100644 index b713849d..00000000 --- a/testsuites/unittest_old/net/netdb/smoke/net_netdb_test_013.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ - - -#include "lt_net_netdb.h" - -static int HerrorTest(void) -{ - const char *err = hstrerror(TRY_AGAIN); - ICUNIT_ASSERT_NOT_EQUAL(err, NULL, -1); - - herror(err); - - return ICUNIT_SUCCESS; -} - -void NetNetDbTest013(void) -{ - TEST_ADD_CASE(__FUNCTION__, HerrorTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/resolv/BUILD.gn b/testsuites/unittest_old/net/resolv/BUILD.gn deleted file mode 100644 index 04ecba29..00000000 --- a/testsuites/unittest_old/net/resolv/BUILD.gn +++ /dev/null @@ -1,92 +0,0 @@ -# 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("net_local_config") { - if (LOSCFG_USER_TEST_NET_RESOLV == true) { - cflags = [ "-DLOSCFG_USER_TEST_NET_RESOLV" ] - cflags_cc = cflags - } -} - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "net_resolv_test.cpp", -] - -sources_smoke = [ - "smoke/net_resolv_test_001.cpp", - "smoke/net_resolv_test_002.cpp", - "smoke/net_resolv_test_003.cpp", - "smoke/net_resolv_test_006.cpp", - "smoke/net_resolv_test_007.cpp", -] - -sources_full = [ - "full/net_resolv_test_004.cpp", - "full/net_resolv_test_005.cpp", - "full/net_resolv_test_008.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_net_resolv_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 += [ ":net_local_config" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_net_resolv_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 += [ ":net_local_config" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} diff --git a/testsuites/unittest_old/net/resolv/full/net_resolv_test_004.cpp b/testsuites/unittest_old/net/resolv/full/net_resolv_test_004.cpp deleted file mode 100644 index e8cb672a..00000000 --- a/testsuites/unittest_old/net/resolv/full/net_resolv_test_004.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ - -#include - -static int EtherHosttonTest(void) -{ - // suppose "0:0:0:0:0:0 localhost" in `/etc/ethers' file. - struct ether_addr addr, *eaddr = &addr; - int ret = ether_hostton("localhost", eaddr); - - ICUNIT_ASSERT_EQUAL(ret, 0, -1); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[0], 0x00, eaddr->ether_addr_octet[0]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[1], 0x00, eaddr->ether_addr_octet[1]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[2], 0x00, eaddr->ether_addr_octet[2]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[3], 0x00, eaddr->ether_addr_octet[3]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[4], 0x00, eaddr->ether_addr_octet[4]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[5], 0x00, eaddr->ether_addr_octet[5]); - - return ICUNIT_SUCCESS; -} - -void NetResolvTest004(void) -{ - TEST_ADD_CASE(__FUNCTION__, EtherHosttonTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/resolv/full/net_resolv_test_005.cpp b/testsuites/unittest_old/net/resolv/full/net_resolv_test_005.cpp deleted file mode 100644 index abb18b64..00000000 --- a/testsuites/unittest_old/net/resolv/full/net_resolv_test_005.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ - - -#include - -static int EtherLineTest(void) -{ - struct ether_addr addr, *eaddr = &addr; - char buf[100]; - int ret; - - ret = ether_line("localhost 01:02:03:04:05:06", eaddr, buf); - ICUNIT_ASSERT_EQUAL(ret, -1, -1); - - ret = ether_line("01:02:03:04:05:06 localhost", eaddr, buf); - ICUNIT_ASSERT_EQUAL(ret, 0, -1); - - ICUNIT_ASSERT_EQUAL(strcmp("localhost", buf), 0, -1); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[0], 0x01, eaddr->ether_addr_octet[0]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[1], 0x02, eaddr->ether_addr_octet[1]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[2], 0x03, eaddr->ether_addr_octet[2]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[3], 0x04, eaddr->ether_addr_octet[3]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[4], 0x05, eaddr->ether_addr_octet[4]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[5], 0x06, eaddr->ether_addr_octet[5]); - - return ICUNIT_SUCCESS; -} - -void NetResolvTest005(void) -{ - TEST_ADD_CASE(__FUNCTION__, EtherLineTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/resolv/full/net_resolv_test_008.cpp b/testsuites/unittest_old/net/resolv/full/net_resolv_test_008.cpp deleted file mode 100644 index baf77fbe..00000000 --- a/testsuites/unittest_old/net/resolv/full/net_resolv_test_008.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ - - -#include - -static int EtherNtohostTest(void) -{ - // suppose "0:0:0:0:0:0 localhost" in `/etc/ethers' file. - struct ether_addr addr = {{0,0,0,0,0,0}}, *eaddr = &addr; - char buf[100]; - int ret = ether_ntohost(buf, eaddr); - - ICUNIT_ASSERT_EQUAL(ret, 0, -1); - ICUNIT_ASSERT_EQUAL(strcmp("localhost", buf), 0, -1); - - return ICUNIT_SUCCESS; -} - -void NetResolvTest008(void) -{ - TEST_ADD_CASE(__FUNCTION__, EtherNtohostTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/resolv/lt_net_resolv.h b/testsuites/unittest_old/net/resolv/lt_net_resolv.h deleted file mode 100644 index 26b25985..00000000 --- a/testsuites/unittest_old/net/resolv/lt_net_resolv.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ - -#ifndef NET_RESOLV_LT_NET_RESOLV_H_ -#define NET_RESOLV_LT_NET_RESOLV_H_ - -#include -#include -#include -#include - -int stricmp(const char *s1, const char *s2); - -void NetResolvTest001(void); -void NetResolvTest002(void); -void NetResolvTest003(void); -void NetResolvTest004(void); -void NetResolvTest005(void); -void NetResolvTest006(void); -void NetResolvTest007(void); -void NetResolvTest008(void); - -#endif /* NET_RESOLV_LT_NET_RESOLV_H_ */ diff --git a/testsuites/unittest_old/net/resolv/net_resolv_test.cpp b/testsuites/unittest_old/net/resolv/net_resolv_test.cpp deleted file mode 100644 index 731c9bf5..00000000 --- a/testsuites/unittest_old/net/resolv/net_resolv_test.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "lt_net_resolv.h" - -int stricmp(const char *s1, const char *s2) -{ - for (; *s1 && *s2; s1++, s2++) { - if (*s1 == *s2) continue; - if ((*s1 ^ *s2) == 0x20 && (*s2 | 0x20) >= 'a' && (*s2 | 0x20) <= 'z') continue; - break; - } - return *s1 - *s2; -} - -using namespace testing::ext; -namespace OHOS { -class NetResolvTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) && defined(LOSCFG_USER_TEST_NET_RESOLV) -/* * - * @tc.name: NetResolvTest001 - * @tc.desc: function for NetResolvTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetResolvTest, NetResolvTest001, TestSize.Level0) -{ - NetResolvTest001(); -} - -/* * - * @tc.name: NetResolvTest002 - * @tc.desc: function for NetResolvTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetResolvTest, NetResolvTest002, TestSize.Level0) -{ - NetResolvTest002(); -} - -/* * - * @tc.name: NetResolvTest003 - * @tc.desc: function for NetResolvTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetResolvTest, NetResolvTest003, TestSize.Level0) -{ - NetResolvTest003(); -} - -/* * - * @tc.name: NetResolvTest006 - * @tc.desc: function for NetResolvTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetResolvTest, NetResolvTest006, TestSize.Level0) -{ - NetResolvTest006(); -} - -/* * - * @tc.name: NetResolvTest007 - * @tc.desc: function for NetResolvTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetResolvTest, NetResolvTest007, TestSize.Level0) -{ - NetResolvTest007(); -} - -#endif -} diff --git a/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_001.cpp b/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_001.cpp deleted file mode 100644 index 3a41448d..00000000 --- a/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_001.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ - - -#include -#include -static void dump(unsigned char *s, int len) { - if (!s) return; - for (int i = 0; i < len; ++i) { - printf("%02x ", s[i]); - } - printf("\n"); -} - -static int DnCompTest(void) -{ - unsigned char comp_dn[100] = "example"; - unsigned char *dnptrs[6] = {comp_dn, 0}; - unsigned char **lastdnptr = &dnptrs[6]; - int offset, ret; - - offset = strlen((const char *)dnptrs[0])+1; - ret = dn_comp("x.y.z.example.com", comp_dn+offset, sizeof(comp_dn)-offset, dnptrs, lastdnptr); - dump(comp_dn+offset, ret); - ICUNIT_ASSERT_EQUAL(ret, 19, ret); - ICUNIT_ASSERT_EQUAL(dnptrs[1], comp_dn+offset, dnptrs[1]); - - offset += ret+1; - ret = dn_comp("zz.example.com", comp_dn+offset, sizeof(comp_dn)-offset, dnptrs, lastdnptr); - dump(comp_dn+offset, ret); - ICUNIT_ASSERT_EQUAL(ret, 5, ret); - ICUNIT_ASSERT_EQUAL(dnptrs[2], comp_dn+offset, dnptrs[2]); - - offset += ret+1; - ret = dn_comp("a.example.com", comp_dn+offset, sizeof(comp_dn)-offset, dnptrs, lastdnptr); - dump(comp_dn+offset, ret); - ICUNIT_ASSERT_EQUAL(ret, 4, ret); - ICUNIT_ASSERT_EQUAL(dnptrs[3], comp_dn+offset, dnptrs[3]); - - offset += ret+1; - ret = dn_comp("example.com.cn", comp_dn+offset, sizeof(comp_dn)-offset, dnptrs, lastdnptr); - dump(comp_dn+offset, ret); - ICUNIT_ASSERT_EQUAL(ret, 16, ret); - ICUNIT_ASSERT_EQUAL(dnptrs[4], comp_dn+offset, dnptrs[4]); - - offset += ret+1; - ret = dn_comp("2example.com", comp_dn+offset, sizeof(comp_dn)-offset, dnptrs, lastdnptr); - dump(comp_dn+offset, ret); - ICUNIT_ASSERT_EQUAL(ret, 11, ret); - ICUNIT_ASSERT_EQUAL(dnptrs[5], /*comp_dn+offset*/ NULL, dnptrs[5]); //last one is always NULL - - for (int i = 0; i < 6; ++i) { - printf("%p: %s\n", dnptrs[i], dnptrs[i]); - } - ICUNIT_ASSERT_EQUAL(offset+ret<100, 1, ret); - return ICUNIT_SUCCESS; -} - -void NetResolvTest001(void) -{ - TEST_ADD_CASE(__FUNCTION__, DnCompTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_002.cpp b/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_002.cpp deleted file mode 100644 index 0419b615..00000000 --- a/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_002.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ - - -#include - -static int EtherAtonTest(void) -{ - struct ether_addr *eaddr = ether_aton("01::EF"); - - ICUNIT_ASSERT_EQUAL(eaddr, NULL, -1); - - eaddr = ether_aton("2C:9D:1E:4A:41:55"); - ICUNIT_ASSERT_NOT_EQUAL(eaddr, NULL, -1); - - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[0], 0x2C, eaddr->ether_addr_octet[0]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[1], 0x9D, eaddr->ether_addr_octet[1]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[2], 0x1E, eaddr->ether_addr_octet[2]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[3], 0x4A, eaddr->ether_addr_octet[3]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[4], 0x41, eaddr->ether_addr_octet[4]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[5], 0x55, eaddr->ether_addr_octet[5]); - - return ICUNIT_SUCCESS; -} - -void NetResolvTest002(void) -{ - TEST_ADD_CASE(__FUNCTION__, EtherAtonTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_003.cpp b/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_003.cpp deleted file mode 100644 index eeb8eeb9..00000000 --- a/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_003.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - - -#include - -static int EtherAtonrTest(void) -{ - struct ether_addr addr; - struct ether_addr *eaddr = ether_aton_r("::01:EF", &addr); - - ICUNIT_ASSERT_EQUAL(eaddr, NULL, -1); - - eaddr = ether_aton_r("2c:9d:1e:4A:41:55", &addr); - - ICUNIT_ASSERT_EQUAL(eaddr, &addr, -1); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[0], 0x2c, eaddr->ether_addr_octet[0]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[1], 0x9d, eaddr->ether_addr_octet[1]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[2], 0x1e, eaddr->ether_addr_octet[2]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[3], 0x4a, eaddr->ether_addr_octet[3]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[4], 0x41, eaddr->ether_addr_octet[4]); - ICUNIT_ASSERT_EQUAL(eaddr->ether_addr_octet[5], 0x55, eaddr->ether_addr_octet[5]); - - return ICUNIT_SUCCESS; -} - -void NetResolvTest003(void) -{ - TEST_ADD_CASE(__FUNCTION__, EtherAtonrTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_006.cpp b/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_006.cpp deleted file mode 100644 index d60d950a..00000000 --- a/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_006.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ - - -#include - -static int EtherNtoaTest(void) -{ - struct ether_addr addr = {{11,12,13,14,15,16}}, *eaddr = &addr; - char *buf = ether_ntoa(eaddr); - - ICUNIT_ASSERT_NOT_EQUAL(buf, 0, -1); - ICUNIT_ASSERT_EQUAL((stricmp("b:c:d:e:f:10", buf) == 0 || stricmp("0b:0c:0d:0e:0f:10", buf) == 0), 1, printf("%s\n", buf)); - - return ICUNIT_SUCCESS; -} - -void NetResolvTest006(void) -{ - TEST_ADD_CASE(__FUNCTION__, EtherNtoaTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_007.cpp b/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_007.cpp deleted file mode 100644 index a509c97a..00000000 --- a/testsuites/unittest_old/net/resolv/smoke/net_resolv_test_007.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ - -#include - -static int EtherNtoarTest(void) -{ - struct ether_addr addr = {{11,12,13,4,15,16}}, *eaddr = &addr; - char buf[100], *p = ether_ntoa_r(eaddr, buf); - - ICUNIT_ASSERT_EQUAL(p, buf, (intptr_t)p); - ICUNIT_ASSERT_EQUAL((stricmp("b:c:d:4:f:10", buf) == 0 || stricmp("0b:0c:0d:04:0f:10", buf) == 0), 1, printf("%s\n", p)); - - return ICUNIT_SUCCESS; -} - -void NetResolvTest007(void) -{ - TEST_ADD_CASE(__FUNCTION__, EtherNtoarTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/BUILD.gn b/testsuites/unittest_old/net/socket/BUILD.gn deleted file mode 100644 index 36cc66d7..00000000 --- a/testsuites/unittest_old/net/socket/BUILD.gn +++ /dev/null @@ -1,96 +0,0 @@ -# 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("net_local_config") { - if (LOSCFG_USER_TEST_NET_SOCKET == true) { - cflags = [ "-DLOSCFG_USER_TEST_NET_SOCKET" ] - cflags_cc = cflags - } -} - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "net_socket_test.cpp", -] - -sources_smoke = [ - "smoke/net_socket_test_001.cpp", - "smoke/net_socket_test_002.cpp", - "smoke/net_socket_test_003.cpp", - "smoke/net_socket_test_004.cpp", - "smoke/net_socket_test_005.cpp", - "smoke/net_socket_test_006.cpp", - "smoke/net_socket_test_007.cpp", - "smoke/net_socket_test_008.cpp", - "smoke/net_socket_test_009.cpp", - "smoke/net_socket_test_010.cpp", - "smoke/net_socket_test_011.cpp", - "smoke/net_socket_test_012.cpp", - "smoke/net_socket_test_013.cpp", -] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_net_socket_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 += [ ":net_local_config" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_net_socket_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 += [ ":net_local_config" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} diff --git a/testsuites/unittest_old/net/socket/lt_net_socket.h b/testsuites/unittest_old/net/socket/lt_net_socket.h deleted file mode 100644 index 04d027c6..00000000 --- a/testsuites/unittest_old/net/socket/lt_net_socket.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ - -#ifndef NET_SOCKET_LT_NET_SOCKET_H_ -#define NET_SOCKET_LT_NET_SOCKET_H_ - -#include -#include - -void NetSocketTest001(void); -void NetSocketTest002(void); -void NetSocketTest003(void); -void NetSocketTest004(void); -void NetSocketTest005(void); -void NetSocketTest006(void); -void NetSocketTest007(void); -void NetSocketTest008(void); -void NetSocketTest009(void); -void NetSocketTest010(void); -void NetSocketTest011(void); -void NetSocketTest012(void); -void NetSocketTest013(void); - -#endif /* NET_SOCKET_LT_NET_SOCKET_H_ */ diff --git a/testsuites/unittest_old/net/socket/net_socket_test.cpp b/testsuites/unittest_old/net/socket/net_socket_test.cpp deleted file mode 100644 index b28b9f8b..00000000 --- a/testsuites/unittest_old/net/socket/net_socket_test.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "lt_net_socket.h" - -using namespace testing::ext; -namespace OHOS { -class NetSocketTest : public testing::Test { -public: - static void SetUpTestCase(void) - { - struct sched_param param = { 0 }; - int currThreadPolicy, ret; - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL_VOID(ret, 0, -ret); - param.sched_priority = TASK_PRIO_TEST; - ret = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - ICUNIT_ASSERT_EQUAL_VOID(ret, 0, -ret); - } - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) && defined(LOSCFG_USER_TEST_NET_SOCKET) -/* * - * @tc.name: NetSocketTest001 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest001, TestSize.Level0) -{ - NetSocketTest001(); -} - -/* * - * @tc.name: NetSocketTest002 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest002, TestSize.Level0) -{ - NetSocketTest002(); -} - -#if TEST_ON_LINUX -/* * - * @tc.name: NetSocketTest003 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest003, TestSize.Level0) -{ - NetSocketTest003(); // getifaddrs need PF_NETLINK which was not supported by lwip currently -} -#endif - -/* * - * @tc.name: NetSocketTest004 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest004, TestSize.Level0) -{ - NetSocketTest004(); -} - -/* * - * @tc.name: NetSocketTest005 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest005, TestSize.Level0) -{ - NetSocketTest005(); -} - -/* * - * @tc.name: NetSocketTest006 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest006, TestSize.Level0) -{ - NetSocketTest006(); -} - -#if TEST_ON_LINUX -/* * - * @tc.name: NetSocketTest007 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest007, TestSize.Level0) -{ - NetSocketTest007(); -} -#endif - -/* * - * @tc.name: NetSocketTest008 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest008, TestSize.Level0) -{ - NetSocketTest008(); -} - -/* * - * @tc.name: NetSocketTest009 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest009, TestSize.Level0) -{ - NetSocketTest009(); -} - -/* * - * @tc.name: NetSocketTest010 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest010, TestSize.Level0) -{ - NetSocketTest010(); -} - -/* * - * @tc.name: NetSocketTest011 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest011, TestSize.Level0) -{ - NetSocketTest011(); -} - -/* * - * @tc.name: NetSocketTest012 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(NetSocketTest, NetSocketTest012, TestSize.Level0) -{ - NetSocketTest012(); -} - -/* * - * @tc.name: NetSocketTest013 - * @tc.desc: function for NetSocketTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -/* -HWTEST_F(NetSocketTest, NetSocketTest013, TestSize.Level0) -{ - //NetSocketTest013(); // broadcast to self to be supported. -} -*/ -#endif -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_001.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_001.cpp deleted file mode 100644 index 1fc95838..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_001.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ - -#include -#include - -static int SocketTest(void) -{ - int fd = socket(0, 0, 0); - ICUNIT_ASSERT_EQUAL(fd, -1, fd); - return ICUNIT_SUCCESS; -} - -void NetSocketTest001(void) -{ - TEST_ADD_CASE(__FUNCTION__, SocketTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_002.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_002.cpp deleted file mode 100644 index 20d2193c..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_002.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#define localhost "127.0.0.1" -#define STACK_IP localhost -#define STACK_PORT 2277 -#define PEER_PORT STACK_PORT -#define PEER_IP localhost -#define MSG "Hi, I am UDP" -#define BUF_SIZE (1024 * 8) - -static char g_buf[BUF_SIZE + 1] = { 0 }; - -static int UdpTest(void) -{ - int sfd; - struct sockaddr_in srvAddr = { 0 }; - struct sockaddr_in clnAddr = { 0 }; - socklen_t clnAddrLen = sizeof(clnAddr); - int ret = 0, i = 0; - struct msghdr msg = { 0 }; - struct iovec iov[2] = { }; - - /* socket creation */ - sfd = socket(AF_INET, SOCK_DGRAM, 0); - ICUNIT_ASSERT_NOT_EQUAL(sfd, -1, sfd); - - srvAddr.sin_family = AF_INET; - srvAddr.sin_addr.s_addr = inet_addr(STACK_IP); - srvAddr.sin_port = htons(STACK_PORT); - ret = bind(sfd, (struct sockaddr*)&srvAddr, sizeof(srvAddr)); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* send */ - clnAddr.sin_family = AF_INET; - clnAddr.sin_addr.s_addr = inet_addr(PEER_IP); - clnAddr.sin_port = htons(PEER_PORT); - ret = memset_s(g_buf, BUF_SIZE, 0, BUF_SIZE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = strcpy_s(g_buf, BUF_SIZE, MSG); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = sendto(sfd, g_buf, strlen(MSG), 0, (struct sockaddr*)&clnAddr, - (socklen_t)sizeof(clnAddr)); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - /* recv */ - ret = memset_s(g_buf, BUF_SIZE, 0, BUF_SIZE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = recvfrom(sfd, g_buf, sizeof(g_buf), 0, (struct sockaddr*)&clnAddr, - &clnAddrLen); - ICUNIT_ASSERT_EQUAL(ret, strlen(MSG), ret); - - /* sendmsg */ - clnAddr.sin_family = AF_INET; - clnAddr.sin_addr.s_addr = inet_addr(PEER_IP); - clnAddr.sin_port = htons(PEER_PORT); - ret = memset_s(g_buf, BUF_SIZE, 0, BUF_SIZE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = strcpy_s(g_buf, BUF_SIZE, MSG); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - msg.msg_name = &clnAddr; - msg.msg_namelen = sizeof(clnAddr); - msg.msg_iov = iov; - msg.msg_iovlen = 2; - iov[0].iov_base = g_buf; - iov[0].iov_len = strlen(MSG); - iov[1].iov_base = g_buf; - iov[1].iov_len = strlen(MSG); - ret = sendmsg(sfd, &msg, 0); - ICUNIT_ASSERT_EQUAL(ret, 2 * strlen(MSG), ret); - - /* recvmsg */ - ret = memset_s(g_buf, BUF_SIZE, 0, BUF_SIZE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = memset_s(&msg, sizeof(msg), 0, sizeof(msg)); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - msg.msg_name = &clnAddr; - msg.msg_namelen = sizeof(clnAddr); - msg.msg_iov = iov; - msg.msg_iovlen = 1; - iov[0].iov_base = g_buf; - iov[0].iov_len = sizeof(g_buf); - ret = recvmsg(sfd, &msg, 0); - ICUNIT_ASSERT_EQUAL(ret, 2 * strlen(MSG), ret); - - /* close socket */ - ret = close(sfd); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - return 0; -} - -void NetSocketTest002(void) -{ - TEST_ADD_CASE(__FUNCTION__, UdpTest, TEST_POSIX, TEST_UDP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_003.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_003.cpp deleted file mode 100644 index 6dbcab64..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_003.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/* - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#define localhost "127.0.0.1" -#define STACK_IP localhost -#define STACK_PORT 2277 -#define PEER_PORT STACK_PORT -#define PEER_IP localhost -#define BUF_SIZE (1024 * 8) -#define SRV_MSG "Hi, I am TCP server" -#define CLI_MSG "Hi, I am TCP client" - -static pthread_barrier_t gBarrier; -#define Wait() pthread_barrier_wait(&gBarrier) - -static int SampleTcpServer() -{ - static char gBuf[BUF_SIZE + 1] = { 0 }; - int sfd = -1, lsfd = -1; - struct sockaddr_in srvAddr = { 0 }; - struct sockaddr_in clnAddr = { 0 }; - socklen_t clnAddrLen = sizeof(clnAddr); - struct msghdr msg = { 0 }; - struct iovec iov[2] = { }; - int ret = 0, i = 0; - - /* tcp server */ - lsfd = socket(AF_INET, SOCK_STREAM, 0); - LogPrintln("create listen socket inet stream: %d", lsfd); - ICUNIT_ASSERT_NOT_EQUAL(lsfd, -1, lsfd); - - srvAddr.sin_family = AF_INET; - srvAddr.sin_addr.s_addr = inet_addr(STACK_IP); - srvAddr.sin_port = htons(STACK_PORT); - ret = bind(lsfd, (struct sockaddr*)&srvAddr, sizeof(srvAddr)); - LogPrintln("bind socket %d to %s:%d: %d", lsfd, inet_ntoa(srvAddr.sin_addr), ntohs(srvAddr.sin_port), ret); - ICUNIT_ASSERT_EQUAL(ret, 0, Wait() + ret); - - ret = listen(lsfd, 0); - LogPrintln("listen socket %d: %d", lsfd, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - Wait(); - - sfd = accept(lsfd, (struct sockaddr*)&clnAddr, &clnAddrLen); - LogPrintln("accept socket %d: %d <%s:%d>", lsfd, sfd, inet_ntoa(clnAddr.sin_addr), ntohs(clnAddr.sin_port)); - ICUNIT_ASSERT_NOT_EQUAL(sfd, -1, sfd); - - /* send */ - ret = memset_s(gBuf, BUF_SIZE - 1, 0, BUF_SIZE - 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - ret = strcpy_s(gBuf, BUF_SIZE - 1, SRV_MSG); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - ret = send(sfd, gBuf, strlen(SRV_MSG), 0); - LogPrintln("send on socket %d: %d", sfd, ret); - ICUNIT_ASSERT_EQUAL(ret, strlen(SRV_MSG), ret); - - /* recv */ - ret = memset_s(gBuf, BUF_SIZE - 1, 0, BUF_SIZE - 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - ret = recv(sfd, gBuf, sizeof(gBuf), 0); - LogPrintln("recv on socket %d: %d", sfd, ret); - ICUNIT_ASSERT_EQUAL(ret, strlen(CLI_MSG), ret); - - Wait(); - - /* sendmsg */ - clnAddr.sin_family = AF_INET; - clnAddr.sin_addr.s_addr = inet_addr(PEER_IP); - clnAddr.sin_port = htons(PEER_PORT); - ret = memset_s(gBuf, BUF_SIZE - 1, 0, BUF_SIZE - 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - ret = strcpy_s(gBuf, BUF_SIZE - 1, SRV_MSG); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - msg.msg_name = &clnAddr; - msg.msg_namelen = sizeof(clnAddr); - msg.msg_iov = iov; - msg.msg_iovlen = 2; - iov[0].iov_base = gBuf; - iov[0].iov_len = strlen(SRV_MSG); - iov[1].iov_base = gBuf; - iov[1].iov_len = strlen(SRV_MSG); - ret = sendmsg(sfd, &msg, 0); - LogPrintln("sendmsg on socket %d: %d", sfd, ret); - ICUNIT_ASSERT_EQUAL(ret, 2 * strlen(SRV_MSG), ret); - - Wait(); - - /* recvmsg */ - ret = memset_s(gBuf, BUF_SIZE - 1, 0, BUF_SIZE - 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - ret = memset_s(&msg, sizeof(msg), 0, sizeof(msg)); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - msg.msg_name = &clnAddr; - msg.msg_namelen = sizeof(clnAddr); - msg.msg_iov = iov; - msg.msg_iovlen = 1; - iov[0].iov_base = gBuf; - iov[0].iov_len = sizeof(gBuf); - ret = recvmsg(sfd, &msg, 0); - LogPrintln("recvmsg on socket %d: %d", sfd, ret); - ICUNIT_ASSERT_EQUAL(ret, 2 * strlen(CLI_MSG), ret); - - ret = shutdown(sfd, SHUT_RDWR); - LogPrintln("shutdown socket %d: %d", sfd, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - close(sfd); - close(lsfd); - return 0; -} - -static int SampleTcpClient() -{ - static char gBuf[BUF_SIZE + 1] = { 0 }; - int sfd = -1; - struct sockaddr_in srvAddr = { 0 }; - struct sockaddr_in clnAddr = { 0 }; - socklen_t clnAddrLen = sizeof(clnAddr); - int ret = 0, i = 0; - struct msghdr msg = { 0 }; - struct iovec iov[2] = { }; - struct sockaddr addr; - socklen_t addrLen = sizeof(addr); - - /* tcp client connection */ - sfd = socket(AF_INET, SOCK_STREAM, 0); - LogPrintln("create client socket inet stream: %d", sfd); - ICUNIT_ASSERT_NOT_EQUAL(sfd, -1, sfd); - - Wait(); - - srvAddr.sin_family = AF_INET; - srvAddr.sin_addr.s_addr = inet_addr(PEER_IP); - srvAddr.sin_port = htons(PEER_PORT); - ret = connect(sfd, (struct sockaddr*)&srvAddr, sizeof(srvAddr)); - LogPrintln("connect socket %d to %s:%d: %d", sfd, inet_ntoa(srvAddr.sin_addr), ntohs(srvAddr.sin_port), ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* test getpeername */ - ret = getpeername(sfd, &addr, &addrLen); - LogPrintln("getpeername %d %s:%d: %d", sfd, inet_ntoa(((struct sockaddr_in*)&addr)->sin_addr), ntohs(((struct sockaddr_in*)&addr)->sin_port), ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(addrLen, sizeof(struct sockaddr_in), addrLen); - ICUNIT_ASSERT_EQUAL(((struct sockaddr_in*)&addr)->sin_addr.s_addr, - inet_addr(PEER_IP), ((struct sockaddr_in*)&addr)->sin_addr.s_addr); - - /* test getsockname */ - ret = getsockname(sfd, &addr, &addrLen); - LogPrintln("getsockname %d %s:%d: %d", sfd, inet_ntoa(((struct sockaddr_in*)&addr)->sin_addr), ntohs(((struct sockaddr_in*)&addr)->sin_port), ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(addrLen, sizeof(struct sockaddr_in), addrLen); - ICUNIT_ASSERT_EQUAL(((struct sockaddr_in*)&addr)->sin_addr.s_addr, - inet_addr(STACK_IP), ((struct sockaddr_in*)&addr)->sin_addr.s_addr); - - /* send */ - ret = memset_s(gBuf, BUF_SIZE - 1, 0, BUF_SIZE - 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - ret = strcpy_s(gBuf, BUF_SIZE - 1, CLI_MSG); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - ret = send(sfd, gBuf, strlen(CLI_MSG), 0); - LogPrintln("send on socket %d: %d", sfd, ret); - ICUNIT_ASSERT_EQUAL(ret, strlen(CLI_MSG), ret); - - /* recv */ - ret = memset_s(gBuf, BUF_SIZE - 1, 0, BUF_SIZE - 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - ret = recv(sfd, gBuf, sizeof(gBuf), 0); - LogPrintln("recv on socket %d: %d", sfd, ret); - ICUNIT_ASSERT_EQUAL(ret, strlen(SRV_MSG), ret); - - Wait(); - - /* sendmsg */ - clnAddr.sin_family = AF_INET; - clnAddr.sin_addr.s_addr = inet_addr(PEER_IP); - clnAddr.sin_port = htons(PEER_PORT); - ret = memset_s(gBuf, BUF_SIZE - 1, 0, BUF_SIZE - 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - ret = strcpy_s(gBuf, BUF_SIZE - 1, CLI_MSG); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - msg.msg_name = &clnAddr; - msg.msg_namelen = sizeof(clnAddr); - msg.msg_iov = iov; - msg.msg_iovlen = 2; - iov[0].iov_base = gBuf; - iov[0].iov_len = strlen(CLI_MSG); - iov[1].iov_base = gBuf; - iov[1].iov_len = strlen(CLI_MSG); - ret = sendmsg(sfd, &msg, 0); - LogPrintln("sendmsg on socket %d: %d", sfd, ret); - ICUNIT_ASSERT_EQUAL(ret, 2 * strlen(CLI_MSG), ret); - - Wait(); - - /* recvmsg */ - ret = memset_s(gBuf, BUF_SIZE - 1, 0, BUF_SIZE - 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gBuf[BUF_SIZE - 1] = '\0'; - ret = memset_s(&msg, sizeof(msg), 0, sizeof(msg)); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - msg.msg_name = &clnAddr; - msg.msg_namelen = sizeof(clnAddr); - msg.msg_iov = iov; - msg.msg_iovlen = 1; - iov[0].iov_base = gBuf; - iov[0].iov_len = sizeof(gBuf); - ret = recvmsg(sfd, &msg, 0); - LogPrintln("recvmsg on socket %d: %d", sfd, ret); - ICUNIT_ASSERT_EQUAL(ret, 2 * strlen(SRV_MSG), ret); - - ret = shutdown(sfd, SHUT_RDWR); - LogPrintln("shutdown socket %d: %d", sfd, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - close(sfd); - return 0; -} - -static void* TcpServerRoutine(void *p) -{ - int ret = SampleTcpServer(); - return (void*)(intptr_t)ret; -} - -static void* TcpClientRoutine(void *p) -{ - int ret = SampleTcpClient(); - return (void*)(intptr_t)ret; -} - -static int TcpTest() -{ - int ret; - void *sret = NULL; - void *cret = NULL; - pthread_t srv, cli; - pthread_attr_t attr; - - ret = pthread_barrier_init(&gBarrier, 0, 2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&srv, &attr, TcpServerRoutine, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&cli, &attr, TcpClientRoutine, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(cli, &cret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LogPrintln("client finish"); - - ret = pthread_join(srv, &sret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LogPrintln("server finish"); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_barrier_destroy(&gBarrier); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return (int)(intptr_t)(sret) + (int)(intptr_t)(cret); -} - -void NetSocketTest003(void) -{ - TEST_ADD_CASE(__FUNCTION__, TcpTest, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_004.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_004.cpp deleted file mode 100644 index 81e2ac37..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_004.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - -#include -#include -#include -#include - -static int SockOptTest(void) -{ - int ret, error, flag; - struct timeval timeout; - socklen_t len; - - int fd = socket(AF_INET, SOCK_STREAM, 0); - ICUNIT_ASSERT_NOT_EQUAL(fd, -1, fd); - - error = -1; - len = sizeof(error); - ret = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len); - LogPrintln("getsockopt(%d, SOL_SOCKET, SO_ERROR, &error, &len)=%d, error=%d, len=%d, errno=%d", fd, ret, error, len, errno); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(error, 0, error); - - len = sizeof(timeout); - ret = getsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, &len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - timeout.tv_sec = 1000; - len = sizeof(timeout); - ret = setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = memset_s(&timeout, len, 0, len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, &len); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(timeout.tv_sec, 1000, ret); - - error = -1; - len = sizeof(error); - ret = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len); - LogPrintln("getsockopt(%d, SOL_SOCKET, SO_ERROR, &error, &len)=%d, error=%d, len=%d, errno=%d", fd, ret, error, len, errno); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(error, 0, error); - - flag=1; - ret = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(flag)); - LogPrintln("setsockopt(TCP_NODELAY) ret=%d", ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = close(fd); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return ICUNIT_SUCCESS; -} - -void NetSocketTest004(void) -{ - TEST_ADD_CASE(__FUNCTION__, SockOptTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_005.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_005.cpp deleted file mode 100644 index 3cf7f895..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_005.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#include -#include -#include - -static int ByteOrderTest(void) -{ -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - uint32_t hl = ntohl(0x12345678); - ICUNIT_ASSERT_EQUAL(hl, 0x78563412, hl); - - uint32_t nl = htonl(0x12345678); - ICUNIT_ASSERT_EQUAL(nl, 0x78563412, nl); - - uint16_t hs = ntohs(0x1234); - ICUNIT_ASSERT_EQUAL(hs, 0x3412, hs); - - uint16_t ns = htons(0x1234); - ICUNIT_ASSERT_EQUAL(ns, 0x3412, ns); -#else - uint32_t hl = ntohl(0x12345678); - ICUNIT_ASSERT_EQUAL(hl, 0x12345678, hl); - - uint32_t nl = htonl(0x12345678); - ICUNIT_ASSERT_EQUAL(nl, 0x12345678, nl); - - uint16_t hs = ntohs(0x1234); - ICUNIT_ASSERT_EQUAL(hs, 0x1234, hs); - - uint16_t ns = htons(0x1234); - ICUNIT_ASSERT_EQUAL(ns, 0x1234, ns); -#endif - return ICUNIT_SUCCESS; -} - -void NetSocketTest005(void) -{ - TEST_ADD_CASE(__FUNCTION__, ByteOrderTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_006.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_006.cpp deleted file mode 100644 index 4c348502..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_006.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -#include -#include -#include -#include - -static int InetTest(void) -{ - struct in_addr in; - int ret = inet_pton(AF_INET, "300.10.10.10", &in); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = inet_pton(AF_INET, "10.11.12.13", &in); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - ICUNIT_ASSERT_EQUAL(in.s_addr, 0x0d0c0b0a, in.s_addr); -#else - ICUNIT_ASSERT_EQUAL(in.s_addr, 0x0a0b0c0d, in.s_addr); -#endif - - // host order - in_addr_t lna = inet_lnaof(in); - ICUNIT_ASSERT_EQUAL(lna, 0x000b0c0d, lna); - - // host order - in_addr_t net = inet_netof(in); - ICUNIT_ASSERT_EQUAL(net, 0x0000000a, net); - - in = inet_makeaddr(net, lna); -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - ICUNIT_ASSERT_EQUAL(in.s_addr, 0x0d0c0b0a, in.s_addr); -#else - ICUNIT_ASSERT_EQUAL(in.s_addr, 0x0a0b0c0d, in.s_addr); -#endif - - net = inet_network("300.10.10.10"); - ICUNIT_ASSERT_EQUAL(net, -1, net); - - // host order - net = inet_network("10.11.12.13"); - ICUNIT_ASSERT_EQUAL(net, 0x0a0b0c0d, net); - - const char *p = inet_ntoa(in); - ICUNIT_ASSERT_EQUAL(strcmp(p, "10.11.12.13"), 0, -1); - - char buf[32]; - p = inet_ntop(AF_INET, &in, buf, sizeof(buf)); - ICUNIT_ASSERT_EQUAL(p, buf, -1); - ICUNIT_ASSERT_EQUAL(strcmp(p, "10.11.12.13"), 0, -1); - - return ICUNIT_SUCCESS; -} - -void NetSocketTest006(void) -{ - TEST_ADD_CASE(__FUNCTION__, InetTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_007.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_007.cpp deleted file mode 100644 index f3418093..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_007.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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. - */ - -#include -#include - -#define SRV_MSG "Hi, I am TCP server" -#define INVALID_USER_ADDR 0X1200000 -#define INVALID_KERNEL_ADDR 0x48000000 - -static int TcpTest() -{ - int ret; - int lsfd = -1; - struct msghdr msg = { 0 }; - - lsfd = socket(AF_INET, SOCK_STREAM, 0); - ICUNIT_ASSERT_NOT_EQUAL(lsfd, -1, lsfd); - - ret = bind(lsfd, (const struct sockaddr *)INVALID_USER_ADDR, sizeof(struct sockaddr_in)); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = bind(lsfd, (const struct sockaddr *)INVALID_KERNEL_ADDR, sizeof(struct sockaddr_in)); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = connect(lsfd, (struct sockaddr*)INVALID_USER_ADDR, sizeof(struct sockaddr_in)); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = connect(lsfd, (struct sockaddr*)INVALID_KERNEL_ADDR, sizeof(struct sockaddr_in)); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = accept(lsfd, (struct sockaddr*)INVALID_USER_ADDR, (socklen_t *)INVALID_USER_ADDR); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = accept(lsfd, (struct sockaddr*)INVALID_KERNEL_ADDR, (socklen_t *)INVALID_KERNEL_ADDR); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = getsockname(lsfd, (struct sockaddr*)INVALID_USER_ADDR, (socklen_t *)INVALID_USER_ADDR); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = getsockname(lsfd, (struct sockaddr*)INVALID_KERNEL_ADDR, (socklen_t *)INVALID_KERNEL_ADDR); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = getpeername(lsfd, (struct sockaddr*)INVALID_USER_ADDR, (socklen_t *)INVALID_USER_ADDR); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = getpeername(lsfd, (struct sockaddr*)INVALID_KERNEL_ADDR, (socklen_t *)INVALID_KERNEL_ADDR); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = send(lsfd, (char *)INVALID_USER_ADDR, strlen(SRV_MSG), 0); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = send(lsfd, (char *)INVALID_KERNEL_ADDR, strlen(SRV_MSG), 0); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = sendto(lsfd, (char *)INVALID_USER_ADDR, strlen(SRV_MSG), 0, (struct sockaddr*)INVALID_USER_ADDR, - (socklen_t)sizeof(struct sockaddr_in)); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = sendto(lsfd, (char *)INVALID_KERNEL_ADDR, strlen(SRV_MSG), 0, (struct sockaddr*)INVALID_KERNEL_ADDR, - (socklen_t)sizeof(struct sockaddr_in)); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = recv(lsfd, (char *)INVALID_USER_ADDR, sizeof(SRV_MSG), 0); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = recv(lsfd, (char *)INVALID_KERNEL_ADDR, sizeof(SRV_MSG), 0); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = recvfrom(lsfd, (char *)INVALID_USER_ADDR, sizeof(SRV_MSG), 0, (struct sockaddr*)INVALID_USER_ADDR, - (socklen_t *)INVALID_USER_ADDR); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = recvfrom(lsfd, (char *)INVALID_KERNEL_ADDR, sizeof(SRV_MSG), 0, (struct sockaddr*)INVALID_KERNEL_ADDR, - (socklen_t *)INVALID_KERNEL_ADDR); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = setsockopt(lsfd, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)INVALID_USER_ADDR, (socklen_t)sizeof(struct timeval)); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = setsockopt(lsfd, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)INVALID_KERNEL_ADDR, (socklen_t)sizeof(struct timeval)); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = getsockopt(lsfd, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)INVALID_USER_ADDR, (socklen_t*)sizeof(struct timeval)); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = getsockopt(lsfd, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)INVALID_KERNEL_ADDR, (socklen_t*)sizeof(struct timeval)); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = sendmsg(lsfd, (struct msghdr *)INVALID_USER_ADDR, 0); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = sendmsg(lsfd, (struct msghdr *)INVALID_KERNEL_ADDR, 0); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - msg.msg_name = (char *)INVALID_USER_ADDR; - msg.msg_namelen = sizeof(struct sockaddr_in); - msg.msg_iov = (struct iovec *)INVALID_KERNEL_ADDR; - msg.msg_iovlen = 2; - ret = recvmsg(lsfd, (struct msghdr *)&msg, 0); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - ret = recvmsg(lsfd, (struct msghdr *)&msg, 0); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - -#ifdef TEST_BIG_MEM - const int bufSiz = 0x1400000; // 20M - void *buf = malloc(bufSiz); - if (!buf) { - printf("malloc 20M fail\n"); - } else { - printf("malloc 20M success\n"); - ret = memset_s(buf, bufSiz, 0, bufSiz); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = send(lsfd, buf, bufSiz, 0); - printf("send ret = %d, errno :%d\n", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - } -#endif - - close(lsfd); - return 0; -} - -void NetSocketTest007(void) -{ - TEST_ADD_CASE(__FUNCTION__, TcpTest, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_008.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_008.cpp deleted file mode 100644 index dd76e80b..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_008.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/* - * 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. - */ - - -#include -#include -#include -#include -#include - -#define SERVER_PORT 6666 -#define INVALID_SOCKET -1 -#define CLIENT_NUM 25 -#define BACKLOG CLIENT_NUM - -static int gFds[FD_SETSIZE]; -static int gBye; - -static void InitFds() -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - gFds[i] = INVALID_SOCKET; - } -} - -static void GetReadfds(fd_set *fds, int *nfd) -{ - for (int i = 0; i < FD_SETSIZE; i++) { - if (gFds[i] == INVALID_SOCKET) { - continue; - } - FD_SET(gFds[i], fds); - if (*nfd < gFds[i]) { - *nfd = gFds[i]; - } - } -} - -static int AddFd(int fd) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] == INVALID_SOCKET) { - gFds[i] = fd; - return 0; - } - } - return -1; -} - -static void DelFd(int fd) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] == fd) { - gFds[i] = INVALID_SOCKET; - } - } - (void)close(fd); -} - -static int CloseAllFd(void) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] != INVALID_SOCKET) { - (void)close(gFds[i]); - gFds[i] = INVALID_SOCKET; - } - } - return 0; -} - -static int HandleRecv(int fd) -{ - char buf[256]; - int ret = recv(fd, buf, sizeof(buf)-1, 0); - if (ret < 0) { - LogPrintln("[%d]Error: %s", fd, strerror(errno)); - DelFd(fd); - } else if (ret == 0) { - LogPrintln("[%d]Closed", fd); - DelFd(fd); - } else { - buf[ret] = 0; - LogPrintln("[%d]Received: %s", fd, buf); - if (strstr(buf, "Bye") != NULL) { - DelFd(fd); - gBye++; - } - } - return -(ret < 0); -} - -static int HandleAccept(int lsfd) -{ - struct sockaddr_in sa; - int saLen = sizeof(sa); - int fd = accept(lsfd, (struct sockaddr *)&sa, (socklen_t *)&saLen); - if (fd == INVALID_SOCKET) { - perror("accept"); - return -1; - } - - if (AddFd(fd) == -1) { - LogPrintln("Too many clients, refuse %s:%d", inet_ntoa(sa.sin_addr), ntohs(sa.sin_port)); - close(fd); - return -1; - } - LogPrintln("New client %d: %s:%d", fd, inet_ntoa(sa.sin_addr), ntohs(sa.sin_port)); - return 0; -} - -static int HandleReadfds(fd_set *fds, int lsfd) -{ - int ret = 0; - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] == INVALID_SOCKET || !FD_ISSET(gFds[i], fds)) { - continue; - } - if (gFds[i] == lsfd) { - ret += HandleAccept(lsfd); - } else { - ret += HandleRecv(gFds[i]); - } - } - return ret; -} - -static void *ClientsThread(void *param) -{ - int fd; - int thrNo = (int)(intptr_t)param; - - LogPrintln("<%d>socket client thread started", thrNo); - fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (fd == INVALID_SOCKET) { - perror("socket"); - return NULL; - } - - struct sockaddr_in sa; - sa.sin_family = AF_INET; - sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - sa.sin_port = htons(SERVER_PORT); - if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) { - perror("connect"); - return NULL; - } - - LogPrintln("[%d]<%d>connected to %s:%d successful", fd, thrNo, inet_ntoa(sa.sin_addr), SERVER_PORT); - - const char *msg[] = { - "hello, ", - "ohos, ", - "my name is net_socket_test_008, ", - "see u next time, ", - "Bye!" - }; - - for (int i = 0; i < sizeof(msg) / sizeof(msg[0]); ++i) { - if (send(fd, msg[i], strlen(msg[i]), 0) < 0) { - LogPrintln("[%d]<%d>send msg [%s] fail", fd, thrNo, msg[i]); - } - } - - (void)shutdown(fd, SHUT_RDWR); - (void)close(fd); - return param; -} - -static int StartClients(pthread_t *cli, int cliNum) -{ - int ret; - pthread_attr_t attr; - - for (int i = 0; i < cliNum; ++i) { - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&cli[i], &attr, ClientsThread, (void *)(intptr_t)i); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - return 0; -} - -static int SelectTest(void) -{ - struct sockaddr_in sa = {0}; - int lsfd; - int ret; - - lsfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - ICUNIT_ASSERT_NOT_EQUAL(lsfd, -1, errno); - - sa.sin_family = AF_INET; - sa.sin_addr.s_addr = htonl(INADDR_ANY); - sa.sin_port = htons(SERVER_PORT); - ret = bind(lsfd, (struct sockaddr *)&sa, sizeof(sa)); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, errno + CloseAllFd()); - - ret = listen(lsfd, BACKLOG); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, errno + CloseAllFd()); - - InitFds(); - AddFd(lsfd); - LogPrintln("[%d]Waiting for client to connect on port %d", lsfd, SERVER_PORT); - - pthread_t clients[CLIENT_NUM]; - - ret = StartClients(clients, CLIENT_NUM); - ICUNIT_ASSERT_EQUAL(ret, 0, ret + CloseAllFd()); - - for ( ; ; ) { - int nfd; - fd_set readfds; - struct timeval timeout; - - timeout.tv_sec = 3; - timeout.tv_usec = 0; - - nfd = 0; - FD_ZERO(&readfds); - - GetReadfds(&readfds, &nfd); - - ret = select(nfd + 1, &readfds, NULL, NULL, &timeout); - LogPrintln("select %d", ret); - if (ret == -1) { - perror("select"); - break; // error occurred - } else if (ret == 0) { - break; // timed out - } - - if (HandleReadfds(&readfds, lsfd) < 0) { - break; - } - } - - for (int i = 0; i < CLIENT_NUM; ++i) { - ret = pthread_join(clients[i], NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret + CloseAllFd()); - } - - ICUNIT_ASSERT_EQUAL(gBye, CLIENT_NUM, gBye + CloseAllFd()); - (void)CloseAllFd(); - return ICUNIT_SUCCESS; -} - -void NetSocketTest008(void) -{ - TEST_ADD_CASE(__FUNCTION__, SelectTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_009.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_009.cpp deleted file mode 100644 index f864727e..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_009.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/* - * 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. - */ - - -#include -#include -#include -#include -#include - -#define SERVER_PORT 8888 -#define INVALID_SOCKET -1 -#define CLIENT_NUM 25 -#define BACKLOG CLIENT_NUM - -static int gFds[FD_SETSIZE]; -static int gBye; - -static void InitFds() -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - gFds[i] = INVALID_SOCKET; - } -} - -static void GetReadfds(struct pollfd *fds, int *nfd) -{ - for (int i = 0; i < FD_SETSIZE; i++) { - if (gFds[i] == INVALID_SOCKET) { - continue; - } - fds[*nfd].fd = gFds[i]; - fds[*nfd].events = POLLIN; - (*nfd)++; - } -} - -static int AddFd(int fd) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] == INVALID_SOCKET) { - gFds[i] = fd; - return 0; - } - } - return -1; -} - -static void DelFd(int fd) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] == fd) { - gFds[i] = INVALID_SOCKET; - } - } - (void)close(fd); -} - -static int CloseAllFd(void) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] != INVALID_SOCKET) { - (void)close(gFds[i]); - gFds[i] = INVALID_SOCKET; - } - } - return 0; -} - -static int HandleRecv(int fd) -{ - char buf[256]; - int ret = recv(fd, buf, sizeof(buf)-1, 0); - if (ret < 0) { - LogPrintln("[%d]Error: %s", fd, strerror(errno)); - DelFd(fd); - } else if (ret == 0) { - LogPrintln("[%d]Closed", fd); - DelFd(fd); - } else { - buf[ret] = 0; - LogPrintln("[%d]Received: %s", fd, buf); - if (strstr(buf, "Bye") != NULL) { - DelFd(fd); - gBye++; - } - } - return -(ret < 0); -} - -static int HandleAccept(int lsfd) -{ - struct sockaddr_in sa; - int saLen = sizeof(sa); - int fd = accept(lsfd, (struct sockaddr *)&sa, (socklen_t *)&saLen); - if (fd == INVALID_SOCKET) { - perror("accept"); - return -1; - } - - if (AddFd(fd) == -1) { - LogPrintln("Too many clients, refuse %s:%d", inet_ntoa(sa.sin_addr), ntohs(sa.sin_port)); - close(fd); - return -1; - } - LogPrintln("New client %d: %s:%d", fd, inet_ntoa(sa.sin_addr), ntohs(sa.sin_port)); - return 0; -} - -static int HandleReadfds(struct pollfd *fds, int nfds, int lsfd) -{ - int ret = 0; - for (int i = 0; i < nfds; ++i) { - if (fds[i].revents == 0) { - continue; - } - LogPrintln("[%d]revents: %04hx", fds[i].fd, fds[i].revents); - if (fds[i].fd == lsfd) { - ret += HandleAccept(lsfd); - } else { - ret += HandleRecv(fds[i].fd); - } - } - return ret; -} - -static void *ClientsThread(void *param) -{ - int fd; - int thrNo = (int)(intptr_t)param; - - LogPrintln("<%d>socket client thread started", thrNo); - fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (fd == INVALID_SOCKET) { - perror("socket"); - return NULL; - } - - struct sockaddr_in sa; - sa.sin_family = AF_INET; - sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - sa.sin_port = htons(SERVER_PORT); - if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) { - perror("connect"); - return NULL; - } - - LogPrintln("[%d]<%d>connected to %s:%d successful", fd, thrNo, inet_ntoa(sa.sin_addr), SERVER_PORT); - - const char *msg[] = { - "hello, ", - "ohos, ", - "my name is net_socket_test_009, ", - "see u next time, ", - "Bye!" - }; - - for (int i = 0; i < sizeof(msg) / sizeof(msg[0]); ++i) { - if (send(fd, msg[i], strlen(msg[i]), 0) < 0) { - LogPrintln("[%d]<%d>send msg [%s] fail", fd, thrNo, msg[i]); - } - } - - (void)shutdown(fd, SHUT_RDWR); - (void)close(fd); - return param; -} - -static int StartClients(pthread_t *cli, int cliNum) -{ - int ret; - pthread_attr_t attr; - - for (int i = 0; i < cliNum; ++i) { - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&cli[i], &attr, ClientsThread, (void *)(intptr_t)i); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - return 0; -} - -static int PollTest(void) -{ - struct sockaddr_in sa = {0}; - int lsfd; - int ret; - - lsfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - ICUNIT_ASSERT_NOT_EQUAL(lsfd, -1, errno); - - sa.sin_family = AF_INET; - sa.sin_addr.s_addr = htonl(INADDR_ANY); - sa.sin_port = htons(SERVER_PORT); - ret = bind(lsfd, (struct sockaddr *)&sa, sizeof(sa)); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, errno + CloseAllFd()); - - ret = listen(lsfd, BACKLOG); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, errno + CloseAllFd()); - - InitFds(); - AddFd(lsfd); - LogPrintln("[%d]Waiting for client to connect on port %d", lsfd, SERVER_PORT); - - pthread_t clients[CLIENT_NUM]; - - ret = StartClients(clients, CLIENT_NUM); - ICUNIT_ASSERT_EQUAL(ret, 0, ret + CloseAllFd()); - - for ( ; ; ) { - int nfd; - struct pollfd readfds[FD_SETSIZE]; - int timeoutMs; - - timeoutMs = 3000; - nfd = 0; - GetReadfds(readfds, &nfd); - - ret = poll(readfds, nfd, timeoutMs); - LogPrintln("poll %d", ret); - if (ret == -1) { - perror("poll"); - break; // error occurred - } else if (ret == 0) { - break; // timed out - } - - if (HandleReadfds(readfds, nfd, lsfd) < 0) { - break; - } - } - - for (int i = 0; i < CLIENT_NUM; ++i) { - ret = pthread_join(clients[i], NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret + CloseAllFd()); - } - - ICUNIT_ASSERT_EQUAL(gBye, CLIENT_NUM, gBye + CloseAllFd()); - (void)CloseAllFd(); - return ICUNIT_SUCCESS; -} - -void NetSocketTest009(void) -{ - TEST_ADD_CASE(__FUNCTION__, PollTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_010.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_010.cpp deleted file mode 100644 index 5638d094..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_010.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* - * 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. - */ - - -#include -#include -#include -#include -#include -#include -#include - -static char gDefaultNetif[IFNAMSIZ] = "eth0"; - -static void InitIfreq(struct ifreq *ifr) -{ - *ifr = (struct ifreq){{0}}; - (void)strncpy_s(ifr->ifr_name, sizeof(ifr->ifr_name) - 1, gDefaultNetif, sizeof(ifr->ifr_name) - 1); - ifr->ifr_name[sizeof(ifr->ifr_name) - 1] = '\0'; -} - -static char *IfIndex2Name(int fd, unsigned index, char *name) -{ -#if SUPPORT_IF_INDEX_TO_NAME - return if_indextoname(index, name); -#else - struct ifreq ifr; - int ret; - - ifr.ifr_ifindex = index; - ret = ioctl(fd, SIOCGIFNAME, &ifr); - if (ret < 0) { - return NULL; - } - ret = strncpy_s(name, IF_NAMESIZE - 1, ifr.ifr_name, IF_NAMESIZE - 1); - if (ret < 0) { - return NULL; - } - name[IF_NAMESIZE - 1] = '\0'; - return name; -#endif -} - -static unsigned IfName2Index(int fd, const char *name) -{ -#if SUPPORT_IF_NAME_TO_INDEX - return if_nametoindex(name); -#else - struct ifreq ifr; - int ret; - - (void)strncpy_s(ifr.ifr_name, sizeof(ifr.ifr_name) - 1, name, sizeof(ifr.ifr_name) - 1); - ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; - ret = ioctl(fd, SIOCGIFINDEX, &ifr); - return ret < 0 ? 0 : ifr.ifr_ifindex; -#endif -} - -static int IoctlTestInternal(int sfd) -{ - struct ifreq ifr = {{0}}; - char ifName[IFNAMSIZ] = {0}, *p = NULL; - unsigned int loIndex = 0; - unsigned int lanIndex = 0; - int maxIndex = 256; - int ret; - - for (int i = 0; i < maxIndex; ++i) { - p = IfIndex2Name(sfd, i, ifName); - if (p) { - if (strcmp(p, "lo") == 0) { - loIndex = i; - } else { - lanIndex = i; - } - } - } - - LogPrintln("ifindex of lo: %u, ifindex of lan: %u", loIndex, lanIndex); - ICUNIT_ASSERT_NOT_EQUAL(loIndex, 0, errno); - ICUNIT_ASSERT_NOT_EQUAL(lanIndex, 0, errno); - - p = IfIndex2Name(sfd, loIndex, ifName); - LogPrintln("ifindex %u: %s", loIndex, p); - ICUNIT_ASSERT_NOT_EQUAL(p, NULL, errno); - - p = IfIndex2Name(sfd, lanIndex, ifName); - LogPrintln("ifindex %u: %s", lanIndex, p); - ICUNIT_ASSERT_NOT_EQUAL(p, NULL, errno); - - ret = strncpy_s(gDefaultNetif, sizeof(gDefaultNetif) -1, p, sizeof(gDefaultNetif) - 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - gDefaultNetif[sizeof(gDefaultNetif) - 1] = '\0'; - - ret = (int)IfName2Index(sfd, p); - LogPrintln("index of %s: %d", p, ret); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, errno); - - ifr.ifr_ifindex = lanIndex; - ret = ioctl(sfd, SIOCGIFNAME, &ifr); - ICUNIT_ASSERT_EQUAL(ret, 0, errno); - LogPrintln("name of ifindex %u: %s", lanIndex, ifr.ifr_name); - - InitIfreq(&ifr); - ret = ioctl(sfd, SIOCGIFINDEX, &ifr); - ICUNIT_ASSERT_EQUAL(ret, 0, errno); - LogPrintln("index of ifname %s: %d", ifr.ifr_name, ifr.ifr_ifindex); - - InitIfreq(&ifr); - ret = ioctl(sfd, SIOCGIFHWADDR, &ifr); - ICUNIT_ASSERT_EQUAL(ret, 0, errno); - LogPrintln("hwaddr: %02hhX:%02hhX:%02hhX:XX:XX:XX", ifr.ifr_hwaddr.sa_data[0], ifr.ifr_hwaddr.sa_data[1], ifr.ifr_hwaddr.sa_data[2]); - - InitIfreq(&ifr); - ret = ioctl(sfd, SIOCGIFFLAGS, &ifr); - ICUNIT_ASSERT_EQUAL(ret, 0, errno); - LogPrintln("FLAGS of ifname %s: %#x, IFF_PROMISC: %d", ifr.ifr_name, ifr.ifr_flags, !!(ifr.ifr_flags & IFF_PROMISC)); - - if (ifr.ifr_flags & IFF_PROMISC) { - ifr.ifr_flags &= ~(IFF_PROMISC); - } else { - ifr.ifr_flags |= IFF_PROMISC; - } - LogPrintln("SIOCSIFFLAGS FLAGS: %#x", ifr.ifr_flags); - ret = ioctl(sfd, SIOCSIFFLAGS, &ifr); - if (ret == -1) { - ICUNIT_ASSERT_EQUAL(errno, EPERM, errno); - } else { - ICUNIT_ASSERT_EQUAL(ret, 0, errno); - } - - InitIfreq(&ifr); - ret = ioctl(sfd, SIOCGIFFLAGS, &ifr); - ICUNIT_ASSERT_EQUAL(ret, 0, errno); - LogPrintln("FLAGS of ifname %s: %#x, IFF_PROMISC: %d", ifr.ifr_name, ifr.ifr_flags, !!(ifr.ifr_flags & IFF_PROMISC)); - - ret = fcntl(sfd, F_GETFL, 0); - ICUNIT_ASSERT_EQUAL(ret < 0, 0, errno); - - ret = fcntl(sfd, F_SETFL, ret | O_NONBLOCK); - ICUNIT_ASSERT_EQUAL(ret < 0, 0, errno); - - return ICUNIT_SUCCESS; -} - -static int IoctlTest(void) -{ - int sfd; - - sfd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); - LogPrintln("socket(PF_INET, SOCK_STREAM, IPPROTO_TCP): %d", sfd); - ICUNIT_ASSERT_NOT_EQUAL(sfd, -1, errno); - - (void)IoctlTestInternal(sfd); - - (void)close(sfd); - return ICUNIT_SUCCESS; -} - -void NetSocketTest010(void) -{ - TEST_ADD_CASE(__FUNCTION__, IoctlTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_011.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_011.cpp deleted file mode 100644 index e71a30c7..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_011.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/* - * 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. - */ - - -#include -#include -#include -#include -#include - -#define SERVER_PORT 7777 -#define INVALID_SOCKET -1 -#define CLIENT_NUM 25 - -static int gFds[FD_SETSIZE]; -static int gBye; - -static void InitFds() -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - gFds[i] = INVALID_SOCKET; - } -} - -static void GetReadfds(fd_set *fds, int *nfd) -{ - for (int i = 0; i < FD_SETSIZE; i++) { - if (gFds[i] == INVALID_SOCKET) { - continue; - } - FD_SET(gFds[i], fds); - if (*nfd < gFds[i]) { - *nfd = gFds[i]; - } - } -} - -static int AddFd(int fd) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] == INVALID_SOCKET) { - gFds[i] = fd; - return 0; - } - } - return -1; -} - -static void DelFd(int fd) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] == fd) { - gFds[i] = INVALID_SOCKET; - } - } - (void)close(fd); -} - -static int CloseAllFd(void) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] != INVALID_SOCKET) { - (void)close(gFds[i]); - gFds[i] = INVALID_SOCKET; - } - } - return 0; -} - -static int HandleRecv(int fd) -{ - char buf[128]; - int ret = recv(fd, buf, sizeof(buf)-1, 0); - if (ret < 0) { - LogPrintln("[%d]Error: %s", fd, strerror(errno)); - DelFd(fd); - } else if (ret == 0) { - LogPrintln("[%d]Closed", fd); - DelFd(fd); - } else { - buf[ret] = 0; - LogPrintln("[%d]Received: %s", fd, buf); - if (strstr(buf, "Bye") != NULL) { - gBye++; - } - } - return -(ret < 0); -} - -static int HandleReadfds(fd_set *fds, int lsfd) -{ - int ret = 0; - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] == INVALID_SOCKET || !FD_ISSET(gFds[i], fds)) { - continue; - } - ret += HandleRecv(gFds[i]); - } - return ret; -} - -static void *ClientsThread(void *param) -{ - int fd; - int thrNo = (int)(intptr_t)param; - - LogPrintln("<%d>socket client thread started", thrNo); - fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (fd == INVALID_SOCKET) { - perror("socket"); - return NULL; - } - - struct sockaddr_in sa; - sa.sin_family = AF_INET; - sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - sa.sin_port = htons(SERVER_PORT); - if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) { - perror("connect"); - return NULL; - } - - LogPrintln("[%d]<%d>connected to udp://%s:%d successful", fd, thrNo, inet_ntoa(sa.sin_addr), SERVER_PORT); - - const char *msg[] = { - "ohos, ", - "hello, ", - "my name is net_socket_test_011, ", - "see u next time, ", - "Bye!", - }; - - for (int i = 0; i < sizeof(msg) / sizeof(msg[0]); ++i) { - if (send(fd, msg[i], strlen(msg[i]), 0) < 0) { - LogPrintln("[%d]<%d>send msg [%s] fail", fd, thrNo, msg[i]); - } - } - - (void)shutdown(fd, SHUT_RDWR); - (void)close(fd); - return param; -} - -static int StartClients(pthread_t *cli, int cliNum) -{ - int ret; - pthread_attr_t attr = {0}; - struct sched_param param = { 0 }; - int policy; - ret = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - for (int i = 0; i < cliNum; ++i) { - ret = pthread_attr_init(&attr); - param.sched_priority = param.sched_priority + 1; - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedparam(&attr, ¶m); - - ret = pthread_create(&cli[i], &attr, ClientsThread, (void *)(intptr_t)i); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - return 0; -} - -static int UdpSelectTest(void) -{ - struct sockaddr_in sa = {0}; - int lsfd; - int ret; - - lsfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - ICUNIT_ASSERT_NOT_EQUAL(lsfd, -1, errno); - - sa.sin_family = AF_INET; - sa.sin_addr.s_addr = htonl(INADDR_ANY); - sa.sin_port = htons(SERVER_PORT); - ret = bind(lsfd, (struct sockaddr *)&sa, sizeof(sa)); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, errno + CloseAllFd()); - - InitFds(); - AddFd(lsfd); - LogPrintln("[%d]Waiting for client to connect on UDP port %d", lsfd, SERVER_PORT); - - pthread_t clients[CLIENT_NUM]; - - ret = StartClients(clients, CLIENT_NUM); - ICUNIT_ASSERT_EQUAL(ret, 0, ret + CloseAllFd()); - - for ( ; ; ) { - int nfd; - fd_set readfds; - struct timeval timeout; - - timeout.tv_sec = 3; - timeout.tv_usec = 0; - - nfd = 0; - FD_ZERO(&readfds); - - GetReadfds(&readfds, &nfd); - - ret = select(nfd + 1, &readfds, NULL, NULL, &timeout); - LogPrintln("select %d", ret); - if (ret == -1) { - perror("select"); - break; // error occurred - } else if (ret == 0) { - break; // timed out - } - - if (HandleReadfds(&readfds, lsfd) < 0) { - break; - } - } - - for (int i = 0; i < CLIENT_NUM; ++i) { - ret = pthread_join(clients[i], NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret + CloseAllFd()); - } - - ICUNIT_ASSERT_EQUAL(gBye, CLIENT_NUM, gBye + CloseAllFd()); - (void)CloseAllFd(); - return ICUNIT_SUCCESS; -} - -void NetSocketTest011(void) -{ - TEST_ADD_CASE(__FUNCTION__, UdpSelectTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_012.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_012.cpp deleted file mode 100644 index f7d684c2..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_012.cpp +++ /dev/null @@ -1,451 +0,0 @@ -/* - * 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. - */ - - -#include -#include -#include -#include -#include -#include - -static struct iovec gIov[IOV_MAX + 1]; - -static int SocketNullTestInternal(int sfd) -{ - int ret; - struct sockaddr addr = {0}; - struct sockaddr *bad = (struct sockaddr *)0xbad; - socklen_t addrlen = sizeof(addr); - socklen_t zero = 0; - struct msghdr message = {0}; - void *badUserAddr = (void*)0x3effffff; - - /** - * accept - */ - ret = accept(sfd, NULL, NULL); - LogPrintln("accept: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = accept(sfd, NULL, &addrlen); - LogPrintln("accept: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = accept(sfd, bad, &zero); - LogPrintln("accept: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = accept(sfd, &addr, NULL); - LogPrintln("accept: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - /** - * bind - */ - ret = bind(sfd, NULL, addrlen); - LogPrintln("bind: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = bind(sfd, bad, 0); - LogPrintln("bind: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - /** - * getpeername - */ - ret = getpeername(sfd, NULL, NULL); - LogPrintln("getpeername: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = getpeername(sfd, NULL, &addrlen); - LogPrintln("getpeername: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = getpeername(sfd, &addr, NULL); - LogPrintln("getpeername: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - zero = 0; - ret = getpeername(sfd, bad, &zero); - LogPrintln("getpeername: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - ICUNIT_ASSERT_EQUAL(errno, ENOTCONN, errno); - - /** - * getsockname - */ - ret = getsockname(sfd, NULL, NULL); - LogPrintln("getsockname: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = getsockname(sfd, NULL, &addrlen); - LogPrintln("getsockname: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = getsockname(sfd, &addr, NULL); - LogPrintln("getsockname: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - zero = 0; - ret = getsockname(sfd, bad, &zero); - LogPrintln("getsockname: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - /** - * getsockopt - */ - ret = getsockopt(sfd, SOL_SOCKET, SO_RCVTIMEO, NULL, NULL); - LogPrintln("getsockopt: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = getsockopt(sfd, SOL_SOCKET, SO_RCVTIMEO, NULL, &addrlen); - LogPrintln("getsockopt: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = getsockopt(sfd, SOL_SOCKET, SO_RCVTIMEO, &addr, NULL); - LogPrintln("getsockopt: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - zero = 0; - ret = getsockopt(sfd, SOL_SOCKET, SO_RCVTIMEO, bad, &zero); - LogPrintln("getsockopt: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - /** - * setsockopt - */ - ret = setsockopt(sfd, SOL_SOCKET, SO_RCVTIMEO, NULL, addrlen); - LogPrintln("setsockopt: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = setsockopt(sfd, SOL_SOCKET, SO_RCVTIMEO, bad, 0); - LogPrintln("setsockopt: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = setsockopt(sfd, SOL_SOCKET, SO_RCVTIMEO, bad, addrlen); - LogPrintln("setsockopt: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - /** - * connect - */ - ret = connect(sfd, NULL, addrlen); - LogPrintln("connect: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = connect(sfd, bad, 0); - LogPrintln("connect: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = connect(sfd, bad, addrlen); - LogPrintln("connect: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - /** - * recv - */ - ret = recv(sfd, NULL, 1, MSG_DONTWAIT); - LogPrintln("recv: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - /** - * recvfrom - */ - ret = recvfrom(sfd, NULL, 1, MSG_DONTWAIT, NULL, NULL); - LogPrintln("recvfrom: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = recvfrom(sfd, NULL, 1, MSG_DONTWAIT, NULL, &addrlen); - LogPrintln("recvfrom: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = recvfrom(sfd, NULL, 1, MSG_DONTWAIT, &addr, NULL); - LogPrintln("recvfrom: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - zero = 0; - ret = recvfrom(sfd, NULL, 1, MSG_DONTWAIT, bad, &zero); - LogPrintln("recvfrom: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - /** - * recvmsg - */ - ret = recvmsg(sfd, NULL, MSG_DONTWAIT); - LogPrintln("recvmsg: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - message.msg_iov = NULL; - message.msg_iovlen = 1; - ret = recvmsg(sfd, &message, MSG_DONTWAIT); - LogPrintln("recvmsg: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - message.msg_iov = gIov; - message.msg_iovlen = 1 + IOV_MAX; - ret = recvmsg(sfd, &message, MSG_DONTWAIT); - LogPrintln("recvmsg: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - message.msg_iov = (struct iovec *)((void *)0xbad); - message.msg_iovlen = 1; - ret = recvmsg(sfd, &message, MSG_DONTWAIT); - LogPrintln("recvmsg: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - message.msg_iov = (struct iovec *)((void *)0xbad); - message.msg_iovlen = 0; - ret = recvmsg(sfd, &message, MSG_DONTWAIT); - LogPrintln("recvmsg: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - /** - * send - */ - ret = send(sfd, NULL, 1, MSG_NOSIGNAL); - LogPrintln("send: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = send(sfd, bad, 0, MSG_NOSIGNAL); - LogPrintln("send: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - /** - * sendmsg - */ - ret = sendmsg(sfd, NULL, MSG_NOSIGNAL); - LogPrintln("sendmsg: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - message.msg_iov = NULL; - message.msg_iovlen = 1; - ret = sendmsg(sfd, &message, MSG_NOSIGNAL); - LogPrintln("sendmsg: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - message.msg_iov = gIov; - message.msg_iovlen = IOV_MAX + 1; - ret = sendmsg(sfd, &message, MSG_NOSIGNAL); - LogPrintln("sendmsg: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - message.msg_iov = gIov; - message.msg_iovlen = (~0UL / sizeof(struct iovec)) + 2; // Test overflow - ret = sendmsg(sfd, &message, MSG_NOSIGNAL); - LogPrintln("sendmsg: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - message.msg_iov = (struct iovec *)0xbad; - message.msg_iovlen = 1; - ret = sendmsg(sfd, &message, MSG_NOSIGNAL); - LogPrintln("sendmsg: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - message.msg_iov = (struct iovec *)0xbad; - message.msg_iovlen = 0; - ret = sendmsg(sfd, &message, MSG_NOSIGNAL); - LogPrintln("sendmsg: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - /** - * sendto - */ - ret = sendto(sfd, NULL, 1, MSG_NOSIGNAL, NULL, addrlen); - LogPrintln("sendto: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = sendto(sfd, NULL, 1, MSG_NOSIGNAL, &addr, addrlen); - LogPrintln("sendto: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = sendto(sfd, bad, 0, MSG_NOSIGNAL, &addr, addrlen); - LogPrintln("sendto: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - ret = sendto(sfd, "NULL", 4, MSG_NOSIGNAL, NULL, addrlen); - LogPrintln("sendto: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = sendto(sfd, "NULL", 4, MSG_NOSIGNAL, bad, 0); - LogPrintln("sendto: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = sendto(sfd, "NULL", 4, MSG_NOSIGNAL, bad, addrlen); - LogPrintln("sendto: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - /** - * read/readv - */ - ret = read(sfd, NULL, 1); - LogPrintln("read: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = read(sfd, NULL, 0); - LogPrintln("read: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, 0, errno); - - ret = read(sfd, bad, 1); - LogPrintln("read: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = read(sfd, badUserAddr, 1); - LogPrintln("read: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = read(sfd, bad, 0); - LogPrintln("read: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - ret = readv(sfd, (struct iovec *)bad, 0); - LogPrintln("readv: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - ret = readv(sfd, (struct iovec *)bad, 1); - LogPrintln("readv: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = readv(sfd, gIov, 0); - LogPrintln("readv: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - ret = readv(sfd, gIov, IOV_MAX + 1); - LogPrintln("readv: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - gIov[0].iov_base = bad; - gIov[0].iov_len = 1; - ret = readv(sfd, gIov, 1); - LogPrintln("readv: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - gIov[0].iov_base = bad; - gIov[0].iov_len = 0; - ret = readv(sfd, gIov, 1); - LogPrintln("readv: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - /** - * write/writev - */ - ret = write(sfd, NULL, 1); - LogPrintln("write: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = write(sfd, NULL, 0); - LogPrintln("write: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - ret = write(sfd, bad, 1); - LogPrintln("write: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = write(sfd, badUserAddr, 1); - LogPrintln("write: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = write(sfd, bad, 0); - LogPrintln("write: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - ret = writev(sfd, (struct iovec *)bad, 0); - LogPrintln("writev: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - ret = writev(sfd, (struct iovec *)bad, 1); - LogPrintln("writev: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - ret = writev(sfd, gIov, 0); - LogPrintln("writev: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - ret = writev(sfd, gIov, IOV_MAX + 1); - LogPrintln("writev: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - gIov[0].iov_base = bad; - gIov[0].iov_len = 1; - ret = writev(sfd, gIov, 1); - LogPrintln("writev: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL(ret, -1, errno); - - gIov[0].iov_base = bad; - gIov[0].iov_len = 0; - ret = writev(sfd, gIov, 1); - LogPrintln("writev: %d, errno=%d", ret, errno); - ICUNIT_ASSERT_EQUAL((ret == 0 || ret == -1), 1, errno); - - return ICUNIT_SUCCESS; -} - -static int SocketSetNonBlock(int sfd) -{ - int ret = fcntl(sfd, F_GETFL, 0); - ICUNIT_ASSERT_EQUAL(ret < 0, 0, errno); - - ret = fcntl(sfd, F_SETFL, ret | O_NONBLOCK); - ICUNIT_ASSERT_EQUAL(ret < 0, 0, errno); - - return ICUNIT_SUCCESS; -} - -static int SocketNullTest(void) -{ - int sfd; - - sighandler_t oldHdl = signal(SIGPIPE, SIG_IGN); - - sfd = socket(PF_INET, SOCK_DGRAM, 0); - ICUNIT_ASSERT_NOT_EQUAL(sfd, -1, errno); - LogPrintln("UDP socket: %d", sfd); - (void)SocketSetNonBlock(sfd); - (void)SocketNullTestInternal(sfd); - (void)close(sfd); - - sfd = socket(PF_INET, SOCK_STREAM, 0); - ICUNIT_ASSERT_NOT_EQUAL(sfd, -1, errno); - LogPrintln("TCP socket: %d", sfd); - (void)SocketSetNonBlock(sfd); - (void)SocketNullTestInternal(sfd); - (void)close(sfd); - - (void)signal(SIGPIPE, oldHdl); - - return ICUNIT_SUCCESS; -} - -void NetSocketTest012(void) -{ - TEST_ADD_CASE(__FUNCTION__, SocketNullTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/net/socket/smoke/net_socket_test_013.cpp b/testsuites/unittest_old/net/socket/smoke/net_socket_test_013.cpp deleted file mode 100644 index 1f435686..00000000 --- a/testsuites/unittest_old/net/socket/smoke/net_socket_test_013.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* - * 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. - */ - - -#include -#include -#include -#include -#include -#include -#include - -#define SERVER_PORT 9999 -#define INVALID_SOCKET -1 -#define CLIENT_NUM 1 - -static int gFds[FD_SETSIZE]; -static int gBye; - -static void InitFds() -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - gFds[i] = INVALID_SOCKET; - } -} - -static void GetReadfds(fd_set *fds, int *nfd) -{ - for (int i = 0; i < FD_SETSIZE; i++) { - if (gFds[i] == INVALID_SOCKET) { - continue; - } - FD_SET(gFds[i], fds); - if (*nfd < gFds[i]) { - *nfd = gFds[i]; - } - } -} - -static int AddFd(int fd) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] == INVALID_SOCKET) { - gFds[i] = fd; - return 0; - } - } - return -1; -} - -static void DelFd(int fd) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] == fd) { - gFds[i] = INVALID_SOCKET; - } - } - (void)close(fd); -} - -static int CloseAllFd(void) -{ - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] != INVALID_SOCKET) { - (void)close(gFds[i]); - gFds[i] = INVALID_SOCKET; - } - } - return 0; -} - -static int HandleRecv(int fd) -{ - char buf[256]; - int ret = recv(fd, buf, sizeof(buf)-1, 0); - if (ret < 0) { - LogPrintln("[%d]Error: %s", fd, strerror(errno)); - DelFd(fd); - } else if (ret == 0) { - LogPrintln("[%d]Closed", fd); - DelFd(fd); - } else { - buf[ret] = 0; - LogPrintln("[%d]Received: %s", fd, buf); - if (strstr(buf, "Bye") != NULL) { - gBye++; - } - } - return -(ret < 0); -} - -static int HandleReadfds(fd_set *fds, int lsfd) -{ - int ret = 0; - for (int i = 0; i < FD_SETSIZE; ++i) { - if (gFds[i] == INVALID_SOCKET || !FD_ISSET(gFds[i], fds)) { - continue; - } - ret += HandleRecv(gFds[i]); - } - return ret; -} - -static unsigned int GetIp(int sfd, const char *ifname) -{ - struct ifreq ifr; - unsigned int ip = 0; - int ret = strncpy_s(ifr.ifr_name, sizeof(ifr.ifr_name) - 1, ifname, sizeof(ifr.ifr_name) - 1); - if (ret < 0) { - return 0; - } - ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; - ret = ioctl(sfd, SIOCGIFADDR, &ifr); - if (ret == 0) { - ip = ((struct sockaddr_in *)&(ifr.ifr_addr))->sin_addr.s_addr; - } - return ip; -} - -static unsigned int GetNetmask(int sfd, const char *ifname) -{ - struct ifreq ifr; - unsigned int msk = 0; - int ret = strncpy_s(ifr.ifr_name, sizeof(ifr.ifr_name) - 1, ifname, sizeof(ifr.ifr_name) - 1); - if (ret < 0) { - return 0; - } - ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; - ret = ioctl(sfd, SIOCGIFNETMASK, &ifr); - if (ret == 0) { - msk = ((struct sockaddr_in *)&(ifr.ifr_addr))->sin_addr.s_addr; - } - return msk; -} - -static char *MyInetNtoa(unsigned int ip) -{ - struct in_addr in = {ip}; - return inet_ntoa(in); -} - -static void *ClientsThread(void *param) -{ - int fd; - int thrNo = (int)(intptr_t)param; - int ret; - const char *ifname[] = {"eth0", "wlan0", "et1", "wl1", "enp4s0f0"}; - unsigned int ip, msk, brdcast; - - LogPrintln("<%d>socket client thread started", thrNo); - fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (fd == INVALID_SOCKET) { - perror("socket"); - return NULL; - } - - int broadcast = 1; - ret = setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast)); - if (ret != 0) { - LogPrintln("[%d]<%d> set broadcast option fail", fd, thrNo); - close(fd); - return NULL; - } - - for (int j = 0; j < sizeof(ifname) / sizeof(ifname[0]); ++j) { - ip = GetIp(fd, ifname[j]); - msk = GetNetmask(fd, ifname[j]); - if (ip != 0) { - LogPrintln("[%d]<%d>%s: ip %s", fd, thrNo, ifname[j], MyInetNtoa(ip)); - LogPrintln("[%d]<%d>%s: netmask %s", fd, thrNo, ifname[j], MyInetNtoa(msk)); - break; - } - } - - brdcast = ip | ~msk; - LogPrintln("[%d]<%d>broadcast address %s", fd, thrNo, MyInetNtoa(brdcast)); - - struct sockaddr_in sa; - sa.sin_family = AF_INET; - sa.sin_addr.s_addr = brdcast; - sa.sin_port = htons(SERVER_PORT); - if (connect(fd, (struct sockaddr *)&sa, sizeof(sa)) == -1) { - perror("connect"); - return NULL; - } - - LogPrintln("[%d]<%d>connected to udp://%s:%d successful", fd, thrNo, inet_ntoa(sa.sin_addr), SERVER_PORT); - - const char *msg[] = { - "hello, ", - "ohos, ", - "my name is net_socket_test_013, ", - "see u next time, ", - "Bye!" - }; - - for (int i = 0; i < sizeof(msg) / sizeof(msg[0]); ++i) { - if (send(fd, msg[i], strlen(msg[i]), 0) < 0) { - LogPrintln("[%d]<%d>send msg [%s] fail: errno %d", fd, thrNo, msg[i], errno); - } - } - - (void)shutdown(fd, SHUT_RDWR); - (void)close(fd); - return param; -} - -static int StartClients(pthread_t *cli, int cliNum) -{ - int ret; - pthread_attr_t attr; - - for (int i = 0; i < cliNum; ++i) { - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&cli[i], &attr, ClientsThread, (void *)(intptr_t)i); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - return 0; -} - -static int UdpBrdcastSelectTest(void) -{ - struct sockaddr_in sa = {0}; - int lsfd; - int ret; - - lsfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - ICUNIT_ASSERT_NOT_EQUAL(lsfd, -1, errno); - - sa.sin_family = AF_INET; - sa.sin_addr.s_addr = htonl(INADDR_ANY); - sa.sin_port = htons(SERVER_PORT); - ret = bind(lsfd, (struct sockaddr *)&sa, sizeof(sa)); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, errno + CloseAllFd()); - - int broadcast = 1; - ret = setsockopt(lsfd, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast)); - ICUNIT_ASSERT_EQUAL(ret, 0, errno + CloseAllFd()); - - int loop = 0; - socklen_t len = sizeof(loop); - ret = getsockopt(lsfd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, &len); - ICUNIT_ASSERT_EQUAL(ret, 0, errno + CloseAllFd()); - LogPrintln("IP_MULTICAST_LOOP default: %d", loop); - - loop = 0; - ret = setsockopt(lsfd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)); - ICUNIT_ASSERT_EQUAL(ret, 0, errno + CloseAllFd()); - - ret = getsockopt(lsfd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, &len); - ICUNIT_ASSERT_EQUAL(ret, 0, errno + CloseAllFd()); - LogPrintln("IP_MULTICAST_LOOP changed to: %d", loop); - - InitFds(); - AddFd(lsfd); - LogPrintln("[%d]Waiting for client to connect on UDP port %d", lsfd, SERVER_PORT); - - pthread_t clients[CLIENT_NUM]; - - ret = StartClients(clients, CLIENT_NUM); - ICUNIT_ASSERT_EQUAL(ret, 0, ret + CloseAllFd()); - - for ( ; ; ) { - int nfd; - fd_set readfds; - struct timeval timeout; - - timeout.tv_sec = 3; - timeout.tv_usec = 0; - - nfd = 0; - FD_ZERO(&readfds); - - GetReadfds(&readfds, &nfd); - - ret = select(nfd + 1, &readfds, NULL, NULL, &timeout); - LogPrintln("select %d", ret); - if (ret == -1) { - perror("select"); - break; // error occurred - } else if (ret == 0) { - break; // timed out - } - - if (HandleReadfds(&readfds, lsfd) < 0) { - break; - } - } - - for (int i = 0; i < CLIENT_NUM; ++i) { - ret = pthread_join(clients[i], NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret + CloseAllFd()); - } - - ICUNIT_ASSERT_EQUAL(gBye, CLIENT_NUM, gBye + CloseAllFd()); - (void)CloseAllFd(); - return ICUNIT_SUCCESS; -} - -void NetSocketTest013(void) -{ - TEST_ADD_CASE(__FUNCTION__, UdpBrdcastSelectTest, TEST_POSIX, TEST_TCP, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mem/BUILD.gn b/testsuites/unittest_old/posix/mem/BUILD.gn deleted file mode 100644 index 163ec961..00000000 --- a/testsuites/unittest_old/posix/mem/BUILD.gn +++ /dev/null @@ -1,76 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "posix_mem_test.cpp", -] - -sources_smoke = [ - "smoke/It_posix_mem_001.cpp", - "smoke/It_posix_mem_003.cpp", -] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_posix_mem_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_posix_mem_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_old/posix/mem/It_posix_mem.h b/testsuites/unittest_old/posix/mem/It_posix_mem.h deleted file mode 100644 index fcc832d5..00000000 --- a/testsuites/unittest_old/posix/mem/It_posix_mem.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_POSIX_MEM_H -#define _IT_POSIX_MEM_H - -#include "osTest.h" - -#if defined(LOSCFG_USER_TEST_SMOKE) -VOID ItPosixMem001(VOID); -VOID IT_POSIX_MEM_002(VOID); -VOID ItPosixMem003(VOID); -#endif - -#endif /* _IT_POSIX_MEM_H */ diff --git a/testsuites/unittest_old/posix/mem/posix_mem_test.cpp b/testsuites/unittest_old/posix/mem/posix_mem_test.cpp deleted file mode 100644 index 41452a35..00000000 --- a/testsuites/unittest_old/posix/mem/posix_mem_test.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "It_posix_mem.h" - - -using namespace testing::ext; -namespace OHOS { -class PosixMemTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: IT_POSIX_MEM_001 - * @tc.desc: function for PosixMemTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMemTest, ItPosixMem001, TestSize.Level0) -{ - ItPosixMem001(); -} - -/* * - * @tc.name: IT_POSIX_MEM_003 - * @tc.desc: function for PosixMemTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMemTest, ItPosixMem003, TestSize.Level0) -{ - ItPosixMem003(); -} - -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/posix/mem/smoke/It_posix_mem_001.cpp b/testsuites/unittest_old/posix/mem/smoke/It_posix_mem_001.cpp deleted file mode 100644 index 8dcc876f..00000000 --- a/testsuites/unittest_old/posix/mem/smoke/It_posix_mem_001.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_mem.h" - -/* * - * @test IT_POSIX_MEMALIGN_001 - * -@tspec posix_memalign API test - * -@ttitle The alignment argument was not a power of two, or was not a multiple of sizeof(void *) - * -@tprecon dynamic memory function open - * -@tbrief - * -#alignment == 0,2,3,7,15,31,63 - * -@texpect - * -#return EINVAL - * -#return EINVAL - * -@tprior 1 - * -@tauto TRUE - * -@tremark - */ -static UINT32 Testcase(VOID) -{ - int ret; - size_t size = 0x100; - void *p = nullptr; - - ret = posix_memalign(&p, 0, size); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - ICUNIT_ASSERT_EQUAL(p, nullptr, p); - - ret = posix_memalign(&p, 2, size); // 2, alignment - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - ICUNIT_ASSERT_EQUAL(p, nullptr, p); - - for (UINT32 n = 2; n < 7; n++) { // 2, 7, alignment - ret = posix_memalign(&p, ((1 << n) - 1), size); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - ICUNIT_ASSERT_EQUAL(p, nullptr, p); - } - - return 0; -} - - -VOID ItPosixMem001(void) -{ - TEST_ADD_CASE("IT_POSIX_MEM_001", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mem/smoke/It_posix_mem_003.cpp b/testsuites/unittest_old/posix/mem/smoke/It_posix_mem_003.cpp deleted file mode 100644 index 8bf8404b..00000000 --- a/testsuites/unittest_old/posix/mem/smoke/It_posix_mem_003.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_posix_mem.h" - -/* * - * @test IT_POSIX_MEMALIGN_003 - * -@tspec posix_memalign Function test - * -@ttitle The alignment argument was a power of two - * -@tprecon dynamic memory function open - * -@tbrief - * -#alignment == 4,8,16,32,64 - * -@texpect - * -#return EINVAL - * -#return EINVAL - * -@tprior 1 - * -@tauto TRUE - * -@tremark - */ -static UINT32 Testcase(VOID) -{ - int ret; - size_t align = sizeof(UINTPTR); - size_t size = 0x100; - void *p = nullptr; - - for (align = sizeof(UINTPTR); align <= 64; align <<= 1) { // 64, alignment - ret = posix_memalign(&p, align, size); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_NOT_EQUAL(p, nullptr, p); - - free(p); - } - - return 0; -} - -VOID ItPosixMem003(void) -{ - TEST_ADD_CASE("IT_POSIX_MEM_003", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/BUILD.gn b/testsuites/unittest_old/posix/mqueue/BUILD.gn deleted file mode 100644 index 7bc49771..00000000 --- a/testsuites/unittest_old/posix/mqueue/BUILD.gn +++ /dev/null @@ -1,232 +0,0 @@ -# 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" ] - } -} diff --git a/testsuites/unittest_old/posix/mqueue/It_posix_queue.h b/testsuites/unittest_old/posix/mqueue/It_posix_queue.h deleted file mode 100644 index 06471361..00000000 --- a/testsuites/unittest_old/posix/mqueue/It_posix_queue.h +++ /dev/null @@ -1,278 +0,0 @@ -/* - * 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. - */ -#ifndef IT_POSIX_QUEUE_H -#define IT_POSIX_QUEUE_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MAXMSG5 5 -#define MSGLEN 10 -#define MAXMSG 10 - -const int MQUEUE_SHORT_ARRAY_LENGTH = 10; // = strlen(MQUEUE_SEND_STRING_TEST) -const int MQUEUE_STANDARD_NAME_LENGTH = 50; - -#define MQUEUE_NO_ERROR 0 -#define MQUEUE_IS_ERROR (-1) -#define MQUEUE_PTHREAD_PRIORITY_TEST1 3 -#define MQUEUE_PTHREAD_PRIORITY_TEST2 4 -#define MQUEUE_PATH_MAX_TEST PATH_MAX -#define MQUEUE_NAME_MAX_TEST NAME_MAX -#define MQUEUE_SEND_STRING_TEST "0123456789" -#define MQUEUE_PTHREAD_NUM_TEST 5 -#define MQUEUE_PRIORITY_TEST 0 -#define MQUEUE_TIMEOUT_TEST 7 -#define MQUEUE_PRIORITY_NUM_TEST 3 -#define MQUEUE_MAX_NUM_TEST (LOSCFG_BASE_IPC_QUEUE_CONFIG - QUEUE_EXISTED_NUM) -#define MQ_MAX_MSG_NUM 16 -#define MQ_MAX_MSG_LEN 64 -#define HWI_NUM_TEST 1 -#define HWI_NUM_TEST1 2 -#define LOS_WAIT_FOREVER 0XFFFFFFFF - -typedef VOID (*HWI_PROC_FUNC)(VOID *pParm); - -#define MQ_VALID_MAGIC 0x6db256c1 -const int LOSCFG_BASE_IPC_QUEUE_CONFIG = 1024; - -#ifdef __LP64__ -#define PER_ADDED_VALUE 8 -#else -#define PER_ADDED_VALUE 4 -#endif - -typedef UINT32 TSK_HANDLE_T; -using SEM_HANDLE_T = UINT32; -extern SEM_HANDLE_T g_mqueueSem; - -static TSK_HANDLE_T g_mqueueTaskPID; -extern CHAR g_gqname[MQUEUE_STANDARD_NAME_LENGTH]; -extern CHAR g_mqueueName[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1][MQUEUE_STANDARD_NAME_LENGTH]; -extern mqd_t g_mqueueId[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1]; - -extern CHAR *g_mqueueMsessage[MQUEUE_SHORT_ARRAY_LENGTH]; -extern mqd_t g_messageQId; -extern mqd_t g_gqueue; - -extern unsigned long MsecsToJiffies(const unsigned int m); - -extern VOID ItSuite_Posix_Mqueue(VOID); -extern UINT32 LosCurTaskIDGet(); -extern int LOS_AtomicInc(const volatile unsigned int *num); -extern int LosSemDelete(SEM_HANDLE_T num); -extern int LosSemCreate(int num, const SEM_HANDLE_T *hdl); -extern UINT32 PosixPthreadInit(pthread_attr_t *attr, int pri); -extern void LOS_TaskUnlock(); -extern void LOS_TaskLock(); -extern int LosSemPost(SEM_HANDLE_T); -extern int LosSemPend(SEM_HANDLE_T hdl, int num); -extern int SemPost(SEM_HANDLE_T); -extern int SemPend(SEM_HANDLE_T hdl, int num); -extern int LOS_HwiCreate(int hwiNum, int hwiPrio, int hwiMode, HWI_PROC_FUNC hwiHandler, int *irqParam); -extern UINT64 JiffiesToTick(unsigned long j); -extern int HalIrqMask(int num); -extern UINT32 PosixPthreadDestroy(pthread_attr_t *attr, pthread_t thread); - -#define LOS_TaskLock() -#define LOS_TaskUnlock() -#define LOS_AtomicInc(a) (++*(a)) -#define TEST_TEST_HwiDelete(ID, NULL) - -#if defined(LOSCFG_USER_TEST_SMOKE) -VOID ItPosixQueue001(VOID); -VOID ItPosixQueue003(VOID); -VOID ItPosixQueue028(VOID); -VOID ItPosixQueue062(VOID); -VOID ItPosixQueue053(VOID); -VOID ItPosixQueue144(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -VOID ItPosixQueue002(VOID); -VOID ItPosixQueue004(VOID); -VOID ItPosixQueue005(VOID); -VOID ItPosixQueue007(VOID); -VOID ItPosixQueue008(VOID); -VOID ItPosixQueue010(VOID); -VOID ItPosixQueue011(VOID); -VOID ItPosixQueue012(VOID); -VOID ItPosixQueue013(VOID); -VOID ItPosixQueue014(VOID); -VOID ItPosixQueue015(VOID); -VOID ItPosixQueue016(VOID); -VOID ItPosixQueue017(VOID); -VOID ItPosixQueue018(VOID); -VOID ItPosixQueue019(VOID); -VOID ItPosixQueue020(VOID); -VOID ItPosixQueue021(VOID); -VOID ItPosixQueue025(VOID); -VOID ItPosixQueue026(VOID); -VOID ItPosixQueue027(VOID); -VOID ItPosixQueue030(VOID); -VOID ItPosixQueue031(VOID); -VOID ItPosixQueue032(VOID); -VOID ItPosixQueue033(VOID); -VOID ItPosixQueue036(VOID); -VOID ItPosixQueue037(VOID); -VOID ItPosixQueue038(VOID); -VOID ItPosixQueue039(VOID); -VOID ItPosixQueue040(VOID); -VOID ItPosixQueue041(VOID); -VOID ItPosixQueue042(VOID); -VOID ItPosixQueue044(VOID); -VOID ItPosixQueue046(VOID); -VOID ItPosixQueue047(VOID); -VOID ItPosixQueue048(VOID); -VOID ItPosixQueue049(VOID); -VOID ItPosixQueue050(VOID); -VOID ItPosixQueue052(VOID); -VOID ItPosixQueue054(VOID); -VOID ItPosixQueue055(VOID); -VOID ItPosixQueue056(VOID); -VOID ItPosixQueue057(VOID); -VOID ItPosixQueue058(VOID); -VOID ItPosixQueue060(VOID); -VOID ItPosixQueue061(VOID); -VOID ItPosixQueue063(VOID); -VOID ItPosixQueue064(VOID); -VOID ItPosixQueue065(VOID); -VOID ItPosixQueue066(VOID); -VOID ItPosixQueue067(VOID); -VOID ItPosixQueue069(VOID); -VOID ItPosixQueue070(VOID); -VOID ItPosixQueue071(VOID); -VOID ItPosixQueue072(VOID); -VOID ItPosixQueue073(VOID); -VOID ItPosixQueue074(VOID); -VOID ItPosixQueue075(VOID); -VOID ItPosixQueue076(VOID); -VOID ItPosixQueue077(VOID); -VOID ItPosixQueue078(VOID); -VOID ItPosixQueue079(VOID); -VOID ItPosixQueue080(VOID); -VOID ItPosixQueue081(VOID); -VOID ItPosixQueue082(VOID); -VOID ItPosixQueue083(VOID); -VOID ItPosixQueue084(VOID); -VOID ItPosixQueue085(VOID); -VOID ItPosixQueue086(VOID); -VOID ItPosixQueue087(VOID); -VOID ItPosixQueue088(VOID); -VOID ItPosixQueue089(VOID); -VOID ItPosixQueue090(VOID); -VOID ItPosixQueue091(VOID); -VOID ItPosixQueue093(VOID); -VOID ItPosixQueue094(VOID); -VOID ItPosixQueue095(VOID); -VOID ItPosixQueue096(VOID); -VOID ItPosixQueue097(VOID); -VOID ItPosixQueue098(VOID); -VOID ItPosixQueue100(VOID); -VOID ItPosixQueue101(VOID); -VOID ItPosixQueue102(VOID); -VOID ItPosixQueue103(VOID); -VOID ItPosixQueue104(VOID); -VOID ItPosixQueue106(VOID); -VOID ItPosixQueue108(VOID); -VOID ItPosixQueue109(VOID); -VOID ItPosixQueue110(VOID); -VOID ItPosixQueue111(VOID); -VOID ItPosixQueue112(VOID); -VOID ItPosixQueue113(VOID); -VOID ItPosixQueue114(VOID); -VOID ItPosixQueue115(VOID); -VOID ItPosixQueue116(VOID); -VOID ItPosixQueue117(VOID); -VOID ItPosixQueue118(VOID); -VOID ItPosixQueue119(VOID); -VOID ItPosixQueue120(VOID); -VOID ItPosixQueue121(VOID); -VOID ItPosixQueue122(VOID); -VOID ItPosixQueue123(VOID); -VOID ItPosixQueue124(VOID); -VOID ItPosixQueue125(VOID); -VOID ItPosixQueue126(VOID); -VOID ItPosixQueue127(VOID); -VOID ItPosixQueue128(VOID); -VOID ItPosixQueue129(VOID); -VOID ItPosixQueue130(VOID); -VOID ItPosixQueue133(VOID); -VOID ItPosixQueue134(VOID); -VOID ItPosixQueue136(VOID); -VOID ItPosixQueue143(VOID); -VOID ItPosixQueue145(VOID); -VOID ItPosixQueue146(VOID); -VOID ItPosixQueue147(VOID); -VOID ItPosixQueue148(VOID); -VOID ItPosixQueue149(VOID); -VOID ItPosixQueue150(VOID); -VOID ItPosixQueue151(VOID); -VOID ItPosixQueue152(VOID); -VOID ItPosixQueue153(VOID); -VOID ItPosixQueue154(VOID); -VOID ItPosixQueue155(VOID); -VOID ItPosixQueue156(VOID); -VOID ItPosixQueue160(VOID); -VOID ItPosixQueue161(VOID); -VOID ItPosixQueue162(VOID); -VOID ItPosixQueue163(VOID); -VOID ItPosixQueue164(VOID); -VOID ItPosixQueue165(VOID); -VOID ItPosixQueue166(VOID); -VOID ItPosixQueue168(VOID); -VOID ItPosixQueue169(VOID); -VOID ItPosixQueue173(VOID); -VOID ItPosixQueue175(VOID); -VOID ItPosixQueue176(VOID); -VOID ItPosixQueue187(VOID); - -VOID ItPosixQueue200(VOID); -VOID ItPosixQueue201(VOID); -VOID ItPosixQueue202(VOID); -VOID ItPosixQueue203(VOID); -VOID ItPosixQueue204(VOID); - -VOID ItPosixQueue205(VOID); -VOID ItPosixQueue206(VOID); -VOID ItPosixQueue207(VOID); -VOID ItPosixQueue208(VOID); -VOID ItPosixQueue209(VOID); -#endif -#endif diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_002.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_002.cpp deleted file mode 100644 index d7507a1b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_002.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct mq_attr attr = { 0 }; - mqd_t mqueue; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 1; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq002_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; - -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue002(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_002", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_005.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_005.cpp deleted file mode 100644 index eace9af2..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_005.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq005_%d", LosCurTaskIDGet()); - mqueue = mq_open(mqname, O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT); - ICUNIT_ASSERT_EQUAL(errno, ENOENT, errno); - - return MQUEUE_NO_ERROR; - -EXIT: - mq_close(mqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue005(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_005", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_008.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_008.cpp deleted file mode 100644 index aa888e9c..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_008.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t roqueue, roqueue2; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq008_%d", LosCurTaskIDGet()); - - roqueue = mq_open(mqname, O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(roqueue, (mqd_t)-1, roqueue, EXIT); - - roqueue2 = mq_open(mqname, O_RDONLY, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(roqueue2, (mqd_t)-1, roqueue2, EXIT1); - - ret = mq_close(roqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(roqueue2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(roqueue2); -EXIT: - mq_close(roqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue008(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_008", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_011.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_011.cpp deleted file mode 100644 index 53f8df27..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_011.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd2[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t rdwrqueue, rdwrqueue2; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq011_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - rdwrqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(rdwrqueue, (mqd_t)-1, rdwrqueue, EXIT); - - ret = mq_send(rdwrqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_receive(rdwrqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr), ret, EXIT); - - rdwrqueue2 = mq_open(mqname, O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(rdwrqueue2, (mqd_t)-1, rdwrqueue2, EXIT1); - - ret = mq_send(rdwrqueue2, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(rdwrqueue2, msgrcd2, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr), ret, EXIT1); - - ret = mq_close(rdwrqueue2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = mq_close(rdwrqueue); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(rdwrqueue2); -EXIT: - mq_close(rdwrqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue011(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_011", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_013.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_013.cpp deleted file mode 100644 index f5b8698e..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_013.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue1, mqueue2; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq013_%d", LosCurTaskIDGet()); - - mqueue1 = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue1, (mqd_t)-1, mqueue1, EXIT1); - - ret = mq_send(mqueue1, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - mqueue2 = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue2, (mqd_t)-1, mqueue2, EXIT2); - - ret = mq_send(mqueue2, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_close(mqueue1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_close(mqueue2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT2: - mq_close(mqueue2); -EXIT1: - mq_close(mqueue1); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue013(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_013", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_014.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_014.cpp deleted file mode 100644 index b124f181..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_014.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq014_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_getattr(mqueue, &attr); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(attr.mq_curmsgs, 0, attr.mq_curmsgs, EXIT1); - ICUNIT_GOTO_EQUAL(attr.mq_flags, O_CREAT | O_RDWR, attr.mq_flags, EXIT1); - ICUNIT_GOTO_EQUAL(attr.mq_maxmsg, MQ_MAX_MSG_NUM, attr.mq_maxmsg, EXIT1); - ICUNIT_GOTO_EQUAL(attr.mq_msgsize, MQ_MAX_MSG_LEN, attr.mq_msgsize, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue014(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_014", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_015.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_015.cpp deleted file mode 100644 index 5bc45d9c..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_015.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - struct mq_attr attrget; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq015_%d", LosCurTaskIDGet()); - - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - attr.mq_msgsize = 5; // 5, queue message size. - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_getattr(mqueue, &attrget); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(attrget.mq_curmsgs, 0, attrget.mq_curmsgs, EXIT1); - ICUNIT_GOTO_EQUAL(attrget.mq_flags, O_CREAT | O_RDWR | O_NONBLOCK, attrget.mq_flags, EXIT1); - ICUNIT_GOTO_EQUAL(attrget.mq_maxmsg, attr.mq_maxmsg, attrget.mq_maxmsg, EXIT1); - ICUNIT_GOTO_EQUAL(attrget.mq_msgsize, attr.mq_msgsize, attrget.mq_msgsize, EXIT1); - - if (!(attrget.mq_flags & O_NONBLOCK)) { - goto EXIT1; - } - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue015(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_015", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_016.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_016.cpp deleted file mode 100644 index 2a464695..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_016.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue1, mqueue2; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq016_%d", LosCurTaskIDGet()); - - mqueue1 = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue1, (mqd_t)-1, mqueue1, EXIT1); - - mqueue2 = mq_open(mqname, O_CREAT | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_EQUAL(mqueue2, (mqd_t)-1, mqueue2, EXIT2); - - ret = mq_close(mqueue1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT2: - mq_close(mqueue2); -EXIT1: - mq_close(mqueue1); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue016(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_016", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_018.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_018.cpp deleted file mode 100644 index 924bf87c..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_018.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq018_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue018(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_018", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_019.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_019.cpp deleted file mode 100644 index a6a4b253..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_019.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue1, mqueue2; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq019_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - mqueue1 = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue1, (mqd_t)-1, mqueue1, EXIT1); - - ret = mq_receive(mqueue1, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - - ret = mq_send(mqueue1, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - mqueue2 = mq_open(mqname, O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue1, (mqd_t)-1, mqueue1, EXIT2); - - ret = mq_receive(mqueue1, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr), ret, EXIT2); - - ret = mq_close(mqueue1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_close(mqueue2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; - -EXIT2: - mq_close(mqueue2); -EXIT1: - mq_close(mqueue1); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue019(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_019", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_020.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_020.cpp deleted file mode 100644 index e24f1a8d..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_020.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - struct sigevent ev; - struct sigaction act; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq020_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue020(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_020", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_021.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_021.cpp deleted file mode 100644 index 24eed50c..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_021.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq021_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT); - - return MQUEUE_NO_ERROR; - -EXIT: - mq_close(mqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue021(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_021", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_025.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_025.cpp deleted file mode 100644 index 34df3292..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_025.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR mqname[MQUEUE_NAME_MAX_TEST * 2]; - mqd_t mqueue; - INT32 i; - - snprintf(mqname, MQUEUE_NAME_MAX_TEST * 2, "/mq025_%d", LosCurTaskIDGet()); // 2, mqname length. - - for (i = 0; i < MQUEUE_NAME_MAX_TEST; i++) - strcat(mqname, "0"); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT); - ICUNIT_ASSERT_EQUAL(errno, ENAMETOOLONG, errno); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(mqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue025(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_025", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_026.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_026.cpp deleted file mode 100644 index 85a62c36..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_026.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR qname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t queue; - - snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq026-1_%d", LosCurTaskIDGet()); - - queue = mq_open(qname, O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_EQUAL(queue, (mqd_t)-1, queue, EXIT); - ICUNIT_ASSERT_EQUAL(errno, ENOENT, errno); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(queue); - mq_unlink(qname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue026(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_026", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_027.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_027.cpp deleted file mode 100644 index 7bf876e1..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_027.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR qname[50]; - INT32 ret; - mqd_t queue; - - snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq027-1_%d", LosCurTaskIDGet()); - - queue = mq_open(qname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue == (mqd_t)-1) { - ICUNIT_ASSERT_NOT_EQUAL(queue, (mqd_t)-1, queue); - } - - ret = mq_close(queue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(qname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(queue); - mq_unlink(qname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue027(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_027", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_030.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_030.cpp deleted file mode 100644 index 4d856c19..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_030.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - ret = mq_close((mqd_t)-1); - ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ICUNIT_ASSERT_EQUAL(errno, EBADF, errno); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close((mqd_t)-1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue030(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_030", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_031.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_031.cpp deleted file mode 100644 index 68263166..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_031.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq031_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - - ret = strncmp(msgptr, msgrcd, strlen(msgptr)); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue031(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_031", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_032.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_032.cpp deleted file mode 100644 index 9feb1399..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_032.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - mqd_t mqueue; - struct sigevent se; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq032_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue032(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_032", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_033.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_033.cpp deleted file mode 100644 index 6c426821..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_033.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq033_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - - ret = strncmp(msgptr, msgrcd, strlen(msgptr)); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue033(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_033", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_036.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_036.cpp deleted file mode 100644 index 991352a2..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_036.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq036_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), MQ_PRIO_MAX + 1, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue036(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_036", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_038.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_038.cpp deleted file mode 100644 index 1a0eadb3..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_038.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq038_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), MQ_PRIO_MAX); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue038(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_038", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_040.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_040.cpp deleted file mode 100644 index 4442ff61..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_040.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *argument) -{ - INT32 i; - INT32 ret; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - - g_testCount = 1; - - g_mqueueTaskPID = LosCurTaskIDGet(); - - for (i = 0; i < 5 + 1; i++) { // 5, The loop frequency. - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert the g_testCount. - - g_testCount = 2; // 2, Init test count value. - - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *argument) -{ - INT32 j, ret; - - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = ""; - - g_testCount = 3; // 3, Init test count value. - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, strlen(MQUEUE_SEND_STRING_TEST), ret, EXIT); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(g_gqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - g_testCount = 4; // 4, Init test count value. - - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh1, newTh2; - UINT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct mq_attr attr = { 0 }; - pthread_attr_t attr1; - - snprintf(g_gqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq040_%d", getpid()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 5; // 5, queue max message size. - - g_testCount = 0; - - g_gqueue = mq_open(g_gqname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - LosTaskDelay(5); // 5, Set delay time. - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT1); - - ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr1, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = LosTaskDelay(5); // 5, Set delay time. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT2); // 4, Here, assert the g_testCount. - - ret = PosixPthreadDestroy(&attr1, newTh2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - return MQUEUE_NO_ERROR; - -EXIT2: - PosixPthreadDestroy(&attr1, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - mq_close(g_gqueue); - mq_unlink(g_gqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue040(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_040", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_041.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_041.cpp deleted file mode 100644 index 7acdcafa..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_041.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *argument) -{ - INT32 i; - struct timespec ts; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - UINT32 ret; - - ts.tv_sec = 0xffff; - ts.tv_nsec = 0; - - g_testCount = 1; - - for (i = 0; i < 5 + 1; i++) { // 5, The loop frequency. - ret = mq_timedsend(g_gqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - ICUNIT_ASSERT_EQUAL_NULL(g_testCount, 3, g_testCount); // 3, Here, assert the g_testCount. - - g_testCount = 2; // 2, Init test count value. - - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *argument) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = ""; - - g_testCount = 3; // 3, Init test count value. - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, strlen(MQUEUE_SEND_STRING_TEST), ret, EXIT1); - - TestExtraTaskDelay(2); // 2, Set delay time. - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(g_gqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - g_testCount = 4; // 4, Init test count value. - - return NULL; -EXIT1: - mq_close(g_gqueue); -EXIT: - mq_unlink(g_gqname); - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - struct mq_attr attr = { 0 }; - pthread_attr_t attr1; - pthread_t newTh1, newTh2; - - snprintf(g_gqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq041_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 5; // 5, queue max message size. - g_gqueue = mq_open(g_gqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - LosTaskDelay(5); // 5, Set delay time. - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT1); - - ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr1, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = LosTaskDelay(5); // 5, Set delay time. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT2); // 4, Here, assert the g_testCount. - - ret = PosixPthreadDestroy(&attr1, newTh2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - return MQUEUE_NO_ERROR; - -EXIT2: - PosixPthreadDestroy(&attr1, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - mq_close(g_gqueue); - mq_unlink(g_gqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue041(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_041", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_042.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_042.cpp deleted file mode 100644 index 926d6ce2..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_042.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgptr[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq042_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - while (1) { - snprintf(msgptr, MQUEUE_STANDARD_NAME_LENGTH, "message %d", i); - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - if (ret == -1) { - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - break; - } - i++; - } - ICUNIT_GOTO_EQUAL(i, MQUEUE_SHORT_ARRAY_LENGTH, i, EXIT1); - - i = 0; - snprintf(msgptr, MQUEUE_STANDARD_NAME_LENGTH, "message %d", i); - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr), ret, EXIT1); - - ret = strcmp(msgptr, msgrcd); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue042(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_042", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_043.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_043.cpp deleted file mode 100644 index 05658401..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_043.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq043_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), MQ_PRIO_MAX - 1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr), ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, msgptr, msgrcd, EXIT1); - - ret = strncmp(msgptr, msgrcd, strlen(msgptr)); - ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -/* * -*-@test IT_POSIX_MQUEUE_043 -*-@tspec The API test for mq_send -*-@ttitle Mq_send writes the mqueue while the priority is MQ_PRIO_MAX - 1 -*-@tprecon The mqueue module is open -*-@tbrief -1. use the mq_open to create a legal mqueue; -2. use the mq_send to write the mqueue while the priority is MQ_PRIO_MAX - 1; -3. use the mq_receive to read the mqueue; -4. use the mq_close to close the mqueue; -5. use the mq_unlink to delete the mqueue. -*-@texpect -1. Return successed -2. Return successed -3. Return successed -4. Return successed -5. Sucessful operation -*-@tprior 1 -*-@tauto TRUE -*-@tremark -*/ -VOID ItPosixQueue043(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_043", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_044.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_044.cpp deleted file mode 100644 index 801e114d..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_044.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq044_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send((mqd_t)(&mqueue + 1), msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - - ret = strcmp(msgptr, msgrcd); - ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue044(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_044", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_046.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_046.cpp deleted file mode 100644 index 90aacd21..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_046.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR qname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t queue; - INT32 unresolved = 0, failure = 0, ret = 0; - - snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq046-1_%d", LosCurTaskIDGet()); - - queue = mq_open(qname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(queue, (mqd_t)-1, queue, EXIT); - - ret = mq_send((mqd_t)(&queue + 1), msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT2); - - ret = mq_close(queue); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = mq_unlink(qname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - return MQUEUE_NO_ERROR; -EXIT2: - mq_close(queue); -EXIT1: - mq_unlink(qname); -EXIT: - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue046(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_046", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_047.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_047.cpp deleted file mode 100644 index 97b1a704..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_047.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH * 2]; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq047_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDONLY | O_NONBLOCK, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EMSGSIZE, errno, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH * 2, NULL); // 2, mqueue message length. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue047(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_047", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_048.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_048.cpp deleted file mode 100644 index 254437ee..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_048.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = "test message"; - mqd_t mqueue; - struct timespec ts; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq048_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = -1; - ret = mq_timedreceive(mqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue048(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_048", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_049.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_049.cpp deleted file mode 100644 index 061bd055..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_049.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 i, ret = 0; - INT32 mqueuePri[MQUEUE_PRIORITY_NUM_TEST] = {MQ_PRIO_MAX, MQ_PRIO_MAX + 1, MQ_PRIO_MAX + 5}; // 5, Mqueue priority. - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq049_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - for (i = 0; i < MQUEUE_PRIORITY_NUM_TEST; i++) { - ret = mq_send(mqueue, msgptr, strlen(msgptr), mqueuePri[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - } - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue049(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_049", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_050.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_050.cpp deleted file mode 100644 index 09c75e2d..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_050.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 i, ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = "01234567890123456789"; - mqd_t mqueue; - INT32 messagesize[MQUEUE_PRIORITY_NUM_TEST] = {19, 2, 1}; - - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq050_%d", LosCurTaskIDGet()); - - for (i = 0; i < MQUEUE_PRIORITY_NUM_TEST; i++) { - attr.mq_msgsize = messagesize[i]; - attr.mq_maxmsg = messagesize[i]; - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EMSGSIZE, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue050(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_050", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_052.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_052.cpp deleted file mode 100644 index 552963f0..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_052.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = "test message"; - mqd_t mqueue; - struct mq_attr attr; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq052_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH + 1; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH + 1; - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EMSGSIZE, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue052(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_052", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_054.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_054.cpp deleted file mode 100644 index 56d26440..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_054.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq054_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_NONBLOCK | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_receive(mqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue054(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_054", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_055.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_055.cpp deleted file mode 100644 index 866fb2cf..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_055.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv1[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv2[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr1 = "test message1"; - const CHAR *msgptr2 = "test message2 with differnet length"; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq055_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr1, strlen(msgptr1), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_send(mqueue, msgptr2, strlen(msgptr2), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrv1, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr1), ret, EXIT1); - - ret = mq_receive(mqueue, msgrv2, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr2), ret, EXIT1); - - ret = strcmp(msgptr1, msgrv1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = strcmp(msgptr2, msgrv2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = strcmp(msgrv1, msgrv2); - ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue055(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_055", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_056.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_056.cpp deleted file mode 100644 index 0d8eaf1d..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_056.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH], msgrv[MQUEUE_STANDARD_NAME_LENGTH]; - mqd_t mqdes; - struct mq_attr attr = { 0 }; - INT32 unresolved = 0, failure = 0, ret = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq056-1-%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqdes = mq_open(mqname, O_CREAT | O_NONBLOCK | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqdes, (mqd_t)-1, mqdes, EXIT); - - if (mq_receive(mqdes, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL) == -1) { - if (EAGAIN != errno) { - failure = 1; - ICUNIT_GOTO_EQUAL(failure, 0, failure, EXIT); - } - } else { - failure = 1; - ICUNIT_GOTO_EQUAL(failure, 0, failure, EXIT); - } - ret = mq_close(mqdes); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(mqdes); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue056(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_056", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_057.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_057.cpp deleted file mode 100644 index 6e081c1e..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_057.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq057_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - mqueue = (mqd_t)((UINTPTR)mqueue + PER_ADDED_VALUE); - ret = mq_receive(mqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = mq_close((mqd_t)((UINTPTR)mqueue - PER_ADDED_VALUE)); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue057(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_057", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_058.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_058.cpp deleted file mode 100644 index cd0bb9ae..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_058.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqdes; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH]; - struct mq_attr attr = { 0 }; - INT32 unresolved = 0, failure = 0, ret = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq058-2-%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqdes = mq_open(mqname, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqdes, (mqd_t)-1, mqdes, EXIT); - - ret = mq_receive(mqdes, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = mq_close(mqdes); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(mqdes); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue058(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_058", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_060.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_060.cpp deleted file mode 100644 index d74b1702..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_060.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq060_%d", LosCurTaskIDGet()); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_unlink(mqname); -EXIT: - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue060(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_060", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_061.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_061.cpp deleted file mode 100644 index 1fe6064d..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_061.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqdes; - struct mq_attr mqstat; - INT32 unresolved = 0; - INT32 failure = 0, ret = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq061-1_%d", LosCurTaskIDGet()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqdes, (mqd_t)-1, mqdes, EXIT); - - memset(&mqstat, 0, sizeof(mqstat)); - - ret = mq_getattr(mqdes, &mqstat); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_close(mqdes); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - if (!(mqstat.mq_flags & O_NONBLOCK)) { - failure = 1; - ICUNIT_ASSERT_EQUAL(failure, 0, failure); - } - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(mqdes); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue061(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_061", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_063.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_063.cpp deleted file mode 100644 index 57f77d7b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_063.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqdes; - struct mq_attr mqstat, nmqstat; - INT32 unresolved = 0; - INT32 failure = 0, ret = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq063-1_%d", LosCurTaskIDGet()); - - memset(&mqstat, 0, sizeof(mqstat)); - mqstat.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - mqstat.mq_maxmsg = 40; // 40, queue max message size. - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &mqstat); - ICUNIT_GOTO_NOT_EQUAL(mqdes, (mqd_t)-1, mqdes, EXIT); - - memset(&nmqstat, 0, sizeof(nmqstat)); - - ret = mq_getattr(mqdes, &nmqstat); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - if ((mqstat.mq_maxmsg != nmqstat.mq_maxmsg) || (mqstat.mq_msgsize != nmqstat.mq_msgsize)) { - failure = 1; - ICUNIT_GOTO_EQUAL(failure, 0, failure, EXIT); - } - - ret = mq_close(mqdes); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(mqdes); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue063(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_063", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_064.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_064.cpp deleted file mode 100644 index d0f6ca48..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_064.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0, i; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = "test message"; - mqd_t mqueue; - struct mq_attr mqstat; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq064_%d", LosCurTaskIDGet()); - - memset(&mqstat, 0, sizeof(mqstat)); - mqstat.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - mqstat.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &mqstat); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - for (i = 0; i < 5; i++) { // 5, the loop frequency. - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - } - memset(&mqstat, 0, sizeof(mqstat)); - ret = mq_getattr(mqueue, &mqstat); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(mqstat.mq_curmsgs, 5, mqstat.mq_curmsgs, EXIT1); // 5, assert the curmsgs. - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue064(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_064", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_065.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_065.cpp deleted file mode 100644 index 4760d6cb..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_065.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue, mqdesInvalid; - struct mq_attr mqstat; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq065_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - mqdesInvalid = (mqd_t)((UINTPTR)mqueue + PER_ADDED_VALUE); - memset(&mqstat, 0, sizeof(mqstat)); - - ret = mq_getattr(mqdesInvalid, &mqstat); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue065(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_065", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_066.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_066.cpp deleted file mode 100644 index 03b127e9..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_066.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqdes; - struct mq_attr mqstat = { 0 }; - struct mq_attr nmqstat = { 0 }; - INT32 unresolved = 0; - INT32 failure = 0, ret = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq066-1_%d", LosCurTaskIDGet()); - - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - ICUNIT_GOTO_NOT_EQUAL(mqdes, (mqd_t)-1, mqdes, EXIT); - - memset(&mqstat, 0, sizeof(mqstat)); - memset(&nmqstat, 0, sizeof(nmqstat)); - - ret = mq_getattr(mqdes, &mqstat); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT); - - mqstat.mq_flags |= O_NONBLOCK; - - ret = mq_setattr(mqdes, &mqstat, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_getattr(mqdes, &nmqstat); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT); - - ret = mq_close(mqdes); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - if (nmqstat.mq_flags != mqstat.mq_flags) { - failure = 1; - ICUNIT_GOTO_EQUAL(failure, 0, failure, EXIT); - } - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(mqdes); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue066(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_066", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_067.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_067.cpp deleted file mode 100644 index 637794b0..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_067.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - struct mq_attr mqstat1 = { 0 }; - struct mq_attr mqstat2 = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq067_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - memset(&mqstat1, 0, sizeof(mqstat1)); - memset(&mqstat2, 0, sizeof(mqstat1)); - - ret = mq_getattr(mqueue, &mqstat1); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - - mqstat1.mq_maxmsg = mqstat1.mq_maxmsg + 1; - mqstat1.mq_msgsize = mqstat1.mq_msgsize + 1; - mqstat1.mq_curmsgs = mqstat1.mq_curmsgs + 1; - - ret = mq_setattr(mqueue, &mqstat1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_getattr(mqueue, &mqstat2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_NOT_EQUAL(mqstat2.mq_maxmsg, mqstat1.mq_maxmsg, mqstat2.mq_maxmsg, EXIT1); - ICUNIT_GOTO_NOT_EQUAL(mqstat2.mq_msgsize, mqstat1.mq_msgsize, mqstat2.mq_msgsize, EXIT1); - ICUNIT_GOTO_NOT_EQUAL(mqstat2.mq_curmsgs, mqstat1.mq_curmsgs, mqstat2.mq_curmsgs, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue067(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_067", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_069.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_069.cpp deleted file mode 100644 index 57b2a789..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_069.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue1, mqueue2; - struct mq_attr mqstat1; - struct mq_attr mqstat2; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq069_%d", LosCurTaskIDGet()); - - mqueue1 = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - ICUNIT_GOTO_NOT_EQUAL(mqueue1, (mqd_t)-1, mqueue1, EXIT1); - - mqueue2 = mqueue1; - mqueue1 = (mqd_t)((UINTPTR)mqueue1 + PER_ADDED_VALUE); - - memset(&mqstat1, 0, sizeof(mqstat1)); - memset(&mqstat2, 0, sizeof(mqstat2)); - mqstat2.mq_flags = 1; - - ret = mq_setattr(mqueue1, &mqstat1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT2); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT2); - - ret = mq_close(mqueue1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT2); - - ret = mq_close(mqueue2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_close(mqueue2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT2); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT2: - mq_close(mqueue2); -EXIT1: - mq_close(mqueue1); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue069(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_069", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_070.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_070.cpp deleted file mode 100644 index 6b80f610..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_070.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR *msgptr1 = "1234567890"; - CHAR *msgptr2 = "2345678901"; - CHAR *msgptr3 = "3456789012"; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq070_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr1, strlen(msgptr1), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_send(mqueue, msgptr2, strlen(msgptr2), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_send(mqueue, msgptr3, strlen(msgptr3), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, 0, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, msgptr1, msgrcd, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, msgptr2, msgrcd, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, msgptr3, msgrcd, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue070(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_070", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_071.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_071.cpp deleted file mode 100644 index e2d4c17c..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_071.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 i; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq071_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - } - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue071(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_071", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_072.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_072.cpp deleted file mode 100644 index 209f95c1..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_072.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - - CHAR qName[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgPtr = MQUEUE_SEND_STRING_TEST; - struct mq_attr msgAttr = { 0 }; - CHAR msgRcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - mqd_t msgQId; - - msgAttr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - msgAttr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(qName, MQUEUE_STANDARD_NAME_LENGTH, "/mq072_%d", LosCurTaskIDGet()); - - msgQId = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_GOTO_NOT_EQUAL(msgQId, (mqd_t)-1, msgQId, EXIT); - - ret = mq_send(msgQId, msgPtr, strlen(msgPtr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_receive(msgQId, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MSGLEN, ret, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(msgRcd, MQUEUE_SEND_STRING_TEST, msgRcd, EXIT2); - - ret = mq_close(msgQId); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_unlink(qName); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - return MQUEUE_NO_ERROR; -EXIT2: - mq_close(msgQId); -EXIT1: - mq_unlink(qName); -EXIT: - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue072(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_072", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_073.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_073.cpp deleted file mode 100644 index 84da59ce..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_073.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR mqname1[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR mqname2[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue1; - mqd_t mqueue2; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname1, MQUEUE_STANDARD_NAME_LENGTH, "/mq073_1_%d", LosCurTaskIDGet()); - snprintf(mqname2, MQUEUE_STANDARD_NAME_LENGTH, "/mq073_2_%d", LosCurTaskIDGet()); - - mqueue1 = mq_open(mqname1, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue1, (mqd_t)-1, mqueue1, EXIT); - - mqueue2 = mq_open(mqname2, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue2, (mqd_t)-1, mqueue2, EXIT1); - - ret = mq_send(mqueue1, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_send(mqueue2, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue2); - mq_unlink(mqname2); -EXIT: - mq_close(mqueue1); - mq_unlink(mqname1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue073(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_073", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_074.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_074.cpp deleted file mode 100644 index c852b8ef..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_074.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - - CHAR msgRcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - CHAR qName[MQUEUE_STANDARD_NAME_LENGTH] = "/mq074"; - mqd_t msgQId; - struct mq_attr msgAttr = { 0 }; - msgAttr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - msgAttr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - msgQId = mq_open(qName, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_ASSERT_NOT_EQUAL(msgQId, (mqd_t)-1, msgQId); - - ret = mq_receive(msgQId, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, (UINT32)-1, ret, EXIT1); - - ret = mq_close(msgQId); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(qName); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(msgQId); -EXIT: - mq_unlink(qName); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue074(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_074", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_075.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_075.cpp deleted file mode 100644 index 2fea2090..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_075.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" -static int g_testFlag = 0; - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - INT32 i; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - ts.tv_sec = 0xffff; - for (i = 0; i < MQUEUE_STANDARD_NAME_LENGTH * 2; i++) { // 2, The loop frequency name length. - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - } - g_testFlag = 0; // 0 means the sub thread has executed - return NULL; -EXIT: - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - INT32 i; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - pthread_t pthread1; - pthread_attr_t attr1; - struct sched_param schedparam; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - g_testFlag = 1; // 1 initialize the flag - LOS_TaskLock(); - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq075_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT1); - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - pthread_attr_setinheritsched(&attr1, PTHREAD_EXPLICIT_SCHED); - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_create(&pthread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - LOS_TaskUnlock(); - for (i = 0; i < MQUEUE_STANDARD_NAME_LENGTH * 2; i++) { // 2, The loop frequency name length. - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - } - - // waitting for the flag is 0, means the sub thread has executed - while (g_testFlag) { - usleep(1); - } - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(g_gqueue); - mq_unlink(mqname); -EXIT: - PosixPthreadDestroy(&attr1, pthread1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue075(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_075", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_076.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_076.cpp deleted file mode 100644 index f34f5c23..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_076.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - LOS_AtomicInc(&g_testCount); - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - return NULL; - -EXIT: - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *arg) -{ - INT32 ret, i; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - pthread_t thread1; - pthread_attr_t attr1; - struct sched_param schedparam; - struct mq_attr attr = { 0 }; - struct timespec ts = { 0 }; - - ts.tv_sec = 0xFFFF; - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 2; // 2, queue max message size. - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq076_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT1); - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_create(&thread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_timedsend(g_gqueue, msgptr, MQUEUE_SHORT_ARRAY_LENGTH, 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - LOS_AtomicInc(&g_testCount); - } - - ret = pthread_join(thread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - return NULL; -EXIT1: - mq_close(g_gqueue); - mq_unlink(mqname); -EXIT: - PosixPthreadDestroy(&attr1, thread1); - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - pthread_t pthread1; - pthread_attr_t attr1; - struct sched_param schedparam; - - g_testCount = 0; - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_create(&pthread1, &attr1, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); // 4, Here, assert the g_testCount. - - return MQUEUE_NO_ERROR; - -EXIT: - PosixPthreadDestroy(&attr1, pthread1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue076(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_076", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_077.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_077.cpp deleted file mode 100644 index d3f4be8e..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_077.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - g_testCount++; - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - g_testCount++; - - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - pthread_t pthread1; - pthread_attr_t attr1; - struct sched_param schedparam; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - g_testCount = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq077_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT1); - - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - pthread_attr_setinheritsched(&attr1, PTHREAD_EXPLICIT_SCHED); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_create(&pthread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert the g_testCount. - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - PosixPthreadDestroy(&attr1, pthread1); -EXIT: - mq_close(g_gqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue077(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_077", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_078.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_078.cpp deleted file mode 100644 index 8ee1ff07..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_078.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - LOS_AtomicInc(&g_testCount); - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - - LOS_AtomicInc(&g_testCount); - - return NULL; - -EXIT: - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t thread1; - pthread_attr_t attr1; - INT32 ret; - struct sched_param schedparam; - - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr = { 0 }; - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - g_testCount = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq078_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue); - - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_ASSERT_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&thread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_join(thread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2, Here, assert the g_testCount. - - return MQUEUE_NO_ERROR; -EXIT1: - pthread_attr_destroy(&attr1); -EXIT: - mq_close(g_gqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue078(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_078", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_079.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_079.cpp deleted file mode 100644 index 0599283b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_079.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - LOS_AtomicInc(&g_testCount); - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(g_gqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - LOS_AtomicInc(&g_testCount); - - return NULL; -EXIT: - mq_close(g_gqueue); - mq_unlink(g_gqname); - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *arg) -{ - INT32 ret; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - LOS_AtomicInc(&g_testCount); - - g_gqueue = mq_open(g_gqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - LOS_AtomicInc(&g_testCount); - return NULL; -EXIT: - mq_close(g_gqueue); - mq_unlink(g_gqname); - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - pthread_t thread1; - pthread_t thread2; - pthread_attr_t attr1; - struct sched_param schedparam; - - memset(g_gqname, 0, MQUEUE_STANDARD_NAME_LENGTH); - snprintf(g_gqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq079_%d", LosCurTaskIDGet()); - - g_testCount = 0; - - ret = pthread_create(&thread1, NULL, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = LosTaskDelay(10); // 10, Set delay time. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT1); // 2, Here, assert the g_testCount. - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&thread2, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT2); // 4, Here, assert the g_testCount. - - ret = pthread_join(thread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_join(thread2, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT2: - pthread_join(thread2, NULL); -EXIT1: - pthread_join(thread1, NULL); -EXIT: - pthread_attr_destroy(&attr1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue079(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_079", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_080.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_080.cpp deleted file mode 100644 index 74e72515..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_080.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR qname[MQUEUE_STANDARD_NAME_LENGTH], msgrcd[MQUEUE_STANDARD_NAME_LENGTH]; - CHAR msgptr[MQUEUE_STANDARD_NAME_LENGTH]; - struct timespec ts; - struct mq_attr attr = { 0 }; - mqd_t queue; - INT32 unresolved = 0, failure = 0, i, maxreached = 0, ret = 0; - unsigned pri; - - snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq080-1_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MAXMSG5; - queue = mq_open(qname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(queue, (mqd_t)-1, queue, EXIT); - - ts.tv_sec = 0; - ts.tv_nsec = 0; - for (i = 0; i < MAXMSG5 + 1; i++) { - snprintf(msgptr, MQUEUE_STANDARD_NAME_LENGTH, "message %d", i); - ts.tv_sec++; - if (mq_timedsend(queue, msgptr, strlen(msgptr), 0, &ts) == -1) { - maxreached = 1; - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT); - break; - } - } - - if (mq_receive(queue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL) == -1) { - unresolved = 1; - } else { - if ((strcmp(msgptr, msgrcd) == 0) && (maxreached != 0)) { - ICUNIT_GOTO_EQUAL(maxreached, 0, maxreached, EXIT); - } - } - - ret = mq_close(queue); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(qname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(queue); - mq_unlink(qname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue080(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_080", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_081.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_081.cpp deleted file mode 100644 index 3ac51ae4..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_081.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR qname[MQUEUE_STANDARD_NAME_LENGTH], msgrcd[MQUEUE_STANDARD_NAME_LENGTH]; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t queue; - struct mq_attr attr = { 0 }; - INT32 unresolved = 0, ret; - unsigned pri; - - snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq081-1_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MAXMSG5; - queue = mq_open(qname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(queue, (mqd_t)-1, queue, EXIT); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedsend(queue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_receive(queue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT); - - ret = strncmp(msgptr, msgrcd, strlen(msgptr)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_close(queue); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(qname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(queue); - mq_unlink(qname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue081(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_081", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_082.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_082.cpp deleted file mode 100644 index ee23a2bc..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_082.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq082_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedsend((mqd_t)((UINTPTR)mqueue + PER_ADDED_VALUE), msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue082(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_082", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_083.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_083.cpp deleted file mode 100644 index 55b26c13..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_083.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR qname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgptr[MQUEUE_STANDARD_NAME_LENGTH]; - struct timespec ts; - struct mq_attr attr = { 0 }; - mqd_t queue; - INT32 unresolved = 0, failure = 0, i, maxreached = 0, ret = 0; - - snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq083-1_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = 100; // 100, queue message size. - attr.mq_maxmsg = MAXMSG5; - queue = mq_open(qname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(queue, (mqd_t)-1, queue, EXIT); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - for (i = 0; i < MAXMSG5; i++) { - snprintf(msgptr, MQUEUE_STANDARD_NAME_LENGTH, "message %d", i); - ret = mq_timedsend(queue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT); - } - - snprintf(msgptr, MQUEUE_STANDARD_NAME_LENGTH, "message %d", i); - ret = mq_timedsend(queue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT); - - ret = mq_close(queue); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(qname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(queue); - mq_unlink(qname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue083(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_083", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_084.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_084.cpp deleted file mode 100644 index 02b6fc18..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_084.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR qname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t queue; - INT32 unresolved = 0, failure = 0, ret = 0; - - snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq084-1_%d", LosCurTaskIDGet()); - - queue = mq_open(qname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(queue, (mqd_t)-1, queue, EXIT); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedsend((mqd_t)(queue + PER_ADDED_VALUE), msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = mq_close(queue); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(qname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(queue); - mq_unlink(qname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue084(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_084", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_085.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_085.cpp deleted file mode 100644 index 750ee14b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_085.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq085_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue085(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_085", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_086.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_086.cpp deleted file mode 100644 index 6771dbaf..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_086.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "mq086_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue086(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_086", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_087.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_087.cpp deleted file mode 100644 index 92ab2b4c..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_087.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 i, ret = 0; - INT32 mqueuePri[MQUEUE_PRIORITY_NUM_TEST] = {_SC_MQ_PRIO_MAX, _SC_MQ_PRIO_MAX + 1, _SC_MQ_PRIO_MAX + 5}; // 5, Mqueue priority. - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq087_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - for (i = 0; i < MQUEUE_PRIORITY_NUM_TEST; i++) { - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), mqueuePri[i], &ts); - ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - } - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue087(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_087", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_088.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_088.cpp deleted file mode 100644 index b6c4caf8..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_088.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 i, ret = 0; - INT32 messagesize[MQUEUE_PRIORITY_NUM_TEST] = {19, 2, 1}; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = "01234567890123456789"; - struct timespec ts; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq088_%d", LosCurTaskIDGet()); - - ts.tv_sec = 0; - ts.tv_nsec = 0; - for (i = 0; i < MQUEUE_PRIORITY_NUM_TEST; i++) { - attr.mq_msgsize = messagesize[i]; - attr.mq_maxmsg = messagesize[i]; - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT); - - ts.tv_sec++; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EMSGSIZE, errno, EXIT); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue088(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_088", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_089.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_089.cpp deleted file mode 100644 index 5da1abcf..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_089.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/tm/mq089_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue089(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_089", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_090.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_090.cpp deleted file mode 100644 index 028c9a31..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_090.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR qname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t queue[_POSIX_OPEN_MAX + _POSIX_MQ_OPEN_MAX + 1]; - INT32 i, unresolved = 0, failure = 0, numqueues = 0, ret; - - for (i = 0; (i < _POSIX_OPEN_MAX) && (i < _POSIX_MQ_OPEN_MAX); i++, numqueues++) { - snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq090%d_%d", i, LosCurTaskIDGet()); - - queue[i] = mq_open(qname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue[i] == (mqd_t)-1) { - unresolved = 1; - break; - } - } - - queue[numqueues] = mq_open(qname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - if (queue[numqueues] != (mqd_t)-1) { - } else { - if (errno != EMFILE) { - failure = 1; - } - } - - for (i = 0; i <= numqueues; i++) { - ret = mq_close(queue[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - for (i = 0; i < numqueues; i++) { - snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq090%d_%d", i, LosCurTaskIDGet()); - ret = mq_unlink(qname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq090%d_%d", numqueues, LosCurTaskIDGet()); - ret = mq_unlink(qname); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - - if (failure == 1) { - ICUNIT_ASSERT_NOT_EQUAL(failure, 1, failure); - } - - if (unresolved == 1) { - ICUNIT_ASSERT_NOT_EQUAL(unresolved, 1, unresolved); - } - return MQUEUE_NO_ERROR; -EXIT: - for (i = 0; i <= numqueues; i++) { - mq_close(queue[i]); - mq_unlink(qname); - } - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue090(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_090", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_091.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_091.cpp deleted file mode 100644 index 614e9c9d..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_091.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - INT32 ret = 0; - struct timespec ts; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq091_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = -1; - ts.tv_nsec = 0; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue091(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_091", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_093.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_093.cpp deleted file mode 100644 index 4e8596f4..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_093.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 i, ret = 0; - CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - struct mq_attr attr = { 0 }; - mqd_t mqueue; - struct sigaction act; - time_t currsec; - - snprintf(g_gqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq093_%d", LosCurTaskIDGet()); - - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - - g_gqueue = mq_open(g_gqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT1); - - ts.tv_sec = 0; - ts.tv_nsec = 0; - - for (i = 0; i < MQUEUE_SHORT_ARRAY_LENGTH; i++) { - ret = mq_timedsend(g_gqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - } - - ret = mq_timedsend(g_gqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(g_gqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(g_gqueue); -EXIT: - mq_unlink(g_gqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue093(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_093", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_094.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_094.cpp deleted file mode 100644 index b9a9a0bf..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_094.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq094_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT); - - ts.tv_sec = -1; - ts.tv_nsec = -1; - - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue094(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_094", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_095.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_095.cpp deleted file mode 100644 index 61c5d9ff..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_095.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv1[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv2[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr1 = "test message 1"; - const CHAR *msgptr2 = "test message 2"; - mqd_t mqueue; - struct timespec ts; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq095_%d", LosCurTaskIDGet()); - - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr1, strlen(msgptr1), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_send(mqueue, msgptr2, strlen(msgptr2), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedreceive(mqueue, msgrv1, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr1), ret, EXIT1); - - ret = strncmp(msgptr1, msgrv1, strlen(msgptr2)); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedreceive(mqueue, msgrv2, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr2), ret, EXIT1); - - ret = strncmp(msgptr2, msgrv2, strlen(msgptr1)); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue095(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_095", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_096.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_096.cpp deleted file mode 100644 index 5556a8e1..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_096.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv[20]; - const CHAR *msgptr = "test message"; - mqd_t mqueue; - struct mq_attr attr; - struct timespec ts; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq096_%d", LosCurTaskIDGet()); - - memset(&attr, 0, sizeof(attr)); - attr.mq_msgsize = 20 + 1; // 20, queue message size. - attr.mq_maxmsg = 20 + 1; // 20, queue max message size. - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - - ret = mq_timedreceive(mqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr), ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue096(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_096", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_097.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_097.cpp deleted file mode 100644 index 00fad7b1..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_097.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *argument) -{ - INT32 ret = 0; - const CHAR *msgptr = "test message "; - - g_testCount = 1; - - ret = LosTaskDelay(2); // 2, Set delay time. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - g_testCount = 2; // 2, Init test count value. - - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *argument) -{ - INT32 ret = 0, len; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = "test message "; - struct timespec ts; - - g_testCount = 3; // 3, Init test count value. - - ts.tv_sec = INT32_MAX; - ts.tv_nsec = 0; - - len = mq_timedreceive(g_gqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - - ret = LosTaskDelay(3); // 3, Set delay time. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(len, strlen(msgptr), len, EXIT); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(g_gqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - g_testCount = 4; // 4, Init test count value. - - return NULL; -EXIT: - mq_close(g_gqueue); - mq_unlink(g_gqname); - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - struct mq_attr attr = { 0 }; - pthread_attr_t attr1; - pthread_t newTh, newTh2; - - snprintf(g_gqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq097_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - g_gqueue = mq_open(g_gqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_create(&newTh, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr1, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = LosTaskDelay(10); // 10, Set delay time. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - TestAssertWaitDelay(&g_testCount, 4); // 4, Here, assert the g_testCount. - - ret = PosixPthreadDestroy(&attr1, newTh2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - return MQUEUE_NO_ERROR; - -EXIT2: - PosixPthreadDestroy(&attr1, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh); -EXIT: - mq_close(g_gqueue); - mq_unlink(g_gqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue097(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_097", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_098.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_098.cpp deleted file mode 100644 index 8071f727..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_098.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR qname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - INT32 ret = 0; - mqd_t queue; - - snprintf(qname, MQUEUE_STANDARD_NAME_LENGTH, "/mq098_%d", LosCurTaskIDGet()); - - queue = mq_open(qname, O_CREAT | O_RDWR | O_WRONLY, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(queue, (mqd_t)-1, queue, EXIT); - - ret = mq_close(queue); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(qname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(queue); - mq_unlink(qname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue098(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_098", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_100.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_100.cpp deleted file mode 100644 index 954d2787..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_100.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - mqd_t mqueue; - struct timespec ts; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq100_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - mqueue = mq_open(mqname, O_CREAT | O_NONBLOCK | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedreceive(mqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue100(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_100", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_101.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_101.cpp deleted file mode 100644 index aee4950a..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_101.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i; - mqd_t mqueue; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq101_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT1); - } - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue101(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_101", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_102.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_102.cpp deleted file mode 100644 index b5e93be3..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_102.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = "test message"; - mqd_t mqueue; - struct timespec ts; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq102_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ts.tv_sec = -1; - ts.tv_nsec = 0; - ret = mq_timedreceive(mqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue102(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_102", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_103.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_103.cpp deleted file mode 100644 index e235b46b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_103.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = "test message"; - mqd_t mqueue; - struct timespec ts; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq103_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - sleep(1); - ts.tv_sec = -1; - ts.tv_nsec = 0; - ret = mq_timedreceive(mqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue103(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_103", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_104.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_104.cpp deleted file mode 100644 index 14c49acf..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_104.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv1[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv2[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr1 = "test message1"; - const CHAR *msgptr2 = "test message2 with differnet length"; - mqd_t mqueue; - struct timespec ts; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq104_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr1, strlen(msgptr1), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_send(mqueue, msgptr2, strlen(msgptr2), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedreceive(mqueue, msgrv1, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr1), ret, EXIT1); - - ret = mq_timedreceive(mqueue, msgrv2, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr2), ret, EXIT1); - - ret = strcmp(msgrv1, msgptr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = strcmp(msgrv2, msgptr2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = strcmp(msgrv1, msgrv2); - ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue104(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_104", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_106.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_106.cpp deleted file mode 100644 index 0470c8b8..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_106.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - mqd_t mqueue; - struct timespec ts; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq106_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - mqueue = (mqd_t)((UINTPTR)mqueue + PER_ADDED_VALUE); - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedreceive(mqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = mq_close((mqd_t)((UINTPTR)mqueue - PER_ADDED_VALUE)); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue106(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_106", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_108.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_108.cpp deleted file mode 100644 index 898c252c..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_108.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH], msgrv[MQUEUE_STANDARD_NAME_LENGTH]; - mqd_t mqdes; - struct timespec ts; - struct mq_attr attr = { 0 }; - INT32 unresolved = 0, failure = 0, ret = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq108-1_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqdes, (mqd_t)-1, mqdes, EXIT); - - ts.tv_sec = 1; - ts.tv_nsec = -1; - ret = mq_timedreceive(mqdes, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = mq_close(mqdes); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(mqdes); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue108(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_108", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_109.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_109.cpp deleted file mode 100644 index 558d7cc5..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_109.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - mqd_t mqueue; - struct timespec ts; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq109_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 1000000000; // 1000000000, one seconds. - ret = mq_timedreceive(mqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue109(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_109", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_110.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_110.cpp deleted file mode 100644 index 1cac5c01..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_110.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - mqd_t mqueue; - struct timespec ts; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq110_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 1000000000 + 1; // 1000000000, one second. - ret = mq_timedreceive(mqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue110(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_110", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_111.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_111.cpp deleted file mode 100644 index fdd8ff00..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_111.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static void *PthreadF01(void *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - LOS_AtomicInc(&g_testCount); - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - return NULL; - -EXIT: - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *arg) -{ - INT32 ret; - UINT32 ret1; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct mq_attr attr = { 0 }; - pthread_t pthread1; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq111_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT2); - - LOS_AtomicInc(&g_testCount); - - ret = pthread_create(&pthread1, NULL, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret1 = LosTaskDelay(1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT2); // 2, Here, assert the g_testCount. - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - LOS_AtomicInc(&g_testCount); - - return NULL; -EXIT2: - mq_close(g_gqueue); -EXIT1: - mq_unlink(mqname); -EXIT: - pthread_join(pthread1, NULL); - return NULL; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - pthread_t pthread1; - pthread_attr_t attr1; - struct sched_param schedparam; - - g_testCount = 0; - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_create(&pthread1, &attr1, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = LosTaskDelay(2); // 2, Set delay time. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT1); // 3, Here, assert the g_testCount. - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - pthread_join(pthread1, NULL); -EXIT: - pthread_attr_destroy(&attr1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue111(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_111", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_112.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_112.cpp deleted file mode 100644 index 40fcdb8b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_112.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR msgRcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - LOS_AtomicInc(&g_testCount); - - ret = mq_receive(g_messageQId, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MSGLEN, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgRcd, MQUEUE_SEND_STRING_TEST, msgRcd, EXIT); - - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} -static UINT32 Testcase(VOID) -{ - pthread_t threadA; - pthread_attr_t attrA; - UINT32 ret; - struct sched_param sp; - - CHAR qName[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgPtr = MQUEUE_SEND_STRING_TEST; - struct mq_attr msgAttr = { 0 }; - msgAttr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - msgAttr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - g_testCount = 0; - - snprintf(qName, MQUEUE_STANDARD_NAME_LENGTH, "/mq112_%d", LosCurTaskIDGet()); - - g_messageQId = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_GOTO_NOT_EQUAL(g_messageQId, (mqd_t)-1, g_messageQId, EXIT); - - ret = mq_send(g_messageQId, msgPtr, strlen(msgPtr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_init(&attrA); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - pthread_attr_setinheritsched(&attrA, PTHREAD_EXPLICIT_SCHED); - - sp.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attrA, &sp); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadA, &attrA, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - LosTaskDelay(2); // 2, Set delay time. - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT2); - - ret = pthread_join(threadA, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attrA); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_close(g_messageQId); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(qName); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - return MQUEUE_NO_ERROR; -EXIT2: - PosixPthreadDestroy(&attrA, threadA); -EXIT1: - mq_close(g_messageQId); - mq_unlink(qName); -EXIT: - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue112(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_112", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_113.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_113.cpp deleted file mode 100644 index 8a041343..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_113.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - - ts.tv_sec = 0xffff; - - g_testCount++; - - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, 0, &ts); - - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} -static UINT32 Testcase(VOID) -{ - INT32 ret; - UINT32 uret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - pthread_t pthread1; - pthread_attr_t attr1; - struct sched_param schedparam; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - g_testCount = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq113_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT2); - - TestExtraTaskDelay(1); - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&pthread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - usleep(0); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT2); - - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - usleep(0); - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT2); - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT2); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - return MQUEUE_NO_ERROR; - -EXIT2: - mq_close(g_gqueue); - mq_unlink(mqname); -EXIT1: - pthread_join(pthread1, NULL); -EXIT: - pthread_attr_destroy(&attr1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue113(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_113", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_114.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_114.cpp deleted file mode 100644 index 01ff7d7a..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_114.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret, count = 0; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - while (count < MQUEUE_SHORT_ARRAY_LENGTH) { - LOS_AtomicInc(&g_testCount); - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, g_mqueueMsessage[count], msgrcd, EXIT); - - count++; - } - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret, count = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - pthread_t pthread1; - pthread_attr_t attr1; - struct sched_param schedparam; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - g_testCount = 0; - - LOS_TaskLock(); - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq114_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT2); - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&pthread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - LOS_TaskUnlock(); - - while (count < MQUEUE_SHORT_ARRAY_LENGTH) { - LOS_AtomicInc(&g_testCount); - - ret = mq_send(g_gqueue, g_mqueueMsessage[count], MQUEUE_SHORT_ARRAY_LENGTH, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - count++; - } - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - TestExtraTaskDelay(2); // 2, Set delay time. - ICUNIT_GOTO_EQUAL(g_testCount, MQUEUE_SHORT_ARRAY_LENGTH * 2, g_testCount, EXIT2); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - return MQUEUE_NO_ERROR; -EXIT2: - mq_close(g_gqueue); - mq_unlink(mqname); -EXIT1: - pthread_join(pthread1, NULL); -EXIT: - pthread_attr_destroy(&attr1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue114(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_114", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_115.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_115.cpp deleted file mode 100644 index 8ce095ba..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_115.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret, count = 0; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - while (count < MQUEUE_SHORT_ARRAY_LENGTH) { - LOS_AtomicInc(&g_testCount); - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, g_mqueueMsessage[count], msgrcd, EXIT); - - count++; - } - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - INT32 ret, count = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - pthread_t pthread1; - pthread_attr_t attr1; - struct sched_param schedparam; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - - g_testCount = 0; - - LOS_TaskLock(); - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq115_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT2); - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&pthread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - while (count < MQUEUE_SHORT_ARRAY_LENGTH) { - LOS_AtomicInc(&g_testCount); - ret = mq_send(g_gqueue, g_mqueueMsessage[count], MQUEUE_SHORT_ARRAY_LENGTH, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - count++; - } - - LOS_TaskUnlock(); - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ICUNIT_GOTO_EQUAL(g_testCount, MQUEUE_SHORT_ARRAY_LENGTH * 2, g_testCount, EXIT2); // 2, Here, assert g_testCount. - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT2: - mq_close(g_gqueue); - mq_unlink(mqname); -EXIT1: - pthread_join(pthread1, NULL); -EXIT: - pthread_attr_destroy(&attr1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue115(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_115", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_116.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_116.cpp deleted file mode 100644 index d4b3c190..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_116.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - LOS_AtomicInc(&g_testCount); - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq116_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT1); - - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT1); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return NULL; -EXIT1: - mq_close(g_gqueue); -EXIT: - mq_unlink(mqname); - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - pthread_t pthread1; - pthread_attr_t attr1; - struct sched_param schedparam; - - g_testCount = 0; - - LOS_TaskLock(); - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&pthread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - LOS_TaskUnlock(); - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - - return MQUEUE_NO_ERROR; - -EXIT1: - pthread_join(pthread1, NULL); -EXIT: - pthread_attr_destroy(&attr1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue116(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_116", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_117.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_117.cpp deleted file mode 100644 index d063374b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_117.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR msgRcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec rcdTimeout = { 0 }; - rcdTimeout.tv_sec = 0xffff; - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_messageQId, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &rcdTimeout); - ICUNIT_GOTO_EQUAL(ret, MSGLEN, ret, NOK); - ICUNIT_GOTO_STRING_EQUAL(msgRcd, MQUEUE_SEND_STRING_TEST, msgRcd, NOK); - -NOK: - return NULL; -} -static UINT32 Testcase(VOID) -{ - pthread_t threadA; - pthread_attr_t attrA; - UINT32 ret; - struct sched_param sp; - - CHAR qName[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgPtr = MQUEUE_SEND_STRING_TEST; - struct mq_attr msgAttr = { 0 }; - - msgAttr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - msgAttr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - g_testCount = 0; - - LOS_TaskLock(); - snprintf(qName, MQUEUE_STANDARD_NAME_LENGTH, "/mq117_%d", LosCurTaskIDGet()); - - g_messageQId = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_GOTO_NOT_EQUAL(g_messageQId, (mqd_t)-1, g_messageQId, EXIT2); - - ret = pthread_attr_init(&attrA); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - sp.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attrA, &sp); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&threadA, &attrA, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - LOS_TaskUnlock(); - - ret = mq_send(g_messageQId, msgPtr, strlen(msgPtr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - LosTaskDelay(1); - - ret = pthread_join(threadA, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attrA); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT3); - - ret = mq_close(g_messageQId); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = mq_unlink(qName); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - return MQUEUE_NO_ERROR; -EXIT3: - mq_close(g_messageQId); - mq_unlink(qName); - return MQUEUE_NO_ERROR; -EXIT2: - mq_close(g_messageQId); - mq_unlink(qName); -EXIT1: - PosixPthreadDestroy(&attrA, threadA); -EXIT: - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue117(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_117", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_118.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_118.cpp deleted file mode 100644 index f330480b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_118.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret, count = 0; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - TestExtraTaskDelay(1); - - ICUNIT_GOTO_EQUAL(g_testCount, MQUEUE_SHORT_ARRAY_LENGTH, g_testCount, EXIT); - - while (count < MQUEUE_SHORT_ARRAY_LENGTH) { - LOS_AtomicInc(&g_testCount); - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, g_mqueueMsessage[count], msgrcd, EXIT); - - count++; - } - return NULL; - -EXIT: - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *arg) -{ - INT32 ret, count = 0; - - LOS_TaskLock(); - - while (count < MQUEUE_SHORT_ARRAY_LENGTH) { - LOS_AtomicInc(&g_testCount); - ret = mq_send(g_gqueue, g_mqueueMsessage[count], MQUEUE_SHORT_ARRAY_LENGTH, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - count++; - } - - ret = mq_send(g_gqueue, g_mqueueMsessage[count], MQUEUE_SHORT_ARRAY_LENGTH, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - - LOS_TaskUnlock(); - - return NULL; - -EXIT: - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - UINT32 uret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - pthread_t pthread1; - pthread_attr_t attr1; - pthread_t pthread2; - pthread_attr_t attr2; - struct sched_param schedparam; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - - g_testCount = 0; - - LOS_TaskLock(); - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq118_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&pthread1, &attr1, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_init(&attr2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr2, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&pthread2, &attr2, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - LOS_TaskUnlock(); - - uret = LosTaskDelay(5); // 5, Set delay time. - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT2); - - ret = pthread_join(pthread2, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attr2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(g_testCount, MQUEUE_SHORT_ARRAY_LENGTH * 2, g_testCount, EXIT); // 2, mqueue message length. - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT2: - PosixPthreadDestroy(&attr2, pthread2); -EXIT1: - PosixPthreadDestroy(&attr1, pthread1); -EXIT: - mq_close(g_gqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue118(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_118", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_119.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_119.cpp deleted file mode 100644 index d93f11d7..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_119.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - TEST_HwiTrigger(HWI_NUM_TEST); - - LOS_AtomicInc(&g_testCount); - - return NULL; -} - -static VOID HwiF01(VOID *arg) -{ - INT32 ret; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts = { 0 }; - - ts.tv_sec = 0; - - TEST_HwiClear(HWI_NUM_TEST); - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedsend(g_gqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return; -EXIT: - g_testCount = 0; - return; -} - -static VOID *PthreadF02(VOID *arg) -{ - INT32 ret; - UINT32 uret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - pthread_t pthread1; - struct mq_attr attr = { 0 }; - struct timespec ts = { 0 }; - - ts.tv_sec = 10; // 10, secend. - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - LOS_AtomicInc(&g_testCount); - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq119_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - ret = LOS_HwiCreate(HWI_NUM_TEST, 0, 0, (HWI_PROC_FUNC)HwiF01, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&pthread1, NULL, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - usleep(10000); // 10000, Microseconds. - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT2); // 3, Here, assert the g_testCount. - - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT2); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT2); - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - TEST_HwiDelete(HWI_NUM_TEST); - - LOS_AtomicInc(&g_testCount); - - return MQUEUE_NO_ERROR; -EXIT2: - TEST_HwiDelete(HWI_NUM_TEST); -EXIT1: - pthread_join(pthread1, NULL); -EXIT: - mq_close(g_gqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - pthread_t pthread1; - pthread_attr_t attr1; - struct sched_param schedparam; - - g_testCount = 0; - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&pthread1, &attr1, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, Here, assert the g_testCount. - - return MQUEUE_NO_ERROR; - -EXIT1: - pthread_join(pthread1, NULL); -EXIT: - pthread_attr_destroy(&attr1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue119(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_119", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_120.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_120.cpp deleted file mode 100644 index 3205a0de..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_120.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - - ts.tv_sec = 0xffff; - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, g_mqueueMsessage[2], msgrcd, EXIT); // 2, g_mqueueMsessage buffer index. - - LOS_AtomicInc(&g_testCount); - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *arg) -{ - INT32 ret; - UINT32 pri; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - ts.tv_sec = 0xffff; - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, &pri, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, g_mqueueMsessage[1], msgrcd, EXIT); - - LOS_AtomicInc(&g_testCount); - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - pthread_t pthread1; - pthread_attr_t attr1; - pthread_t pthread2; - pthread_attr_t attr2; - struct sched_param schedparam1; - struct sched_param schedparam2; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - g_testCount = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq120_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT1); - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - schedparam1.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&pthread1, &attr1, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_init(&attr2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - schedparam2.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2 - 2; // 2, Pthread schedul priority. - ret = pthread_attr_setschedparam(&attr2, &schedparam2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = pthread_create(&pthread2, &attr2, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = mq_send(g_gqueue, g_mqueueMsessage[1], MQUEUE_SHORT_ARRAY_LENGTH, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = mq_send(g_gqueue, g_mqueueMsessage[2], MQUEUE_SHORT_ARRAY_LENGTH, 0); // 2, mqueue message buffer index. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - TestExtraTaskDelay(3); // 3, Set delay time. - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT3); // 4, Here, assert the g_testCount. - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = pthread_join(pthread2, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attr2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT3: - pthread_attr_destroy(&attr1); -EXIT2: - pthread_attr_destroy(&attr2); -EXIT1: - mq_close(g_gqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue120(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_120", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_121.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_121.cpp deleted file mode 100644 index 66574cce..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_121.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - - ts.tv_sec = 0xffff; - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, g_mqueueMsessage[4], msgrcd, EXIT); // 4, g_mqueueMsessage buffer index. - - LOS_AtomicInc(&g_testCount); - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - - ts.tv_sec = 0xffff; - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, g_mqueueMsessage[3], msgrcd, EXIT); // 3, g_mqueueMsessage buffer index. - - LOS_AtomicInc(&g_testCount); - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF03(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - struct timespec ts = { 0 }; - ts.tv_sec = 0xffff; - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, g_mqueueMsessage[2], msgrcd, EXIT); // 2, g_mqueueMsessage buffer index. - - LOS_AtomicInc(&g_testCount); - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF04(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - - ts.tv_sec = 0xffff; - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, g_mqueueMsessage[1], msgrcd, EXIT); - - LOS_AtomicInc(&g_testCount); - -EXIT: - return NULL; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - - pthread_t threadA; - pthread_attr_t attrA; - struct sched_param spA; - - pthread_t threadB; - pthread_attr_t attrB; - struct sched_param spB; - - pthread_t threadC; - pthread_attr_t attrC; - struct sched_param spC; - - pthread_t threadD; - pthread_attr_t attrD; - struct sched_param spD; - - struct mq_attr msgAttr = { 0 }; - CHAR qName[MQUEUE_STANDARD_NAME_LENGTH] = ""; - - msgAttr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - msgAttr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - g_testCount = 0; - - snprintf(qName, MQUEUE_STANDARD_NAME_LENGTH, "/mq121_%d", LosCurTaskIDGet()); - - g_messageQId = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_GOTO_NOT_EQUAL(g_messageQId, (mqd_t)-1, g_messageQId, EXIT); - - ret = pthread_attr_init(&attrA); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pthread_attr_setinheritsched(&attrA, PTHREAD_EXPLICIT_SCHED); - - spA.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attrA, &spA); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_create(&threadA, &attrA, PthreadF04, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = pthread_attr_init(&attrB); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - pthread_attr_setinheritsched(&attrB, PTHREAD_EXPLICIT_SCHED); - spB.sched_priority = 2; // 2, Queue pthread priority. - ret = pthread_attr_setschedparam(&attrB, &spB); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = pthread_create(&threadB, &attrB, PthreadF03, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = pthread_attr_init(&attrC); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - pthread_attr_setinheritsched(&attrC, PTHREAD_EXPLICIT_SCHED); - - spC.sched_priority = 2; // 2, Queue pthread priority. - ret = pthread_attr_setschedparam(&attrC, &spC); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = pthread_create(&threadC, &attrC, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = pthread_attr_init(&attrD); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - pthread_attr_setinheritsched(&attrD, PTHREAD_EXPLICIT_SCHED); - - spD.sched_priority = 1; - ret = pthread_attr_setschedparam(&attrD, &spD); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = pthread_create(&threadD, &attrD, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mq_send(g_messageQId, g_mqueueMsessage[1], MSGLEN, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mq_send(g_messageQId, g_mqueueMsessage[2], MSGLEN, 0); // 2, g_mqueueMsessage buffer index. - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mq_send(g_messageQId, g_mqueueMsessage[3], MSGLEN, 0); // 3, g_mqueueMsessage buffer index. - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mq_send(g_messageQId, g_mqueueMsessage[4], MSGLEN, 0); // 4, g_mqueueMsessage buffer index. - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - TestExtraTaskDelay(3); // 3, Set delay time. - ICUNIT_GOTO_EQUAL(g_testCount, 8, g_testCount, EXIT4); // 8, Here, assert the g_testCount. - - ret = pthread_join(threadD, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - ret = pthread_attr_destroy(&attrD); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = pthread_join(threadC, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - ret = pthread_attr_destroy(&attrC); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT3); - - ret = pthread_join(threadB, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - ret = pthread_attr_destroy(&attrB); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = pthread_join(threadA, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - ret = pthread_attr_destroy(&attrA); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT4); - - ret = mq_close(g_messageQId); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = mq_unlink(qName); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - return MQUEUE_NO_ERROR; - -EXIT4: - pthread_join(threadD, NULL); - pthread_attr_destroy(&attrD); -EXIT3: - pthread_join(threadC, NULL); - pthread_attr_destroy(&attrC); -EXIT2: - pthread_join(threadB, NULL); - pthread_attr_destroy(&attrA); -EXIT1: - pthread_join(threadB, NULL); - pthread_attr_destroy(&attrA); -EXIT: - mq_close(g_messageQId); - mq_unlink(qName); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue121(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_121", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_122.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_122.cpp deleted file mode 100644 index 60a483c6..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_122.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID HwiF01(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - - ts.tv_sec = 0; - - TEST_HwiClear(HWI_NUM_TEST); - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - LOS_AtomicInc(&g_testCount); - - return; - -EXIT: - g_testCount = 0; - return; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - UINT32 uret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - g_testCount = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq122_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT1); - - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - uret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT2); - - TEST_HwiTrigger(HWI_NUM_TEST); - - uret = LosTaskDelay(2); // 2, Set delay time. - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT2); - - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT2); // 2, Here, assert the g_testCount. - - TEST_HwiDelete(HWI_NUM_TEST); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT2: - TEST_HwiDelete(HWI_NUM_TEST); -EXIT1: - mq_close(g_gqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue122(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_122", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_123.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_123.cpp deleted file mode 100644 index c1847935..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_123.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID HwiF01(VOID *arg) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts = { 0 }; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - ts.tv_sec = 0; - - TEST_HwiClear(HWI_NUM_TEST); - - LOS_AtomicInc(&g_testCount); - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq123_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - ret = mq_timedsend(g_gqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - LOS_AtomicInc(&g_testCount); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return; - -EXIT: - mq_close(g_gqueue); - mq_unlink(mqname); - g_testCount = 0; - return; -} - -static UINT32 Testcase(VOID) -{ - UINT32 uret; - - g_testCount = 0; - - uret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT); - - TEST_HwiTrigger(HWI_NUM_TEST); - - uret = LosTaskDelay(2); // 2, Set delay time. - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert the g_testCount. - - TEST_HwiDelete(HWI_NUM_TEST); - - return MQUEUE_NO_ERROR; -EXIT: - TEST_HwiDelete(HWI_NUM_TEST); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue123(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_123", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_124.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_124.cpp deleted file mode 100644 index 774c8dd1..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_124.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID HwiF01(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - - ts.tv_sec = 0; - - TEST_HwiClear(HWI_NUM_TEST); - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, Here, assert the g_testCount. - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - LOS_AtomicInc(&g_testCount); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(g_gqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - return; - -EXIT: - mq_close(g_gqueue); - mq_unlink(g_gqname); - return; -} - -static VOID HwiF02(VOID *arg) -{ - INT32 ret; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts = { 0 }; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - ts.tv_sec = 0; - - TEST_HwiClear(HWI_NUM_TEST1); - - LOS_AtomicInc(&g_testCount); - - g_gqueue = mq_open(g_gqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - ret = mq_timedsend(g_gqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - LOS_AtomicInc(&g_testCount); - - return; - -EXIT: - mq_close(g_gqueue); - mq_unlink(g_gqname); - return; -} - -static UINT32 Testcase(VOID) -{ - UINT32 uret; - - g_testCount = 0; - - snprintf(g_gqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq124_%d", LosCurTaskIDGet()); - - uret = LOS_HwiCreate(HWI_NUM_TEST1, 1, 0, (HWI_PROC_FUNC)HwiF02, 0); - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT); - -#ifdef LOSCFG_KERNEL_SMP - HalIrqSetAffinity(HWI_NUM_TEST1, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); -#endif - - TEST_HwiTrigger(HWI_NUM_TEST1); - - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert the g_testCount. - - uret = LOS_HwiCreate(HWI_NUM_TEST, 1, 0, (HWI_PROC_FUNC)HwiF01, 0); - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT1); - -#ifdef LOSCFG_KERNEL_SMP - HalIrqSetAffinity(HWI_NUM_TEST, CPUID_TO_AFFI_MASK(ArchCurrCpuid())); -#endif - - LOS_AtomicInc(&g_testCount); - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT1); // 3, Here, assert the g_testCount. - - TEST_HwiTrigger(HWI_NUM_TEST); - - ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT1); // 5, Here, assert the g_testCount. - - TEST_HwiDelete(HWI_NUM_TEST); - - TEST_HwiDelete(HWI_NUM_TEST1); - - return MQUEUE_NO_ERROR; - -EXIT1: - TEST_HwiDelete(HWI_NUM_TEST); -EXIT: - TEST_HwiDelete(HWI_NUM_TEST1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue124(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_124", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_125.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_125.cpp deleted file mode 100644 index f6372190..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_125.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID HwiF01(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - - ts.tv_sec = 0; - - TEST_HwiClear(HWI_NUM_TEST); - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(g_gqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - LOS_AtomicInc(&g_testCount); - - return; - -EXIT: - g_testCount = 0; - TEST_HwiDelete(HWI_NUM_TEST); - mq_close(g_gqueue); - mq_unlink(g_gqname); - return; -} - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - LOS_AtomicInc(&g_testCount); - - g_gqueue = mq_open(g_gqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - LOS_AtomicInc(&g_testCount); - - return NULL; - -EXIT: - g_testCount = 0; - mq_close(g_gqueue); - mq_unlink(g_gqname); - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - INT32 ret; - UINT32 uret; - pthread_t pthread1; - pthread_attr_t attr1; - struct sched_param schedparam; - - g_testCount = 0; - - snprintf(g_gqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq125_%d", LosCurTaskIDGet()); - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_create(&pthread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - TestExtraTaskDelay(2); // 2, Set delay time. - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert the g_testCount. - - LOS_AtomicInc(&g_testCount); - - uret = LOS_HwiCreate(HWI_NUM_TEST, 0, 0, (HWI_PROC_FUNC)HwiF01, 0); - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT2); - - TEST_HwiTrigger(HWI_NUM_TEST); - - uret = LosTaskDelay(2); // 2, Set delay time. - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT2); - - ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT2); // 5, Here, assert the g_testCount. - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - TEST_HwiDelete(HWI_NUM_TEST); - - return MQUEUE_NO_ERROR; - -EXIT2: - TEST_HwiDelete(HWI_NUM_TEST); -EXIT1: - pthread_join(pthread1, NULL); -EXIT: - pthread_attr_destroy(&attr1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue125(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_125", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_126.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_126.cpp deleted file mode 100644 index 022b0001..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_126.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - LOS_AtomicInc(&g_testCount); - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - LOS_AtomicInc(&g_testCount); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(g_gqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return NULL; - -EXIT: - g_testCount = 0; - mq_close(g_gqueue); - mq_unlink(g_gqname); - return NULL; -} - -static VOID HwiF01(VOID *arg) -{ - INT32 ret; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts = { 0 }; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - ts.tv_sec = 0; - - TEST_HwiClear(HWI_NUM_TEST); - - LOS_AtomicInc(&g_testCount); - - g_gqueue = mq_open(g_gqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - ret = mq_timedsend(g_gqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - LOS_AtomicInc(&g_testCount); - - return; -EXIT: - g_testCount = 0; - mq_close(g_gqueue); - mq_unlink(g_gqname); - return; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - UINT32 uret; - pthread_t pthread1; - pthread_attr_t attr1; - struct sched_param schedparam; - - g_testCount = 0; - - snprintf(g_gqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq126_%d", LosCurTaskIDGet()); - - uret = LOS_HwiCreate(HWI_NUM_TEST, 0, 0, (HWI_PROC_FUNC)HwiF01, 0); - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT); - - TEST_HwiTrigger(HWI_NUM_TEST); - - uret = LosTaskDelay(2); // 2, Set delay time. - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, Here, assert the g_testCount. - - LOS_AtomicInc(&g_testCount); - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - ret = pthread_create(&pthread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - TestExtraTaskDelay(2); // 2, Set delay time. - ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT2); // 5, Here, assert the g_testCount. - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT2); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - TEST_HwiDelete(HWI_NUM_TEST); - - return MQUEUE_NO_ERROR; -EXIT2: - pthread_join(pthread1, NULL); -EXIT1: - pthread_attr_destroy(&attr1); -EXIT: - TEST_HwiDelete(HWI_NUM_TEST); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue126(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_126", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_127.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_127.cpp deleted file mode 100644 index 8e39a2d5..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_127.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - - CHAR qName[MQUEUE_STANDARD_NAME_LENGTH] = "/mq127"; - mqd_t msgQId1; - mqd_t msgQId2; - - struct mq_attr msgAttr = { 0 }; - msgAttr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - msgAttr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - msgQId1 = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_GOTO_NOT_EQUAL(msgQId1, (mqd_t)-1, msgQId1, EXIT1); - - msgQId2 = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_GOTO_NOT_EQUAL(msgQId2, (mqd_t)-1, msgQId2, EXIT2); - - ret = mq_close(msgQId2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_close(msgQId1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(qName); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT2: - mq_close(msgQId2); -EXIT1: - mq_close(msgQId1); -EXIT: - mq_unlink(qName); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue127(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_127", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_128.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_128.cpp deleted file mode 100644 index b2060b62..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_128.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq128_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue128(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_128", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_129.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_129.cpp deleted file mode 100644 index b78aa4fb..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_129.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq129_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - for (i = 0; i < 0xffff; i++) { - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT1); - } - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; - -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue129(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_129", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_130.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_130.cpp deleted file mode 100644 index 8ee6607c..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_130.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = 0; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq130_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = mq_receive(g_gqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(g_gqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue130(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_130", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_133.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_133.cpp deleted file mode 100644 index f980ccf7..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_133.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 ret; - CHAR msgRcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec rcdTimeout = { 0 }; - rcdTimeout.tv_sec = 0xffff; - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_messageQId, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &rcdTimeout); - ICUNIT_GOTO_EQUAL(ret, MSGLEN, ret, NOK); - ICUNIT_GOTO_STRING_EQUAL(msgRcd, g_mqueueMsessage[2], msgRcd, NOK); // 2, g_mqueueMsessage buffer index. - - LOS_AtomicInc(&g_testCount); - -NOK: - return NULL; -} - -static VOID *PthreadF02(VOID *arg) -{ - INT32 ret; - CHAR msgRcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec rcdTimeout = { 0 }; - rcdTimeout.tv_sec = 0xffff; - - LOS_AtomicInc(&g_testCount); - - ret = mq_timedreceive(g_messageQId, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &rcdTimeout); - ICUNIT_GOTO_EQUAL(ret, MSGLEN, ret, NOK); - ICUNIT_GOTO_STRING_EQUAL(msgRcd, g_mqueueMsessage[1], msgRcd, NOK); - - LOS_AtomicInc(&g_testCount); - -NOK: - return NULL; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - - pthread_t threadA; - pthread_attr_t attrA; - struct sched_param spA; - - pthread_t threadB; - pthread_attr_t attrB; - struct sched_param spB; - - struct mq_attr msgAttr = { 0 }; - CHAR qName[MQUEUE_STANDARD_NAME_LENGTH] = ""; - - msgAttr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - msgAttr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - g_testCount = 0; - - snprintf(qName, MQUEUE_STANDARD_NAME_LENGTH, "/mq170_%d", LosCurTaskIDGet()); - - g_messageQId = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_GOTO_NOT_EQUAL(g_messageQId, (mqd_t)-1, g_messageQId, EXIT1); - - ret = pthread_attr_init(&attrA); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - spA.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attrA, &spA); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadA, &attrA, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_init(&attrB); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - spB.sched_priority = 8; // 8, Queue pthread priority. - ret = pthread_attr_setschedparam(&attrB, &spB); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = pthread_create(&threadB, &attrB, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = mq_send(g_messageQId, g_mqueueMsessage[1], MSGLEN, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = mq_send(g_messageQId, g_mqueueMsessage[2], MSGLEN, 0); // 2, g_mqueueMsessage buffer index. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - TestExtraTaskDelay(2); // 2, Set delay time. - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT3); // 4, Here, assert the g_testCount. - - ret = pthread_join(threadB, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = pthread_attr_destroy(&attrB); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = pthread_join(threadA, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attrA); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = mq_close(g_messageQId); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(qName); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - return MQUEUE_NO_ERROR; -EXIT3: - PosixPthreadDestroy(&attrB, threadB); -EXIT2: - PosixPthreadDestroy(&attrA, threadA); -EXIT1: - mq_close(g_messageQId); - mq_unlink(qName); -EXIT: - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue133(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_133", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_134.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_134.cpp deleted file mode 100644 index bc147b0c..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_134.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - UINTPTR temp; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq134_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, 0); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue134(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_134", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_136.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_136.cpp deleted file mode 100644 index 83f0f82f..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_136.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - INT32 index; - - mqd_t queueID[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1]; - CHAR qName[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1][MQUEUE_STANDARD_NAME_LENGTH]; - - const CHAR *msgPtr = MQUEUE_SEND_STRING_TEST; - CHAR msgRcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - struct mq_attr msgAttr = { 0 }; - msgAttr.mq_msgsize = 20; // 20, mqueue message size. - msgAttr.mq_maxmsg = 20; // 20, mqueue message size. - - for (index = 0; index < (LOSCFG_BASE_IPC_QUEUE_CONFIG - QUEUE_EXISTED_NUM); index++) { - snprintf(qName[index], MQUEUE_STANDARD_NAME_LENGTH, "/mq136_%d", index); - queueID[index] = mq_open(qName[index], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_GOTO_NOT_EQUAL(queueID[index], (mqd_t)-1, queueID[index], EXIT); - } - -EXIT: - for (; index >= 1;) { - ret = mq_close(queueID[--index]); - ICUNIT_ASSERT_EQUAL(ret, 0, index); - - ret = mq_unlink(qName[index]); - ICUNIT_ASSERT_EQUAL(ret, MQUEUE_NO_ERROR, ret); - } - - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue136(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_136", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_143.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_143.cpp deleted file mode 100644 index 246d34cb..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_143.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *argument) -{ - INT32 ret; - struct timespec ts = { 0 }; - - TestBusyTaskDelay(3); // 3, Set the timeout of runtime - - LOS_AtomicInc(&g_testCount); - ret = mq_timedsend(g_gqueue, "1234567890123456789", 20, 0, &ts); // 20, mqueue max message size. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return NULL; - -EXIT: - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - const INT32 size = 20; // 20, queue max message size. - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - pthread_t newTh; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = size; - attr.mq_maxmsg = size; - attr.mq_flags = O_NONBLOCK; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq143_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue); - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(g_gqueue, msgrcd, size, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT1); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - g_gqueue = mq_open(mqname, O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT1); - - ret = mq_receive(g_gqueue, msgrcd, size, NULL); - ICUNIT_GOTO_EQUAL(ret, size, ret, EXIT1); - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT1); - - ret = pthread_join(newTh, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - pthread_join(newTh, NULL); -EXIT: - mq_close(g_gqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue143(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_143", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_144.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_144.cpp deleted file mode 100644 index c9d07ef4..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_144.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *argument) -{ - INT32 i, ret; - const CHAR *msgptr[] = { "msg test 1", "msg test 2", "msg test 3" }; - struct mq_attr attr = { 0 }; - - g_testCount = 1; - - mq_getattr(g_gqueue, &attr); - for (i = 0; i < 3; i++) { // 3, the loop frequency. - LosTaskDelay(2); // 2, delay - ret = mq_send(g_gqueue, msgptr[i], attr.mq_msgsize, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - g_testCount = 2; // 2, Init test count value. - - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *argument) -{ - INT32 i, ret; - UINT32 uret; - const CHAR *msgptr[] = { "msg test 1", "msg test 2", "msg test 3" }; - CHAR msgrcd[3][MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr = { 0 }; - UINT32 msgPrio = 1; - - g_testCount = 3; // 3, Init test count value. - - mq_getattr(g_gqueue, &attr); - for (i = 0; i < 3; i++) { // 3, the loop frequency. - uret = LosTaskDelay(2); // 2, delay - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT); - - ret = mq_receive(g_gqueue, msgrcd[i], attr.mq_msgsize, &msgPrio); - ICUNIT_GOTO_EQUAL(ret, attr.mq_msgsize, ret, EXIT); - ICUNIT_GOTO_NOT_EQUAL(ret, strlen(msgptr[i]), ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd[i], msgptr[i], msgrcd[i], EXIT); - } - - g_testCount = 4; // 4, Init test count value. - - return NULL; -EXIT: - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - UINT32 uret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - struct mq_attr mqstat, attr; - pthread_attr_t attr1; - pthread_t newTh, newTh2; - - memset(&mqstat, 0, sizeof(mqstat)); - mqstat.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - mqstat.mq_msgsize = MQUEUE_SHORT_ARRAY_LENGTH * 2; // 2, mqueue message size. - mqstat.mq_flags = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq144_%d", LosCurTaskIDGet()); - - g_gqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO, &mqstat); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - LosTaskDelay(1); - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT1); - - ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr1, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - uret = LosTaskDelay(12); // 12, Set delay time. - ICUNIT_GOTO_EQUAL(uret, MQUEUE_NO_ERROR, uret, EXIT2); - - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT2); // 4, Here, assert the g_testCount. - - ret = PosixPthreadDestroy(&attr1, newTh2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT2: - PosixPthreadDestroy(&attr1, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh); -EXIT: - mq_close(g_gqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue144(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("ItPosixQueue144", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_145.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_145.cpp deleted file mode 100644 index 76ce0c07..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_145.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *mq) -{ - INT32 i, ret; - mqd_t mqueue1 = *(mqd_t *)mq; - const CHAR *msgptr[] = { "msg test 1", "msg test 2", "msg test 3" }; - - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_send(mqueue1, msgptr[i], MQUEUE_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - LOS_AtomicInc(&g_testCount); - - pthread_exit((void *)0); - - return NULL; -EXIT: - pthread_exit((void *)0); - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *mq) -{ - INT32 i, ret; - mqd_t mqueue2 = *(mqd_t *)mq; - const CHAR *msgptr[] = { "msg test 1", "msg test 2", "msg test 3" }; - - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_send(mqueue2, msgptr[i], MQUEUE_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - LOS_AtomicInc(&g_testCount); - - pthread_exit((void *)0); - - return NULL; -EXIT: - pthread_exit((void *)0); - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF03(VOID *mq) -{ - INT32 i, ret; - mqd_t mqueue1 = *(mqd_t *)mq; - CHAR msgrcd[3][MQUEUE_STANDARD_NAME_LENGTH] = {{0, 0}}; - - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_receive(mqueue1, msgrcd[i], MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_STANDARD_NAME_LENGTH, ret, EXIT); - } - LOS_AtomicInc(&g_testCount); - - pthread_exit((void *)0); - - return NULL; -EXIT: - pthread_exit((void *)0); - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF04(VOID *mq) -{ - INT32 i, ret; - mqd_t mqueue2 = *(mqd_t *)mq; - CHAR msgrcd[3][MQUEUE_STANDARD_NAME_LENGTH]; - - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_receive(mqueue2, msgrcd[i], MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_STANDARD_NAME_LENGTH, ret, EXIT); - } - - LOS_AtomicInc(&g_testCount); - - pthread_exit((void *)0); - - return NULL; -EXIT: - pthread_exit((void *)0); - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret, oflag; - CHAR mqname1[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR mqname2[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue1 = 0, mqueue2 = 0; - struct mq_attr mqstat; - pthread_t pthreadSend1, pthreadSend2, pthreadRecev1, pthreadRecev2; - - snprintf(mqname1, MQUEUE_STANDARD_NAME_LENGTH, "/mqueue145_1_%d", LosCurTaskIDGet()); - snprintf(mqname2, MQUEUE_STANDARD_NAME_LENGTH, "/mqueue145_2_%d", LosCurTaskIDGet()); - - g_testCount = 0; - - memset(&mqstat, 0, sizeof(mqstat)); - mqstat.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - mqstat.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - mqstat.mq_flags = 0; - - oflag = O_CREAT | O_NONBLOCK | O_RDWR; - - mqueue1 = mq_open(mqname1, oflag, S_IRWXU | S_IRWXG | S_IRWXO, &mqstat); - ICUNIT_GOTO_NOT_EQUAL(mqueue1, (mqd_t)-1, mqueue1, EXIT); - - mqueue2 = mq_open(mqname2, oflag, S_IRWXU | S_IRWXG | S_IRWXO, &mqstat); - ICUNIT_GOTO_NOT_EQUAL(mqueue2, (mqd_t)-1, mqueue2, EXIT1); - - ret = pthread_create(&pthreadSend1, NULL, PthreadF01, (void *)&mqueue1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&pthreadSend2, NULL, PthreadF02, (void *)&mqueue2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = pthread_create(&pthreadRecev1, NULL, PthreadF03, (void *)&mqueue1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT4); - - ret = pthread_create(&pthreadRecev2, NULL, PthreadF04, (void *)&mqueue2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT5); - - ret = pthread_join(pthreadSend1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT5); - - ret = pthread_join(pthreadSend2, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT5); - - ret = pthread_join(pthreadRecev1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT5); - - ret = pthread_join(pthreadRecev2, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT5); - - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT1); // 4, Here, assert the g_testCount. - - ret = mq_close(mqueue2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT5: - pthread_join(pthreadRecev2, NULL); -EXIT4: - pthread_join(pthreadRecev1, NULL); -EXIT3: - pthread_join(pthreadSend2, NULL); -EXIT2: - pthread_join(pthreadSend1, NULL); -EXIT1: - mq_close(mqueue2); - mq_unlink(mqname2); -EXIT: - mq_close(mqueue1); - mq_unlink(mqname1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue145(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_145", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_146.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_146.cpp deleted file mode 100644 index 256ed91f..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_146.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -typedef struct { - INT32 pthread_ID; - mqd_t mqueue_ID; -} mq_info; - -static VOID *PthreadF01(VOID *info) -{ - INT32 i, ret; - const CHAR *msgptr[] = { "msg test 1", "msg test 2", "msg test 3" }; - mq_info sendInfo; - - sendInfo.pthread_ID = ((mq_info *)info)->pthread_ID; - sendInfo.mqueue_ID = ((mq_info *)info)->mqueue_ID; - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_send(sendInfo.mqueue_ID, msgptr[i], MQUEUE_STANDARD_NAME_LENGTH, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - LOS_AtomicInc(&g_testCount); - - pthread_exit((void *)0); - - return NULL; -EXIT: - pthread_exit((void *)0); - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *info) -{ - INT32 i, ret; - CHAR msgrcd[3][MQUEUE_STANDARD_NAME_LENGTH * 2]; - mq_info recvInfo; - - recvInfo.pthread_ID = ((mq_info *)info)->pthread_ID; - recvInfo.mqueue_ID = ((mq_info *)info)->mqueue_ID; - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_receive(recvInfo.mqueue_ID, msgrcd[i], MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_STANDARD_NAME_LENGTH, ret, EXIT); - } - - LOS_AtomicInc(&g_testCount); - - pthread_exit((void *)0); - - return NULL; -EXIT: - pthread_exit((void *)0); - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 i, ret, oflag; - UINT32 uret; - const CHAR *mqname[MQUEUE_PTHREAD_NUM_TEST] = {"/msg1", "/msg2", "/msg3", "/msg4", "/msg5"}; - mqd_t mqueue[MQUEUE_PTHREAD_NUM_TEST]; - struct mq_attr mqstat; - pthread_t pthreadSend[MQUEUE_PTHREAD_NUM_TEST]; - pthread_t pthreadRecev[MQUEUE_PTHREAD_NUM_TEST]; - mq_info info[MQUEUE_PTHREAD_NUM_TEST]; - - g_testCount = 0; - - oflag = O_CREAT | O_NONBLOCK | O_RDWR; - - memset(&mqstat, 0, sizeof(mqstat)); - mqstat.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - mqstat.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - mqstat.mq_flags = 0; - - for (i = 0; i < MQUEUE_PTHREAD_NUM_TEST; i++) { - mqueue[i] = mq_open(mqname[i], oflag, S_IRWXU | S_IRWXG | S_IRWXO, &mqstat); - ICUNIT_GOTO_NOT_EQUAL(mqueue[i], (mqd_t)-1, mqueue[i], EXIT); - } - for (i = 0; i < MQUEUE_PTHREAD_NUM_TEST; i++) { - info[i].pthread_ID = i; - info[i].mqueue_ID = mqueue[i]; - ret = pthread_create(&pthreadSend[i], NULL, PthreadF01, (void *)&info[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&pthreadRecev[i], NULL, PthreadF02, (void *)&info[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - } - - uret = sleep(5); // 5, seconds. - ICUNIT_GOTO_EQUAL(uret, 0, uret, EXIT1); - - ICUNIT_GOTO_EQUAL(g_testCount, MQUEUE_PTHREAD_NUM_TEST * 2, g_testCount, EXIT1); // 2, assert the g_testCount. - - for (i = 0; i < MQUEUE_PTHREAD_NUM_TEST; i++) { - ret = pthread_join(pthreadSend[i], NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_join(pthreadRecev[i], NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - } - - for (i = 0; i < MQUEUE_PTHREAD_NUM_TEST; i++) { - ret = mq_close(mqueue[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - return MQUEUE_NO_ERROR; -EXIT1: - for (i = 0; i < MQUEUE_PTHREAD_NUM_TEST; i++) { - pthread_join(pthreadSend[i], NULL); - pthread_join(pthreadRecev[i], NULL); - } -EXIT: - for (i = 0; i < MQUEUE_PTHREAD_NUM_TEST; i++) { - mq_close(mqueue[i]); - mq_unlink(mqname[i]); - } - - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue146(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_146", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_147.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_147.cpp deleted file mode 100644 index 972b09cc..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_147.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = "A"; - mqd_t mqueue = 0; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = 1; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq147_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, strlen(msgptr), ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, msgptr, msgrcd, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue147(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_147", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_148.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_148.cpp deleted file mode 100644 index bfad43ea..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_148.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - - CHAR qName[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgPtr = MQUEUE_SEND_STRING_TEST; - struct mq_attr msgAttr = { 0 }; - CHAR msgRcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - msgAttr.mq_msgsize = 0xFFF0; - msgAttr.mq_maxmsg = 0xFFF0; - - snprintf(qName, MQUEUE_STANDARD_NAME_LENGTH, "/mq148_%d", LosCurTaskIDGet()); - - g_messageQId = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_GOTO_EQUAL(g_messageQId, (mqd_t)-1, g_messageQId, EXIT); - - ret = mq_send(g_messageQId, msgPtr, strlen(msgPtr), 0); - ICUNIT_GOTO_EQUAL(ret, (UINT32)-1, ret, EXIT); - - ret = mq_receive(g_messageQId, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, (UINT32)-1, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(g_messageQId); - mq_unlink(qName); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue148(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_148", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_149.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_149.cpp deleted file mode 100644 index 61143620..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_149.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq149_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, NULL, 0, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue149(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_149", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_150.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_150.cpp deleted file mode 100644 index 6852a595..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_150.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq150_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send((mqd_t)(-1), msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue150(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_150", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_151.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_151.cpp deleted file mode 100644 index 4874cdf8..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_151.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq151_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue151(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_151", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_152.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_152.cpp deleted file mode 100644 index 82221297..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_152.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr = { 0 }; - mqd_t mqueue; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq152_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue152(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_152", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_153.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_153.cpp deleted file mode 100644 index 77241880..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_153.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr = { 0 }; - mqd_t mqueue; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq153_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, (MQUEUE_STANDARD_NAME_LENGTH - 1), NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EMSGSIZE, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue153(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_153", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_154.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_154.cpp deleted file mode 100644 index 66a6d6d8..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_154.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH * 2] = {0}; - struct mq_attr attr = { 0 }; - mqd_t mqueue; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq154_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, (MQUEUE_STANDARD_NAME_LENGTH + 1), NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue154(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_154", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_155.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_155.cpp deleted file mode 100644 index e916a045..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_155.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr = { 0 }; - mqd_t mqueue; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq155_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - errno = 0; - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue155(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_155", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_156.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_156.cpp deleted file mode 100644 index 26dac7bf..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_156.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - - mqd_t msgQIdA; // Define queue ID for queue A - mqd_t msgQIdB; // Define queue ID for queue B - - CHAR qNameA[MQUEUE_STANDARD_NAME_LENGTH] = "/mq156_A"; - CHAR qNameB[MQUEUE_STANDARD_NAME_LENGTH] = "/mq156_B"; - - const CHAR *msgPtr = MQUEUE_SEND_STRING_TEST; - CHAR msgRcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - struct mq_attr msgAttr = { 0 }; - msgAttr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - msgAttr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - msgQIdA = mq_open(qNameA, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_ASSERT_NOT_EQUAL(msgQIdA, (mqd_t)-1, msgQIdA); - - ret = mq_receive(msgQIdA, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, (UINT32)-1, ret, EXIT); - - msgQIdB = mq_open(qNameB, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_ASSERT_NOT_EQUAL(msgQIdB, (mqd_t)-1, msgQIdB); - - ret = mq_send(msgQIdB, msgPtr, strlen(msgPtr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(msgQIdB, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MSGLEN, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgRcd, MQUEUE_SEND_STRING_TEST, msgRcd, EXIT1); - - ret = mq_close(msgQIdB); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(qNameB); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(msgQIdA); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(qNameA); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; - -EXIT1: - mq_close(msgQIdB); - mq_unlink(qNameB); -EXIT: - mq_close(msgQIdA); - mq_unlink(qNameA); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue156(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_156", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_157.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_157.cpp deleted file mode 100644 index c369ff84..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_157.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i; - INT32 count = MQUEUE_MAX_NUM_TEST; - CHAR mqname[LOSCFG_BASE_IPC_QUEUE_CONFIG + 2][MQUEUE_STANDARD_NAME_LENGTH]; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - mqd_t mqueue[LOSCFG_BASE_IPC_QUEUE_CONFIG + 2]; - - struct mq_attr attr = { 0 }; - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - - for (i = 0; i < count; i++) { - snprintf(mqname[i], MQUEUE_STANDARD_NAME_LENGTH, "mq157_%d_%d", LosCurTaskIDGet(), i); - - mqueue[i] = mq_open(mqname[i], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue[i], (mqd_t)-1, mqueue[i], EXIT); - } - -#ifndef LOSCFG_DEBUG_QUEUE - snprintf(mqname[i], MQUEUE_STANDARD_NAME_LENGTH, "mq157_%d_%d", LosCurTaskIDGet(), i); - mqueue[i] = mq_open(mqname[i], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_EQUAL(mqueue[i], (mqd_t)-1, mqueue[i], EXIT); -#endif - - ret = mq_send(mqueue[(count - 1)], msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_receive(mqueue[(count - 1)], msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - for (i = 0; i < count; i++) { - ret = mq_close(mqueue[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - return MQUEUE_NO_ERROR; -EXIT: - for (i = 0; i < count; i++) { - mq_close(mqueue[i]); - mq_unlink(mqname[i]); - } - return MQUEUE_NO_ERROR; -} - - -VOID ItPosixQueue157(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_157", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_159.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_159.cpp deleted file mode 100644 index 033dc349..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_159.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i; - INT32 count = MQUEUE_MAX_NUM_TEST; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR mqname[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1][MQUEUE_STANDARD_NAME_LENGTH]; - mqd_t mqueue[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1]; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 20; - - for (i = 0; i < count; i++) { - snprintf(mqname[i], MQUEUE_STANDARD_NAME_LENGTH, "mq158_%d_%d", LosCurTaskIDGet(), i); - - mqueue[i] = mq_open(mqname[i], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue[i], (mqd_t)-1, mqueue[i], EXIT); - } - -#ifndef LOSCFG_DEBUG_QUEUE - snprintf(mqname[i], MQUEUE_STANDARD_NAME_LENGTH, "/mq158_%d", i); - mqueue[i] = mq_open(mqname[i], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_EQUAL(mqueue[i], (mqd_t)(-1), mqueue[i], EXIT); -#else - mqueue[i] = (mqd_t)(-1); -#endif - - ret = mq_send(mqueue[i], msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = mq_receive(mqueue[i], msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - for (i = 0; i < count; i++) { - ret = mq_close(mqueue[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - return MQUEUE_NO_ERROR; - -EXIT: - for (i = 0; i < count; i++) { - mq_close(mqueue[i]); - mq_unlink(mqname[i]); - } - return MQUEUE_NO_ERROR; -} - - - -VOID ItPosixQueue159(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_159", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_160.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_160.cpp deleted file mode 100644 index c451568b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_160.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 i, ret; - INT32 count = MQUEUE_MAX_NUM_TEST; - struct mq_attr attr = { 0 }; - - g_testCount = 0; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 5; // 5, queue max message size. - - for (i = 0; i < count; i++, g_testCount++) { - snprintf(g_mqueueName[i], MQUEUE_STANDARD_NAME_LENGTH, "/mq160_%d_%d", LosCurTaskIDGet(), i); - g_mqueueId[i] = mq_open(g_mqueueName[i], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_mqueueId[i], (mqd_t)-1, g_mqueueId[i], EXIT); - } - -#ifndef LOSCFG_DEBUG_QUEUE - snprintf(g_mqueueName[i], MQUEUE_STANDARD_NAME_LENGTH, "/mq160_%d_%d", LosCurTaskIDGet(), i); - g_mqueueId[i] = mq_open(g_mqueueName[i], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_EQUAL(g_mqueueId[i], (mqd_t)-1, g_mqueueId[i], EXIT); -#endif - - return NULL; -EXIT: - for (i = 0; i < g_testCount; i++) { - mq_close(g_mqueueId[i]); - mq_unlink(g_mqueueName[i]); - } - return NULL; -} - -static VOID *PthreadF02(VOID *arg) -{ - INT32 ret; - UINT32 i; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - - ts.tv_sec = 0xffff; - - for (i = 0; i < g_testCount; i++) { - ret = mq_timedsend(g_mqueueId[i % g_testCount], msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_timedreceive(g_mqueueId[i % g_testCount], msgrcd, MQUEUE_STANDARD_NAME_LENGTH, 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - } - return NULL; -EXIT: - for (i = 0; i < g_testCount; i++) { - mq_close(g_mqueueId[i]); - mq_unlink(g_mqueueName[i]); - } - return NULL; -} - -static VOID *PthreadF03(VOID *arg) -{ - INT32 ret, i; - - for (i = 0; i < g_testCount; i++) { - ret = mq_close(g_mqueueId[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(g_mqueueName[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - return NULL; -EXIT: - for (i = 0; i < g_testCount; i++) { - mq_close(g_mqueueId[i]); - mq_unlink(g_mqueueName[i]); - } - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - INT32 ret, i; - pthread_t pthread1, pthread2, pthread3; - pthread_attr_t attr1; - struct sched_param schedparam; - - g_testCount = 0; - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - schedparam.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attr1, &schedparam); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - for (i = 0; i < MQUEUE_STANDARD_NAME_LENGTH; i++) { - ret = pthread_create(&pthread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&pthread2, &attr1, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_join(pthread2, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&pthread3, &attr1, PthreadF03, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - - ret = pthread_join(pthread3, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT3); - } - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT3: - pthread_join(pthread3, NULL); -EXIT2: - pthread_join(pthread2, NULL); -EXIT1: - pthread_join(pthread1, NULL); -EXIT: - pthread_attr_destroy(&attr1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue160(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_160", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_161.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_161.cpp deleted file mode 100644 index ca6949a7..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_161.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 g_index = 0; - -static VOID *PthreadF01(VOID *arg) -{ - INT32 i, ret; - UINT32 uret = 0; - INT32 count = (INT32)arg; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 5; // 5, queue max message size. - - uret = g_index % count; - - snprintf(g_mqueueName[uret], MQUEUE_STANDARD_NAME_LENGTH, "/mqueue_161_%d_%d", LosCurTaskIDGet(), (uret)); - g_mqueueId[uret] = mq_open(g_mqueueName[uret], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_mqueueId[uret], (mqd_t)-1, g_mqueueId[uret], EXIT); - - return NULL; - -EXIT: - for (i = 0; i < count; i++) { - mq_close(g_mqueueId[i]); - mq_unlink(g_mqueueName[i]); - } - return NULL; -} - -static VOID *PthreadF02(VOID *arg) -{ - INT32 ret; - INT32 queueCount = MQUEUE_MAX_NUM_TEST; - UINT32 i, j, count; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct timespec ts = { 0 }; - - ts.tv_sec = 0xffff; - - for (i = 0; i < 10; i++) { // 10, The loop frequency. - count = g_index % queueCount; - - for (j = 0; j <= count; j++) { - ret = mq_timedsend(g_mqueueId[j], msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_timedreceive(g_mqueueId[j], msgrcd, MQUEUE_STANDARD_NAME_LENGTH, 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - } - } - return NULL; -EXIT: - for (i = 0; i < queueCount; i++) { - mq_close(g_mqueueId[i]); - mq_unlink(g_mqueueName[i]); - } - return NULL; -} - -static VOID *PthreadF03(VOID *arg) -{ - INT32 ret, i; - INT32 count = (INT32)arg; - - for (i = 0; i < count; i++) { - ret = mq_close(g_mqueueId[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(g_mqueueName[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - return NULL; -EXIT: - for (i = 0; i < count; i++) { - mq_close(g_mqueueId[i]); - mq_unlink(g_mqueueName[i]); - } - return NULL; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - INT32 count = MQUEUE_MAX_NUM_TEST; - pthread_t threadA; - pthread_attr_t attrA; - pthread_t threadB; - pthread_attr_t attrB; - pthread_t threadC; - pthread_attr_t attrC; - struct sched_param sp; - - ret = pthread_attr_init(&attrA); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - sp.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attrA, &sp); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_init(&attrB); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - sp.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attrB, &sp); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_init(&attrC); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - sp.sched_priority = MQUEUE_PTHREAD_PRIORITY_TEST2; - ret = pthread_attr_setschedparam(&attrC, &sp); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - for (g_index = 0; g_index < count; g_index++) { - ret = pthread_create(&threadA, &attrA, PthreadF01, (void *)count); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_join(threadA, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&threadB, &attrB, PthreadF02, (void *)count); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_join(threadB, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - if (g_index % count == (count - 1)) { - ret = pthread_create(&threadC, &attrC, PthreadF03, (void *)count); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_join(threadC, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - } - } - - ret = pthread_attr_destroy(&attrC); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_attr_destroy(&attrB); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attrA); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; - -EXIT2: - pthread_attr_destroy(&attrC); -EXIT1: - pthread_attr_destroy(&attrB); -EXIT: - pthread_attr_destroy(&attrA); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue161(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_161", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_162.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_162.cpp deleted file mode 100644 index 379cf12b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_162.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *arg) -{ - INT32 i, ret; - const CHAR *msgptr[] = { "send_111 1", "send_111 2", "send_111 3", "send_111 4", "send_111 5" }; - - for (i = 0; i < MQUEUE_PTHREAD_NUM_TEST; i++) { - ret = mq_send(g_gqueue, msgptr[i], strlen(msgptr[i]), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - LOS_AtomicInc(&g_testCount); - - pthread_exit((void *)0); - - return NULL; -EXIT: - pthread_exit((void *)0); - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *arg) -{ - INT32 i, ret; - INT32 pthreadCount = *(INT32 *)arg; - CHAR msgrcd[MQUEUE_PTHREAD_NUM_TEST][MQUEUE_PTHREAD_NUM_TEST][MQUEUE_STANDARD_NAME_LENGTH]; - - for (i = 0; i < MQUEUE_PTHREAD_NUM_TEST; i++) { - ret = mq_receive(g_gqueue, msgrcd[pthreadCount][i], MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - } - - LOS_AtomicInc(&g_testCount); - - pthread_exit((void *)0); - - return NULL; -EXIT: - g_testCount = 0; - pthread_exit((void *)0); - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 oflag, i, ret = 0; - INT32 pthreadCount[MQUEUE_PTHREAD_NUM_TEST]; - - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - pthread_t pthreadSend[MQUEUE_PTHREAD_NUM_TEST]; - pthread_t pthreadRecev[MQUEUE_PTHREAD_NUM_TEST]; - pthread_attr_t attr1; - struct mq_attr mqstat; - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - g_testCount = 0; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq162_%d", LosCurTaskIDGet()); - - memset(&mqstat, 0, sizeof(mqstat)); - mqstat.mq_maxmsg = MQUEUE_PTHREAD_NUM_TEST; - mqstat.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - mqstat.mq_flags = 0; - - oflag = O_CREAT | O_NONBLOCK | O_RDWR; - - g_gqueue = mq_open(mqname, oflag, S_IRWXU | S_IRWXG | S_IRWXO, &mqstat); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT1); - - for (i = 0; i < MQUEUE_PTHREAD_NUM_TEST; i++) { - pthreadCount[i] = i; - ret = pthread_create(&pthreadSend[i], &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&pthreadRecev[i], &attr1, PthreadF02, (void *)&pthreadCount[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - } - - for (i = 0; i < MQUEUE_PTHREAD_NUM_TEST; i++) { - ret = pthread_join(pthreadSend[i], NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_join(pthreadRecev[i], NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - } - ICUNIT_GOTO_EQUAL(g_testCount, MQUEUE_PTHREAD_NUM_TEST * 2, g_testCount, EXIT1); // 2, assert the g_testCount. - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_attr_destroy(&attr1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT2: - for (i = 0; i < MQUEUE_PTHREAD_NUM_TEST; i++) { - pthread_join(pthreadSend[i], NULL); - pthread_join(pthreadRecev[i], NULL); - } -EXIT1: - mq_close(g_gqueue); - mq_unlink(mqname); -EXIT: - pthread_attr_destroy(&attr1); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue162(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_162", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_163.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_163.cpp deleted file mode 100644 index d2113b18..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_163.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i; - INT32 count = MQUEUE_MAX_NUM_TEST; - CHAR mqname[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1][MQUEUE_STANDARD_NAME_LENGTH]; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1]; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - for (i = 0; i < (count); i++) { - snprintf(mqname[i], MQUEUE_STANDARD_NAME_LENGTH, "/mq163_%d_%d", LosCurTaskIDGet(), i); - mqueue[i] = mq_open(mqname[i], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue[i], (mqd_t)-1, mqueue[i], EXIT); - } - -#ifndef LOSCFG_DEBUG_QUEUE - snprintf(mqname[i], MQUEUE_STANDARD_NAME_LENGTH, "/mq163_%d_%d", LosCurTaskIDGet(), i); - mqueue[i] = mq_open(mqname[i], O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_EQUAL(mqueue[i], (mqd_t)-1, mqueue[i], EXIT1); - ICUNIT_GOTO_EQUAL(errno, ENFILE, errno, EXIT1); -#endif - - for (i = 0; i < (count); i++) { - ret = mq_send(mqueue[i], msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - for (i = 0; i < (count); i++) { - ret = mq_close(mqueue[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname[i]); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - } - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue[i]); - mq_unlink(mqname[i]); -EXIT: - for (i = 0; i < (count); i++) { - mq_close(mqueue[i]); - mq_unlink(mqname[i]); - } - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue163(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_163", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_164.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_164.cpp deleted file mode 100644 index 6c26ffc4..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_164.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i; - - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct mq_attr attr = { 0 }; - mqd_t mqueue; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 3; // 3, queue max message size. - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq164_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT1); - - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - } - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue164(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_164", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_165.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_165.cpp deleted file mode 100644 index a4408bfa..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_165.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret, i; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 3; // 3, queue max message size. - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq165_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - for (i = 0; i < 3; i++) { // 3, the loop frequency. - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - } - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue165(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_165", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_166.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_166.cpp deleted file mode 100644 index a5cbb49b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_166.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - - mqd_t msgQId; - struct mq_attr msgAttr = { 0 }; - CHAR qName[MQUEUE_STANDARD_NAME_LENGTH] = ""; - - CHAR *msgPtr1 = "1234567890"; - CHAR *msgPtr2 = "2345678901"; - CHAR *msgPtr3 = "3456789012"; - CHAR msgRcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - msgAttr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - msgAttr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - snprintf(qName, MQUEUE_STANDARD_NAME_LENGTH, "/mq166_%d", LosCurTaskIDGet()); - - msgQId = mq_open(qName, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &msgAttr); - ICUNIT_GOTO_NOT_EQUAL(msgQId, (mqd_t)-1, msgQId, EXIT); - - ret = mq_send(msgQId, msgPtr1, strlen(msgPtr1), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_send(msgQId, msgPtr2, strlen(msgPtr2), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_send(msgQId, msgPtr3, strlen(msgPtr3), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_receive(msgQId, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MSGLEN, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgRcd, msgPtr1, msgRcd, EXIT); - - ret = mq_receive(msgQId, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MSGLEN, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgRcd, msgPtr2, msgRcd, EXIT); - - ret = mq_receive(msgQId, msgRcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MSGLEN, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgRcd, msgPtr3, msgRcd, EXIT); - - ret = mq_close(msgQId); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(qName); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(msgQId); - mq_unlink(qName); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue166(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_166", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_168.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_168.cpp deleted file mode 100644 index 48f215f3..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_168.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" -#define FNONBLOCK O_NONBLOCK - -static UINT32 Testcase(VOID) -{ - UINT32 pri; - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq168_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - - mqueue = mq_open(mqname, FNONBLOCK | O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 6); // 6, Mqueue priority. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 10); // 10, Mqueue priority. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 2); // 2, Mqueue priority. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 8); // 8, Mqueue priority. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EAGAIN, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue168(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_168", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_169.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_169.cpp deleted file mode 100644 index d161ab4f..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_169.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - UINT32 pri; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - struct timespec ts; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq169_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 2); // 2, Mqueue priority. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedreceive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, ETIMEDOUT, errno, EXIT1); - - ret = strncmp(msgptr, msgrcd, strlen(msgptr)); - ICUNIT_GOTO_NOT_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue169(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_169", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_173.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_173.cpp deleted file mode 100644 index d87588d4..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_173.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - UINT32 rvprio; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd1[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd2[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr1 = "test message 1"; - const CHAR *msgptr2 = "test message 2"; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq173_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue); - - ret = mq_send(mqueue, msgptr1, strlen(msgptr1), MQUEUE_PRIORITY_TEST + 1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_send(mqueue, msgptr2, strlen(msgptr2), MQUEUE_PRIORITY_TEST + 2); // 2, Mqueue priority. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; - -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue173(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_173", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_175.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_175.cpp deleted file mode 100644 index 0fa63e43..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_175.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - struct mq_attr attr = { 0 }; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq175_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 6, &ts); // 6, Mqueue priority. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ts.tv_sec++; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 10, &ts); // 10, Mqueue priority. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ts.tv_sec++; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 2, &ts); // 2, Mqueue priority. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ts.tv_sec++; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 8, &ts); // 8, Mqueue priority. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ts.tv_sec++; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 1, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue175(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_175", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_176.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_176.cpp deleted file mode 100644 index fda61054..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_176.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - UINT32 pri; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq176_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 1, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ts.tv_sec++; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 1, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ts.tv_sec++; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), MQUEUE_PRIORITY_TEST + 2, &ts); // 2, Mqueue priority. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue176(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_176", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_177.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_177.cpp deleted file mode 100644 index 574c1bc1..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_177.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - UINT32 pri; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct timespec ts; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq177_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_SHORT_ARRAY_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), MQ_PRIO_MAX - 1, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - - ret = strncmp(msgptr, msgrcd, strlen(msgptr)); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - - -VOID ItPosixQueue177(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_177", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_187.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_187.cpp deleted file mode 100644 index 1a08094b..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_187.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq187_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_NONBLOCK, S_IRUSR | S_IWUSR, 0); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - mqueue = mq_open(mqname, O_CREAT | 0, S_IRUSR | S_IWUSR, 0); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue187(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_187", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_200.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_200.cpp deleted file mode 100644 index c521771d..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_200.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - struct timespec ts; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq200_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ts.tv_sec = 1; - ts.tv_nsec = 0; - errno = 0; - ret = mq_timedreceive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue200(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_200", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_201.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_201.cpp deleted file mode 100644 index 2ecd5038..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_201.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH + 1] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - pthread_t newTh; - struct mq_attr attr = { 0 }; - struct timespec ts = { 0 }; - mqd_t mqueue; - - attr.mq_msgsize = 20; // 20, queue message size. - attr.mq_maxmsg = 20; // 20, queue max message size. - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq201_%d", LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue); - - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - errno = 0; - ret = mq_timedsend(mqueue, msgptr, strlen(msgptr), 0, &ts); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue201(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_201", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_202.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_202.cpp deleted file mode 100644 index 71e24309..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_202.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = MQUEUE_NO_ERROR, i; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - struct timespec ts; - struct mq_attr attr = { 0 }; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq202_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - for (i = 0; i < MQUEUE_SHORT_ARRAY_LENGTH; i++) { - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - } - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue202(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_202", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_203.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_203.cpp deleted file mode 100644 index 09e36c39..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_203.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - CHAR msgrv1[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr = { 0 }; - INT32 ret = MQUEUE_NO_ERROR, i; - pthread_t pthread1, pthread2; - mqd_t mqueue1, mqueue2; - struct timespec ts; - - snprintf(mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq203_%d", LosCurTaskIDGet()); - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - mqueue1 = mq_open(mqname, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(mqueue1, (mqd_t)-1, mqueue1); - - mqueue2 = mq_open(mqname, O_RDWR | O_EXCL, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(mqueue2, (mqd_t)-1, mqueue2); - - ts.tv_sec = 1; - ts.tv_nsec = 1; - ret = mq_timedreceive(mqueue1, msgrv1, MQUEUE_STANDARD_NAME_LENGTH, NULL, &ts); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - -EXIT: - mq_close(mqueue1); - mq_close(mqueue2); - mq_unlink(mqname); - return LOS_OK; -} - -VOID ItPosixQueue203(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_203", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_204.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_204.cpp deleted file mode 100644 index 1f24ce2c..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_204.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -CHAR g_mqname[MQUEUE_STANDARD_NAME_LENGTH] = {0}; -struct mq_attr g_attr = { 0 }; -STATIC volatile UINT32 g_itSync = 0; -mqd_t g_mqueue1, g_mqueue2; - -static void *PthreadF01(void *arg) -{ - while (g_itSync != 1) { - } - - struct mqarray *ptrMqcb = (struct mqarray *)NULL; - g_mqueue1 = mq_open(g_mqname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR, &g_attr); - LosTaskDelay(2); // 2, Set delay time. - if (g_mqueue1 != -1) { - mq_close(g_mqueue1); - mq_unlink(g_mqname); - } - return nullptr; -} - -static void *PthreadF02(void *arg) -{ - g_itSync = 1; - - struct mqarray *ptrMqcb = (struct mqarray *)NULL; - g_mqueue2 = mq_open(g_mqname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR, &g_attr); - LosTaskDelay(2); // 2, Set delay time. - if (g_mqueue2 != -1) { - mq_close(g_mqueue2); - mq_unlink(g_mqname); - } - - ICUNIT_GOTO_EQUAL(((g_mqueue1 == -1) && (g_mqueue2 != -1)) || ((g_mqueue1 != -1) && (g_mqueue2 == -1)), TRUE, - g_mqueue1, EXIT); -EXIT: - return NULL; -} - -STATIC UINT32 Testcase(VOID) -{ - INT32 ret = MQUEUE_NO_ERROR, i; - pthread_t pthread1, pthread2; - pthread_attr_t attr1, attr2; - - snprintf(g_mqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq204_%d", LosCurTaskIDGet()); - g_attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - g_attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - - ret = pthread_attr_init(&attr1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ret = pthread_create(&pthread1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_attr_init(&attr2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ret = pthread_create(&pthread2, &attr2, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - LosTaskDelay(10); // 10, Set delay time. - -EXIT: - (VOID)pthread_join(pthread1, NULL); - (VOID)pthread_join(pthread2, NULL); - return LOS_OK; -} - -VOID ItPosixQueue204(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_204", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_205.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_205.cpp deleted file mode 100644 index aee98dce..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_205.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static mqd_t g_mqueue; -static CHAR g_mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; -static int g_signo; - -static void SigUsr1(int signo) -{ - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - int ret; - g_signo = signo; - - ret = mq_receive(g_mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, nullptr); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - return; -EXIT: - exit(255); // 255, Set a exit status. -} -static void Child(void) -{ - int ret; - struct sigevent sigev; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct mq_attr attr; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 1; - - (void)snprintf_s(g_mqname, MQUEUE_STANDARD_NAME_LENGTH - 1, MQUEUE_STANDARD_NAME_LENGTH, "/mq205_%d", getpid()); - - g_mqueue = mq_open(g_mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_mqueue, (mqd_t)-1, g_mqueue, EXIT); - - signal(SIGUSR1, SigUsr1); - - sigev.sigev_notify = SIGEV_SIGNAL; - sigev.sigev_signo = SIGUSR1; - - g_signo = 0; - - ret = mq_notify(g_mqueue, &sigev); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_send(g_mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - while (g_signo == 0) { - } - ICUNIT_GOTO_EQUAL(g_signo, SIGUSR1, g_signo, EXIT); - - mq_close(g_mqueue); - mq_unlink(g_mqname); - - exit(10); // 10, Set a exit status. - -EXIT: - mq_close(g_mqueue); - mq_unlink(g_mqname); - return; -} - -static UINT32 TestCase(VOID) -{ - int ret; - int status; - - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, Valid range value of pid. - - if (pid == 0) { - Child(); - exit(255); // 255, Set a exit status. - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 10, status); // 10, Here, assert the ret. - - return 0; -EXIT: - return 1; -} - -VOID ItPosixQueue205(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_205", TestCase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_206.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_206.cpp deleted file mode 100644 index 160d1437..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_206.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static int Child(VOID) -{ - int ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - int pid; - int status; - mqd_t mqueue; - struct sigevent notification; - - (void)snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH - 1, MQUEUE_STANDARD_NAME_LENGTH, "/mq206_%d", getpid()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, nullptr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT); - - notification.sigev_notify = 5; // 5, User-defined signal. - - ret = mq_notify(mqueue, ¬ification); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - notification.sigev_notify = SIGEV_THREAD; - - ret = mq_notify(mqueue, ¬ification); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOTSUP, errno, EXIT); - - notification.sigev_notify = SIGEV_NONE; - - ret = mq_notify(-1, ¬ification); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EBADF, errno, EXIT); - - ret = mq_notify(mqueue, ¬ification); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, Valid range value of pid. - - if (pid == 0) { - ret = mq_notify(mqueue, ¬ification); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EBUSY, errno); - - exit(8); // 8, Set a exit status. - } else { - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 8, status, EXIT); // 8, Here, assert the ret. - - ret = mq_notify(mqueue, nullptr); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, Valid range value of pid. - if (pid == 0) { - notification.sigev_notify = SIGEV_SIGNAL; - notification.sigev_signo = SIGUSR1; - - ret = mq_notify(mqueue, ¬ification); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(11); // 11, Set a exit status. - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 11, status, EXIT); // 11, Here, assert the ret. - - mq_close(mqueue); - mq_unlink(mqname); - } - exit(10); // 10, Set a exit status. - -EXIT: - mq_close(mqueue); - mq_unlink(mqname); - return MQUEUE_IS_ERROR; -} -static UINT32 Testcase(VOID) -{ - int ret; - int status; - - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, Valid range value of pid. - - if (pid == 0) { - Child(); - exit(255); // 255, Set a exit status. - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 10, status); // 10, Here, assert the ret. - - return 0; -EXIT: - return 1; -} - -VOID ItPosixQueue206(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_206", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_207.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_207.cpp deleted file mode 100644 index 64c59158..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_207.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static mqd_t g_mqueue; -static CHAR g_mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; -static int g_signo; - -static void SigUsr1(int signo) -{ - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - int ret; - - g_signo = 1; - - ret = mq_receive(g_mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, nullptr); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - return; -EXIT: - exit(255); // 255, Set a exit status. -} -static void Child(void) -{ - int ret; - struct sigevent sigev = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct mq_attr attr; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 1; - - (void)snprintf_s(g_mqname, MQUEUE_STANDARD_NAME_LENGTH - 1, MQUEUE_STANDARD_NAME_LENGTH, "/mq207_%d", getpid()); - - g_mqueue = mq_open(g_mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_mqueue, (mqd_t)-1, g_mqueue, EXIT); - - signal(SIGUSR1, SigUsr1); - - sigev.sigev_notify = SIGEV_NONE; - g_signo = 0; - - ret = mq_notify(g_mqueue, &sigev); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - ret = mq_send(g_mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - for (int i = 0; i < 5; i++) { // 5, The loop frequency. - sleep(1); - } - ICUNIT_GOTO_EQUAL(g_signo, 0, g_signo, EXIT); - - mq_close(g_mqueue); - mq_unlink(g_mqname); - - exit(10); // 10, Set a exit status. -EXIT: - mq_close(g_mqueue); - mq_unlink(g_mqname); - return; -} - -static UINT32 Testcase(VOID) -{ - int ret; - int status; - - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, Valid range value of pid. - - if (pid == 0) { - Child(); - exit(255); // 255, Set a exit status. - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 10, status); // 10, Here, assert the ret. - - return 0; -EXIT: - return 1; -} - -VOID ItPosixQueue207(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_207", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_208.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_208.cpp deleted file mode 100644 index 33282ed2..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_208.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static mqd_t g_mqueue; -static CHAR g_mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; -static int g_signo; - -static void SigUsr1(int signo) -{ - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - int ret; - g_signo = signo; - - ret = mq_receive(g_mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, nullptr); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - return; -EXIT: - exit(255); // 255, Set a exit status. -} -static void Child(void) -{ - int ret; - struct sigevent sigev; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 3; // 3, queue max message size. - - (void)snprintf_s(g_mqname, MQUEUE_STANDARD_NAME_LENGTH - 1, MQUEUE_STANDARD_NAME_LENGTH, "/mq208_%d", getpid()); - - g_mqueue = mq_open(g_mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_mqueue, (mqd_t)-1, g_mqueue, EXIT); - - signal(SIGUSR1, SigUsr1); - - sigev.sigev_notify = SIGEV_SIGNAL; - sigev.sigev_signo = SIGUSR1; - - g_signo = 0; - - ret = mq_send(g_mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - for (int i = 0; i < 5; i++) { // 5, The loop frequency. - sleep(1); - } - ICUNIT_GOTO_EQUAL(g_signo, 0, g_signo, EXIT); - - ret = mq_notify(g_mqueue, &sigev); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_send(g_mqueue, g_mqueueMsessage[1], MQUEUE_SHORT_ARRAY_LENGTH, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - for (int i = 0; i < 5; i++) { // 5, The loop frequency. - sleep(1); - } - ICUNIT_GOTO_EQUAL(g_signo, 0, g_signo, EXIT); - - ret = mq_receive(g_mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, nullptr); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - ret = mq_receive(g_mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, nullptr); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, g_mqueueMsessage[1], msgrcd, EXIT); - - ret = mq_send(g_mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - while (g_signo == 0) { - } - ICUNIT_GOTO_EQUAL(g_signo, SIGUSR1, g_signo, EXIT); - - ret = mq_notify(g_mqueue, &sigev); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - mq_close(g_mqueue); - mq_unlink(g_mqname); - exit(10); // 10, Set a exit status. - -EXIT: - mq_close(g_mqueue); - mq_unlink(g_mqname); - return; -} -static UINT32 Testcase(VOID) -{ - int ret; - int status; - - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, Valid range value of pid. - - if (pid == 0) { - Child(); - exit(255); // 255, Set a exit status. - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 10, status); // 10, Here, assert the ret. - - return 0; -EXIT: - return 1; -} - -VOID ItPosixQueue208(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_208", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_209.cpp b/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_209.cpp deleted file mode 100644 index 8bfe3909..00000000 --- a/testsuites/unittest_old/posix/mqueue/full/It_posix_queue_209.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static mqd_t g_mqueue; -static CHAR g_mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; -static int g_signo; -static int g_cnt; - -static VOID *Pthread(VOID *temp) -{ - INT32 ret; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - g_cnt = 1; - - (void *)(temp); - ret = mq_receive(g_mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, nullptr); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - return nullptr; -EXIT: - g_cnt = 0; - return nullptr; -} - -static void SigUsr1(int signo) -{ - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - int ret; - g_signo = signo; - - ret = mq_receive(g_mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, nullptr); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, g_mqueueMsessage[1], msgrcd, EXIT); - - return; -EXIT: - exit(255); // 255, Set a exit status. -} -static void Child(void) -{ - int ret; - struct sigevent sigev = {0}; - pthread_t pthread1; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - struct mq_attr attr = {0}; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 3; // 3, queue max message size. - - (void)snprintf_s(g_mqname, MQUEUE_STANDARD_NAME_LENGTH - 1, MQUEUE_STANDARD_NAME_LENGTH, "/mq209_%d", getpid()); - - g_mqueue = mq_open(g_mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_mqueue, (mqd_t)-1, g_mqueue, EXIT); - - signal(SIGUSR1, SigUsr1); - - sigev.sigev_notify = SIGEV_SIGNAL; - sigev.sigev_signo = SIGUSR1; - - g_signo = 0; - g_cnt = 0; - - ret = pthread_create(&pthread1, nullptr, Pthread, nullptr); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - for (int i = 0; i < 3; i++) { // 3, The loop frequency. - sleep(1); - } - ICUNIT_GOTO_EQUAL(g_cnt, 1, g_cnt, EXIT); - ret = mq_notify(g_mqueue, &sigev); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_send(g_mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = pthread_join(pthread1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_cnt, 1, g_cnt, EXIT); - ICUNIT_GOTO_EQUAL(g_signo, 0, g_signo, EXIT); - - ret = mq_send(g_mqueue, g_mqueueMsessage[1], MQUEUE_SHORT_ARRAY_LENGTH, 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - while (g_signo == 0) { - } - ICUNIT_GOTO_EQUAL(g_signo, SIGUSR1, g_signo, EXIT); - - mq_close(g_mqueue); - mq_unlink(g_mqname); - exit(10); // 10, Set a exit status. - -EXIT: - mq_close(g_mqueue); - mq_unlink(g_mqname); - return; -} -static UINT32 Testcase(VOID) -{ - int ret; - int status; - - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, Valid range value of pid. - - if (pid == 0) { - Child(); - exit(255); // 255, Set a exit status. - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 10, status); // 10, Here, assert the ret. - - return 0; -EXIT: - return 1; -} - -VOID ItPosixQueue209(VOID) -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_209", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/posix_mqueue_test.cpp b/testsuites/unittest_old/posix/mqueue/posix_mqueue_test.cpp deleted file mode 100644 index 0297556e..00000000 --- a/testsuites/unittest_old/posix/mqueue/posix_mqueue_test.cpp +++ /dev/null @@ -1,1416 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - - -#include "It_posix_queue.h" -CHAR *g_mqueueMsessage[MQUEUE_SHORT_ARRAY_LENGTH] = {"0123456789", "1234567890", "2345678901", "3456789012", "4567890123", "5678901234", "6789012345", "7890123456", "lalalalala", "hahahahaha"}; -CHAR g_gqname[MQUEUE_STANDARD_NAME_LENGTH]; -CHAR g_mqueueName[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1][MQUEUE_STANDARD_NAME_LENGTH]; -mqd_t g_mqueueId[LOSCFG_BASE_IPC_QUEUE_CONFIG + 1]; -SEM_HANDLE_T g_mqueueSem; -mqd_t g_messageQId; -mqd_t g_gqueue; - -int LOS_HwiCreate(int hwiNum, int hwiPrio, int hwiMode, HWI_PROC_FUNC hwiHandler, int *irqParam) -{ - return 0; -} - -int LosSemCreate(int num, const SEM_HANDLE_T *hdl) -{ - return 0; -} - -int LosSemDelete(SEM_HANDLE_T num) -{ - return 0; -} - -int SemPost(SEM_HANDLE_T num) -{ - return 0; -} - -int LosSemPost(SEM_HANDLE_T num) -{ - return 0; -} - -int HalIrqMask(int num) -{ - return 0; -} - -int SemPend(SEM_HANDLE_T hdl, int num) -{ - return 0; -} - -int LosSemPend(SEM_HANDLE_T hdl, int num) -{ - return 0; -} - -UINT32 QueueCountGetTest(VOID) -{ - return 0; -} - -void TEST_HwiTrigger(unsigned int irq) -{ - return; -} - -UINT64 JiffiesToTick(unsigned long j) -{ - return 0; -} - -unsigned long MsecsToJiffies(const unsigned int m) -{ - return 0; -} - -using namespace testing::ext; -namespace OHOS { -class PosixMqueueTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: IT_POSIX_QUEUE_001 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue001, TestSize.Level0) -{ - ItPosixQueue001(); -} - -/* * - * @tc.name: IT_POSIX_QUEUE_003 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue003, TestSize.Level0) -{ - ItPosixQueue003(); -} - -/* * - * @tc.name: IT_POSIX_QUEUE_053 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue053, TestSize.Level0) -{ - ItPosixQueue053(); -} - -/* * - * @tc.name: IT_POSIX_QUEUE_028 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue028, TestSize.Level0) -{ - ItPosixQueue028(); -} - -/* * - * @tc.name: IT_POSIX_QUEUE_062 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue062, TestSize.Level0) -{ - ItPosixQueue062(); -} - -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -/** - * @tc.name: IT_POSIX_QUEUE_002 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue002, TestSize.Level0) -{ - ItPosixQueue002(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_005 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue005, TestSize.Level0) -{ - ItPosixQueue005(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_008 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue008, TestSize.Level0) -{ - ItPosixQueue008(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_011 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue011, TestSize.Level0) -{ - ItPosixQueue011(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_013 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue013, TestSize.Level0) -{ - ItPosixQueue013(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_014 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue014, TestSize.Level0) -{ - ItPosixQueue014(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_015 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue015, TestSize.Level0) -{ - ItPosixQueue015(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_016 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue016, TestSize.Level0) -{ - ItPosixQueue016(); -} - -#ifndef LOSCFG_KERNEL_SMP -/** - * @tc.name: IT_POSIX_QUEUE_113 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue113, TestSize.Level0) -{ - ItPosixQueue113(); -} -#endif -/** - * @tc.name: IT_POSIX_QUEUE_018 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue018, TestSize.Level0) -{ - ItPosixQueue018(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_019 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue019, TestSize.Level0) -{ - ItPosixQueue019(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_020 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue020, TestSize.Level0) -{ - ItPosixQueue020(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_021 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue021, TestSize.Level0) -{ - ItPosixQueue021(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_025 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue025, TestSize.Level0) -{ - ItPosixQueue025(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_026 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue026, TestSize.Level0) -{ - ItPosixQueue026(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_027 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue027, TestSize.Level0) -{ - ItPosixQueue027(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_030 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue030, TestSize.Level0) -{ - ItPosixQueue030(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_031 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue031, TestSize.Level0) -{ - ItPosixQueue031(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_032 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue032, TestSize.Level0) -{ - ItPosixQueue032(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_033 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue033, TestSize.Level0) -{ - ItPosixQueue033(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_036 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue036, TestSize.Level0) -{ - ItPosixQueue036(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_038 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue038, TestSize.Level0) -{ - ItPosixQueue038(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_040 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue040, TestSize.Level0) -{ - ItPosixQueue040(); -} - -#ifndef LOSCFG_USER_TEST_SMP -/** - * @tc.name: IT_POSIX_QUEUE_041 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue041, TestSize.Level0) -{ - ItPosixQueue041(); -} -#endif - -/** - * @tc.name: IT_POSIX_QUEUE_042 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue042, TestSize.Level0) -{ - ItPosixQueue042(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_044 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue044, TestSize.Level0) -{ - ItPosixQueue044(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_046 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue046, TestSize.Level0) -{ - ItPosixQueue046(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_047 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue047, TestSize.Level0) -{ - ItPosixQueue047(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_048 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue048, TestSize.Level0) -{ - ItPosixQueue048(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_049 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue049, TestSize.Level0) -{ - ItPosixQueue049(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_050 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue050, TestSize.Level0) -{ - ItPosixQueue050(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_052 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue052, TestSize.Level0) -{ - ItPosixQueue052(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_054 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue054, TestSize.Level0) -{ - ItPosixQueue054(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_055 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue055, TestSize.Level0) -{ - ItPosixQueue055(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_056 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue056, TestSize.Level0) -{ - ItPosixQueue056(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_057 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue057, TestSize.Level0) -{ - ItPosixQueue057(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_058 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue058, TestSize.Level0) -{ - ItPosixQueue058(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_060 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue060, TestSize.Level0) -{ - ItPosixQueue060(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_061 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue061, TestSize.Level0) -{ - ItPosixQueue061(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_063 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue063, TestSize.Level0) -{ - ItPosixQueue063(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_064 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue064, TestSize.Level0) -{ - ItPosixQueue064(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_065 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue065, TestSize.Level0) -{ - ItPosixQueue065(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_066 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue066, TestSize.Level0) -{ - ItPosixQueue066(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_067 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue067, TestSize.Level0) -{ - ItPosixQueue067(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_069 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue069, TestSize.Level0) -{ - ItPosixQueue069(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_070 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue070, TestSize.Level0) -{ - ItPosixQueue070(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_071 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue071, TestSize.Level0) -{ - ItPosixQueue071(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_072 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue072, TestSize.Level0) -{ - ItPosixQueue072(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_073 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue073, TestSize.Level0) -{ - ItPosixQueue073(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_074 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue074, TestSize.Level0) -{ - ItPosixQueue074(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_075 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue075, TestSize.Level0) -{ - ItPosixQueue075(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_080 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue080, TestSize.Level0) -{ - ItPosixQueue080(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_081 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue081, TestSize.Level0) -{ - ItPosixQueue081(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_082 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue082, TestSize.Level0) -{ - ItPosixQueue082(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_083 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue083, TestSize.Level0) -{ - ItPosixQueue083(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_084 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue084, TestSize.Level0) -{ - ItPosixQueue084(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_085 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue085, TestSize.Level0) -{ - ItPosixQueue085(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_086 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue086, TestSize.Level0) -{ - ItPosixQueue086(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_087 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue087, TestSize.Level0) -{ - ItPosixQueue087(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_088 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue088, TestSize.Level0) -{ - ItPosixQueue088(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_089 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue089, TestSize.Level0) -{ - ItPosixQueue089(); -} - - -#ifndef TEST3559A_M7 -/** - * @tc.name: IT_POSIX_QUEUE_090 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue090, TestSize.Level0) -{ - ItPosixQueue090(); -} - -#endif -/** - * @tc.name: IT_POSIX_QUEUE_091 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue091, TestSize.Level0) -{ - ItPosixQueue091(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_093 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue093, TestSize.Level0) -{ - ItPosixQueue093(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_094 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue094, TestSize.Level0) -{ - ItPosixQueue094(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_095 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue095, TestSize.Level0) -{ - ItPosixQueue095(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_096 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue096, TestSize.Level0) -{ - ItPosixQueue096(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_097 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue097, TestSize.Level0) -{ - ItPosixQueue097(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_098 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue098, TestSize.Level0) -{ - ItPosixQueue098(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_100 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue100, TestSize.Level0) -{ - ItPosixQueue100(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_101 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue101, TestSize.Level0) -{ - ItPosixQueue101(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_102 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue102, TestSize.Level0) -{ - ItPosixQueue102(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_103 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue103, TestSize.Level0) -{ - ItPosixQueue103(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_104 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue104, TestSize.Level0) -{ - ItPosixQueue104(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_106 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue106, TestSize.Level0) -{ - ItPosixQueue106(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_108 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue108, TestSize.Level0) -{ - ItPosixQueue108(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_109 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue109, TestSize.Level0) -{ - ItPosixQueue109(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_110 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue110, TestSize.Level0) -{ - ItPosixQueue110(); -} - - -/** - * @tc.name: IT_POSIX_QUEUE_127 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue127, TestSize.Level0) -{ - ItPosixQueue127(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_128 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue128, TestSize.Level0) -{ - ItPosixQueue128(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_129 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue129, TestSize.Level0) -{ - ItPosixQueue129(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_130 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue130, TestSize.Level0) -{ - ItPosixQueue130(); -} - -/* * - * @tc.name: IT_POSIX_QUEUE_144 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue144, TestSize.Level0) -{ - ItPosixQueue144(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_147 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue147, TestSize.Level0) -{ - ItPosixQueue147(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_148 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue148, TestSize.Level0) -{ - ItPosixQueue148(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_149 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue149, TestSize.Level0) -{ - ItPosixQueue149(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_150 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue150, TestSize.Level0) -{ - ItPosixQueue150(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_151 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue151, TestSize.Level0) -{ - ItPosixQueue151(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_152 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue152, TestSize.Level0) -{ - ItPosixQueue152(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_153 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue153, TestSize.Level0) -{ - ItPosixQueue153(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_154 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue154, TestSize.Level0) -{ - ItPosixQueue154(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_155 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue155, TestSize.Level0) -{ - ItPosixQueue155(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_156 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue156, TestSize.Level0) -{ - ItPosixQueue156(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_164 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue164, TestSize.Level0) -{ - ItPosixQueue164(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_165 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue165, TestSize.Level0) -{ - ItPosixQueue165(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_166 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue166, TestSize.Level0) -{ - ItPosixQueue166(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_168 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue168, TestSize.Level0) -{ - ItPosixQueue168(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_169 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue169, TestSize.Level0) -{ - ItPosixQueue169(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_173 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue173, TestSize.Level0) -{ - ItPosixQueue173(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_175 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue175, TestSize.Level0) -{ - ItPosixQueue175(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_176 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue176, TestSize.Level0) -{ - ItPosixQueue176(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_187 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue187, TestSize.Level0) -{ - ItPosixQueue187(); -} - - -/** - * @tc.name: IT_POSIX_QUEUE_200 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue200, TestSize.Level0) -{ - ItPosixQueue200(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_201 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue201, TestSize.Level0) -{ - ItPosixQueue201(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_202 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue202, TestSize.Level0) -{ - ItPosixQueue202(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_203 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue203, TestSize.Level0) -{ - ItPosixQueue203(); -} - -#if (LOSCFG_USER_TEST_SMP == 1) -/** - * @tc.name: IT_POSIX_QUEUE_204 - * @tc.desc: function for PosixMqueueTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue204, TestSize.Level0) -{ - ItPosixQueue204(); -} - -#endif - -/** - * @tc.name: IT_POSIX_QUEUE_205 - * @tc.desc: function for mq_notify:Set sigev_notify to SIGEV_NONE - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue205, TestSize.Level0) -{ - ItPosixQueue205(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_206 - * @tc.desc: function for mq_notify:The function returns a failure and the error code is verified. - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue206, TestSize.Level0) -{ - ItPosixQueue206(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_207 - * @tc.desc: function for mq_notify:Set sigev_notify to SIGEV_NONE - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue207, TestSize.Level0) -{ - ItPosixQueue207(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_208 - * @tc.desc: function for mq_notify:The message queue is not empty. - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixMqueueTest, ItPosixQueue208, TestSize.Level0) -{ - ItPosixQueue208(); -} - -/** - * @tc.name: IT_POSIX_QUEUE_209 - * @tc.desc: function for mq_notify:The message queue has waiters. - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - **/ -HWTEST_F(PosixMqueueTest, ItPosixQueue209, TestSize.Level0) -{ - ItPosixQueue209(); -} - -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_001.cpp b/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_001.cpp deleted file mode 100644 index aea27701..00000000 --- a/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_001.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - struct mq_attr attr = { 0 }; - mqd_t mqueue; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 0; - - (void)snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH - 1, MQUEUE_STANDARD_NAME_LENGTH, "/mq001_%d", - LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue001(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_001", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_003.cpp b/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_003.cpp deleted file mode 100644 index ec612d75..00000000 --- a/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_003.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgrcd[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - mqd_t mqueue; - struct mq_attr attr = { 0 }; - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = 1; - - (void)snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH - 1, MQUEUE_STANDARD_NAME_LENGTH, "/mq003_%d", - LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT); - - ret = mq_send(mqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_receive(mqueue, msgrcd, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - ICUNIT_GOTO_STRING_EQUAL(msgrcd, MQUEUE_SEND_STRING_TEST, msgrcd, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT: - mq_close(mqueue); - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue003(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_003", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_028.cpp b/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_028.cpp deleted file mode 100644 index ba554fed..00000000 --- a/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_028.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - CHAR msgrcd[20] = {0}; - struct mq_attr attr = { 0 }; - struct timespec absTimeout = { 0 }; - mqd_t mqueue; - - (void)snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH - 1, MQUEUE_STANDARD_NAME_LENGTH, "/mq028_%d", - LosCurTaskIDGet()); - - attr.mq_msgsize = 20; // 20, queue message size. - attr.mq_maxmsg = 20; // 20, queue max message size. - - mqueue = mq_open(mqname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR, &attr); - ICUNIT_ASSERT_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue); - - ret = mq_timedsend(mqueue, "1234567890123456789", 20, 0, &absTimeout); // 20, mqueue message length. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_receive(mqueue, msgrcd, 20, NULL); // 20, mqueue message length. - ICUNIT_GOTO_EQUAL(ret, 20, ret, EXIT1); // 20, Here, assert the ret. - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - mqueue = mq_open(mqname, O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - ret = mq_receive(mqueue, msgrcd, 20, NULL); // 20, mqueue message length. - ICUNIT_GOTO_EQUAL(ret, MQUEUE_IS_ERROR, ret, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue028(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_028", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_053.cpp b/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_053.cpp deleted file mode 100644 index 01dd6aa2..00000000 --- a/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_053.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static VOID *PthreadF01(VOID *argument) -{ - INT32 ret; - const CHAR *msgptr = MQUEUE_SEND_STRING_TEST; - - g_testCount = 1; - - TestAssertWaitDelay(&g_testCount, 3); // 3, Here, assert the g_testCount. - - ret = mq_send(g_gqueue, msgptr, strlen(msgptr), 0); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - g_testCount = 2; // 2, Init test count value. - - return NULL; -EXIT: - mq_close(g_gqueue); - mq_unlink(g_gqname); - g_testCount = 0; - return NULL; -} - -static VOID *PthreadF02(VOID *argument) -{ - INT32 ret = 0; - CHAR msgrv[MQUEUE_STANDARD_NAME_LENGTH] = {0}; - - g_testCount = 3; // 3, Init test count value. - - ret = mq_receive(g_gqueue, msgrv, MQUEUE_STANDARD_NAME_LENGTH, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_SHORT_ARRAY_LENGTH, ret, EXIT); - - ret = LosTaskDelay(1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_close(g_gqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - ret = mq_unlink(g_gqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - g_testCount = 4; // 4, Init test count value. - return NULL; -EXIT: - mq_close(g_gqueue); - mq_unlink(g_gqname); - g_testCount = 0; - return NULL; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - struct mq_attr attr = { 0 }; - pthread_attr_t attr1; - pthread_t newTh1, newTh2; - - snprintf(g_gqname, MQUEUE_STANDARD_NAME_LENGTH, "/mq053_%d", LosCurTaskIDGet()); - - attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH; - attr.mq_maxmsg = MQUEUE_STANDARD_NAME_LENGTH; - g_gqueue = mq_open(g_gqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr); - ICUNIT_GOTO_NOT_EQUAL(g_gqueue, (mqd_t)-1, g_gqueue, EXIT); - - g_testCount = 0; - - ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = pthread_create(&newTh1, &attr1, PthreadF01, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - TestAssertWaitDelay(&g_testCount, 1); - - ret = PosixPthreadInit(&attr1, MQUEUE_PTHREAD_PRIORITY_TEST2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = pthread_create(&newTh2, &attr1, PthreadF02, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - -#ifdef TEST3559A_M7 - ret = LosTaskDelay(50); // 50, Set delay time. -#else - ret = LosTaskDelay(10); // 10, Set delay time. -#endif - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - TestAssertWaitDelay(&g_testCount, 4); // 4, Here, assert the g_testCount. - - ret = PosixPthreadDestroy(&attr1, newTh2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT2); - - ret = PosixPthreadDestroy(&attr1, newTh1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - return MQUEUE_NO_ERROR; -EXIT2: - PosixPthreadDestroy(&attr1, newTh2); -EXIT1: - PosixPthreadDestroy(&attr1, newTh1); -EXIT: - mq_close(g_gqueue); - mq_unlink(g_gqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue053(VOID) -{ - TEST_ADD_CASE("ItPosixQueue053", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_062.cpp b/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_062.cpp deleted file mode 100644 index d1ecd7b2..00000000 --- a/testsuites/unittest_old/posix/mqueue/smoke/It_posix_queue_062.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "It_posix_queue.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = ""; - mqd_t mqueue; - struct mq_attr mqstat1 = { 0 }; - struct mq_attr mqstat2 = { 0 }; - - (void)snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH - 1, MQUEUE_STANDARD_NAME_LENGTH, "/mq062_%d", - LosCurTaskIDGet()); - - mqueue = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, NULL); - ICUNIT_GOTO_NOT_EQUAL(mqueue, (mqd_t)-1, mqueue, EXIT1); - - (void)memset_s(&mqstat1, sizeof(mqstat1), 0, sizeof(mqstat1)); - (void)memset_s(&mqstat2, sizeof(mqstat2), 0, sizeof(mqstat2)); - - ret = mq_getattr(mqueue, &mqstat1); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - mqstat1.mq_flags |= O_NONBLOCK; - ret = mq_setattr(mqueue, &mqstat1, NULL); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_getattr(mqueue, &mqstat2); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - ICUNIT_GOTO_EQUAL(mqstat2.mq_flags, mqstat1.mq_flags, mqstat2.mq_flags, EXIT1); - ICUNIT_GOTO_EQUAL(mqstat2.mq_curmsgs, 0, mqstat2.mq_curmsgs, EXIT1); - ICUNIT_GOTO_EQUAL(mqstat2.mq_flags, O_CREAT | O_RDWR | O_NONBLOCK, mqstat2.mq_flags, EXIT1); - ICUNIT_GOTO_EQUAL(mqstat2.mq_maxmsg, mqstat1.mq_maxmsg, mqstat2.mq_maxmsg, EXIT1); - ICUNIT_GOTO_EQUAL(mqstat2.mq_msgsize, mqstat1.mq_msgsize, mqstat2.mq_msgsize, EXIT1); - - ret = mq_close(mqueue); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT1); - - ret = mq_unlink(mqname); - ICUNIT_GOTO_EQUAL(ret, MQUEUE_NO_ERROR, ret, EXIT); - - return MQUEUE_NO_ERROR; -EXIT1: - mq_close(mqueue); -EXIT: - mq_unlink(mqname); - return MQUEUE_NO_ERROR; -} - -VOID ItPosixQueue062(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_QUEUE_062", Testcase, TEST_POSIX, TEST_QUE, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/BUILD.gn b/testsuites/unittest_old/posix/pthread/BUILD.gn deleted file mode 100644 index ea47e4c5..00000000 --- a/testsuites/unittest_old/posix/pthread/BUILD.gn +++ /dev/null @@ -1,195 +0,0 @@ -# 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 -} - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "posix_pthread_test.cpp", -] - -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", -] - -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_203.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", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_posix_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" ] - configs += [ ":pthread_config" ] - } -} - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_posix_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" ] - configs += [ ":pthread_config" ] - } -} diff --git a/testsuites/unittest_old/posix/pthread/It_posix_pthread.h b/testsuites/unittest_old/posix/pthread/It_posix_pthread.h deleted file mode 100644 index e38f09e8..00000000 --- a/testsuites/unittest_old/posix/pthread/It_posix_pthread.h +++ /dev/null @@ -1,446 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_POSIX_PTHREAD_H -#define _IT_POSIX_PTHREAD_H - -#include "sched.h" -#include "signal.h" -#include "semaphore.h" -#include "sched.h" -#include "osTest.h" -#include "pthread.h" -#include "limits.h" -#include "unistd.h" -#include "mqueue.h" -#include "signal.h" -#include "sys/time.h" - -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/* Some routines are part of the XSI Extensions */ - -#define LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE (0x6000) -#define LOS_HwiCreate(ID, prio, mode, Func, arg) (-1) -#define HalIrqMask(ID) -#define TEST_TEST_HwiDelete(ID, NULL) -#define TEST_HwiTrigger(HWI_NUM_TEST) -#define LOS_TaskLock() -#define LOS_TaskUnlock() -#define LOS_MS2Tick(ms) (ms / 10) -#define OS_TASK_PRIORITY_HIGHEST 0 -#define OS_TASK_PRIORITY_LOWEST 31 - -#define PTHREAD_NO_ERROR 0 -#define PTHREAD_IS_ERROR (-1) -#define PTHREAD_SIGNAL_SUPPORT 0 /* 0 means that not support the signal */ -#define PTHREAD_PRIORITY_TEST 20 -#define PTHREAD_DEFAULT_STACK_SIZE (LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE) -#define PTHREAD_KEY_NUM 10 -#define THREAD_NUM 3 -#define PTHREAD_TIMEOUT (THREAD_NUM * 2) -#define PTHREAD_INTHREAD_TEST 0 /* Control going to or is already for Thread */ -#define PTHREAD_INMAIN_TEST 1 /* Control going to or is already for Main */ -#define INVALID_PSHARED_VALUE (-100) -#define NUM_OF_CONDATTR 10 -#define RUNTIME 5 -#define PTHREAD_THREADS_NUM 3 -#define TCOUNT 5 // Number of single-threaded polling -#define COUNT_LIMIT 7 // The number of times the signal is sent -#define HIGH_PRIORITY 5 -#define LOW_PRIORITY 10 -#define PTHREAD_EXIT_VALUE ((void *)100) /* The return code of the thread when using pthread_exit(). */ - -#define PTHREAD_EXISTED_NUM TASK_EXISTED_NUM -#define PTHREAD_EXISTED_SEM_NUM SEM_EXISTED_NUM - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -#define uart_printf_func printf - -/* The value below shall be >= to the # of CPU on the test architecture */ -#define NCPU (4) - -#define PRIORITY_OTHER (-1) -#define PRIORITY_FIFO 20 -#define PRIORITY_RR 20 - -#define PTHREAD_TEST_BUG printf - -#define CASE(det, expl, scp, spa, sco, sta, gua, ssi, desc, res) \ - { \ - { 0 }, det, expl, scp, spa, sco, sta, gua, ssi, desc, NULL, res, \ - { \ - 0 \ - } \ - } -#define CASE_POS(det, expl, scp, spa, sco, sta, gua, ssi, desc) CASE(det, expl, scp, spa, sco, sta, gua, ssi, desc, 0) -#define CASE_NEG(det, expl, scp, spa, sco, sta, gua, ssi, desc) CASE(det, expl, scp, spa, sco, sta, gua, ssi, desc, 1) -#define CASE_UNK(det, expl, scp, spa, sco, sta, gua, ssi, desc) CASE(det, expl, scp, spa, sco, sta, gua, ssi, desc, 2) - -struct params { - INT32 policy; - INT32 priority; - char *policy_label; - INT32 status; -}; - -typedef struct { - /* - * Object to hold the given configuration, - * and which will be used to create the threads - */ - pthread_attr_t ta; - - /* General parameters */ - /* 0 => joinable; 1 => detached */ - INT32 detached; - - /* Scheduling parameters */ - /* - * 0 => sched policy is inherited; - * 1 => sched policy from the attr param - */ - INT32 explicitsched; - /* 0 => default; 1=> SCHED_FIFO; 2=> SCHED_RR */ - INT32 schedpolicy; - /* - * 0 => default sched param; - * 1 => max value for sched param; - * -1 => min value for sched param - */ - INT32 schedparam; - /* - * 0 => default contension scope; - * 1 => alternative contension scope - */ - INT32 altscope; - - /* Stack parameters */ - /* 0 => system manages the stack; 1 => stack is provided */ - INT32 altstack; - /* - * 0 => default guardsize; - * 1=> guardsize is 0; - * 2=> guard is 1 page - * -- this setting only affect system stacks (not user's). - */ - INT32 guard; - /* - * 0 => default stack size; - * 1 => stack size specified (min value) - * -- ignored when stack is provided - */ - INT32 altsize; - - /* Additionnal information */ - /* object description */ - char *descr; - /* Stores the stack start when an alternate stack is required */ - void *bottom; - /* - * This thread creation is expected to: - * 0 => succeed; 1 => fail; 2 => unknown - */ - INT32 result; - /* - * This semaphore is used to signal the end of - * the detached threads execution - */ - sem_t sem; -} __scenario; - -#define NSCENAR 10 // (sizeof(scenarii)/sizeof(scenarii[0])) - -extern __scenario g_scenarii[]; - -extern pthread_key_t g_key; -extern pthread_key_t g_key1; -extern pthread_key_t g_key2; -extern pthread_key_t g_pthreadKeyTest[PTHREAD_KEY_NUM]; -extern pthread_t g_newTh; -extern pthread_t g_newTh2; -extern UINT32 g_taskMaxNum; -extern pthread_once_t g_onceControl; -extern pthread_cond_t g_pthreadCondTest1; -extern pthread_mutex_t g_pthreadMutexTest1; -extern pthread_mutex_t g_pthreadMutexTest2; -extern INT32 g_startNum; -extern INT32 g_wakenNum; -extern INT32 g_t1Start; -extern INT32 g_signaled; -extern INT32 g_wokenUp; -extern INT32 g_lowDone; -extern INT32 g_pthreadSem; -extern INT32 g_pthreadScopeValue; -extern INT32 g_pthreadSchedInherit; -extern INT32 g_pthreadSchedPolicy; - -extern sem_t g_pthreadSem1; -extern sem_t g_pthreadSem2; - -extern pthread_t g_pthreadTestTh; - -extern INT32 g_iCunitErrCode; -extern INT32 g_iCunitErrLineNo; - -#ifdef LOSCFG_AARCH64 -#define PTHREAD_STACK_MIN_TEST (PTHREAD_STACK_MIN * 3) -#else -#define PTHREAD_STACK_MIN_TEST PTHREAD_STACK_MIN -#endif - -extern pthread_t g_Test_new_th; - -struct testdata { - pthread_mutex_t mutex; - pthread_cond_t cond; -}; -extern struct testdata g_td; - - -extern unsigned int sleep(unsigned int seconds); -extern unsigned int alarm(unsigned int seconds); - -extern int map_errno(UINT32 err); -extern long sysconf(int name); -extern void posix_signal_start(void); - -VOID ScenarInit(VOID); -VOID ScenarFini(VOID); -pthread_t TestPthreadSelf(void); - -extern UINT32 PosixPthreadInit(pthread_attr_t *attr, INT32 pri); - -#if defined(LOSCFG_USER_TEST_SMOKE) -VOID ItPosixPthread003(VOID); -VOID ItPosixPthread004(VOID); -VOID ItPosixPthread005(VOID); -VOID ItPosixPthread006(VOID); -VOID IT_POSIX_PTHREAD_009(VOID); -VOID ItPosixPthread018(VOID); -VOID ItPosixPthread019(VOID); -VOID ItPosixPthread020(VOID); -VOID ItPosixPthread021(VOID); -VOID ItPosixPthread022(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -VOID ItPosixPthread001(VOID); -VOID ItPosixPthread002(VOID); -VOID ItPosixPthread007(VOID); -VOID IT_POSIX_PTHREAD_008(VOID); -VOID ItPosixPthread010(VOID); -VOID ItPosixPthread011(VOID); -VOID ItPosixPthread013(VOID); -VOID ItPosixPthread023(VOID); -VOID ItPosixPthread025(VOID); -VOID ItPosixPthread026(VOID); -VOID ItPosixPthread027(VOID); -VOID ItPosixPthread028(VOID); -VOID ItPosixPthread029(VOID); -VOID ItPosixPthread030(VOID); -VOID ItPosixPthread031(VOID); -VOID IT_POSIX_PTHREAD_032(VOID); -VOID IT_POSIX_PTHREAD_033(VOID); -VOID ItPosixPthread034(VOID); -VOID ItPosixPthread035(VOID); -VOID ItPosixPthread039(VOID); -VOID ItPosixPthread040(VOID); -VOID IT_POSIX_PTHREAD_041(VOID); -VOID ItPosixPthread042(VOID); -VOID ItPosixPthread044(VOID); -VOID ItPosixPthread045(VOID); -VOID ItPosixPthread046(VOID); -VOID IT_POSIX_PTHREAD_047(VOID); -VOID IT_POSIX_PTHREAD_048(VOID); -VOID IT_POSIX_PTHREAD_049(VOID); -VOID IT_POSIX_PTHREAD_050(VOID); -VOID ItPosixPthread051(VOID); -VOID ItPosixPthread052(VOID); -VOID ItPosixPthread053(VOID); -VOID ItPosixPthread054(VOID); -VOID ItPosixPthread055(VOID); -VOID IT_POSIX_PTHREAD_056(VOID); -VOID ItPosixPthread057(VOID); -VOID IT_POSIX_PTHREAD_058(VOID); -VOID ItPosixPthread059(VOID); -VOID ItPosixPthread060(VOID); -VOID ItPosixPthread061(VOID); -VOID ItPosixPthread062(VOID); -VOID ItPosixPthread063(VOID); -VOID ItPosixPthread064(VOID); -VOID ItPosixPthread066(VOID); -VOID IT_POSIX_PTHREAD_068(VOID); -VOID ItPosixPthread069(VOID); -VOID ItPosixPthread070(VOID); -VOID ItPosixPthread071(VOID); -VOID ItPosixPthread072(VOID); -VOID ItPosixPthread073(VOID); -VOID ItPosixPthread074(VOID); -VOID IT_POSIX_PTHREAD_075(VOID); -VOID ItPosixPthread078(VOID); -VOID ItPosixPthread079(VOID); -VOID ItPosixPthread080(VOID); -VOID ItPosixPthread081(VOID); -VOID ItPosixPthread082(VOID); -VOID ItPosixPthread083(VOID); -VOID ItPosixPthread084(VOID); -VOID ItPosixPthread085(VOID); -VOID ItPosixPthread087(VOID); -VOID ItPosixPthread088(VOID); -VOID ItPosixPthread089(VOID); -VOID ItPosixPthread090(VOID); -VOID ItPosixPthread091(VOID); -VOID ItPosixPthread092(VOID); -VOID ItPosixPthread094(VOID); -VOID ItPosixPthread095(VOID); -VOID IT_POSIX_PTHREAD_098(VOID); -VOID IT_POSIX_PTHREAD_101(VOID); -VOID IT_POSIX_PTHREAD_102(VOID); -VOID IT_POSIX_PTHREAD_103(VOID); -VOID IT_POSIX_PTHREAD_105(VOID); -VOID ItPosixPthread106(VOID); -VOID ItPosixPthread107(VOID); -VOID IT_POSIX_PTHREAD_108(VOID); -VOID IT_POSIX_PTHREAD_110(VOID); -VOID IT_POSIX_PTHREAD_112(VOID); -VOID ItPosixPthread116(VOID); -VOID ItPosixPthread121(VOID); -VOID ItPosixPthread123(VOID); -VOID ItPosixPthread124(VOID); -VOID ItPosixPthread125(VOID); -VOID ItPosixPthread127(VOID); -VOID IT_POSIX_PTHREAD_128(VOID); -VOID ItPosixPthread129(VOID); -VOID ItPosixPthread132(VOID); -VOID ItPosixPthread133(VOID); -VOID ItPosixPthread134(VOID); -VOID ItPosixPthread136(VOID); -VOID ItPosixPthread138(VOID); -VOID ItPosixPthread141(VOID); -VOID ItPosixPthread142(VOID); -VOID ItPosixPthread144(VOID); -VOID IT_POSIX_PTHREAD_150(VOID); -VOID ItPosixPthread152(VOID); -VOID ItPosixPthread154(VOID); -VOID ItPosixPthread166(VOID); -VOID ItPosixPthread167(VOID); -VOID ItPosixPthread173(VOID); -VOID ItPosixPthread175(VOID); -VOID ItPosixPthread176(VOID); -VOID ItPosixPthread177(VOID); -VOID ItPosixPthread182(VOID); -VOID ItPosixPthread185(VOID); -VOID ItPosixPthread186(VOID); -VOID ItPosixPthread187(VOID); -VOID ItPosixPthread188(VOID); -VOID ItPosixPthread193(VOID); -VOID ItPosixPthread194(VOID); -VOID IT_POSIX_PTHREAD_197(VOID); -VOID IT_POSIX_PTHREAD_198(VOID); -VOID ItPosixPthread200(VOID); -VOID ItPosixPthread203(VOID); -VOID ItPosixPthread204(VOID); -VOID ItPosixPthread205(VOID); -VOID ItPosixPthread206(VOID); -VOID IT_POSIX_PTHREAD_208(VOID); -VOID ItPosixPthread209(VOID); -VOID IT_POSIX_PTHREAD_211(VOID); -VOID ItPosixPthread213(VOID); -VOID IT_POSIX_PTHREAD_214(VOID); -VOID IT_POSIX_PTHREAD_215(VOID); -VOID ItPosixPthread217(VOID); -VOID ItPosixPthread218(VOID); -VOID ItPosixPthread219(VOID); -VOID ItPosixPthread221(VOID); -VOID ItPosixPthread224(VOID); -VOID ItPosixPthread226(VOID); -VOID ItPosixPthread233(VOID); -VOID IT_POSIX_PTHREAD_237(VOID); -VOID ItPosixPthread238(VOID); -VOID ItPosixPthread239(VOID); -VOID ItPosixPthread240(VOID); -VOID ItPosixPthread241(VOID); -VOID IT_POSIX_PTHREAD_246(VOID); -#endif - -#if defined(LOSCFG_USER_TEST_PRESSURE) -VOID ItPosixPthread065(VOID); -#endif -#if defined(LOSCFG_USER_TEST_LLT) -VOID LltPosixPthread001(VOID); -VOID LltPosixPthread002(VOID); -VOID LltPosixPthread003(VOID); -VOID LltPosixPthread004(VOID); -VOID ItPosixPthread012(VOID); -VOID ItPosixPthread014(VOID); -VOID ItPosixPthread015(VOID); -VOID ItPosixPthread016(VOID); -VOID ItPosixPthread017(VOID); -VOID ItPosixPthread024(VOID); -VOID ItPosixPthread036(VOID); -VOID ItPosixPthread037(VOID); -VOID ItPosixPthread038(VOID); -VOID ItPosixPthread043(VOID); -VOID ItPosixPthread067(VOID); -VOID ItPosixPthread076(VOID); -VOID ItPosixPthread077(VOID); -VOID ItPosixPthread086(VOID); -VOID ItPosixPthread090(VOID); -VOID ItPosixPthread093(VOID); -VOID ItPosixPthread096(VOID); -VOID ItPosixPthread097(VOID); -VOID ItPosixPthread099(VOID); -VOID ItPosixPthread100(VOID); -VOID ItPosixPthread104(VOID); -VOID ItPosixPthread109(VOID); -VOID ItPosixPthread111(VOID); -VOID ItPosixPthread113(VOID); -VOID ItPosixPthread114(VOID); -VOID ItPosixPthread115(VOID); -VOID ItPosixPthread169(VOID); -VOID ItPosixPthread170(VOID); -VOID ItPosixPthread172(VOID); -VOID ItPosixPthread179(VOID); -VOID ItPosixPthread180(VOID); -VOID ItPosixPthread181(VOID); -VOID ItPosixPthread184(VOID); -VOID ItPosixPthread190(VOID); -VOID ItPosixPthread191(VOID); -VOID ItPosixPthread199(VOID); -VOID ItPosixPthread201(VOID); -VOID ItPosixPthread202(VOID); -#endif - -#endif /* _IT_POSIX_PTHREAD_H */ diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_001.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_001.cpp deleted file mode 100644 index 09ede149..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_001.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ -#ifndef PTHREAD_CANCEL_ASYNCHRONOUS -#error PTHREAD_CANCEL_ASYNCHRONOUS not defined -#endif - -#ifndef PTHREAD_CANCEL_ENABLE -#error PTHREAD_CANCEL_ENABLE not defined -#endif - -#ifndef PTHREAD_CANCEL_DEFERRED -#error PTHREAD_CANCEL_DEFERRED not defined -#endif - -#ifndef PTHREAD_CANCEL_DISABLE -#error PTHREAD_CANCEL_DISABLE not defined -#endif - -#ifndef PTHREAD_CANCELED -#error PTHREAD_CANCELED not defined -#endif - -#ifndef PTHREAD_CREATE_DETACHED -#error PTHREAD_CREATE_DETACHED not defined -#endif - -#ifndef PTHREAD_CREATE_JOINABLE -#error PTHREAD_CREATE_JOINABLE not defined -#endif - -#ifndef PTHREAD_EXPLICIT_SCHED -#error PTHREAD_EXPLICIT_SCHED not defined -#endif - -#ifndef PTHREAD_INHERIT_SCHED -#error PTHREAD_INHERIT_SCHED not defined -#endif - -#ifndef PTHREAD_ONCE_INIT -#error PTHREAD_ONCE_INIT not defined -#endif - - -#ifndef PTHREAD_PROCESS_SHARED -#error PTHREAD_PROCESS_SHARED not defined -#endif - -#ifndef PTHREAD_PROCESS_PRIVATE -#error PTHREAD_PROCESS_PRIVATE not defined -#endif - -#ifndef PTHREAD_COND_INITIALIZER -#error PTHREAD_COND_INTIALIZER not defined -#endif - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread001(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_001", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_002.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_002.cpp deleted file mode 100644 index 0d487291..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_002.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_attr_t dummy1; - pthread_key_t dummy6; - pthread_mutex_t dummy7; - pthread_mutexattr_t dummy8; - pthread_once_t dummy9; - pthread_t dummy13; - pthread_once_t dummy = PTHREAD_ONCE_INIT; - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread002(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_002", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_007.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_007.cpp deleted file mode 100644 index 2ebc59ed..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_007.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - - return argument; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - pthread_attr_t attr; - UINT32 ret; - UINT32 uwint = 8; - char cc = 'a'; - char str[5] = "abcd"; - - UINTPTR uwtemp; - - g_testCount = 0; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, NULL, pthread_f01, (void *)&uwint); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(*((UINT32 *)uwtemp), 8, *((UINT32 *)uwtemp)); - - ret = pthread_create(&newTh, &attr, NULL, (void *)8); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_create(&newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL((UINT32)uwtemp, 0, (UINT32)uwtemp); - - ret = pthread_create(&newTh, &attr, pthread_f01, (void *)&cc); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(*((char *)uwtemp), 97, *((char *)uwtemp)); - - ret = pthread_create(&newTh, &attr, pthread_f01, (void *)str); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_STRING_EQUAL((char *)uwtemp, "abcd", (char *)uwtemp); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread007(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_007", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_010.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_010.cpp deleted file mode 100644 index 3811c72e..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_010.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - g_testCount = pthread_self(); - - pthread_exit((void *)8); - - return (void *)9; -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, newTh, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, 8, uwtemp); - - uwtemp = TestPthreadSelf(); - ret = pthread_equal(uwtemp, g_testCount); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_equal(newTh, g_testCount); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = pthread_equal(0, 0); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = pthread_equal(0, 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread010(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_010", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_011.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_011.cpp deleted file mode 100644 index 68f50c75..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_011.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_attr_t attr; - UINT32 ret; - int detachstate; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setdetachstate(&attr, 3); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_getdetachstate(&attr, &detachstate); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(detachstate, PTHREAD_CREATE_DETACHED, detachstate); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread011(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_011", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_013.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_013.cpp deleted file mode 100644 index afb15daf..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_013.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_attr_t attr; - UINT32 ret; - int inherit; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED + 1); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_getinheritsched(&attr, &inherit); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(inherit, PTHREAD_EXPLICIT_SCHED, inherit); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread013(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_013", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_023.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_023.cpp deleted file mode 100644 index 3e70982d..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_023.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void PthreadCleanF01(void *arg) -{ - ICUNIT_ASSERT_EQUAL_VOID((int)arg, 8, (int)arg); - g_testCount++; - - return; -} - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - - pthread_cleanup_push(PthreadCleanF01, (void *)8); - if (argument) - return (void *)8; - pthread_cleanup_pop(0); - - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, 9, uwtemp); - - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread023(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_023", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_025.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_025.cpp deleted file mode 100644 index 64e0a318..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_025.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void PthreadCleanF01(void *arg) -{ - ICUNIT_ASSERT_EQUAL_VOID((int)arg, 8, (int)arg); - g_testCount++; - - return; -} - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - - pthread_cleanup_push(PthreadCleanF01, (void *)8); - pthread_exit((void *)8); - pthread_cleanup_pop(1); - - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, 8, uwtemp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread025(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_025", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_026.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_026.cpp deleted file mode 100644 index 82e204db..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_026.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void PthreadCleanF01(void *arg) -{ - ICUNIT_ASSERT_EQUAL_VOID((int)arg, 8, (int)arg); - g_testCount++; - - return; -} - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - LosTaskDelay(5); - - pthread_cleanup_push(PthreadCleanF01, (void *)8); - pthread_testcancel(); - pthread_cleanup_pop(1); - - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, (UINTPTR)PTHREAD_CANCELED, uwtemp); - - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread026(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_026", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_027.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_027.cpp deleted file mode 100644 index 45c12c16..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_027.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void PthreadCleanF01(void *arg) -{ - if (g_testCount == 1) - ICUNIT_ASSERT_EQUAL_VOID((int)arg, 8, (int)arg); - if (g_testCount == 2) - ICUNIT_ASSERT_EQUAL_VOID((int)arg, 9, (int)arg); - - g_testCount++; - - return; -} - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - - pthread_cleanup_push(PthreadCleanF01, (void *)9); - pthread_cleanup_push(PthreadCleanF01, (void *)8); - pthread_exit((void *)8); - pthread_cleanup_pop(1); - pthread_cleanup_pop(1); - - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, 8, uwtemp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread027(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_027", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_028.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_028.cpp deleted file mode 100644 index 5a7a5363..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_028.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, 9, uwtemp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread028(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_028", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_029.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_029.cpp deleted file mode 100644 index bfebb8df..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_029.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - - pthread_exit((void *)8); - return (void *)9; -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, 8, uwtemp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread029(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_029", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_030.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_030.cpp deleted file mode 100644 index 6d7e9153..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_030.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - LosTaskDelay(2); - - pthread_testcancel(); - g_testCount++; - return (void *)9; -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, (UINTPTR)PTHREAD_CANCELED, uwtemp); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread030(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_030", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_031.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_031.cpp deleted file mode 100644 index 45523f26..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_031.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - UINT32 ret; - - g_testCount++; - - ret = pthread_join(g_newTh, NULL); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); -EXIT: - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&g_newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_join(g_newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, 9, uwtemp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread031(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_031", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_034.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_034.cpp deleted file mode 100644 index c3596f47..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_034.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - UINT32 i, j; - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - - - for (i = 0, j = 0; i < 2000; i++) { - j++; - } - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); -EXIT: - return (void *)9; -} - -static VOID *pthread_f02(void *argument) -{ - UINT32 i, j; - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - - - for (i = 0, j = 0; i < 2000; i++) { - j++; - } - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); -EXIT: - return (void *)8; -} - -static VOID *PthreadF03(void *argument) -{ - UINT32 i, j; - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); - - - for (i = 0, j = 0; i < 2000; i++) { - j++; - } - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); - -EXIT: - return (void *)7; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh, newTh2, newTh3; - - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh2, NULL, pthread_f02, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh3, NULL, PthreadF03, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh2, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh3, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread034(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_034", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_035.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_035.cpp deleted file mode 100644 index 8f7c8b62..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_035.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" -static volatile int g_testCnt1; - -static VOID *pthread_f01(void *argument) -{ - UINT32 j = 0; - INT32 value; - ICUNIT_GOTO_EQUAL(g_testCnt1, 0, g_testCnt1, EXIT); - g_testCnt1++; - - while (g_testCnt1 != 3) { - j++; - j = j * 2 - 4; - j = 2001 + 4001 * 1 - 2001; - usleep(100); - } - g_testCnt1++; - ICUNIT_GOTO_EQUAL(g_testCnt1, 4, g_testCnt1, EXIT); -EXIT: - return (void *)9; -} - -static VOID *pthread_f02(void *argument) -{ - UINT32 j = 0; - INT32 value; - ICUNIT_GOTO_EQUAL(g_testCnt1, 1, g_testCnt1, EXIT); - g_testCnt1++; - - while (g_testCnt1 != 4) { - j++; - j = j * 2 - 4; - j = 2001 + 4001 * 1 - 2001; - usleep(100); - } - - g_testCnt1++; - ICUNIT_GOTO_EQUAL(g_testCnt1, 5, g_testCnt1, EXIT); -EXIT: - return (void *)8; -} - -static VOID *PthreadF03(void *argument) -{ - UINT32 j = 0; - INT32 value; - ICUNIT_GOTO_EQUAL(g_testCnt1, 2, g_testCnt1, EXIT); - g_testCnt1++; - - while (g_testCnt1 != 5) { - j++; - j = j * 2 - 4; - j = 2001 + 4001 * 1 - 2001; - usleep(10); - } - - g_testCnt1++; - ICUNIT_GOTO_EQUAL(g_testCnt1, 6, g_testCnt1, EXIT); - -EXIT: - return (void *)7; -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh, newTh2, newTh3; - - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCnt1 = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh2, NULL, pthread_f02, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh3, NULL, PthreadF03, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - while (g_testCnt1 < 6) - sleep(1); - - ICUNIT_ASSERT_EQUAL(g_testCnt1, 6, g_testCnt1); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh2, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh3, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread035(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_035", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_039.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_039.cpp deleted file mode 100644 index 1acba6f0..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_039.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *PthreadF01(void *argument) -{ - g_testCount++; - LosTaskDelay(2); - pthread_testcancel(); - g_testCount++; - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - INT32 count = PTHREAD_EXISTED_NUM; - pthread_t newTh; - UINT32 ret; - UINT32 index; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, PthreadF01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_detach(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - LosTaskDelay(2); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - - ret = pthread_create(&newTh, NULL, PthreadF01, - NULL); // the detach will release resources the next time when creates one pthread - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(2); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread039(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_039", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_040.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_040.cpp deleted file mode 100644 index 1da332ef..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_040.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - LosTaskDelay(2); - g_testCount++; - - return (void *)9; -} -static UINT32 Testcase(VOID) -{ - INT32 count = PTHREAD_EXISTED_NUM; - pthread_t newTh; - UINT32 ret; - UINT32 index; - - g_testCount = 0; - - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_detach(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - LosTaskDelay(2); - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread040(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_040", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_042.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_042.cpp deleted file mode 100644 index 1191d6d5..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_042.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - LosTaskDelay(2); - g_testCount++; - - return (void *)9; -} -static UINT32 Testcase(VOID) -{ - INT32 count = PTHREAD_EXISTED_NUM; - pthread_t newTh; - UINT32 ret; - UINT32 index; - pthread_attr_t attr; - int detachstate; - - g_testCount = 0; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_getdetachstate(&attr, &detachstate); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(detachstate, PTHREAD_CREATE_JOINABLE, detachstate); - - ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = pthread_detach(newTh); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - LosTaskDelay(3); - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - - ret = pthread_attr_getdetachstate(&attr, &detachstate); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(detachstate, PTHREAD_CREATE_DETACHED, detachstate); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread042(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_042", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_044.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_044.cpp deleted file mode 100644 index 9c8c79d9..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_044.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f02(void *argument) -{ - UINT32 ret; - INT32 policy; - struct sched_param param; - - LosTaskDelay(2); - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - g_testCount++; - - ret = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(policy, SCHED_RR, policy, EXIT); // - ICUNIT_GOTO_EQUAL(param.sched_priority, 3, param.sched_priority, EXIT); - -EXIT: - return (void *)9; -} - -static VOID *pthread_f01(void *argument) -{ - pthread_t newTh; - UINT32 ret; - INT32 policy; - pthread_attr_t attr; - struct sched_param param; - - g_testCount++; - - ret = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(policy, SCHED_RR, policy, EXIT); // - ICUNIT_GOTO_EQUAL(param.sched_priority, 4, param.sched_priority, EXIT); - - ret = pthread_attr_init(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_create(&newTh, &attr, pthread_f02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - param.sched_priority = 3; - ret = pthread_setschedparam(newTh, SCHED_RR, ¶m); // - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_detach(newTh); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - LosTaskDelay(4); - - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); - g_testCount++; - ret = pthread_attr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); -EXIT: - return (void *)9; -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - pthread_attr_t attr; - int inherit; - int policy; - struct sched_param param; - - g_testCount = 0; - - ret = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(policy, SCHED_RR, policy); // - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setschedpolicy(&attr, SCHED_RR); // - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - param.sched_priority = 4; - ret = pthread_attr_setschedparam(&attr, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(6); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_getinheritsched(&attr, &inherit); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(inherit, PTHREAD_EXPLICIT_SCHED, inherit); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread044(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_044", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_045.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_045.cpp deleted file mode 100644 index beed4406..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_045.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - printf("!!!!!!!!!\n"); - printf("%x\n", TASK_STACK_SIZE_TEST); - - g_testCount++; - -EXIT: - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - int ret; - pthread_attr_t attr; - size_t stacksize; - size_t stacksize2; - - g_testCount = 0; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - stacksize = TASK_STACK_SIZE_TEST; - ret = pthread_attr_setstacksize(&attr, stacksize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = LosTaskDelay(10); - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - - ret = pthread_join(newTh, NULL); - - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_getstacksize(&attr, &stacksize2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(stacksize2, TASK_STACK_SIZE_TEST, stacksize2); - - pthread_attr_setstacksize(&attr, LOS_TASK_MIN_STACK_SIZE - 2 * sizeof(UINTPTR)); - ret = pthread_create(&newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread045(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_045", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_046.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_046.cpp deleted file mode 100644 index 775c3061..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_046.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - - g_testCount++; - -EXIT: - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - pthread_attr_t attr; - size_t stacksize; - size_t stacksize2; - - g_testCount = 0; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - stacksize = PTHREAD_STACK_MIN_TEST + 1; - ret = pthread_attr_setstacksize(&attr, stacksize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(10); - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_getstacksize(&attr, &stacksize2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(stacksize2, PTHREAD_STACK_MIN_TEST + 1, stacksize2); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread046(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_046", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_051.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_051.cpp deleted file mode 100644 index 106beb18..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_051.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void PthreadOnceF01(void) -{ - printf("enter pthread_once_01\n"); - g_testCount++; -} - -static VOID *pthread_f01(void *argument) -{ - UINT32 ret; - - g_testCount++; - - LosTaskDelay(2); - ret = pthread_once(&g_onceControl, PthreadOnceF01); - pthread_testcancel(); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // not reachable - -EXIT: - return (void *)9; -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - UINTPTR temp; - - g_testCount = 0; - g_onceControl = PTHREAD_ONCE_INIT; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(1); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - LosTaskDelay(10); - - ICUNIT_ASSERT_EQUAL(g_onceControl, 2, g_onceControl); - ret = pthread_once(&g_onceControl, PthreadOnceF01); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - - ret = pthread_join(newTh, (void **)&temp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(temp, (UINTPTR)PTHREAD_CANCELED, temp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread051(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_051", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_052.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_052.cpp deleted file mode 100644 index 29edfdc8..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_052.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - UINT32 temp = 2; - UINT32 ret; - VOID *result; - - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - - result = pthread_getspecific(g_key); - ICUNIT_GOTO_EQUAL(result, NULL, result, EXIT); - - ret = pthread_setspecific(g_key, (void *)&temp); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - LosTaskDelay(5); - - ret = *((UINT32 *)pthread_getspecific(g_key)); - ICUNIT_GOTO_EQUAL(ret, 2, ret, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); -EXIT: - return (void *)9; -} - -static VOID *pthread_f02(void *argument) -{ - UINT32 temp = 9; - UINT32 ret; - VOID *result; - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - g_testCount++; - - result = pthread_getspecific(g_key); - ICUNIT_GOTO_EQUAL(result, NULL, result, EXIT); - - ret = pthread_setspecific(g_key, (void *)&temp); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - LosTaskDelay(10); - - ret = *((UINT32 *)pthread_getspecific(g_key)); - ICUNIT_GOTO_EQUAL(ret, 9, ret, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT); -EXIT: - return (void *)8; -} - -static VOID *PthreadF03(void *argument) -{ - char temp[10] = "abcde"; - char *temp1; - UINT32 ret; - VOID *result; - - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); - g_testCount++; - - result = pthread_getspecific(g_key); - ICUNIT_GOTO_EQUAL(result, NULL, result, EXIT); - - ret = pthread_setspecific(g_key, (void *)temp); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - LosTaskDelay(20); - - temp1 = (char *)pthread_getspecific(g_key); - ICUNIT_GOTO_STRING_EQUAL(temp1, "abcde", temp1, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 8, g_testCount, EXIT); - -EXIT: - return (void *)7; -} - -static void PthreadKeyF01(void *threadLog) -{ - g_testCount++; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh, newTh2, newTh3; - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_key_create(&g_key, PthreadKeyF01); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh2, NULL, pthread_f02, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh3, NULL, PthreadF03, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(30); - ICUNIT_ASSERT_EQUAL(g_testCount, 9, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh2, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh3, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_key_delete(g_key); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread052(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_052", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_053.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_053.cpp deleted file mode 100644 index 4ab4aed4..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_053.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - UINT32 temp = 200; - UINT32 temp1 = 20000; - char str[11] = "1234567890"; - UINT32 ret; - VOID *result; - - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - - result = pthread_getspecific(g_key); - ICUNIT_GOTO_EQUAL(result, NULL, result, EXIT); - - result = pthread_getspecific(g_key1); - ICUNIT_GOTO_EQUAL(result, NULL, result, EXIT); - - result = pthread_getspecific(g_key2); - ICUNIT_GOTO_EQUAL(result, NULL, result, EXIT); - - ret = pthread_setspecific(g_key, (void *)&temp); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_setspecific(g_key1, (void *)&temp1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_setspecific(g_key2, (void *)str); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = *((UINT32 *)pthread_getspecific(g_key)); - ICUNIT_GOTO_EQUAL(ret, 200, ret, EXIT); - - ret = *((UINT32 *)pthread_getspecific(g_key1)); - ICUNIT_GOTO_EQUAL(ret, 20000, ret, EXIT); - - result = pthread_getspecific(g_key2); - ICUNIT_GOTO_STRING_EQUAL((char *)result, "1234567890", (char *)result, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); -EXIT: - return (void *)9; -} - -static VOID *pthread_f02(void *argument) -{ - UINT32 temp = 100; - UINT32 temp1 = 10000; - char str[11] = "abcdefghjk"; - UINT32 ret; - VOID *result; - - ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); - g_testCount++; - - result = pthread_getspecific(g_key); - ICUNIT_GOTO_EQUAL(result, NULL, result, EXIT); - - result = pthread_getspecific(g_key1); - ICUNIT_GOTO_EQUAL(result, NULL, result, EXIT); - - result = pthread_getspecific(g_key2); - ICUNIT_GOTO_EQUAL(result, NULL, result, EXIT); - - ret = pthread_setspecific(g_key, (void *)&temp); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_setspecific(g_key1, (void *)&temp1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_setspecific(g_key2, (void *)str); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = *((UINT32 *)pthread_getspecific(g_key)); - ICUNIT_GOTO_EQUAL(ret, 100, ret, EXIT); - - ret = *((UINT32 *)pthread_getspecific(g_key1)); - ICUNIT_GOTO_EQUAL(ret, 10000, ret, EXIT); - - result = pthread_getspecific(g_key2); - ICUNIT_GOTO_STRING_EQUAL((char *)result, "abcdefghjk", (char *)result, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 7, g_testCount, EXIT); -EXIT: - return (void *)8; -} -static void PthreadKeyF01(void *threadLog) -{ - g_testCount++; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh, newTh2; - UINT32 ret; - UINTPTR uwtemp = 1; - VOID *result; - - g_testCount = 0; - - ret = pthread_key_create(&g_key, PthreadKeyF01); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_key_create(&g_key1, PthreadKeyF01); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_key_create(&g_key2, PthreadKeyF01); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(20); - - ret = pthread_create(&newTh2, NULL, pthread_f02, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(20); - ICUNIT_ASSERT_EQUAL(g_testCount, 10, g_testCount); - - result = pthread_getspecific(g_key); - ICUNIT_ASSERT_EQUAL(result, NULL, result); - - result = pthread_getspecific(g_key1); - ICUNIT_ASSERT_EQUAL(result, NULL, result); - - result = pthread_getspecific(g_key2); - ICUNIT_ASSERT_EQUAL(result, NULL, result); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh2, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_key_delete(g_key); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_key_delete(g_key1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_key_delete(g_key2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread053(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_053", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_054.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_054.cpp deleted file mode 100644 index 7d3a39e9..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_054.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - UINT32 temp = 2; - UINT32 ret; - - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - - ret = pthread_setspecific(g_key, (void *)&temp); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - LosTaskDelay(1); - - ret = *((UINT32 *)pthread_getspecific(g_key)); - ICUNIT_GOTO_EQUAL(ret, 2, ret, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); - - pthread_exit((void *)7); -EXIT: - return (void *)9; -} - -static void PthreadKeyF01(void *threadLog) -{ - g_testCount++; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_key_create(&g_key, PthreadKeyF01); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(2); - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_key_delete(g_key); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread054(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_054", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_055.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_055.cpp deleted file mode 100644 index 2302bb08..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_055.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - UINT32 temp = 2; - UINT32 ret; - - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - - ret = pthread_setspecific(g_key, (void *)&temp); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - LosTaskDelay(1); - - ret = *((UINT32 *)pthread_getspecific(g_key)); - ICUNIT_GOTO_EQUAL(ret, 2, ret, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); - - pthread_testcancel(); -EXIT: - return (void *)9; -} - -static void PthreadKeyF01(void *threadLog) -{ - g_testCount++; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_key_create(&g_key, PthreadKeyF01); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(2); - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(10); - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_key_delete(g_key); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread055(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_055", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_057.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_057.cpp deleted file mode 100644 index 83010095..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_057.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - UINT32 ret; - int oldstate; - int i = 0; - - ICUNIT_ASSERT_EQUAL_NULL(g_testCount, 1, (void *)g_testCount); - g_testCount++; // 2 - printf("enter pthread_01\n"); - printf("count: %d\n", g_testCount); - ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, (void *)ret); - ICUNIT_ASSERT_EQUAL_NULL(oldstate, PTHREAD_CANCEL_DEFERRED, (void *)oldstate); - pthread_testcancel(); - while (1) { - if (++i == 5) { - sleep(20); - } - } -} -static VOID *pthread_f02(void *argument) -{ - UINT32 ret; - int oldstate; - - ICUNIT_ASSERT_EQUAL_NULL(g_testCount, 3, (void *)g_testCount); - g_testCount++; // 4 - ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, (void *)ret); - ICUNIT_ASSERT_EQUAL_NULL(oldstate, PTHREAD_CANCEL_DEFERRED, (void *)oldstate); - pthread_testcancel(); - LosTaskDelay(20); - g_testCount++; // 7 - ICUNIT_ASSERT_EQUAL_NULL(g_testCount, 7, (void *)g_testCount); -} -static VOID *PthreadF03(void *argument) -{ - UINT32 ret; - UINTPTR uwtemp = 1; - int oldstate; - - ICUNIT_ASSERT_EQUAL_NULL(g_testCount, 5, (void *)g_testCount); - g_testCount++; // 6 - printf("thread01: %#x", (UINT32)g_newTh); - pthread_cancel(g_newTh); - LosTaskDelay(12); - - ret = pthread_join(g_newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, (void *)ret); - ICUNIT_ASSERT_EQUAL_NULL(uwtemp, (UINTPTR)PTHREAD_CANCELED, (void *)uwtemp); - - ret = pthread_join(g_newTh2, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, (void *)ret); - ICUNIT_ASSERT_EQUAL_NULL(g_testCount, 7, (void *)g_testCount); - ICUNIT_ASSERT_NOT_EQUAL_NULL(uwtemp, (UINTPTR)PTHREAD_CANCELED, (void *)uwtemp); -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - g_testCount = 0; - struct sched_param param = { 0 }; - int ret; - void *res = NULL; - pthread_attr_t a = { 0 }; - int curThreadPri, curThreadPolicy; - - g_testCount++; // 1 - - curThreadPri = param.sched_priority; - ret = pthread_attr_init(&a); - param.sched_priority = curThreadPri - 1; - - ret = pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&g_newTh, &a, pthread_f01, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(10); - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - g_testCount++; // 3 - - ret = pthread_create(&g_newTh2, &a, pthread_f02, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(10); - ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); - g_testCount++; // 5 - - ret = pthread_create(&newTh, &a, PthreadF03, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(20); - ICUNIT_ASSERT_EQUAL(g_testCount, 7, g_testCount); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -VOID ItPosixPthread057(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_057", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_059.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_059.cpp deleted file mode 100644 index 925c3f10..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_059.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - - sleep(1); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); // failed, =2 - -EXIT: - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - sleep(2); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, (UINTPTR)PTHREAD_CANCELED, uwtemp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread059(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_059", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_060.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_060.cpp deleted file mode 100644 index 4a4e8f6e..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_060.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f02(void *argument) -{ - g_testCount++; - return (void *)8; -} -static VOID *pthread_f01(void *argument) -{ - UINT32 ret; - - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - - TestExtraTaskDelay(2); - - ret = pthread_create(&g_newTh, NULL, pthread_f02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_join(g_newTh, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - -EXIT: - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(10); - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, (UINTPTR)PTHREAD_CANCELED, uwtemp); - - ret = pthread_join(g_newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, 8, uwtemp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread060(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_060", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_061.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_061.cpp deleted file mode 100644 index 2a3aa5d8..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_061.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - UINT32 ret; - sigset_t set; - int sig; - - sigemptyset(&set); - sigaddset(&set, SIGUSR1); - - - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - - ret = sigwait(&set, &sig); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - -EXIT: - return (void *)9; -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(2); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, (UINTPTR)PTHREAD_CANCELED, uwtemp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread061(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_061", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_062.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_062.cpp deleted file mode 100644 index af3e0f6a..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_062.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - UINT32 ret; - sem_t *sem = (sem_t *)argument; - - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - - ret = sem_wait(sem); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - -EXIT: - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - UINTPTR uwtemp = 1; - sem_t sem; - - g_testCount = 0; - - ret = sem_init(&sem, 0, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, NULL, pthread_f01, (void *)&sem); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(2); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, (UINTPTR)PTHREAD_CANCELED, uwtemp); - - ret = sem_destroy(&sem); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread062(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_062", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_063.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_063.cpp deleted file mode 100644 index 75be1055..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_063.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - UINT32 ret; - char msgrcd[10]; - siginfo_t newSiginfoT; - sigset_t newSigsetT2; - sigset_t newSigsetT; - struct timespec time = { (time_t)0, 2000000 }; - - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - - sigemptyset(&newSigsetT2); - sigaddset(&newSigsetT2, 17); - ret = sigtimedwait(&newSigsetT2, &newSiginfoT, &time); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - -EXIT: - return (void *)9; -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(2); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, (UINTPTR)PTHREAD_CANCELED, uwtemp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread063(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_063", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_064.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_064.cpp deleted file mode 100644 index 881e3380..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_064.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - UINT32 ret; - char msgrcd[10]; - siginfo_t newSiginfoT; - sigset_t newSigsetT2; - sigset_t newSigsetT; - struct timespec time = { (time_t)0, 3000000 }; - - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - - - sigemptyset(&newSigsetT2); - sigaddset(&newSigsetT2, 17); - ret = sigtimedwait(&newSigsetT2, &newSiginfoT, &time); - ICUNIT_GOTO_EQUAL(ret, 17, ret, EXIT); - - g_testCount++; - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); - -EXIT: - return (void *)9; -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - UINTPTR uwtemp = 1; - sigset_t set; - pthread_attr_t attr; - - sigemptyset(&set); - sigaddset(&set, 17); - sigprocmask(SIG_BLOCK, &set, NULL); - - g_testCount = 0; - - ret = PosixPthreadInit(&attr, 4); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - g_testCount++; - - ret = kill(0, 17); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread064(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_064", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_066.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_066.cpp deleted file mode 100644 index 193faba3..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_066.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f02(void *argument) -{ - int oldstate; - UINT32 ret; - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - - ret = pthread_cancel(g_newTh); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testCount++; - - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); -EXIT: - return (void *)9; -} - -static VOID *pthread_f01(void *argument) -{ - int oldstate; - UINT32 ret; - pthread_attr_t attr; - pthread_t newTh; - struct sched_param schedparam; - - g_testCount++; - - ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(oldstate, PTHREAD_CANCEL_DEFERRED, oldstate, EXIT); - - ret = pthread_attr_init(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - schedparam.sched_priority = 8; - pthread_attr_setschedparam(&attr, &schedparam); - - ret = pthread_create(&g_newTh2, &attr, pthread_f02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -#ifdef LOSCFG_KERNEL_SMP - while (g_testCount < 2) { - TestBusyTaskDelay(1); - } - TestExtraTaskDelay(1); -#else - g_testCount++; - - ret = pthread_join(g_newTh2, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - g_testCount++; - - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); -#endif -EXIT: - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - UINTPTR uwtemp = 1; - pthread_attr_t attr; - struct sched_param schedparam; - - g_testCount = 0; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - schedparam.sched_priority = 9; - pthread_attr_setschedparam(&attr, &schedparam); - - ret = pthread_create(&g_newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(10); - - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - - ret = pthread_join(g_newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, (UINTPTR)PTHREAD_CANCELED, uwtemp); - - ret = pthread_join(g_newTh2, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread066(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_066", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_069.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_069.cpp deleted file mode 100644 index 2a6fdc0c..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_069.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_condattr_t condattr; - pthread_cond_t cond1; - pthread_cond_t cond2; - int rc; - - rc = pthread_condattr_init(&condattr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&cond1, &condattr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&cond2, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - - rc = pthread_cond_destroy(&cond1); - ICUNIT_ASSERT_EQUAL(rc, ENOERR, rc); - rc = pthread_cond_destroy(&cond2); - ICUNIT_ASSERT_EQUAL(rc, ENOERR, rc); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread069(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_069", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_070.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_070.cpp deleted file mode 100644 index 6dfb5af2..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_070.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_cond_t cond; - int rc; - - rc = pthread_cond_init(&cond, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&cond, NULL); - if (rc && rc != EBUSY) { - ICUNIT_ASSERT_EQUAL(rc, EBUSY, rc); - } - - rc = pthread_cond_destroy(&cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread070(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_070", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_071.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_071.cpp deleted file mode 100644 index c6a104b7..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_071.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_condattr_t condattr; - int rc; - pthread_cond_t cond1, cond2; - pthread_cond_t cond3 = PTHREAD_COND_INITIALIZER; - - /* Initialize a condition variable attribute object */ - rc = pthread_condattr_init(&condattr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Initialize cond1 with the default condition variable attribute */ - rc = pthread_cond_init(&cond1, &condattr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Initialize cond2 with NULL attributes */ - rc = pthread_cond_init(&cond2, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Destroy the condition variable attribute object */ - rc = pthread_condattr_destroy(&condattr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Destroy cond1 */ - rc = pthread_cond_destroy(&cond1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Destroy cond2 */ - rc = pthread_cond_destroy(&cond2); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Destroy cond3 */ - rc = pthread_cond_destroy(&cond3); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread071(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_071", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_072.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_072.cpp deleted file mode 100644 index b6e5efd8..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_072.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *pthread_f01(void *tmp) -{ - int rc = 0; - g_testCount++; - // printf("www\n"); - - /* acquire the mutex */ - rc = pthread_mutex_lock(&g_pthreadMutexTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_testCount++; - /* Wait on the cond var. This will not return, as nobody signals */ - rc = pthread_cond_wait(&g_pthreadCondTest1, &g_pthreadMutexTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_testCount++; - - rc = pthread_mutex_unlock(&g_pthreadMutexTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_testCount++; -EXIT: - return NULL; -} -static UINT32 Testcase(VOID) -{ - pthread_t lowId; - int rc = 0; - - g_pthreadMutexTest1 = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; - g_pthreadCondTest1 = (pthread_cond_t)PTHREAD_COND_INITIALIZER; - g_testCount = 0; - - /* Create a new thread with default attributes */ - rc = pthread_create(&lowId, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Let the other thread run */ - LosTaskDelay(2); - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - - /* Try to destroy the cond var. This should return an error */ - rc = pthread_cond_destroy(&g_pthreadCondTest1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_broadcast(&g_pthreadCondTest1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - LosTaskDelay(2); - ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); - - rc = pthread_cond_destroy(&g_pthreadCondTest1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_join(lowId, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread072(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_072", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_073.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_073.cpp deleted file mode 100644 index a029b58b..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_073.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ -#include "pthread.h" -#include "It_posix_pthread.h" - - -static UINT32 Testcase(VOID) -{ - pthread_condattr_t condattr; - int rc; - -#ifdef PTHREAD_PROCESS_SHARED - int pshared; -#endif - /* Initialize a cond attributes object */ - rc = pthread_condattr_init(&condattr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - -#ifdef PTHREAD_PROCESS_SHARED - /* If the symbol {PTHREAD_PROCESS_SHARED} is defined, the attribute - * process-shared should be provided and its default value should be - * PTHREAD_PROCESS_PRIVATE */ - rc = pthread_condattr_getpshared(&condattr, &pshared); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - ICUNIT_ASSERT_EQUAL(pshared, PTHREAD_PROCESS_PRIVATE, pshared); - -#endif - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread073(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_073", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_074.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_074.cpp deleted file mode 100644 index 37b44d24..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_074.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_condattr_t condattr; - int rc; - - /* Initialize a condition variable attributes object */ - rc = pthread_condattr_init(&condattr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Destroy the condition variable attributes object */ - rc = pthread_condattr_destroy(&condattr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Initialize the condition variable attributes object again. This shouldn't result in an error. */ - rc = pthread_condattr_init(&condattr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread074(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_074", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_078.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_078.cpp deleted file mode 100644 index d442e5ab..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_078.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_condattr_t attr; - int ret; - - /* Initialize a cond attributes object */ - ret = pthread_condattr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Set 'pshared' to INVALID_PSHARED_VALUE. */ - ret = pthread_condattr_setpshared(&attr, INVALID_PSHARED_VALUE); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - /* Destroy the cond attributes object */ - ret = pthread_condattr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread078(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_078", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_079.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_079.cpp deleted file mode 100644 index afe5a8a9..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_079.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_condattr_t attr; - int ret; - int pshared; - - /* Initialize a cond attributes object */ - ret = pthread_condattr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Set 'pshared' to INVALID_PSHARED_VALUE. */ - ret = pthread_condattr_getpshared(&attr, &pshared); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(pshared, PTHREAD_PROCESS_PRIVATE, pshared); - - /* Destroy the cond attributes object */ - ret = pthread_condattr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread079(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_079", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_080.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_080.cpp deleted file mode 100644 index e350881d..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_080.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *pthread_f01(void *arg) -{ - int rc; - pthread_t self = pthread_self(); - - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_startNum++; - printf("pthread start_num: %d \n", g_startNum); - rc = pthread_cond_wait(&g_td.cond, &g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_wakenNum++; - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - -EXIT: - return NULL; -} -static UINT32 Testcase(VOID) -{ - int i, rc; - g_startNum = 0; - g_wakenNum = 0; - pthread_t thread[THREAD_NUM]; - - rc = pthread_mutex_init(&g_td.mutex, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&g_td.cond, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - for (i = 0; i < THREAD_NUM; i++) { - rc = pthread_create(&thread[i], NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - while (g_startNum < THREAD_NUM) - usleep(1000 * 10 * 2); - - /* - * Acquire the mutex to make sure that all waiters are currently - * blocked on pthread_cond_wait - */ - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* broadcast and check if all waiters are wakened */ - rc = pthread_cond_broadcast(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - sleep(1); - - /* join all secondary threads */ - for (i = 0; i < THREAD_NUM; i++) { - rc = pthread_join(thread[i], NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - printf("start_num: %d", g_startNum); - ICUNIT_ASSERT_EQUAL(g_wakenNum, THREAD_NUM, g_wakenNum); - rc = pthread_cond_destroy(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, ENOERR, rc); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread080(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_080", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_081.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_081.cpp deleted file mode 100644 index eda2a34f..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_081.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *pthread_f01(void *arg) -{ - int rc; - pthread_t self = pthread_self(); - - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_startNum++; - - rc = pthread_cond_wait(&g_td.cond, &g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_mutex_trylock(&g_td.mutex); - ICUNIT_GOTO_NOT_EQUAL(rc, 0, rc, EXIT); - - g_wakenNum++; - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - -EXIT: - return NULL; -} - -static UINT32 Testcase(VOID) -{ - int i, rc; - pthread_t thread[THREAD_NUM]; - - g_startNum = 0; - g_wakenNum = 0; - - rc = pthread_mutex_init(&g_td.mutex, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&g_td.cond, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - for (i = 0; i < THREAD_NUM; i++) { - rc = pthread_create(&thread[i], NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - while (g_startNum < THREAD_NUM) - usleep(1000 * 10 * 2); - /* - * Acquire the mutex to make sure that all waiters are currently - * blocked on pthread_cond_wait - */ - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* broadcast and check if all waiters are wakened */ - rc = pthread_cond_broadcast(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - sleep(1); - - ICUNIT_ASSERT_EQUAL(g_wakenNum, THREAD_NUM, g_wakenNum); - - /* join all secondary threads */ - for (i = 0; i < THREAD_NUM; i++) { - rc = pthread_join(thread[i], NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - rc = pthread_cond_destroy(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, ENOERR, rc); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread081(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_081", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_082.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_082.cpp deleted file mode 100644 index 9cd04309..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_082.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *pthread_f01(void *arg) -{ - int rc; - struct timespec timeout; - struct timeval curtime; - pthread_t self = pthread_self(); - - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_startNum++; - - rc = gettimeofday(&curtime, NULL); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - timeout.tv_sec = curtime.tv_sec + PTHREAD_TIMEOUT; - timeout.tv_nsec = curtime.tv_usec * 1000; - - rc = pthread_cond_timedwait(&g_td.cond, &g_td.mutex, &timeout); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_mutex_trylock(&g_td.mutex); - ICUNIT_GOTO_NOT_EQUAL(rc, 0, rc, EXIT); - - g_wakenNum++; - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - -EXIT: - return NULL; -} -static UINT32 Testcase(VOID) -{ - int i, rc; - pthread_t thread[THREAD_NUM]; - - g_startNum = 0; - g_wakenNum = 0; - - rc = pthread_mutex_init(&g_td.mutex, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&g_td.cond, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - for (i = 0; i < THREAD_NUM; i++) { - rc = pthread_create(&thread[i], NULL, pthread_f01, NULL); // - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - while (g_startNum < THREAD_NUM) - usleep(1000 * 10 * 2); - - /* - * Acquire the mutex to make sure that all waiters are currently - * blocked on pthread_cond_wait - */ - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* broadcast and check if all waiters are wakened */ - ICUNIT_ASSERT_EQUAL(g_wakenNum, 0, g_wakenNum); - - rc = pthread_cond_broadcast(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - sleep(1); - - ICUNIT_ASSERT_EQUAL(g_wakenNum, THREAD_NUM, g_wakenNum); - - /* join all secondary threads */ - for (i = 0; i < THREAD_NUM; i++) { - rc = pthread_join(thread[i], NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - rc = pthread_cond_destroy(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, ENOERR, rc); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread082(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_082", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_083.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_083.cpp deleted file mode 100644 index 6e5fd3c6..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_083.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *pthread_f01(void *arg) -{ - int rc; - pthread_t self = pthread_self(); - - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_startNum++; - - rc = pthread_cond_wait(&g_td.cond, &g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_wakenNum++; - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - -EXIT: - return NULL; -} -static UINT32 Testcase(VOID) -{ - int i, rc; - pthread_t thread[THREAD_NUM]; - - g_startNum = 0; - g_wakenNum = 0; - - rc = pthread_mutex_init(&g_td.mutex, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&g_td.cond, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - for (i = 0; i < THREAD_NUM; i++) { - rc = pthread_create(&thread[i], NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - while (g_startNum < THREAD_NUM) - usleep(1000 * 10 * 2); - - /* - * Acquire the mutex to make sure that all waiters are currently - * blocked on pthread_cond_wait - */ - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* broadcast and check if all waiters are wakened */ - ICUNIT_ASSERT_EQUAL(g_wakenNum, 0, g_wakenNum); - - rc = pthread_cond_signal(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - sleep(1); - - ICUNIT_ASSERT_EQUAL(g_wakenNum, 1, g_wakenNum); - - rc = pthread_cond_signal(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_signal(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_signal(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - sleep(1); - - ICUNIT_ASSERT_EQUAL(g_wakenNum, THREAD_NUM, g_wakenNum); - - /* join all secondary threads */ - for (i = 0; i < THREAD_NUM; i++) { - rc = pthread_join(thread[i], NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - rc = pthread_cond_destroy(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, ENOERR, rc); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread083(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_083", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_084.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_084.cpp deleted file mode 100644 index b8058e23..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_084.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *pthread_f01(void *arg) -{ - int rc; - pthread_t self = pthread_self(); - - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_startNum++; - - rc = pthread_cond_wait(&g_td.cond, &g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_mutex_trylock(&g_td.mutex); - ICUNIT_GOTO_NOT_EQUAL(rc, 0, rc, EXIT); - - g_wakenNum++; - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - -EXIT: - return NULL; -} -static UINT32 Testcase(VOID) -{ - int i, rc; - pthread_t thread[THREAD_NUM]; - - g_startNum = 0; - g_wakenNum = 0; - - rc = pthread_mutex_init(&g_td.mutex, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&g_td.cond, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - for (i = 0; i < THREAD_NUM; i++) { - rc = pthread_create(&thread[i], NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - while (g_startNum < THREAD_NUM) - usleep(1000 * 10 * 2); - - /* - * Acquire the mutex to make sure that all waiters are currently - * blocked on pthread_cond_wait - */ - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* broadcast and check if all waiters are wakened */ - rc = pthread_cond_signal(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - sleep(1); - - ICUNIT_ASSERT_EQUAL(g_wakenNum, 1, g_wakenNum); - - rc = pthread_cond_signal(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_signal(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_signal(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - sleep(1); - - ICUNIT_ASSERT_EQUAL(g_wakenNum, THREAD_NUM, g_wakenNum); - - /* join all secondary threads */ - for (i = 0; i < THREAD_NUM; i++) { - rc = pthread_join(thread[i], NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - rc = pthread_cond_destroy(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, ENOERR, rc); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread084(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_084", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_085.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_085.cpp deleted file mode 100644 index 317eb41b..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_085.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *pthread_f01(void *arg) -{ - int rc; - - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_t1Start = 1; /* let main thread continue */ - - rc = pthread_cond_wait(&g_td.cond, &g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - ICUNIT_GOTO_NOT_EQUAL(g_signaled, 0, g_signaled, EXIT); - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_t1Start = 2; -EXIT: - return NULL; -} -static UINT32 Testcase(VOID) -{ - struct sigaction act; - int rc; - pthread_t thread1; - - g_t1Start = 0; - - rc = pthread_mutex_init(&g_td.mutex, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&g_td.cond, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_create(&thread1, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - while (!g_t1Start) /* wait for thread1 started */ - usleep(1000 * 10 * 2); - - /* acquire the mutex released by pthread_cond_wait() within thread 1 */ - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - sleep(1); - - fprintf(stderr, "Time to wake up thread1 by signaling a condition\n"); - g_signaled = 1; - rc = pthread_cond_signal(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_join(thread1, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - ICUNIT_ASSERT_EQUAL(g_t1Start, 2, g_t1Start); - g_signaled = 0; // add by d00346846 - - rc = pthread_cond_destroy(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, ENOERR, rc); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread085(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_085", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_087.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_087.cpp deleted file mode 100644 index 0cf58da4..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_087.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *pthread_f01(void *arg) -{ - int rc; - struct timespec timeout; - struct timeval curtime; - - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_t1Start = 1; /* let main thread continue */ - - rc = gettimeofday(&curtime, NULL); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - timeout.tv_sec = curtime.tv_sec + PTHREAD_TIMEOUT; - timeout.tv_nsec = curtime.tv_usec * 1000; - - rc = pthread_cond_timedwait(&g_td.cond, &g_td.mutex, &timeout); - ICUNIT_GOTO_EQUAL(rc, ETIMEDOUT, rc, EXIT); - - rc = pthread_mutex_trylock(&g_td.mutex); - ICUNIT_GOTO_NOT_EQUAL(rc, 0, rc, EXIT); - ICUNIT_GOTO_EQUAL(g_signaled, 1, g_signaled, EXIT); - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); -EXIT: - pthread_exit((void *)5); -} - -static UINT32 Testcase(VOID) -{ - struct sigaction act; - int rc; - pthread_t thread1; - void *thRet; - - g_t1Start = 0; - - rc = pthread_mutex_init(&g_td.mutex, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&g_td.cond, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_create(&thread1, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - while (!g_t1Start) /* wait for thread1 started */ - usleep(1000 * 10 * 2); - - - /* acquire the mutex released by pthread_cond_wait() within thread 1 */ - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - sleep(1); - g_signaled = 1; - rc = pthread_join(thread1, &thRet); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - ICUNIT_ASSERT_EQUAL((long)thRet, 5, (long)thRet); - g_signaled = 0; - - rc = pthread_cond_destroy(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, ENOERR, rc); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread087(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_087", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_088.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_088.cpp deleted file mode 100644 index 7b04f642..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_088.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" -static pthread_mutex_t g_pthreadMutexTest100; -static pthread_cond_t g_pthreadCondTest100; - -static void PthreadSignalHandlerF01(int sig) -{ - int rc; - - rc = pthread_cond_signal(&g_pthreadCondTest100); - ICUNIT_ASSERT_EQUAL_VOID(rc, 0, rc); -} - -/* Utility function to find difference between two time values */ -static float PthreadTimeF01(struct timespec t2, struct timespec t1) -{ - float diff = t2.tv_sec - t1.tv_sec; - diff += (t2.tv_nsec - t1.tv_nsec) / 1000000000.0; - return diff; -} - -static void *pthread_f01(void *tmp) -{ - struct sched_param param; - int policy; - int rc = 0; - - param.sched_priority = HIGH_PRIORITY; - - rc = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - ICUNIT_GOTO_EQUAL(policy, SCHED_RR, policy, EXIT); - ICUNIT_GOTO_EQUAL(param.sched_priority, HIGH_PRIORITY, param.sched_priority, EXIT); - - rc = pthread_mutex_lock(&g_pthreadMutexTest100); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - /* Block, to be woken up by the signal handler */ - rc = pthread_cond_wait(&g_pthreadCondTest100, &g_pthreadMutexTest100); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - /* This variable is unprotected because the scheduling removes - * the contention - */ - if (g_lowDone != 1) - g_wokenUp = 1; - - rc = pthread_mutex_unlock(&g_pthreadMutexTest100); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); -EXIT: - return NULL; -} - -static void *pthread_f02(void *tmp) -{ - struct timespec startTime, currentTime; - struct sched_param param; - int policy; - int rc = 0; - - param.sched_priority = LOW_PRIORITY; - - rc = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - ICUNIT_GOTO_EQUAL(policy, SCHED_RR, policy, EXIT); - ICUNIT_GOTO_EQUAL(param.sched_priority, LOW_PRIORITY, param.sched_priority, EXIT); - - PthreadSignalHandlerF01(SIGALRM); - - /* grab the start time and busy loop for 5 seconds */ - clock_gettime(CLOCK_REALTIME, &startTime); - while (1) { - clock_gettime(CLOCK_REALTIME, ¤tTime); - if (PthreadTimeF01(currentTime, startTime) > RUNTIME) - break; - } - g_lowDone = 1; -EXIT: - return NULL; -} -static UINT32 Testcase(VOID) -{ - pthread_t highId, lowId; - pthread_attr_t highAttr, lowAttr; - struct sched_param param; - int rc = 0; - g_pthreadMutexTest100 = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; - g_pthreadCondTest100 = (pthread_cond_t)PTHREAD_COND_INITIALIZER; - /* Create the higher priority thread */ - rc = pthread_attr_init(&highAttr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_attr_setschedpolicy(&highAttr, SCHED_RR); // - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - pthread_attr_setinheritsched(&highAttr, PTHREAD_EXPLICIT_SCHED); - - param.sched_priority = HIGH_PRIORITY; - rc = pthread_attr_setschedparam(&highAttr, ¶m); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_create(&highId, &highAttr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Create the low priority thread */ - rc = pthread_attr_init(&lowAttr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_attr_setschedpolicy(&lowAttr, SCHED_RR); // - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - pthread_attr_setinheritsched(&lowAttr, PTHREAD_EXPLICIT_SCHED); - - param.sched_priority = LOW_PRIORITY; - rc = pthread_attr_setschedparam(&lowAttr, ¶m); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_create(&lowId, &lowAttr, pthread_f02, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - - /* Wait for the threads to exit */ - rc = pthread_join(highId, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_join(lowId, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_destroy(&g_pthreadCondTest100); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Check the result */ - ICUNIT_ASSERT_EQUAL(g_wokenUp, 1, g_wokenUp); - ICUNIT_ASSERT_EQUAL(g_lowDone, 1, g_lowDone); - - g_iCunitErrLineNo = 0; - g_iCunitErrCode = 0; - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread088(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_088", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_089.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_089.cpp deleted file mode 100644 index ef7cf044..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_089.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" -static pthread_mutex_t g_pthreadMutexTest100; -; -static pthread_cond_t g_pthreadCondTest100; - -static void PthreadSignalHandlerF01(int sig) -{ - int rc; - rc = pthread_cond_broadcast(&g_pthreadCondTest100); - ICUNIT_ASSERT_EQUAL_VOID(rc, 0, rc); -} - -/* Utility function to find difference between two time values */ -static float PthreadTimeF01(struct timespec t2, struct timespec t1) -{ - float diff = t2.tv_sec - t1.tv_sec; - diff += (t2.tv_nsec - t1.tv_nsec) / 1000000000.0; - return diff; -} - -static void *pthread_f01(void *tmp) -{ - struct sched_param param; - int policy; - int rc = 0; - - param.sched_priority = HIGH_PRIORITY; - - rc = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - ICUNIT_GOTO_EQUAL(policy, SCHED_RR, policy, EXIT); - ICUNIT_GOTO_EQUAL(param.sched_priority, HIGH_PRIORITY, param.sched_priority, EXIT); - - /* acquire the mutex */ - rc = pthread_mutex_lock(&g_pthreadMutexTest100); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - /* Block, to be woken up by the signal handler */ - rc = pthread_cond_wait(&g_pthreadCondTest100, &g_pthreadMutexTest100); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - /* This variable is unprotected because the scheduling removes - * the contention - */ - if (g_lowDone != 1) - g_wokenUp = 1; - - rc = pthread_mutex_unlock(&g_pthreadMutexTest100); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); -EXIT: - return NULL; -} - -static void *pthread_f02(void *tmp) -{ - struct timespec startTime, currentTime; - struct sched_param param; - int policy; - int rc = 0; - - ICUNIT_GOTO_EQUAL(g_wokenUp, -1, g_wokenUp, EXIT); - - param.sched_priority = LOW_PRIORITY; - - rc = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - ICUNIT_GOTO_EQUAL(policy, SCHED_RR, policy, EXIT); - ICUNIT_GOTO_EQUAL(param.sched_priority, LOW_PRIORITY, param.sched_priority, EXIT); - - PthreadSignalHandlerF01(SIGALRM); - - /* grab the start time and busy loop for 5 seconds */ - clock_gettime(CLOCK_REALTIME, &startTime); - while (1) { - clock_gettime(CLOCK_REALTIME, ¤tTime); - if (PthreadTimeF01(currentTime, startTime) > RUNTIME) - break; - } - g_lowDone = 1; -EXIT: - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t highId, lowId; - pthread_attr_t highAttr, lowAttr; - struct sched_param param; - int rc = 0; - - sleep(1); - - g_wokenUp = -1; - g_lowDone = -1; - - g_pthreadMutexTest100 = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; - g_pthreadCondTest100 = (pthread_cond_t)PTHREAD_COND_INITIALIZER; - /* Create the higher priority thread */ - rc = pthread_attr_init(&highAttr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_attr_setschedpolicy(&highAttr, SCHED_RR); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - pthread_attr_setinheritsched(&highAttr, PTHREAD_EXPLICIT_SCHED); - - param.sched_priority = HIGH_PRIORITY; - rc = pthread_attr_setschedparam(&highAttr, ¶m); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_create(&highId, &highAttr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Create the low priority thread */ - rc = pthread_attr_init(&lowAttr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_attr_setschedpolicy(&lowAttr, SCHED_RR); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - param.sched_priority = LOW_PRIORITY; - rc = pthread_attr_setschedparam(&lowAttr, ¶m); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_create(&lowId, &lowAttr, pthread_f02, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Wait for the threads to exit */ - rc = pthread_join(highId, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_join(lowId, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_destroy(&g_pthreadCondTest100); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* Check the result */ - ICUNIT_ASSERT_EQUAL(g_wokenUp, 1, g_wokenUp); - ICUNIT_ASSERT_EQUAL(g_lowDone, 1, g_lowDone); - - g_iCunitErrLineNo = 0; - g_iCunitErrCode = 0; - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread089(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_089", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_090.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_090.cpp deleted file mode 100644 index e65fa951..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_090.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -#define THREAD_COUNT 15 -static void *pthread_f01(void *arg) -{ - int rc; - pthread_t self = pthread_self(); - - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_startNum++; - if (g_startNum > 5) - usleep(1000 * 10 * 2); - - printf("pthread start_num: %d \n", g_startNum); - rc = pthread_cond_wait(&g_td.cond, &g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_wakenNum++; - - printf("pthread waken_num: %d \n", g_wakenNum); - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - -EXIT: - return NULL; -} -static UINT32 Testcase(VOID) -{ - int i, rc; - g_startNum = 0; - g_wakenNum = 0; - pthread_t thread[THREAD_COUNT]; - - rc = pthread_mutex_init(&g_td.mutex, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&g_td.cond, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - for (i = 0; i < THREAD_COUNT; i++) { - rc = pthread_create(&thread[i], NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - usleep(1000 * 10 * 2); - } - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - usleep(1000 * 10 * 1); - - printf("%s %d pthread_cond_broadcast \n", __FUNCTION__, __LINE__); - - /* broadcast and check if all waiters are wakened */ - rc = pthread_cond_broadcast(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - sleep(1); - - printf("%s %d pthread_cond_broadcast two\n", __FUNCTION__, __LINE__); - rc = pthread_cond_broadcast(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - /* join all secondary threads */ - for (i = 0; i < THREAD_COUNT; i++) { - rc = pthread_join(thread[i], NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - printf("start_num: %d", g_startNum); - rc = pthread_cond_destroy(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, ENOERR, rc); - - g_iCunitErrCode = 0; - g_iCunitErrLineNo = 0; - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread090(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_090", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_091.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_091.cpp deleted file mode 100644 index c648c05f..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_091.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - int oldstate; - UINT32 ret; - - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - - usleep(1000 * 10 * 5); - ret = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldstate); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(oldstate, PTHREAD_CANCEL_DEFERRED, oldstate, EXIT); - - pthread_testcancel(); - g_testCount++; - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); -EXIT: - return (void *)9; -} - -static VOID *pthread_f02(void *argument) -{ - UINT32 ret; - int oldstate; - UINT32 i, j; - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - g_testCount++; - - usleep(1000 * 10 * 5); - ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(oldstate, PTHREAD_CANCEL_DEFERRED, oldstate, EXIT); - printf("10\n"); - - for (i = 0, j = 0; i < 0xffffffff; i++) - j++; - g_testCount++; - printf("11\n"); - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // failed , =3 -EXIT: - return (void *)9; -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh, newTh2; - UINT32 ret; - UINTPTR uwtemp = 1; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh2, NULL, pthread_f02, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_cancel(newTh2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(10); - - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); - ret = pthread_join(newTh, (void **)&uwtemp); - - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, (UINTPTR)PTHREAD_CANCELED, uwtemp); - - ret = pthread_join(newTh2, (void **)&uwtemp); - - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, (UINTPTR)PTHREAD_CANCELED, uwtemp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread091(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_091", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_092.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_092.cpp deleted file mode 100644 index b1e0f69b..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_092.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -#define THREAD_COUNT 15 -static int g_testCnt; - -static void *pthread_f01(void *arg) -{ - int rc; - pthread_t self = pthread_self(); - - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_startNum++; - if (g_startNum > 5) - usleep(1000 * 10 * 2); - - printf("pthread start_num: %d \n", g_startNum); - rc = pthread_cond_wait(&g_td.cond, &g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_wakenNum++; - - printf("pthread waken_num: %d \n", g_wakenNum); - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - -EXIT: - return NULL; -} - -static void *pthread_f02(void *arg) -{ - int rc; - pthread_t self = pthread_self(); - - g_testCnt++; - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - -EXIT: - return NULL; -} - -static UINT32 Testcase(VOID) -{ - int i, rc; - g_startNum = 0; - g_wakenNum = 0; - pthread_t thread[THREAD_COUNT]; - pthread_t thread2[THREAD_COUNT]; - - rc = pthread_mutex_init(&g_td.mutex, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_cond_init(&g_td.cond, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_lock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - g_testCnt = 0; - for (i = 0; i < THREAD_COUNT; i++) { - rc = pthread_create(&thread[i], NULL, pthread_f02, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - usleep(1000 * 10 * 2); - } - - ICUNIT_ASSERT_EQUAL(g_testCnt, THREAD_COUNT, g_testCnt); - - for (i = 0; i < THREAD_COUNT; i++) { - rc = pthread_create(&thread2[i], NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - usleep(1000 * 10 * 2); - } - - rc = pthread_mutex_unlock(&g_td.mutex); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - usleep(1000 * 10 * 1); - - printf("%s %d pthread_cond_broadcast \n", __FUNCTION__, __LINE__); - - /* broadcast and check if all waiters are wakened */ - rc = pthread_cond_broadcast(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - sleep(1); - - printf("%s %d pthread_cond_broadcast two\n", __FUNCTION__, __LINE__); - rc = pthread_cond_broadcast(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - for (i = 0; i < THREAD_COUNT; i++) { - rc = pthread_join(thread[i], NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - /* join all secondary threads */ - for (i = 0; i < THREAD_COUNT; i++) { - rc = pthread_join(thread2[i], NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - printf("start_num: %d", g_startNum); - rc = pthread_cond_destroy(&g_td.cond); - ICUNIT_ASSERT_EQUAL(rc, ENOERR, rc); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread092(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_092", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_094.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_094.cpp deleted file mode 100644 index b49d3870..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_094.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f02(void *argument) -{ - int oldstate; - UINT32 ret; - int i = 0; - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); - g_testCount++; - - ret = pthread_cancel(g_newTh); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); - g_testCount++; -EXIT: - return (void *)9; -} - -static VOID *pthread_f01(void *argument) -{ - int oldstate; - UINT32 ret; - pthread_attr_t attr; - struct sched_param schedparam; - - ICUNIT_GOTO_EQUAL(g_testCount, 0, g_testCount, EXIT); - g_testCount++; - ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(oldstate, PTHREAD_CANCEL_DEFERRED, oldstate, EXIT); - - ret = pthread_attr_init(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - schedparam.sched_priority = 15; - pthread_attr_setschedparam(&attr, &schedparam); - - ret = pthread_create(&g_newTh2, &attr, pthread_f02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - g_testCount++; - -EXIT: - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - UINTPTR wtemp = 1; - pthread_attr_t attr; - struct sched_param schedparam; - - int i = 0; - g_testCount = 0; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - schedparam.sched_priority = 10; - pthread_attr_setschedparam(&attr, &schedparam); - - ret = pthread_create(&g_newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); - g_testCount++; - - ret = pthread_join(g_newTh, (void **)&wtemp); - - ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); - g_testCount++; - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_NOT_EQUAL(wtemp, (UINTPTR)PTHREAD_CANCELED, wtemp); - - ICUNIT_GOTO_EQUAL(g_testCount, 6, g_testCount, EXIT); - g_testCount++; - - ret = pthread_join(g_newTh2, NULL); - - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_GOTO_EQUAL(g_testCount, 7, g_testCount, EXIT); - g_testCount++; - -EXIT: - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread094(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_094", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_095.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_095.cpp deleted file mode 100644 index 9a67603b..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_095.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static volatile int g_testCnt1; - -static VOID *pthread_f02(void *argument) -{ - int oldstate; - UINT32 ret; - int i = 0; - - ICUNIT_GOTO_EQUAL(g_testCnt1, 2, g_testCnt1, EXIT); - g_testCnt1++; - - ret = pthread_cancel(g_newTh); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - while (g_testCnt1 != 5) { - LosTaskDelay(1); - } - - g_testCnt1++; -EXIT: - return (void *)9; -} - -static VOID *pthread_f01(void *argument) -{ - int oldstate; - UINT32 ret; - pthread_attr_t attr; - struct sched_param schedparam; - - TestExtraTaskDelay(1); - ICUNIT_GOTO_EQUAL(g_testCnt1, 1, g_testCnt1, EXIT); - g_testCnt1++; - ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(oldstate, PTHREAD_CANCEL_DEFERRED, oldstate, EXIT); - - ret = pthread_attr_init(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - schedparam.sched_priority = 26; - pthread_attr_setschedparam(&attr, &schedparam); - - ret = pthread_create(&g_newTh2, &attr, pthread_f02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - LosTaskDelay(5); - - ICUNIT_GOTO_EQUAL(g_testCnt1, 3, g_testCnt1, EXIT); - g_testCnt1++; - -EXIT: - return (void *)9; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - UINTPTR wtemp = 1; - - int i = 0; - g_testCnt1 = 0; - - ret = pthread_create(&g_newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - g_testCnt1++; - - ret = pthread_join(g_newTh, (void **)&wtemp); - - ICUNIT_GOTO_EQUAL(g_testCnt1, 3, g_testCnt1, EXIT); - g_testCnt1++; - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(wtemp, (UINTPTR)PTHREAD_CANCELED, wtemp); - - ICUNIT_GOTO_EQUAL(g_testCnt1, 4, g_testCnt1, EXIT); - g_testCnt1++; - - ret = pthread_join(g_newTh2, NULL); - - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_GOTO_EQUAL(g_testCnt1, 6, g_testCnt1, EXIT); - g_testCnt1++; - -EXIT: - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread095(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_095", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_106.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_106.cpp deleted file mode 100644 index ce0fecf9..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_106.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - g_testCount++; - LosTaskDelay(10); - pthread_exit(NULL); - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh2; - UINT32 ret; - pthread_attr_t attr; - - int i = 0; - - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - g_testCount = 0; - - ret = pthread_create(&newTh2, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_detach(newTh2); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - return PTHREAD_NO_ERROR; -} - -/* -********** -testcase brief in English -Posix_Pthread_add_079 -********** -*/ - -VOID ItPosixPthread106(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_106", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_107.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_107.cpp deleted file mode 100644 index 9578c6c4..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_107.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *t) -{ - long myId = (long)t; - int rc; - - rc = pthread_mutex_lock(&g_pthreadMutexTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_testCount++; - LosTaskDelay(1); - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); - g_testCount++; - - rc = pthread_cond_wait(&g_pthreadCondTest1, &g_pthreadMutexTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); - rc = pthread_mutex_unlock(&g_pthreadMutexTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - -EXIT: - return NULL; -} - -static VOID *pthread_f02(void *t) -{ - int i; - long myId = (long)t; - int rc; - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - g_testCount++; - rc = pthread_mutex_lock(&g_pthreadMutexTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); - g_testCount++; - rc = pthread_cond_signal(&g_pthreadCondTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); - g_testCount++; - - rc = pthread_mutex_unlock(&g_pthreadMutexTest1); /* ΪÏß³ÌÂÖѯ»¥³âËøÔö¼ÓÑÓʱ */ - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - LosTaskDelay(2); - -EXIT: - pthread_exit(NULL); -} -static UINT32 Testcase(VOID) -{ - int i; - long t1 = 1, t2 = 2, t3 = 3; - int rc; - pthread_t threads[3]; - pthread_attr_t attr; /* ³õʼ»¯»¥³âÁ¿ºÍÌõ¼þ±äÁ¿¶ÔÏó */ - - g_testCount = 0; - pthread_mutex_init(&g_pthreadMutexTest1, NULL); - pthread_cond_init(&g_pthreadCondTest1, NULL); /* ´´½¨Ïß³ÌʱÉèΪ¿ÉÁ¬½Ó״̬£¬±ãÓÚÒÆÖ² */ - pthread_attr_init(&attr); - - rc = pthread_create(&threads[0], &attr, pthread_f01, (void *)t1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_create(&threads[1], &attr, pthread_f02, (void *)t2); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - - /* µÈ´ýËùÓÐÏß³ÌÍê³É */ - for (i = 0; i < 2; i++) { - rc = pthread_join(threads[i], NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - /* Çå³ý²¢Í˳ö */ - rc = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_destroy(&g_pthreadMutexTest1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - rc = pthread_cond_destroy(&g_pthreadCondTest1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread107(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_107", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_116.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_116.cpp deleted file mode 100644 index 44ebd7d6..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_116.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static pthread_t g_th1; -static pthread_mutex_t g_mutx = PTHREAD_MUTEX_INITIALIZER; -static int g_cnt = 0; -#define PRI 9 - -static VOID *pthread_f01(VOID *arg) -{ - struct sched_param schParam; - UINT32 priority = 0; - INT32 sched = SCHED_RR; - int ret; - - g_cnt++; - ICUNIT_GOTO_EQUAL(g_cnt, 1, g_cnt, EXIT); - pthread_mutex_lock(&g_mutx); - LosTaskDelay(10); - - pthread_getschedparam(g_th1, &sched, &schParam); - ICUNIT_GOTO_EQUAL(schParam.sched_priority, PRI, schParam.sched_priority, EXIT); - - priority = schParam.sched_priority - 4; - schParam.sched_priority = priority; - ret = pthread_setschedparam(g_th1, sched, &schParam); - g_cnt++; - ICUNIT_GOTO_EQUAL(g_cnt, 3, g_cnt, EXIT); - pthread_mutex_unlock(&g_mutx); - pthread_getschedparam(g_th1, &sched, &schParam); - ICUNIT_GOTO_EQUAL(schParam.sched_priority, priority, schParam.sched_priority, EXIT); -EXIT: - return NULL; -} - -static VOID *pthread_f02(VOID *arg) -{ - g_cnt++; - ICUNIT_GOTO_EQUAL(g_cnt, 2, g_cnt, EXIT); - pthread_mutex_lock(&g_mutx); - - g_cnt++; - ICUNIT_GOTO_EQUAL(g_cnt, 4, g_cnt, EXIT); - pthread_mutex_unlock(&g_mutx); - - return NULL; -EXIT: - pthread_mutex_unlock(&g_mutx); - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - pthread_attr_t attr; - struct sched_param schParam; - UINT32 priority = 0; - INT32 sched = SCHED_RR; - g_cnt = 0; - struct sched_param schedparam; - - pthread_attr_init(&attr); - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - schedparam.sched_priority = PRI; - pthread_attr_setschedparam(&attr, &schedparam); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - - ret = pthread_create(&g_th1, &attr, pthread_f01, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pthread_attr_init(&attr); - schedparam.sched_priority = PRI - 1; - pthread_attr_setschedparam(&attr, &schedparam); - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - - ret = pthread_create(&newTh, &attr, pthread_f02, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - pthread_getschedparam(g_th1, &sched, &schParam); - - ret = pthread_join(newTh, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_cnt, 4, g_cnt, EXIT); - - return PTHREAD_NO_ERROR; - -EXIT: - pthread_detach(g_th1); - pthread_detach(newTh); - return LOS_NOK; -} - -VOID ItPosixPthread116(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_116", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_123.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_123.cpp deleted file mode 100644 index 4152b6b6..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_123.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - g_pthreadTestTh = pthread_self(); - pthread_exit(0); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret = 0; - - /* Create a new thread */ - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_NO_ERROR, ret, EXIT); - - /* Wait for the thread function to return to make sure we got - * the thread ID value from pthread_self(). */ - ret = pthread_join(newTh, NULL); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_NO_ERROR, ret, EXIT); - - /* If the value of pthread_self() and the return value from - * pthread_create() is equal, then the test passes. */ - ret = pthread_equal(newTh, g_pthreadTestTh); - ICUNIT_GOTO_NOT_EQUAL(ret, PTHREAD_NO_ERROR, ret, EXIT); - return PTHREAD_NO_ERROR; -EXIT: - pthread_detach(newTh); - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread123(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_123", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_124.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_124.cpp deleted file mode 100644 index c27c263c..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_124.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *num) -{ - intptr_t i = (intptr_t)num; - printf("Passed argument for thread: %d\n", (int)i); - ICUNIT_TRACK_EQUAL(g_testCount++, i, g_testCount++); - - pthread_exit(0); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - long i; - INT32 ret = 0; - - g_testCount = 1; - - for (i = 1; i < PTHREAD_THREADS_NUM + 1; i++) { - ret = pthread_create(&newTh, NULL, pthread_f01, (void *)i); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_NO_ERROR, ret, EXIT); - - /* Wait for thread to end execution */ - ret = pthread_join(newTh, NULL); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_NO_ERROR, ret, EXIT); - } - - return PTHREAD_NO_ERROR; -EXIT: - pthread_detach(newTh); - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread124(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_124", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_125.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_125.cpp deleted file mode 100644 index 9a480f45..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_125.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *num) -{ - int *i, j; - - i = (int *)num; - - for (j = 0; j < PTHREAD_THREADS_NUM; j++) { - printf("Passed argument %d for thread\n", i[j]); - ICUNIT_TRACK_EQUAL(i[j], j + 1, i[j]); - } - - pthread_exit(0); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 i[PTHREAD_THREADS_NUM], j, ret; - - for (j = 0; j < PTHREAD_THREADS_NUM; j++) - i[j] = j + 1; - - ret = pthread_create(&newTh, NULL, pthread_f01, (void *)&i); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_NO_ERROR, ret, EXIT); - - /* Wait for thread to end execution */ - ret = pthread_join(newTh, NULL); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_NO_ERROR, ret, EXIT); - - return PTHREAD_NO_ERROR; -EXIT: - pthread_detach(newTh); - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread125(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_125", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_127.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_127.cpp deleted file mode 100644 index 5e1fe9e7..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_127.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -typedef struct { - sigset_t mask; - sigset_t pending; -} testdata_t; - -/* Thread function; which will check the signal mask and pending signals */ -static VOID *pthread_f01(VOID *arg) -{ - INT32 ret; - testdata_t *td = (testdata_t *)arg; - - /* Obtain the signal mask of this thread. */ - ret = pthread_sigmask(SIG_SETMASK, NULL, &(td->mask)); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* Obtain the pending signals of this thread. It should be empty. */ - ret = sigpending(&(td->pending)); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* Signal we're done (especially in case of a detached thread) */ - do { - ret = sem_post(&g_scenarii[g_testCount].sem); - } while ((ret == -1) && (errno == EINTR)); - ICUNIT_TRACK_NOT_EQUAL(ret, -1, ret); - - return arg; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - pthread_t child; - testdata_t tdParent, tdThread; - - g_testCount = 0; - -#if PTHREAD_SIGNAL_SUPPORT == 1 - - /* Initialize thread attribute objects */ - ScenarInit(); - - /* Initialize the signal state */ - ret = sigemptyset(&(tdParent.mask)); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = sigemptyset(&(tdParent.pending)); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* Add SIGCONT, SIGUSR1 and SIGUSR2 to the set of blocked signals */ - ret = sigaddset(&(tdParent.mask), SIGUSR1); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = sigaddset(&(tdParent.mask), SIGUSR2); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* Block those signals. */ - ret = pthread_sigmask(SIG_SETMASK, &(tdParent.mask), NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* Raise those signals so they are now pending. */ - ret = raise(SIGUSR1); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = raise(SIGUSR2); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* Do the testing for each thread */ - for (g_testCount = 0; g_testCount < NSCENAR; g_testCount++) { - /* (re)initialize thread signal sets */ - ret = sigemptyset(&(tdThread.mask)); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = sigemptyset(&(tdThread.pending)); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&child, &g_scenarii[g_testCount].ta, pthread_f01, &tdThread); - switch (g_scenarii[g_testCount].result) { - case 0: /* Operation was expected to succeed */ - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - break; - - case 1: /* Operation was expected to fail */ - ICUNIT_ASSERT_NOT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - break; - - case 2: /* We did not know the expected result */ - default: - break; - } - if (ret == 0) { /* The new thread is running */ - if (g_scenarii[g_testCount].detached == 0) { - ret = pthread_join(child, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } else { - /* Just wait for the thread to terminate */ - do { - ret = sem_wait(&g_scenarii[g_testCount].sem); - } while ((ret == -1) && (errno == EINTR)); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - /* The thread has terminated its work, so we can now control */ - ret = sigismember(&(tdThread.mask), SIGUSR1); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - - ret = sigismember(&(tdThread.mask), SIGUSR2); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - - ret = sigismember(&(tdThread.pending), SIGUSR1); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = sigismember(&(tdThread.pending), SIGUSR2); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - } - - ScenarFini(); - -#endif - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread127(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_127", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_129.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_129.cpp deleted file mode 100644 index 6b69c1bc..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_129.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - pthread_exit(0); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_NO_ERROR, errno, EXIT); - - ret = pthread_join(newTh, NULL); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_NO_ERROR, errno, EXIT); - - return PTHREAD_NO_ERROR; - -EXIT: - pthread_join(newTh, NULL); - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread129(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_129", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_132.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_132.cpp deleted file mode 100644 index f8cdc66c..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_132.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - g_newTh = pthread_self(); - - pthread_exit(0); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh1; - INT32 ret = 0; - - ret = pthread_create(&newTh1, NULL, pthread_f01, NULL); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_NO_ERROR, ret, EXIT); - - ret = pthread_join(newTh1, NULL); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_NO_ERROR, ret, EXIT); - - ret = pthread_equal(newTh1, g_newTh); - ICUNIT_GOTO_EQUAL(ret, 1, errno, EXIT); - - ret = pthread_equal(newTh1, TestPthreadSelf()); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_NO_ERROR, ret, EXIT); - - return PTHREAD_NO_ERROR; -EXIT: - pthread_detach(g_newTh); - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread132(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_132", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_133.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_133.cpp deleted file mode 100644 index 06cc1295..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_133.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - pthread_exit(0); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_equal(newTh, newTh); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - - - -VOID ItPosixPthread133(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_133", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_134.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_134.cpp deleted file mode 100644 index 2054481c..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_134.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - pthread_exit(0); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh1, newTh2; - INT32 ret = 0; - - ret = pthread_create(&newTh1, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&newTh2, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_equal(newTh1, newTh2); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh2, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread134(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_134", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_136.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_136.cpp deleted file mode 100644 index 284c4250..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_136.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - INT32 i; - - printf("Wait for 3 seconds for thread to finish execution:\n"); - for (i = 1; i < 4; i++) { - printf("Waited (%d) second\n", i); - sleep(1); - } - - g_testCount = 1; - - pthread_exit(0); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret = 0; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - return PTHREAD_NO_ERROR; -} - - - -VOID ItPosixPthread136(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_136", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_138.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_138.cpp deleted file mode 100644 index b41056a3..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_138.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - g_pthreadSem = PTHREAD_INMAIN_TEST; - pthread_exit(PTHREAD_EXIT_VALUE); - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - VOID *valuePtr; - INT32 ret = 0; - - valuePtr = 0; - g_pthreadSem = PTHREAD_INTHREAD_TEST; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* Make sure the thread was created before we join it. */ - while (g_pthreadSem == PTHREAD_INTHREAD_TEST) - sleep(1); - - ret = pthread_join(newTh, &valuePtr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* - * Check to make sure that 'value_ptr' that was passed to - * pthread_join() and the pthread_exit() return code that - * was used in the thread funciton are the same. - */ - ICUNIT_ASSERT_EQUAL(valuePtr, PTHREAD_EXIT_VALUE, errno); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread138(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_138", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_141.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_141.cpp deleted file mode 100644 index 3157ff5d..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_141.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - pthread_exit(0); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - - -VOID ItPosixPthread141(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_141", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_142.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_142.cpp deleted file mode 100644 index cc46f118..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_142.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - pthread_exit(0); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread142(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_142", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_144.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_144.cpp deleted file mode 100644 index e3439635..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_144.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - INT32 ret = 0; - - ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* If the thread wasn't canceled in 10 seconds, time out */ - LosTaskDelay(3); - - pthread_exit(0); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_attr_t newAttr; - pthread_t newTh; - INT32 ret; - - ret = pthread_attr_init(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_setdetachstate(&newAttr, PTHREAD_CREATE_JOINABLE); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&newTh, &newAttr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_detach(newTh); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = LosTaskDelay(2); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread144(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_144", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_152.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_152.cpp deleted file mode 100644 index d45a0bb6..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_152.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_attr_t newAttr; - INT32 detachState, ret = 0; - ; - - /* Initialize attribute */ - ret = pthread_attr_init(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* The test passes if the attribute object has a detachstate of - * PTHREAD_CREATE_JOINABLE, which is the default value for this - * attribute. */ - ret = pthread_attr_getdetachstate(&newAttr, &detachState); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(detachState, PTHREAD_CREATE_JOINABLE, detachState); - - ret = pthread_attr_destroy(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - return 0; -} - - -VOID ItPosixPthread152(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_152", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_154.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_154.cpp deleted file mode 100644 index f30be159..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_154.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - pthread_exit(NULL); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newThreads[PTHREAD_THREADS_NUM]; - pthread_attr_t newAttr; - INT32 i, ret; - - ret = pthread_attr_init(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - for (i = 0; i < PTHREAD_THREADS_NUM; i++) { - ret = pthread_create(&newThreads[i], &newAttr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - for (i = 0; i < PTHREAD_THREADS_NUM; i++) { - ret = pthread_join(newThreads[i], NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread154(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_154", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_166.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_166.cpp deleted file mode 100644 index c64f4734..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_166.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - pthread_exit(0); - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - pthread_attr_t newAttr; - INT32 ret; - - /* Initialize attribute */ - ret = pthread_attr_init(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* Destroy attribute */ - ret = pthread_attr_destroy(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* Creating a thread, passing to it the destroyed attribute, should - * result in an error value of EINVAL (invalid 'attr' value). */ - ret = pthread_create(&newTh, &newAttr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread166(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_166", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_167.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_167.cpp deleted file mode 100644 index 1dbcca34..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_167.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_attr_t newAttr; - INT32 ret = PTHREAD_NO_ERROR; - - ret = pthread_attr_init(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_destroy(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_init(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_destroy(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread167(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_167", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_173.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_173.cpp deleted file mode 100644 index 852313bd..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_173.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_attr_t newAttr; - INT32 detachState, ret = PTHREAD_NO_ERROR; - - /* Initialize attribute */ - ret = pthread_attr_init(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* The test passes if pthread_attr_getdetachstate gets the attribute - * of PTHREAD_CREATE_JOINABLE from the attribute object. */ - ret = pthread_attr_getdetachstate(&newAttr, &detachState); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(detachState, PTHREAD_CREATE_JOINABLE, detachState); - - ret = pthread_attr_destroy(&newAttr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread173(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_173", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_175.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_175.cpp deleted file mode 100644 index c0dd0fe9..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_175.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - pthread_exit(PTHREAD_EXIT_VALUE); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - pthread_attr_t attr; - INT32 cscope; - INT32 ret; - - g_pthreadScopeValue = PTHREAD_SCOPE_PROCESS; - - /* Initialize attr */ - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, errno); - - ret = pthread_attr_setscope(&attr, g_pthreadScopeValue); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, errno); - - ret = pthread_create(&newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, errno); - - ret = pthread_attr_getscope(&attr, &cscope); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, errno); - ICUNIT_ASSERT_EQUAL(cscope, g_pthreadScopeValue, cscope); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, errno); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, errno); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread175(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_175", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_176.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_176.cpp deleted file mode 100644 index f35df3cb..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_176.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - pthread_attr_t attr; - - g_pthreadScopeValue = 999; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_setscope(&attr, g_pthreadScopeValue); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, errno); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread176(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_176", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_177.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_177.cpp deleted file mode 100644 index 1b162b14..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_177.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = PTHREAD_NO_ERROR; - INT32 rc2; - pthread_attr_t attr; - INT32 scope; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_getscope(&attr, &scope); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(scope, PTHREAD_SCOPE_PROCESS, scope); - - g_pthreadScopeValue = PTHREAD_SCOPE_SYSTEM; - ret = pthread_attr_setscope(&attr, g_pthreadScopeValue); - ICUNIT_ASSERT_EQUAL(ret, ENOTSUP, ret); - - ret = pthread_attr_getscope(&attr, &scope); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(scope, PTHREAD_SCOPE_PROCESS, scope); - - g_pthreadScopeValue = PTHREAD_SCOPE_PROCESS; - ret = pthread_attr_setscope(&attr, g_pthreadScopeValue); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_getscope(&attr, &scope); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(scope, PTHREAD_SCOPE_PROCESS, scope); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread177(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_177", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_182.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_182.cpp deleted file mode 100644 index af4b67cf..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_182.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - - -static VOID *pthread_f01(void *tmp) -{ - struct sched_param param; - INT32 policy; - INT32 ret = PTHREAD_NO_ERROR; - - TestExtraTaskDelay(2); - LosTaskDelay(1); - - ret = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - if (policy == g_pthreadSchedPolicy) { - g_testCount = 1; - } - if (param.sched_priority == PTHREAD_PRIORITY_TEST) { - g_testCount--; - } - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_attr_t attr; - pthread_t threadId; - struct sched_param param; - INT32 ret = PTHREAD_NO_ERROR; - - g_pthreadSchedPolicy = SCHED_RR; - g_pthreadSchedInherit = PTHREAD_INHERIT_SCHED; - g_testCount = 0; - - param.sched_priority = PTHREAD_PRIORITY_TEST; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_setinheritsched(&attr, g_pthreadSchedInherit); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&threadId, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_setschedparam(threadId, g_pthreadSchedPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(threadId, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 0, g_testCount); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread182(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_182", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_185.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_185.cpp deleted file mode 100644 index 8f50e8f7..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_185.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - INT32 ret = PTHREAD_NO_ERROR; - INT32 inheritsched; - pthread_attr_t attr; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSchedInherit = PTHREAD_INHERIT_SCHED; - ret = pthread_attr_setinheritsched(&attr, g_pthreadSchedInherit); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_getinheritsched(&attr, &inheritsched); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(inheritsched, g_pthreadSchedInherit, inheritsched); - - g_pthreadSchedInherit = PTHREAD_EXPLICIT_SCHED; - ret = pthread_attr_setinheritsched(&attr, g_pthreadSchedInherit); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_getinheritsched(&attr, &inheritsched); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(inheritsched, g_pthreadSchedInherit, inheritsched); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread185(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_185", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_186.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_186.cpp deleted file mode 100644 index c20fef28..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_186.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *data) -{ - pthread_t self; - struct sched_param schedparam; - struct params *paramTest = (struct params *)data; - INT32 policy; - INT32 ret; - - self = pthread_self(); - ret = pthread_getschedparam(self, &policy, &schedparam); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_TRACK_EQUAL(policy, paramTest->policy, policy); - ICUNIT_TRACK_EQUAL(schedparam.sched_priority, 10, schedparam.sched_priority); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - struct params paramTest; - pthread_t thread; - pthread_attr_t attr; - VOID *status; - struct sched_param schedparam; - - paramTest.policy = SCHED_OTHER; - paramTest.priority = PRIORITY_OTHER; - paramTest.policy_label = "SCHED_OTHER"; - paramTest.status = PTHREAD_NO_ERROR; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSchedPolicy = SCHED_OTHER; - ret = pthread_attr_setschedpolicy(&attr, g_pthreadSchedPolicy); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - g_pthreadSchedInherit = PTHREAD_EXPLICIT_SCHED; - ret = pthread_attr_setinheritsched(&attr, g_pthreadSchedInherit); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - schedparam.sched_priority = paramTest.priority; - ret = pthread_attr_setschedparam(&attr, &schedparam); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - schedparam.sched_priority = 10; - ret = pthread_attr_setschedparam(&attr, &schedparam); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - paramTest.policy = SCHED_RR; - ret = pthread_create(&thread, &attr, pthread_f01, ¶mTest); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(thread, &status); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread186(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_186", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_187.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_187.cpp deleted file mode 100644 index bacfa73c..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_187.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *data) -{ - pthread_t self; - struct sched_param schedparam; - struct params *paramTest = (struct params *)data; - INT32 policy; - INT32 ret; - - self = pthread_self(); - ret = pthread_getschedparam(self, &policy, &schedparam); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_TRACK_EQUAL(policy, SCHED_FIFO, policy); - ICUNIT_TRACK_EQUAL(paramTest->priority, PRIORITY_FIFO, paramTest->priority); - ICUNIT_TRACK_EQUAL(schedparam.sched_priority, paramTest->priority, schedparam.sched_priority); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - struct params paramTest; - pthread_t thread; - pthread_attr_t attr; - VOID *status; - struct sched_param schedparam; - - paramTest.policy = SCHED_FIFO; - paramTest.priority = PRIORITY_FIFO; - paramTest.policy_label = "SCHED_FIFO"; - paramTest.status = LOS_NOK; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSchedPolicy = SCHED_FIFO; - ret = pthread_attr_setschedpolicy(&attr, g_pthreadSchedPolicy); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - g_pthreadSchedInherit = PTHREAD_EXPLICIT_SCHED; - ret = pthread_attr_setinheritsched(&attr, g_pthreadSchedInherit); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - schedparam.sched_priority = paramTest.priority; - ret = pthread_attr_setschedparam(&attr, &schedparam); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&thread, &attr, pthread_f01, ¶mTest); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(thread, &status); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread187(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_187", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_188.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_188.cpp deleted file mode 100644 index bc0c49eb..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_188.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *data) -{ - pthread_t self; - struct sched_param schedparam; - struct params *paramTest = (struct params *)data; - INT32 policy; - INT32 ret; - - self = pthread_self(); - ret = pthread_getschedparam(self, &policy, &schedparam); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_TRACK_EQUAL(policy, paramTest->policy, policy); - ICUNIT_TRACK_EQUAL(paramTest->priority, PRIORITY_RR, paramTest->priority); - ICUNIT_TRACK_EQUAL(schedparam.sched_priority, paramTest->priority, schedparam.sched_priority); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret; - struct params paramTest; - pthread_t thread; - pthread_attr_t attr; - VOID *status; - struct sched_param schedparam; - - paramTest.policy = SCHED_RR; - paramTest.priority = PRIORITY_RR; - paramTest.policy_label = "SCHED_RR"; - paramTest.status = PTHREAD_NO_ERROR; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSchedPolicy = SCHED_OTHER; - ret = pthread_attr_setschedpolicy(&attr, g_pthreadSchedPolicy); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - g_pthreadSchedPolicy = SCHED_RR; - ret = pthread_attr_setschedpolicy(&attr, g_pthreadSchedPolicy); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSchedInherit = PTHREAD_EXPLICIT_SCHED; - ret = pthread_attr_setinheritsched(&attr, g_pthreadSchedInherit); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - schedparam.sched_priority = paramTest.priority; - if (paramTest.priority != PRIORITY_OTHER) { - ret = pthread_attr_setschedparam(&attr, &schedparam); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - ret = pthread_create(&thread, &attr, pthread_f01, ¶mTest); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(thread, &status); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread188(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_188", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_193.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_193.cpp deleted file mode 100644 index 1bc2b059..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_193.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - LosTaskDelay(1); - - g_testCount = 1; - - pthread_exit(PTHREAD_NO_ERROR); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t thread; - pthread_attr_t attr; - INT32 ret = PTHREAD_NO_ERROR; - struct sched_param param; - INT32 priority = 31; - - g_testCount = 0; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSchedPolicy = SCHED_OTHER; - ret = pthread_attr_setschedpolicy(&attr, g_pthreadSchedPolicy); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - g_pthreadSchedPolicy = -1; - priority = sched_get_priority_max(g_pthreadSchedPolicy); - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - g_pthreadSchedPolicy = 4; - priority = sched_get_priority_max(g_pthreadSchedPolicy); - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - g_pthreadSchedPolicy = SCHED_OTHER; - priority = sched_get_priority_max(g_pthreadSchedPolicy); - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - priority = 31; - param.sched_priority = priority + 1; - ret = pthread_attr_setschedparam(&attr, ¶m); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_create(&thread, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(thread, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread193(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_193", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_194.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_194.cpp deleted file mode 100644 index e8b012ac..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_194.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - g_testCount = 1; - - pthread_exit(PTHREAD_NO_ERROR); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t thread; - pthread_attr_t attr; - INT32 ret = PTHREAD_NO_ERROR; - struct sched_param param; - INT32 priority; - - g_testCount = 0; - - /* use delay to reset timelsice to prevent created task get - to run before expected */ - LosTaskDelay(1); - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSchedPolicy = SCHED_RR; - ret = pthread_attr_setschedpolicy(&attr, g_pthreadSchedPolicy); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - priority = sched_get_priority_max(g_pthreadSchedPolicy); - ICUNIT_ASSERT_NOT_EQUAL(priority, -1, priority); - - param.sched_priority = priority; - ret = pthread_attr_setschedparam(&attr, ¶m); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&thread, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(thread, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread194(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_194", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_200.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_200.cpp deleted file mode 100644 index 71afbaa6..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_200.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *arg) -{ - pthread_exit(PTHREAD_NO_ERROR); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - pthread_attr_t attr; - size_t stackSize = PTHREAD_STACK_MIN; - size_t ssize; - INT32 ret; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_getstacksize(&attr, &ssize); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(ssize, 0x20000, ssize); - - ret = pthread_attr_setstacksize(&attr, stackSize); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_getstacksize(&attr, &ssize); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(ssize, stackSize, ssize); - - ret = pthread_create(&newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread200(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_200", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_203.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_203.cpp deleted file mode 100644 index ba8e7f39..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_203.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static int Testcase(void) -{ - int ret; - - ret = pthread_setconcurrency(0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_getconcurrency(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_setconcurrency(-1); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_setconcurrency(1); - ICUNIT_ASSERT_EQUAL(ret, EAGAIN, ret); - - return 0; -} - -VOID ItPosixPthread203(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_203", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_204.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_204.cpp deleted file mode 100644 index 91962e00..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_204.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - struct sched_param sparam; - INT32 priority, policy; - INT32 ret; - - g_pthreadSchedPolicy = SCHED_RR; - -#ifdef LOSCFG_KERNEL_TICKLESS - priority = sched_get_priority_max(g_pthreadSchedPolicy) - 1; -#else - priority = sched_get_priority_max(g_pthreadSchedPolicy); -#endif - - sparam.sched_priority = priority; - - ret = pthread_setschedparam(pthread_self(), g_pthreadSchedPolicy, &sparam); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_getschedparam(pthread_self(), &policy, &sparam); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_TRACK_EQUAL(policy, g_pthreadSchedPolicy, policy); - ICUNIT_TRACK_EQUAL(sparam.sched_priority, priority, sparam.sched_priority); - - pthread_exit(0); - - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret = PTHREAD_NO_ERROR; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - - -VOID ItPosixPthread204(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_204", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_205.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_205.cpp deleted file mode 100644 index fbb96e56..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_205.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *arg) -{ - INT32 ret = 0; - INT32 policy; - INT32 priority; - struct sched_param schedparam; - - LosTaskDelay(2); - -#ifdef LOSCFG_KERNEL_TICKLESS - priority = sched_get_priority_max(SCHED_RR) - 1; -#else - priority = sched_get_priority_max(SCHED_RR); // priority = 31 -#endif - - ret = pthread_getschedparam(pthread_self(), &policy, &schedparam); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_TRACK_EQUAL(policy, SCHED_RR, policy); - ICUNIT_TRACK_EQUAL(schedparam.sched_priority, priority, schedparam.sched_priority); - - return NULL; -} - -static VOID *pthread_f02(VOID *arg) -{ - INT32 ret = 0; - struct sched_param schedparam; -#ifdef LOSCFG_KERNEL_TICKLESS - schedparam.sched_priority = sched_get_priority_max(SCHED_RR) - 1; - ICUNIT_TRACK_EQUAL(schedparam.sched_priority, OS_TASK_PRIORITY_LOWEST - 1, schedparam.sched_priority); -#else - schedparam.sched_priority = sched_get_priority_max(SCHED_RR); // priority = 31 - ICUNIT_TRACK_EQUAL(schedparam.sched_priority, OS_TASK_PRIORITY_LOWEST, schedparam.sched_priority); -#endif - - ret = pthread_setschedparam(*(pthread_t *)arg, SCHED_RR, &schedparam); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - pthread_t newTh1, newTh2; - pthread_attr_t attr; - INT32 bar; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSchedInherit = PTHREAD_EXPLICIT_SCHED; - ret = pthread_attr_setinheritsched(&attr, g_pthreadSchedInherit); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - LOS_TaskLock(); - ret = pthread_create(&newTh1, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&newTh2, &attr, pthread_f02, &newTh1); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - LOS_TaskUnlock(); - - ret = pthread_join(newTh2, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh1, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread205(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_205", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_206.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_206.cpp deleted file mode 100644 index 9718f8a8..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_206.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *pthread_f01(void *arg) -{ - INT32 ret = 0; - INT32 policy; - struct sched_param schedparam; - struct sched_param schedparam1; - - g_pthreadSchedPolicy = SCHED_RR; - - schedparam.sched_priority = sched_get_priority_min(g_pthreadSchedPolicy); - - ret = pthread_setschedparam(pthread_self(), g_pthreadSchedPolicy, &schedparam); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - policy = SCHED_RR; - ret = pthread_getschedparam(pthread_self(), &policy, &schedparam1); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_TRACK_EQUAL(policy, g_pthreadSchedPolicy, policy); - ICUNIT_TRACK_EQUAL(schedparam1.sched_priority, schedparam.sched_priority, schedparam1.sched_priority); - - /* Now set the priority to an invalid value. */ - schedparam.sched_priority++; - - ret = pthread_setschedparam(pthread_self(), SCHED_RR, &schedparam); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - policy = SCHED_RR; - ret = pthread_getschedparam(pthread_self(), &policy, &schedparam1); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_TRACK_EQUAL(policy, g_pthreadSchedPolicy, policy); - ICUNIT_TRACK_EQUAL(schedparam1.sched_priority, schedparam.sched_priority, schedparam1.sched_priority); - - return NULL; -} - -static UINT32 Testcase(VOID) -{ - INT32 ret = 0; - pthread_attr_t attr; - pthread_t newTh1; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSchedInherit = PTHREAD_EXPLICIT_SCHED; - ret = pthread_attr_setinheritsched(&attr, g_pthreadSchedInherit); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&newTh1, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh1, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread206(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_206", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_209.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_209.cpp deleted file mode 100644 index 4286ca9a..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_209.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - struct sched_param sparam; - INT32 policy, priority; - INT32 ret; - - g_pthreadSchedPolicy = SCHED_RR; - -#ifdef LOSCFG_KERNEL_TICKLESS - priority = sched_get_priority_max(g_pthreadSchedPolicy) - 1; -#else - priority = sched_get_priority_max(g_pthreadSchedPolicy); -#endif - - sparam.sched_priority = priority; - - ret = pthread_setschedparam(pthread_self(), g_pthreadSchedPolicy, &sparam); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_getschedparam(pthread_self(), &policy, &sparam); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_TRACK_EQUAL(policy, g_pthreadSchedPolicy, policy); - -#ifdef LOSCFG_KERNEL_TICKLESS - ICUNIT_TRACK_EQUAL(sparam.sched_priority, USER_PROCESS_PRIORITY_LOWEST - 1, sparam.sched_priority); -#else - ICUNIT_TRACK_EQUAL(sparam.sched_priority, USER_PROCESS_PRIORITY_LOWEST, sparam.sched_priority); -#endif - - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - pthread_attr_t attr; - INT32 ret; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSchedInherit = PTHREAD_EXPLICIT_SCHED; - ret = pthread_attr_setinheritsched(&attr, g_pthreadSchedInherit); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&newTh, &attr, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread209(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_209", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_213.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_213.cpp deleted file mode 100644 index b45d167a..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_213.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID pthread_f02(VOID) -{ - INT32 ret = 0; - ret = pthread_mutex_lock(&g_pthreadMutexTest1); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_testCount++; - - ret = pthread_mutex_unlock(&g_pthreadMutexTest1); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return; -} - -static VOID *pthread_f01(VOID *arg) -{ - INT32 ret; - - ret = pthread_once((pthread_once_t *)arg, pthread_f02); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - INT32 ret, i; - - pthread_once_t myctl[PTHREAD_THREADS_NUM] = {PTHREAD_ONCE_INIT, }; - - pthread_t th[PTHREAD_THREADS_NUM]; - - g_pthreadMutexTest1 = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; - - g_testCount = 0; - - for (i = 0; i < PTHREAD_THREADS_NUM; i++) { - ret = pthread_create(&th[i], NULL, pthread_f01, &myctl[i]); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - for (i = 0; i < PTHREAD_THREADS_NUM; i++) { - ret = pthread_join(th[i], NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - ret = pthread_mutex_lock(&g_pthreadMutexTest1); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ICUNIT_ASSERT_EQUAL(g_testCount, 3, g_testCount); - - ret = pthread_mutex_unlock(&g_pthreadMutexTest1); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread213(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_213", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_217.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_217.cpp deleted file mode 100644 index e88bc1fa..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_217.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - INT32 i, ret = 0; - const INT32 keyValue = 0; - VOID *specific; - - for (i = 0; i < PTHREAD_KEY_NUM; i++) { - ret = pthread_key_create(&g_pthreadKeyTest[i], NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_setspecific(g_pthreadKeyTest[i], (VOID *)(long)(i + keyValue)); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - for (i = 0; i < PTHREAD_KEY_NUM; ++i) { - specific = pthread_getspecific(g_pthreadKeyTest[i]); - ICUNIT_ASSERT_EQUAL(specific, (VOID *)(long)(i + keyValue), specific); - - ret = pthread_key_delete(g_pthreadKeyTest[i]); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread217(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_217", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_218.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_218.cpp deleted file mode 100644 index 0858a627..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_218.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - INT32 ret = 0; - const INT32 keyValue = 1000; - - ret = pthread_setspecific(g_pthreadKeyTest[g_testCount], (const void *)(keyValue)); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - pthread_exit(0); - - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - VOID *valuePtr; - INT32 ret = 0; - - g_testCount = 0; - - for (g_testCount = 0; g_testCount < PTHREAD_KEY_NUM; g_testCount++) { - ret = pthread_key_create(&g_pthreadKeyTest[g_testCount], NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - for (g_testCount = 0; g_testCount < PTHREAD_KEY_NUM; g_testCount++) { - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, &valuePtr); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(valuePtr, 0, valuePtr); - } - - for (g_testCount = 0; g_testCount < PTHREAD_KEY_NUM; g_testCount++) { - ret = pthread_key_delete(g_pthreadKeyTest[g_testCount]); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread218(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_218", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_219.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_219.cpp deleted file mode 100644 index 3a036f6d..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_219.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - pthread_key_t key; - VOID *specific; - INT32 ret = 0; - - specific = pthread_getspecific(key); - ICUNIT_ASSERT_EQUAL(specific, NULL, specific); - - ret = pthread_key_create(&key, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - specific = pthread_getspecific(key); - ICUNIT_ASSERT_EQUAL(specific, NULL, specific); - - ret = pthread_key_delete(key); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread219(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_219", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_221.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_221.cpp deleted file mode 100644 index cb7a065b..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_221.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - INT32 i, ret; - pthread_key_t keysMax[PTHREAD_KEYS_MAX]; - - for (i = 0; i < PTHREAD_KEYS_MAX; i++) { - ret = pthread_key_create(&keysMax[i], NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - for (i = 0; i < PTHREAD_KEYS_MAX; i++) { - ret = pthread_key_delete(keysMax[i]); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread221(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_221", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_224.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_224.cpp deleted file mode 100644 index aa63d7cf..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_224.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID pthread_f02(VOID *p) -{ - INT32 ret = 0; - - g_testCount++; - - ret = pthread_key_delete(g_key); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); -} - -static VOID *pthread_f01(VOID *argument) -{ - INT32 ret = 0; - const INT32 keyValue = 1000; - - ret = pthread_setspecific(g_key, (void *)(keyValue)); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - pthread_exit(0); - - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret = 0; - - g_testCount = 0; - - - ret = pthread_key_create(&g_key, pthread_f02); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread224(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_224", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_226.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_226.cpp deleted file mode 100644 index 1393d6b8..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_226.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static const INT32 key_value1 = 100; -static const INT32 key_value2 = 200; - -static VOID *g_specific1; -static VOID *g_specific2; - -static VOID *pthread_f01(VOID *argument) -{ - INT32 ret = 0; - - /* Bind a value to key for this thread (this will be different from the value - * that we bind for the main thread) */ - ret = pthread_setspecific(g_key, (void *)(key_value2)); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - /* Get the bound value of the key that we just set. */ - g_specific2 = pthread_getspecific(g_key); - - pthread_exit(0); - - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret = 0; - - ret = pthread_key_create(&g_key, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_setspecific(g_key, (void *)(key_value1)); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_specific1 = pthread_getspecific(g_key); - - ICUNIT_ASSERT_EQUAL(g_specific1, (void *)(key_value1), g_specific1); - ICUNIT_ASSERT_EQUAL(g_specific2, (void *)(key_value2), g_specific2); - - ret = pthread_key_delete(g_key); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread226(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_226", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_233.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_233.cpp deleted file mode 100644 index b552fdb1..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_233.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID pthread_f02(VOID *tmp) -{ - g_testCount = 1; -} - -static VOID *pthread_f01(VOID *tmp) -{ - pthread_key_t key; - INT32 value = 1; - INT32 ret = 0; - - ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_key_create(&key, pthread_f02); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_setspecific(key, &value); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSem = 1; - - while (1) - sleep(5); - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret = 0; - - g_testCount = 0; - g_pthreadSem = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - while (g_pthreadSem == 0) - sleep(1); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_key_delete(g_key); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread233(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_233", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_238.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_238.cpp deleted file mode 100644 index 1de43f21..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_238.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - INT32 ret = 0; - - ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_testCount = 1; - - g_pthreadSem = PTHREAD_INMAIN_TEST; - - while (g_pthreadSem == PTHREAD_INMAIN_TEST) - sleep(1); - - pthread_testcancel(); - - g_testCount = -1; - pthread_exit(0); - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret = 0; - - g_pthreadSem = PTHREAD_INTHREAD_TEST; - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - while (g_pthreadSem == PTHREAD_INTHREAD_TEST) - sleep(1); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSem = PTHREAD_INTHREAD_TEST; - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread238(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_238", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_239.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_239.cpp deleted file mode 100644 index db32e99f..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_239.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - INT32 ret = 0; - - ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_testCount = -1; - - g_pthreadSem = PTHREAD_INMAIN_TEST; - - while (g_pthreadSem == PTHREAD_INMAIN_TEST) - sleep(1); - - pthread_testcancel(); - - g_testCount = 1; - pthread_exit(0); - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret = 0; - - g_pthreadSem = PTHREAD_INTHREAD_TEST; - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - while (g_pthreadSem == PTHREAD_INTHREAD_TEST) - sleep(1); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSem = PTHREAD_INTHREAD_TEST; - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread239(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_239", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_240.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_240.cpp deleted file mode 100644 index b35e1677..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_240.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - INT32 ret = 0; - - ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_testCount = 1; - - g_pthreadSem = PTHREAD_INMAIN_TEST; - - while (g_pthreadSem == PTHREAD_INMAIN_TEST) - sleep(1); - - pthread_testcancel(); - - g_testCount = -1; - - pthread_exit(0); - return NULL; -} - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret = 0; - - g_pthreadSem = PTHREAD_INTHREAD_TEST; - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - while (g_pthreadSem == PTHREAD_INTHREAD_TEST) - sleep(1); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - g_pthreadSem = PTHREAD_INTHREAD_TEST; - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread240(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_240", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_241.cpp b/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_241.cpp deleted file mode 100644 index 62395de1..00000000 --- a/testsuites/unittest_old/posix/pthread/full/It_posix_pthread_241.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(VOID *argument) -{ - INT32 ret = 0; - - g_testCount++; - - ret = pthread_setcancelstate(-100, NULL); - ICUNIT_TRACK_EQUAL(ret, EINVAL, ret); - - pthread_exit(0); - - return NULL; -} - - -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - INT32 ret = 0; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, pthread_f01, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - return PTHREAD_NO_ERROR; -} - - -VOID ItPosixPthread241(VOID) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_241", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/posix_pthread_test.cpp b/testsuites/unittest_old/posix/pthread/posix_pthread_test.cpp deleted file mode 100644 index 3e490035..00000000 --- a/testsuites/unittest_old/posix/pthread/posix_pthread_test.cpp +++ /dev/null @@ -1,1425 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - - -#include "It_posix_pthread.h" - -pthread_key_t g_key; -pthread_key_t g_key1; -pthread_key_t g_key2; -pthread_key_t g_pthreadKeyTest[PTHREAD_KEY_NUM]; -pthread_t g_newTh; -pthread_t g_newTh2; -UINT32 g_taskMaxNum = LOSCFG_BASE_CORE_TSK_CONFIG; -pthread_once_t g_onceControl = PTHREAD_ONCE_INIT; -pthread_cond_t g_pthreadCondTest1 = PTHREAD_COND_INITIALIZER; -pthread_mutex_t g_pthreadMutexTest1 = PTHREAD_MUTEX_INITIALIZER; -pthread_mutex_t g_pthreadMutexTest2 = PTHREAD_MUTEX_INITIALIZER; -INT32 g_startNum = 0; -INT32 g_wakenNum = 0; -INT32 g_t1Start = 0; -INT32 g_signaled = 0; -INT32 g_wokenUp = -1; -INT32 g_lowDone = -1; -INT32 g_pthreadSem = 0; /* Manual semaphore */ -INT32 g_pthreadScopeValue = 0; -INT32 g_pthreadSchedInherit = 0; -INT32 g_pthreadSchedPolicy = 0; -struct testdata g_td; - -sem_t g_pthreadSem1; -sem_t g_pthreadSem2; - -__scenario g_scenarii[] = { - CASE_POS(0, 0, 0, 0, 0, 0, 0, 0, (char *)"default"), - CASE_POS(1, 0, 0, 0, 0, 0, 0, 0, (char *)"detached"), - CASE_POS(0, 1, 0, 0, 0, 0, 0, 0, (char *)"Explicit sched"), - CASE_UNK(0, 0, 1, 0, 0, 0, 0, 0, (char *)"FIFO Policy"), - CASE_UNK(0, 0, 2, 0, 0, 0, 0, 0, (char *)"RR Policy"), - CASE_UNK(0, 0, 0, 1, 0, 0, 0, 0, (char *)"Max sched param"), - CASE_UNK(0, 0, 0, -1, 0, 0, 0, 0, (char *)"Min sched param"), - CASE_POS(0, 0, 0, 0, 1, 0, 0, 0, (char *)"Alternative contension scope"), - CASE_POS(0, 0, 0, 0, 0, 1, 0, 0, (char *)"Alternative stack"), - CASE_POS(0, 0, 0, 0, 0, 0, 1, 0, (char *)"No guard size"), - CASE_UNK(0, 0, 0, 0, 0, 0, 2, 0, (char *)"1p guard size"), - CASE_POS(0, 0, 0, 0, 0, 0, 0, 1, (char *)"Min stack size"), - /* Stack play */ - CASE_POS(0, 0, 0, 0, 0, 0, 1, 1, (char *)"Min stack size, no guard"), - CASE_UNK(0, 0, 0, 0, 0, 0, 2, 1, (char *)"Min stack size, 1p guard"), - CASE_POS(1, 0, 0, 0, 0, 1, 0, 0, (char *)"Detached, Alternative stack"), - CASE_POS(1, 0, 0, 0, 0, 0, 1, 1, (char *)"Detached, Min stack size, no guard"), - CASE_UNK(1, 0, 0, 0, 0, 0, 2, 1, (char *)"Detached, Min stack size, 1p guard"), -}; - -pthread_t g_pthreadTestTh; - -VOID ScenarInit(VOID) -{ - INT32 ret = 0; - UINT32 i; - INT32 old; - long pagesize, minstacksize; - long tsa, tss, tps; - - pagesize = sysconf(_SC_PAGESIZE); - minstacksize = sysconf(_SC_THREAD_STACK_MIN); - tsa = sysconf(_SC_THREAD_ATTR_STACKADDR); - tss = sysconf(_SC_THREAD_ATTR_STACKSIZE); - tps = sysconf(_SC_THREAD_PRIORITY_SCHEDULING); - - if (minstacksize % pagesize) - ICUNIT_ASSERT_EQUAL_VOID(1, 0, errno); - - for (i = 0; i < NSCENAR; i++) { - ret = pthread_attr_init(&g_scenarii[i].ta); - ICUNIT_ASSERT_EQUAL_VOID(ret, PTHREAD_NO_ERROR, ret); - - if (g_scenarii[i].detached == 1) { - ret = pthread_attr_setdetachstate(&g_scenarii[i].ta, PTHREAD_CREATE_DETACHED); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_getdetachstate(&g_scenarii[i].ta, &old); - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - ICUNIT_TRACK_EQUAL(old, PTHREAD_CREATE_JOINABLE, old); - } - - /* Sched related attributes */ - /* - * This routine is dependent on the Thread Execution - * Scheduling option - */ - if (tps > 0) { - if (g_scenarii[i].explicitsched == 1) - ret = pthread_attr_setinheritsched(&g_scenarii[i].ta, PTHREAD_EXPLICIT_SCHED); - else - ret = pthread_attr_setinheritsched(&g_scenarii[i].ta, PTHREAD_INHERIT_SCHED); - - ICUNIT_TRACK_EQUAL(ret, PTHREAD_NO_ERROR, ret); - } - - if (tps > 0) { - if (g_scenarii[i].schedpolicy == 1) - ret = pthread_attr_setschedpolicy(&g_scenarii[i].ta, SCHED_FIFO); - if (g_scenarii[i].schedpolicy == 2) - ret = pthread_attr_setschedpolicy(&g_scenarii[i].ta, SCHED_RR); - ICUNIT_ASSERT_EQUAL_VOID(ret, PTHREAD_NO_ERROR, ret); - - if (g_scenarii[i].schedparam != 0) { - struct sched_param sp; - - ret = pthread_attr_getschedpolicy(&g_scenarii[i].ta, &old); - ICUNIT_ASSERT_EQUAL_VOID(ret, PTHREAD_NO_ERROR, ret); - - if (g_scenarii[i].schedparam == 1) - sp.sched_priority = sched_get_priority_min(old); - if (g_scenarii[i].schedparam == -1) - sp.sched_priority = sched_get_priority_max(old); - - ret = pthread_attr_setschedparam(&g_scenarii[i].ta, &sp); - ICUNIT_ASSERT_EQUAL_VOID(ret, PTHREAD_NO_ERROR, ret); - } - - if (tps > 0) { - ret = pthread_attr_getscope(&g_scenarii[i].ta, &old); - ICUNIT_ASSERT_EQUAL_VOID(ret, PTHREAD_NO_ERROR, ret); - - if (g_scenarii[i].altscope != 0) { - if (old == PTHREAD_SCOPE_PROCESS) - old = PTHREAD_SCOPE_SYSTEM; - else - old = PTHREAD_SCOPE_PROCESS; - - ret = pthread_attr_setscope(&g_scenarii[i].ta, old); - } - } - - if ((tss > 0) && (tsa > 0)) { - if (g_scenarii[i].altstack != 0) { - g_scenarii[i].bottom = malloc(minstacksize + pagesize); - ICUNIT_TRACK_NOT_EQUAL(g_scenarii[i].bottom, NULL, g_scenarii[i].bottom); - } - } - - - if (tss > 0) { - if (g_scenarii[i].altsize != 0) { - ret = pthread_attr_setstacksize(&g_scenarii[i].ta, minstacksize); - ICUNIT_ASSERT_EQUAL_VOID(ret, PTHREAD_NO_ERROR, ret); - } - } - - ret = sem_init(&g_scenarii[i].sem, 0, 0); - ICUNIT_ASSERT_EQUAL_VOID(ret, PTHREAD_NO_ERROR, ret); - } - } -} -/* - * This function will free all resources consumed - * in the scenar_init() routine - */ -VOID ScenarFini(VOID) -{ - INT32 ret = 0; - UINT32 i; - - for (i = 0; i < NSCENAR; i++) { - if (g_scenarii[i].bottom != NULL) - free(g_scenarii[i].bottom); - - ret = sem_destroy(&g_scenarii[i].sem); - ICUNIT_ASSERT_EQUAL_VOID(ret, PTHREAD_NO_ERROR, ret); - - ret = pthread_attr_destroy(&g_scenarii[i].ta); - ICUNIT_ASSERT_EQUAL_VOID(ret, PTHREAD_NO_ERROR, ret); - } -} - -/* - * return value of pthread_self() is 0 when - * pthread create from LOS_TaskCreate() - */ -pthread_t TestPthreadSelf(void) -{ - pthread_t tid = pthread_self(); - return tid; -} -UINT32 TaskCountGetTest(VOID) -{ - // not implemented - return 0; -} -using namespace testing::ext; -namespace OHOS { -class PosixPthreadTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/** - * @tc.name: IT_POSIX_PTHREAD_003 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread003, TestSize.Level0) -{ - ItPosixPthread003(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_004 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread004, TestSize.Level0) -{ - ItPosixPthread004(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_005 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread005, TestSize.Level0) -{ - ItPosixPthread005(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_006 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread006, TestSize.Level0) -{ - ItPosixPthread006(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_018 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread018, TestSize.Level0) -{ - ItPosixPthread018(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_019 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread019, TestSize.Level0) -{ - ItPosixPthread019(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_020 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread020, TestSize.Level0) -{ - ItPosixPthread020(); // pthread_key_delete -} - -/** - * @tc.name: IT_POSIX_PTHREAD_021 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread021, TestSize.Level0) -{ - ItPosixPthread021(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_022 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread022, TestSize.Level0) -{ - ItPosixPthread022(); // pthread_cancel -} - -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -/** - * @tc.name: IT_POSIX_PTHREAD_001 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread001, TestSize.Level0) -{ - ItPosixPthread001(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_002 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread002, TestSize.Level0) -{ - ItPosixPthread002(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_007 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread007, TestSize.Level0) -{ - ItPosixPthread007(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_010 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread010, TestSize.Level0) -{ - ItPosixPthread010(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_011 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread011, TestSize.Level0) -{ - ItPosixPthread011(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_013 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread013, TestSize.Level0) -{ - ItPosixPthread013(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_023 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread023, TestSize.Level0) -{ - ItPosixPthread023(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_025 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread025, TestSize.Level0) -{ - ItPosixPthread025(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_026 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread026, TestSize.Level0) -{ - ItPosixPthread026(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_027 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread027, TestSize.Level0) -{ - ItPosixPthread027(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_028 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread028, TestSize.Level0) -{ - ItPosixPthread028(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_029 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread029, TestSize.Level0) -{ - ItPosixPthread029(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_030 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread030, TestSize.Level0) -{ - ItPosixPthread030(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_031 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread031, TestSize.Level0) -{ - ItPosixPthread031(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_034 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread034, TestSize.Level0) -{ - ItPosixPthread034(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_035 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread035, TestSize.Level0) -{ - ItPosixPthread035(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_039 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread039, TestSize.Level0) -{ - ItPosixPthread039(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_040 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread040, TestSize.Level0) -{ - ItPosixPthread040(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_042 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread042, TestSize.Level0) -{ - ItPosixPthread042(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_044 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread044, TestSize.Level0) -{ - ItPosixPthread044(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_045 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread045, TestSize.Level0) -{ - ItPosixPthread045(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_046 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread046, TestSize.Level0) -{ - ItPosixPthread046(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_051 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread051, TestSize.Level0) -{ - ItPosixPthread051(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_052 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread052, TestSize.Level0) -{ - ItPosixPthread052(); // pthread_key_delete -} - -/** - * @tc.name: IT_POSIX_PTHREAD_053 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread053, TestSize.Level0) -{ - ItPosixPthread053(); // pthread_key_delete -} - -/** - * @tc.name: IT_POSIX_PTHREAD_054 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread054, TestSize.Level0) -{ - ItPosixPthread054(); // pthread_key_delete -} - -/** - * @tc.name: IT_POSIX_PTHREAD_055 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread055, TestSize.Level0) -{ - ItPosixPthread055(); // pthread_key_delete and pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_057 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread057, TestSize.Level0) -{ - ItPosixPthread057(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_059 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread059, TestSize.Level0) -{ - ItPosixPthread059(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_060 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread060, TestSize.Level0) -{ - ItPosixPthread060(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_069 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread069, TestSize.Level0) -{ - ItPosixPthread069(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_070 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread070, TestSize.Level0) -{ - ItPosixPthread070(); // bug:pthread_cond_init -} - -/** - * @tc.name: IT_POSIX_PTHREAD_071 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread071, TestSize.Level0) -{ - ItPosixPthread071(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_072 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread072, TestSize.Level0) -{ - ItPosixPthread072(); // pthread_cond_destroy doesn't fully support -} - -/** - * @tc.name: IT_POSIX_PTHREAD_073 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread073, TestSize.Level0) -{ - ItPosixPthread073(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_074 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread074, TestSize.Level0) -{ - ItPosixPthread074(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_078 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread078, TestSize.Level0) -{ - ItPosixPthread078(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_079 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread079, TestSize.Level0) -{ - ItPosixPthread079(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_080 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread080, TestSize.Level0) -{ - ItPosixPthread080(); // pthread_cond -} - -/** - * @tc.name: IT_POSIX_PTHREAD_081 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread081, TestSize.Level0) -{ - ItPosixPthread081(); // pthread_cond -} - -/** - * @tc.name: IT_POSIX_PTHREAD_082 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread082, TestSize.Level0) -{ - ItPosixPthread082(); // pthread_cond -} - -/** - * @tc.name: IT_POSIX_PTHREAD_083 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread083, TestSize.Level0) -{ - ItPosixPthread083(); // pthread_cond -} - -/** - * @tc.name: IT_POSIX_PTHREAD_084 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread084, TestSize.Level0) -{ - ItPosixPthread084(); // pthread_cond -} - -/** - * @tc.name: IT_POSIX_PTHREAD_085 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread085, TestSize.Level0) -{ - ItPosixPthread085(); // pthread_cond -} - -/** - * @tc.name: IT_POSIX_PTHREAD_087 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread087, TestSize.Level0) -{ - ItPosixPthread087(); // pthread_cond -} - -/** - * @tc.name: IT_POSIX_PTHREAD_088 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread088, TestSize.Level0) -{ - ItPosixPthread088(); // pthread_cond -} - -/** - * @tc.name: IT_POSIX_PTHREAD_089 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread089, TestSize.Level0) -{ - ItPosixPthread089(); // pthread_cond -} - -/** - * @tc.name: IT_POSIX_PTHREAD_090 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread090, TestSize.Level0) -{ - ItPosixPthread090(); // pthread_cond -} - -/** - * @tc.name: IT_POSIX_PTHREAD_092 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread092, TestSize.Level0) -{ - ItPosixPthread092(); // pthread_cond -} - -/** - * @tc.name: IT_POSIX_PTHREAD_091 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread091, TestSize.Level0) -{ - ItPosixPthread091(); // pthread_cancel -} - -#ifndef LOSCFG_USER_TEST_SMP -/** - * @tc.name: IT_POSIX_PTHREAD_094 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread094, TestSize.Level0) -{ - ItPosixPthread094(); // pthread_cancel -} -#endif - -/** - * @tc.name: IT_POSIX_PTHREAD_095 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread095, TestSize.Level0) -{ - ItPosixPthread095(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_106 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread106, TestSize.Level0) -{ - ItPosixPthread106(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_107 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread107, TestSize.Level0) -{ - ItPosixPthread107(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_116 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread116, TestSize.Level0) -{ - ItPosixPthread116(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_123 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread123, TestSize.Level0) -{ - ItPosixPthread123(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_124 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread124, TestSize.Level0) -{ - ItPosixPthread124(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_125 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread125, TestSize.Level0) -{ - ItPosixPthread125(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_127 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread127, TestSize.Level0) -{ - ItPosixPthread127(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_129 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread129, TestSize.Level0) -{ - ItPosixPthread129(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_132 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread132, TestSize.Level0) -{ - ItPosixPthread132(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_133 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread133, TestSize.Level0) -{ - ItPosixPthread133(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_134 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread134, TestSize.Level0) -{ - ItPosixPthread134(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_136 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread136, TestSize.Level0) -{ - ItPosixPthread136(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_138 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread138, TestSize.Level0) -{ - ItPosixPthread138(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_141 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread141, TestSize.Level0) -{ - ItPosixPthread141(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_142 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread142, TestSize.Level0) -{ - ItPosixPthread142(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_144 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread144, TestSize.Level0) -{ - ItPosixPthread144(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_152 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread152, TestSize.Level0) -{ - ItPosixPthread152(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_154 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread154, TestSize.Level0) -{ - ItPosixPthread154(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_166 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread166, TestSize.Level0) -{ - ItPosixPthread166(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_167 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread167, TestSize.Level0) -{ - ItPosixPthread167(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_173 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread173, TestSize.Level0) -{ - ItPosixPthread173(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_175 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread175, TestSize.Level0) -{ - ItPosixPthread175(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_176 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread176, TestSize.Level0) -{ - ItPosixPthread176(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_177 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread177, TestSize.Level0) -{ - ItPosixPthread177(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_182 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread182, TestSize.Level0) -{ - ItPosixPthread182(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_185 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread185, TestSize.Level0) -{ - ItPosixPthread185(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_186 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread186, TestSize.Level0) -{ - ItPosixPthread186(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_187 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread187, TestSize.Level0) -{ - ItPosixPthread187(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_188 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread188, TestSize.Level0) -{ - ItPosixPthread188(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_193 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread193, TestSize.Level0) -{ - ItPosixPthread193(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_194 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread194, TestSize.Level0) -{ - ItPosixPthread194(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_200 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread200, TestSize.Level0) -{ - ItPosixPthread200(); -} - -/* * - * @tc.name: IT_POSIX_PTHREAD_203 - * @tc.desc: function for pthread concurrency - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread203, TestSize.Level0) -{ - ItPosixPthread203(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_204 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread204, TestSize.Level0) -{ - ItPosixPthread204(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_205 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread205, TestSize.Level0) -{ - ItPosixPthread205(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_206 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread206, TestSize.Level0) -{ - ItPosixPthread206(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_209 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread209, TestSize.Level0) -{ - ItPosixPthread209(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_213 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread213, TestSize.Level0) -{ - ItPosixPthread213(); -} - -/** - * @tc.name: IT_POSIX_PTHREAD_217 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread217, TestSize.Level0) -{ - ItPosixPthread217(); // phthread_key_create -} - -/** - * @tc.name: IT_POSIX_PTHREAD_218 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread218, TestSize.Level0) -{ - ItPosixPthread218(); // phthread_key_create -} - -/** - * @tc.name: IT_POSIX_PTHREAD_224 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread224, TestSize.Level0) -{ - ItPosixPthread224(); // pthread_key_create -} - -/** - * @tc.name: IT_POSIX_PTHREAD_226 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread226, TestSize.Level0) -{ - ItPosixPthread226(); // pthread_key -} - -/** - * @tc.name: IT_POSIX_PTHREAD_233 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread233, TestSize.Level0) -{ - ItPosixPthread233(); // pthread_key and pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_238 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread238, TestSize.Level0) -{ - ItPosixPthread238(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_239 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread239, TestSize.Level0) -{ - ItPosixPthread239(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_240 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread240, TestSize.Level0) -{ - ItPosixPthread240(); // pthread_cancel -} - -/** - * @tc.name: IT_POSIX_PTHREAD_241 - * @tc.desc: function for PosixPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(PosixPthreadTest, ItPosixPthread241, TestSize.Level0) -{ - ItPosixPthread241(); // pthread_cancel -} -#endif - -} // namespace OHOS diff --git a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_003.cpp b/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_003.cpp deleted file mode 100644 index 001d1c6b..00000000 --- a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_003.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *ThreadF01(void *arg) -{ - pthread_exit(NULL); - return NULL; -} -static UINT32 Testcase(VOID) -{ - pthread_t aThread; - pthread_t ptid = pthread_self(); - pthread_t a = 0; - pthread_t b = 0; - int tmp; - pthread_attr_t aa = { 0 }; - int detachstate; - pthread_mutex_t c; - UINT32 ret; - - pthread_create(&aThread, NULL, ThreadF01, NULL); - - tmp = pthread_equal(a, b); - - // pthread_join(a, NULL); - - // pthread_detach(a); - - pthread_attr_init(&aa); - - pthread_attr_getdetachstate(&aa, &detachstate); - - pthread_attr_setdetachstate(&aa, PTHREAD_CREATE_DETACHED); - - pthread_attr_destroy(&aa); - - // pthread_mutex_init(&c, NULL); - - // pthread_mutex_destroy(&c); - - // pthread_mutex_lock(&c); - - // pthread_mutex_trylock(&c); - - // pthread_mutex_unlock(&c); - - // pthread_mutexattr_init(&c); - - // pthread_mutexattr_destroy(&c); - ret = pthread_join(aThread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread003(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_003", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_004.cpp b/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_004.cpp deleted file mode 100644 index b1436e51..00000000 --- a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_004.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *ThreadF01(void *arg) -{ - pthread_exit((void *)2); - return NULL; -} -static UINT32 Testcase(VOID) -{ - pthread_t mainTh, newTh; - INT32 ret; - INTPTR *temp; - - if (pthread_create(&newTh, NULL, ThreadF01, NULL) != 0) { - uart_printf_func("Error creating thread\n"); - ICUNIT_ASSERT_EQUAL(1, 0, errno); - } - - LosTaskDelay(1); - /* Obtain the thread ID of this main function */ - mainTh = TestPthreadSelf(); - - /* Compare the thread ID of the new thread to the main thread. - * They should be different. If not, the test fails. */ - if (pthread_equal(newTh, mainTh) != 0) { - printf("Test FAILED: A new thread wasn't created\n"); - ICUNIT_ASSERT_EQUAL(1, 0, errno); - } - - TestExtraTaskDelay(1); - ret = pthread_join(newTh, (void **)&temp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL((int)temp, 2, temp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread004(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_004", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_005.cpp b/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_005.cpp deleted file mode 100644 index 67729f02..00000000 --- a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_005.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *ThreadF01(void *arg) -{ - sleep(1); - - /* Shouldn't reach here. If we do, then the pthread_cancel() - * function did not succeed. */ - // uart_printf_func("Could not send cancel request correctly\n"); - // ICUNIT_TRACK_EQUAL(1, 0, errno); - pthread_exit((void *)0); - return NULL; -} -static UINT32 Testcase(VOID) -{ - pthread_t newTh; - UINT32 ret; - UINTPTR *temp; - - if (pthread_create(&newTh, NULL, ThreadF01, NULL) < 0) { - uart_printf_func("Error creating thread\n"); - ICUNIT_ASSERT_EQUAL(1, 0, errno); - } - - LosTaskDelay(1); - /* Try to cancel the newly created thread. If an error is returned, - * then the thread wasn't created successfully. */ - if (pthread_cancel(newTh) != 0) { - printf("Test FAILED: A new thread wasn't created\n"); - ICUNIT_ASSERT_EQUAL(1, 0, errno); - } - - ret = pthread_join(newTh, (void **)&temp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - // ICUNIT_ASSERT_EQUAL(temp, (UINTPTR)PTHREAD_CANCELED, temp); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread005(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_005", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_006.cpp b/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_006.cpp deleted file mode 100644 index 61342e52..00000000 --- a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_006.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void *ThreadF01(void *arg) -{ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - - // while (1) - sleep(1); - - pthread_exit((void *)0); - return NULL; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - void *temp; - pthread_t a; - - /* SIGALRM will be sent in 5 seconds. */ - // alarm(5);//alarm NOT SUPPORT - - /* Create a new thread. */ - if (pthread_create(&a, NULL, ThreadF01, NULL) != 0) { - uart_printf_func("Error creating thread\n"); - ICUNIT_ASSERT_EQUAL(1, 0, errno); - } - - LosTaskDelay(1); - pthread_cancel(a); - /* If 'main' has reached here, then the test passed because it means - * that the thread is truly asynchronise, and main isn't waiting for - * it to return in order to move on. */ - // printf("Test PASSED\n"); - - ret = pthread_join(a, &temp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread006(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_006", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_018.cpp b/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_018.cpp deleted file mode 100644 index 9c22a77c..00000000 --- a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_018.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *pthread_f01(void *argument) -{ - g_testCount++; - - return argument; -} -static UINT32 Testcase(VOID) -{ - pthread_attr_t attr; - pthread_t newTh; - UINT32 ret; - UINTPTR uwtemp; - int policy; - struct sched_param param; - struct sched_param param2 = { 2 }; - - g_testCount = 0; - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, NULL, pthread_f01, (void *)9); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_setschedparam(newTh, 0, ¶m); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_setschedparam(newTh, 4, ¶m); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - - param.sched_priority = 0; - ret = pthread_setschedparam(newTh, SCHED_RR, ¶m); // - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - param.sched_priority = 31; - ret = pthread_setschedparam(newTh, SCHED_RR, ¶m); // - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - param.sched_priority = 32; - ret = pthread_setschedparam(newTh, SCHED_RR, ¶m); // - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_getschedparam(newTh, &policy, ¶m2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(param2.sched_priority, 31, param2.sched_priority); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(uwtemp, 9, uwtemp); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread018(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_018", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_019.cpp b/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_019.cpp deleted file mode 100644 index 20ac176c..00000000 --- a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_019.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID PthreadOnceF01(VOID) -{ - g_testCount++; -} -static UINT32 Testcase(VOID) -{ - UINT32 ret; - pthread_once_t onceBlock = PTHREAD_ONCE_INIT; - - g_testCount = 0; - - // pthread_once_init: (0) NEVER (1) IN_PROGRESS (2) DONE - // If 1:all pthread_once() will wait until one of them transfer his state to (2) DONE,so all of them will stuck - // infinitely. We can't make it happen that all pthreads stuck infinitely in testsuit which is unreasonable. - onceBlock = 2; - ret = pthread_once(&onceBlock, PthreadOnceF01); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 0, g_testCount); - - onceBlock = PTHREAD_ONCE_INIT; - - ret = pthread_once(&onceBlock, PthreadOnceF01); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_once(&onceBlock, PthreadOnceF01); - ICUNIT_ASSERT_EQUAL(onceBlock, 2, onceBlock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread019(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_019", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_020.cpp b/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_020.cpp deleted file mode 100644 index cf008c80..00000000 --- a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_020.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static void PthreadKeyF01(void *arg) -{ - g_testCount++; -} - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - UINT32 temp = 9; - VOID *buf; - - g_testCount = 0; - - ret = pthread_key_create(&g_key, PthreadKeyF01); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_setspecific(g_key, &temp); // ´´½¨³É¹¦µÄkeyÉèÖà - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = *((UINT32 *)pthread_getspecific(g_key)); - ICUNIT_ASSERT_EQUAL(ret, 9, ret); - - ret = pthread_key_delete(g_key); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(g_testCount, 0, g_testCount); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread020(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_020", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_021.cpp b/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_021.cpp deleted file mode 100644 index c5646d89..00000000 --- a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_021.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static UINT32 Testcase(VOID) -{ - UINT32 ret; - int oldstate; - int oldstype; - - // pthread_setcancelstate(int new, int *old): if new > 2U, return EINVAL, else return 0. - ret = pthread_setcancelstate(0, &oldstate); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_setcancelstate(3, &oldstate); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(oldstate, PTHREAD_CANCEL_ENABLE, oldstate); - - // pthread_setcanceltype(int new, int *old): if new > 1U, return EINVAL,else return 0. - ret = pthread_setcanceltype(0, &oldstype); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_setcanceltype(3, &oldstype); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldstate); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(oldstate, PTHREAD_CANCEL_ASYNCHRONOUS, oldstate); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread021(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_021", Testcase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_022.cpp b/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_022.cpp deleted file mode 100644 index 0945ae20..00000000 --- a/testsuites/unittest_old/posix/pthread/smoke/It_posix_pthread_022.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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. - */ -#include "It_posix_pthread.h" - -static VOID *PthreadF01(void *argument) -{ - g_testCount++; - printf("%d,g_TestCount:%d\n", __LINE__, g_testCount); - while (1) { - LosTaskDelay(1); - } - printf("%d,g_TestCount:%d\n", __LINE__, g_testCount); - g_testCount++; - return argument; -} - -static VOID *PthreadF02(void *argument) -{ - printf("%d,g_TestCount:%d\n", __LINE__, g_testCount); - g_testCount++; - pthread_testcancel(); - return argument; -} - -static UINT32 TestCase(VOID) -{ - pthread_t newTh; - - UINT32 ret; - UINTPTR *uwtemp = NULL; - UINT32 uwint = 8; - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, PthreadF01, (void **)&uwint); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(2); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL((UINTPTR)uwtemp, (UINTPTR)PTHREAD_CANCELED, uwtemp); - - g_testCount = 0; - - ret = pthread_create(&newTh, NULL, PthreadF02, (void **)uwint); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - LosTaskDelay(1); - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_cancel(newTh); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh, (void **)&uwtemp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL((UINTPTR)uwtemp, 8, uwtemp); - - return PTHREAD_NO_ERROR; -} - -VOID ItPosixPthread022(VOID) // IT_Layer_ModuleORFeature_No -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_022", TestCase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/BUILD.gn b/testsuites/unittest_old/process/mutex/BUILD.gn deleted file mode 100644 index 4ceb762d..00000000 --- a/testsuites/unittest_old/process/mutex/BUILD.gn +++ /dev/null @@ -1,100 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "process_mutex_test.cpp", -] - -sources_smoke = [ - "smoke/pthread_mutex_test_001.cpp", - "smoke/pthread_mutex_test_002.cpp", - "smoke/pthread_mutex_test_003.cpp", - "smoke/pthread_mutex_test_004.cpp", - "smoke/pthread_mutex_test_005.cpp", - "smoke/pthread_mutex_test_006.cpp", - "smoke/pthread_mutex_test_007.cpp", - "smoke/pthread_mutex_test_008.cpp", - "smoke/pthread_mutex_test_009.cpp", - "smoke/pthread_mutex_test_010.cpp", - "smoke/pthread_mutex_test_011.cpp", - "smoke/pthread_mutex_test_012.cpp", - "smoke/pthread_mutex_test_013.cpp", - "smoke/pthread_mutex_test_014.cpp", - "smoke/pthread_mutex_test_015.cpp", - "smoke/pthread_mutex_test_016.cpp", - "smoke/pthread_mutex_test_017.cpp", - "smoke/pthread_mutex_test_019.cpp", - "smoke/pthread_mutex_test_020.cpp", - "smoke/pthread_mutex_test_021.cpp", - "smoke/pthread_mutex_test_022.cpp", -] - -sources_full = [ - "full/pthread_mutex_test_018.cpp", - "full/pthread_mutex_test_023.cpp", - "full/pthread_mutex_test_024.cpp", - "full/pthread_mutex_test_025.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_mutex_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_mutex_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_old/process/mutex/full/pthread_mutex_test_018.cpp b/testsuites/unittest_old/process/mutex/full/pthread_mutex_test_018.cpp deleted file mode 100644 index 7980e275..00000000 --- a/testsuites/unittest_old/process/mutex/full/pthread_mutex_test_018.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_muxLock001; -static pthread_mutex_t g_muxLock002; -static pthread_mutex_t g_muxLock003; - -static const unsigned int TEST_COUNT = 10; -static volatile int g_testToCount001 = 0; -static volatile int g_testToCount002 = 0; -static volatile int g_testToCount003 = 0; - -static void *ThreadFuncTest2(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount002 = 1; - - return nullptr; - -EXIT: - g_testToCount002 = -1; - return nullptr; -} - -static void *ThreadFuncTest1(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - gettimeofday(&timeVal, nullptr); - - if(timeVal.tv_usec + 100000 >= 1000000) { // 100000us, delay time; 1000000us, compare - time.tv_sec = timeVal.tv_sec + 1; - time.tv_nsec = (timeVal.tv_usec + 100000 - 1000000) * 1000; // 100000, delaytime; 1000, us to ns; 1000000us=1s; - } else { - time.tv_sec = timeVal.tv_sec + 0; - time.tv_nsec = (timeVal.tv_usec + 100000) * 1000; // 1000, 100000us to ns - } - - ret = pthread_mutex_timedlock(&g_muxLock001, &time); - ICUNIT_GOTO_EQUAL(ret, ETIMEDOUT, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testToCount002, 1, g_testToCount002, EXIT); - - g_testToCount001 = 1; - return nullptr; - -EXIT: - g_testToCount001 = -1; - return nullptr; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread, newPthread1; - pthread_mutexattr_t mutex; - int index = TEST_COUNT; - int gCurrThreadPri, gCurrThreadPolicy; - struct timeval time = { 0 }; - struct timeval timeVal = { 0 }; - - ret = pthread_getschedparam(pthread_self(), &gCurrThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - gCurrThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - - // 2, Set the priority according to the task purpose,a smaller number means a higher priority. - param.sched_priority = gCurrThreadPri + 2; - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedparam(&a, ¶m); - - while (index) { - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_muxLock001, &mutex); - - g_testToCount001 = 0; - g_testToCount002 = 0; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newPthread, &a, ThreadFuncTest1, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 2); // 1000, 10, 2 - - ret = pthread_create(&newPthread1, nullptr, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - gettimeofday(&timeVal, nullptr); - while (1) { - gettimeofday(&time, nullptr); - if ((time.tv_sec - timeVal.tv_sec) >= 1) { - break; - } - } - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount001, -1, g_testToCount001); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount002, -1, g_testToCount002); - pthread_mutex_destroy(&g_muxLock003); - index--; - } - return 0; -} - -void ItTestPthreadMutex018(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_018", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/full/pthread_mutex_test_023.cpp b/testsuites/unittest_old/process/mutex/full/pthread_mutex_test_023.cpp deleted file mode 100644 index b782afbe..00000000 --- a/testsuites/unittest_old/process/mutex/full/pthread_mutex_test_023.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_mutexLock; -static volatile int g_testToCount001 = 0; -static volatile int g_testToCount002 = 0; - -static void *ThreadFuncTest1(void *arg) -{ - int ret = pthread_mutex_lock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount001++; - return nullptr; - -EXIT: - g_testToCount001 = -1; - return nullptr; -} - -static void *ThreadFuncTest2(void *arg) -{ - int ret = pthread_mutex_lock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, EOWNERDEAD, ret, EXIT); - - ret = pthread_mutex_consistent(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount002++; - ret = pthread_mutex_unlock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return nullptr; - -EXIT: - g_testToCount002 = -1; - return nullptr; -} - -static int Testcase(void) -{ - int ret; - pthread_t tid1, tid2; - pthread_mutexattr_t attr; - int robust; - - pthread_mutexattr_init(&attr); - - pthread_mutexattr_getrobust(&attr, &robust); - ICUNIT_ASSERT_EQUAL(robust, 0, robust); - - ret = pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pthread_mutexattr_getrobust(&attr, &robust); - ICUNIT_ASSERT_EQUAL(robust, PTHREAD_MUTEX_ROBUST, robust); - - pthread_mutex_init(&g_mutexLock, &attr); - - pthread_mutexattr_destroy(&attr); - - g_testToCount001 = 0; - g_testToCount002 = 0; - - ret = pthread_create(&tid1, nullptr, ThreadFuncTest1, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&tid2, nullptr, ThreadFuncTest2, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pthread_join(tid1, nullptr); - pthread_join(tid2, nullptr); - - while (g_testToCount001 == 0 || g_testToCount002 == 0) { - } - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount001, -1, g_testToCount001); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount002, -1, g_testToCount002); - - pthread_mutex_destroy(&g_mutexLock); - - return 0; -} - -void ItTestPthreadMutex023(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_023", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/full/pthread_mutex_test_024.cpp b/testsuites/unittest_old/process/mutex/full/pthread_mutex_test_024.cpp deleted file mode 100644 index acf5b183..00000000 --- a/testsuites/unittest_old/process/mutex/full/pthread_mutex_test_024.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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. - */ - -#include "it_mutex_test.h" - -static pthread_mutex_t g_muxLock001; -static pthread_mutex_t g_muxLock002; -static pthread_mutex_t g_muxLock003; -static volatile int g_testToCount001 = 0; -static volatile int g_testToCount002 = 0; -static volatile int g_testToCount003 = 0; - -static void *ThreadFuncTest1(void *arg) -{ - int ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ret = pthread_mutex_consistent(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - g_testToCount001++; - return nullptr; - -EXIT: - g_testToCount001 = -1; - return nullptr; -} - -static void *ThreadFuncTest2(void *arg) -{ - int ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, EOWNERDEAD, ret, EXIT); - - g_testToCount002 = 1; - - while (g_testToCount003 == 0) { - sleep(1); - } - - g_testToCount002++; - return nullptr; - -EXIT: - g_testToCount002 = -1; - return nullptr; -} -static void *ThreadFuncTest3(void *arg) -{ - int ret = pthread_mutex_consistent(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, EPERM, ret, EXIT); - g_testToCount003 = 1; - - for (int i = 0; i < 5; i++) { // 5 - sleep(1); - } - - g_testToCount003++; - return nullptr; - -EXIT: - g_testToCount003 = -1; - return nullptr; -} - -static int Testcase(void) -{ - int ret; - pthread_t tid1, tid2, tid3; - pthread_mutexattr_t attr; - int robust; - - pthread_mutexattr_init(&attr); - - pthread_mutexattr_getrobust(&attr, &robust); - ICUNIT_ASSERT_EQUAL(robust, 0, robust); - - ret = pthread_mutexattr_setrobust(&attr, 2); // 2 - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pthread_mutex_init(&g_muxLock002, &attr); - ret = pthread_mutex_consistent(&g_muxLock002); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - pthread_mutexattr_getrobust(&attr, &robust); - ICUNIT_ASSERT_EQUAL(robust, PTHREAD_MUTEX_ROBUST, robust); - - pthread_mutex_init(&g_muxLock001, &attr); - pthread_mutex_init(&g_muxLock003, &attr); - - ret = pthread_mutex_consistent(&g_muxLock003); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_mutex_unlock(&g_muxLock003); - ICUNIT_ASSERT_EQUAL(ret, EPERM, ret); - - pthread_mutexattr_destroy(&attr); - - g_testToCount001 = 0; - g_testToCount002 = 0; - g_testToCount003 = 0; - - ret = pthread_create(&tid1, nullptr, ThreadFuncTest1, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&tid2, nullptr, ThreadFuncTest2, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - while (g_testToCount002 == 0) { - sleep(1); - } - - ret = pthread_create(&tid3, nullptr, ThreadFuncTest3, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pthread_join(tid1, nullptr); - pthread_join(tid2, nullptr); - pthread_join(tid3, nullptr); - - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount001, -1, g_testToCount001); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount002, -1, g_testToCount002); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount003, -1, g_testToCount003); - - pthread_mutex_destroy(&g_muxLock001); - pthread_mutex_destroy(&g_muxLock002); - pthread_mutex_destroy(&g_muxLock003); - - return 0; -} - -void ItTestPthreadMutex024(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_024", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/full/pthread_mutex_test_025.cpp b/testsuites/unittest_old/process/mutex/full/pthread_mutex_test_025.cpp deleted file mode 100644 index 77ec8240..00000000 --- a/testsuites/unittest_old/process/mutex/full/pthread_mutex_test_025.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_mutexLock; -static volatile int g_testToCount001 = 0; -static volatile int g_testToCount002 = 0; - -static void *ThreadFuncTest1(void *arg) -{ - int ret = pthread_mutex_lock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount001++; - return nullptr; - -EXIT: - g_testToCount001 = -1; - return nullptr; -} - -static void *ThreadFuncTest2(void *arg) -{ - int ret = pthread_mutex_lock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, EOWNERDEAD, ret, EXIT); - - ret = pthread_mutex_consistent(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount002++; - ret = pthread_mutex_unlock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return nullptr; - -EXIT: - g_testToCount002 = -1; - return nullptr; -} - -static int Child() -{ - int ret; - pthread_t tid1, tid2; - pthread_mutexattr_t attr; - int robust; - - pthread_mutexattr_init(&attr); - - pthread_mutexattr_getrobust(&attr, &robust); - ICUNIT_ASSERT_EQUAL(robust, 0, robust); - - ret = pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pthread_mutexattr_getrobust(&attr, &robust); - ICUNIT_ASSERT_EQUAL(robust, PTHREAD_MUTEX_ROBUST, robust); - - ret = pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_STALLED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pthread_mutexattr_getrobust(&attr, &robust); - ICUNIT_ASSERT_EQUAL(robust, PTHREAD_MUTEX_STALLED, robust); - - pthread_mutex_init(&g_mutexLock, &attr); - - pthread_mutexattr_destroy(&attr); - - g_testToCount001 = 0; - g_testToCount002 = 0; - - ret = pthread_create(&tid1, nullptr, ThreadFuncTest1, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&tid2, nullptr, ThreadFuncTest2, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - for (int i = 0; i < 5; i++) { // 5 - if (g_testToCount002 == 0) { - sleep(1); - } - } - - pthread_join(tid1, nullptr); - - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount001, -1, g_testToCount001); - ICUNIT_ASSERT_EQUAL(g_testToCount002, 0, g_testToCount002); - - pthread_mutex_destroy(&g_mutexLock); - - exit(255); // 255, set exitcode -} - -static int Testcase(void) -{ - int ret; - int status; - - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, The expected value - - if (pid == 0) { - Child(); - exit(0); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 255, status); // 255, exitcode is 255 - - return 0; -EXIT: - return 1; -} - -void ItTestPthreadMutex025(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_025", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/it_mutex_test.h b/testsuites/unittest_old/process/mutex/it_mutex_test.h deleted file mode 100644 index 8e1678f7..00000000 --- a/testsuites/unittest_old/process/mutex/it_mutex_test.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_MUTEX_H -#define _IT_TEST_MUTEX_H -#include "osTest.h" -#include "sys/time.h" -#include - -#define SLEEP_AND_YIELD(tick) usleep((tick)*10 * 1000) - -extern int Gettid(void); -extern void ItTestPthreadMutex001(void); -extern void ItTestPthreadMutex002(void); -extern void ItTestPthreadMutex003(void); -extern void ItTestPthreadMutex004(void); -extern void ItTestPthreadMutex005(void); -extern void ItTestPthreadMutex006(void); -extern void ItTestPthreadMutex007(void); -extern void ItTestPthreadMutex008(void); -extern void ItTestPthreadMutex009(void); -extern void ItTestPthreadMutex010(void); -extern void ItTestPthreadMutex011(void); -extern void ItTestPthreadMutex012(void); -extern void ItTestPthreadMutex013(void); -extern void ItTestPthreadMutex014(void); -extern void ItTestPthreadMutex015(void); -extern void ItTestPthreadMutex016(void); -extern void ItTestPthreadMutex017(void); -extern void ItTestPthreadMutex018(void); -extern void ItTestPthreadMutex019(void); -extern void ItTestPthreadMutex020(void); -extern void ItTestPthreadMutex021(void); -extern void ItTestPthreadMutex022(void); -extern void ItTestPthreadMutex023(void); -extern void ItTestPthreadMutex024(void); -extern void ItTestPthreadMutex025(void); - -#endif diff --git a/testsuites/unittest_old/process/mutex/process_mutex_test.cpp b/testsuites/unittest_old/process/mutex/process_mutex_test.cpp deleted file mode 100644 index 2df414df..00000000 --- a/testsuites/unittest_old/process/mutex/process_mutex_test.cpp +++ /dev/null @@ -1,334 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include -#include -#include - -__attribute__((weak)) int Gettid() -{ - return syscall(SYS_gettid); -} - -#include "it_mutex_test.h" - -using namespace testing::ext; -namespace OHOS { -class ProcessMutexTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: it_test_pthread_mutex_001 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex001, TestSize.Level0) -{ - ItTestPthreadMutex001(); -} - -/* * - * @tc.name: it_test_pthread_mutex_002 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex002, TestSize.Level0) -{ - ItTestPthreadMutex002(); -} - -/* * - * @tc.name: it_test_pthread_mutex_003 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex003, TestSize.Level0) -{ - ItTestPthreadMutex003(); -} - -/* * - * @tc.name: it_test_pthread_mutex_004 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex004, TestSize.Level0) -{ - ItTestPthreadMutex004(); -} - -/* * - * @tc.name: it_test_pthread_mutex_005 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex005, TestSize.Level0) -{ - ItTestPthreadMutex005(); -} - -/* * - * @tc.name: it_test_pthread_mutex_006 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex006, TestSize.Level0) -{ - ItTestPthreadMutex006(); -} - -/* * - * @tc.name: it_test_pthread_mutex_007 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex007, TestSize.Level0) -{ - ItTestPthreadMutex007(); -} - -/* * - * @tc.name: it_test_pthread_mutex_008 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex008, TestSize.Level0) -{ - ItTestPthreadMutex008(); -} - -/* * - * @tc.name: it_test_pthread_mutex_009 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex009, TestSize.Level0) -{ - ItTestPthreadMutex009(); -} - -/* * - * @tc.name: it_test_pthread_mutex_010 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex010, TestSize.Level0) -{ - ItTestPthreadMutex010(); -} - -/* * - * @tc.name: it_test_pthread_mutex_011 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex011, TestSize.Level0) -{ - ItTestPthreadMutex011(); -} - -/* * - * @tc.name: it_test_pthread_mutex_012 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex012, TestSize.Level0) -{ - ItTestPthreadMutex012(); -} - -/* * - * @tc.name: it_test_pthread_mutex_013 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex013, TestSize.Level0) -{ - ItTestPthreadMutex013(); -} - -/* * - * @tc.name: it_test_pthread_mutex_014 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex014, TestSize.Level0) -{ - ItTestPthreadMutex014(); -} - -/* * - * @tc.name: it_test_pthread_mutex_015 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex015, TestSize.Level0) -{ - ItTestPthreadMutex015(); -} - -/* * - * @tc.name: it_test_pthread_mutex_016 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex016, TestSize.Level0) -{ - ItTestPthreadMutex016(); -} - -/* * - * @tc.name: it_test_pthread_mutex_017 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex017, TestSize.Level0) -{ - ItTestPthreadMutex017(); -} - -#ifndef LOSCFG_USER_TEST_SMP -/* * - * @tc.name: it_test_pthread_mutex_019 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex019, TestSize.Level0) -{ - ItTestPthreadMutex019(); -} - -#endif -/* * - * @tc.name: it_test_pthread_mutex_020 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex020, TestSize.Level0) -{ - ItTestPthreadMutex020(); -} - -/* * - * @tc.name: it_test_pthread_mutex_021 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex021, TestSize.Level0) -{ - ItTestPthreadMutex021(); -} - -/* * - * @tc.name: it_test_pthread_mutex_022 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex022, TestSize.Level0) -{ - ItTestPthreadMutex022(); -} -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -#ifndef LOSCFG_USER_TEST_SMP -/* * - * @tc.name: it_test_pthread_mutex_018 - * @tc.desc: function for ProcessMutexTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex018, TestSize.Level0) -{ - ItTestPthreadMutex018(); -} -#endif - -/* * - * @tc.name: it_test_pthread_mutex_023 - * @tc.desc: function for test mutexattr robust - * @tc.type: FUNC - * @tc.require: AR000E0QAB - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex023, TestSize.Level0) -{ - ItTestPthreadMutex023(); -} - -/* * - * @tc.name: it_test_pthread_mutex_024 - * @tc.desc: function for test mutexattr robust:error return value - * @tc.type: FUNC - * @tc.require: AR000E0QAB - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex024, TestSize.Level0) -{ - ItTestPthreadMutex024(); -} - -/* * - * @tc.name: it_test_pthread_mutex_025 - * @tc.desc: test mutexattr robust:robustness product deadlock is not set - * @tc.type: FUNC - * @tc.require: AR000E0QAB - */ -HWTEST_F(ProcessMutexTest, ItTestPthreadMutex025, TestSize.Level0) -{ - ItTestPthreadMutex025(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_001.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_001.cpp deleted file mode 100644 index cd5249d6..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_001.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_mutexLock; - -static const unsigned int TEST_COUNT = 5; -static int g_testInfo[5] = { 0 }; -static int g_testToCount = 0; -static int g_testBackCount = 0; - -static void *ThreadFuncTest3(void *a) -{ - int ret; - int tid = Gettid(); - pthread_t thread = pthread_self(); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testInfo[g_testToCount] = tid; - g_testToCount++; - - ret = pthread_mutex_lock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testInfo[g_testBackCount], tid, tid, EXIT); - g_testBackCount++; - - ret = pthread_mutex_unlock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread, newPthread1; - pthread_mutexattr_t mutex; - int index = 0; - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_mutexLock, &mutex); - - while (index < 1) { - g_testToCount = 0; - g_testBackCount = 0; - - ret = pthread_mutex_lock(&g_mutexLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - for (int count = 0; count < TEST_COUNT; count++) { - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - } - - ret = pthread_mutex_unlock(&g_mutexLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - - ICUNIT_ASSERT_EQUAL(g_testBackCount, TEST_COUNT, g_testBackCount); - ICUNIT_ASSERT_EQUAL(g_testToCount, TEST_COUNT, g_testToCount); - - index++; - } - - pthread_mutex_destroy(&g_mutexLock); - return 0; -} - -void ItTestPthreadMutex001(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_001", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_002.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_002.cpp deleted file mode 100644 index 55dda966..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_002.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_muxLock; - -static const unsigned int TEST_COUNT = 5; -static int g_testInfo[5] = { 0 }; -static int g_testToCount = 0; -static int g_testBackCount = 0; - -static void *ThreadFuncTest3(void *a) -{ - int ret; - int tid = Gettid(); - pthread_t thread = pthread_self(); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testInfo[g_testToCount] = tid; - g_testToCount++; - - ret = pthread_mutex_lock(&g_muxLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testBackCount--; - - ret = pthread_mutex_unlock(&g_muxLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread, newPthread1; - pthread_mutexattr_t mutex; - int index = 0; - int currThreadPri, currThreadPolicy; - - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_muxLock, &mutex); - - param.sched_priority = 20; // 20, Set Priorities - ret = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - currThreadPri = param.sched_priority; - - while (index < 2) { // 2 - g_testToCount = 0; - g_testBackCount = TEST_COUNT - 1; - ret = pthread_mutex_lock(&g_muxLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - for (int count = 0; count < TEST_COUNT; count++) { - ret = pthread_attr_init(&a); - param.sched_priority = currThreadPri - count - 1; - if (param.sched_priority < 0) { - param.sched_priority = 0; - printf("sched_priority is zero !!!\n"); - } - pthread_attr_setschedparam(&a, ¶m); - pthread_attr_setschedpolicy(&a, currThreadPolicy); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - ret = pthread_create(&newPthread, &a, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - - ret = pthread_mutex_unlock(&g_muxLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - - ICUNIT_ASSERT_EQUAL(g_testBackCount, -1, g_testBackCount); - ICUNIT_ASSERT_EQUAL(g_testToCount, TEST_COUNT, g_testToCount); - - index++; - } - - pthread_mutex_destroy(&g_muxLock); - return 0; -} - -void ItTestPthreadMutex002(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_002", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_003.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_003.cpp deleted file mode 100644 index ff3bca70..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_003.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static const unsigned int THREAD_COUNT = 5; -static pthread_mutex_t g_muxLock; -static int g_preTaskPri = 0; -static int g_testCnt = 0; - -static void *ThreadFuncTest3(void *a) -{ - int ret; - struct sched_param param = { 0 }; - pthread_t thread = pthread_self(); - int currThreadPri, currThreadPolicy; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testCnt++; - - ret = pthread_mutex_lock(&g_muxLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - currThreadPri = param.sched_priority; - - if (g_preTaskPri == 0xffffffff) { - ICUNIT_GOTO_EQUAL(currThreadPri, 0, currThreadPri, EXIT); - } else { - ICUNIT_GOTO_WITHIN_EQUAL(currThreadPri, g_preTaskPri, 31, currThreadPri, EXIT); // 31, Lowest priority - } - - g_preTaskPri = currThreadPri; - g_testCnt--; - - ret = pthread_mutex_unlock(&g_muxLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread, newPthread1; - pthread_mutexattr_t mutex; - int count = 0; - int currThreadPri, currThreadPolicy; - - g_preTaskPri = 0xffffffff; - g_testCnt = 0; - - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_muxLock, &mutex); - - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - currThreadPri = param.sched_priority; - - ret = pthread_mutex_lock(&g_muxLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - for (int count = 0; count < THREAD_COUNT; count++) { - // 2, Set the priority according to the task purpose,a smaller number means a higher priority. - param.sched_priority = currThreadPri - 2 * count; - pthread_attr_setschedparam(&a, ¶m); - pthread_attr_setschedpolicy(&a, currThreadPolicy); - ret = pthread_create(&newPthread, &a, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - - param.sched_priority = currThreadPri - 1; - pthread_attr_setschedparam(&a, ¶m); - pthread_attr_setschedpolicy(&a, currThreadPolicy); - ret = pthread_create(&newPthread, &a, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - // 6, Set the priority according to the task purpose,a smaller number means a higher priority. - param.sched_priority = currThreadPri - 6; - pthread_attr_setschedparam(&a, ¶m); - pthread_attr_setschedpolicy(&a, currThreadPolicy); - ret = pthread_create(&newPthread, &a, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - param.sched_priority = 0; - pthread_attr_setschedparam(&a, ¶m); - pthread_attr_setschedpolicy(&a, currThreadPolicy); - ret = pthread_create(&newPthread, &a, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - param.sched_priority = currThreadPri - 1; - pthread_attr_setschedparam(&a, ¶m); - pthread_attr_setschedpolicy(&a, currThreadPolicy); - ret = pthread_create(&newPthread, &a, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - param.sched_priority = currThreadPri; - pthread_attr_setschedparam(&a, ¶m); - pthread_attr_setschedpolicy(&a, currThreadPolicy); - ret = pthread_create(&newPthread, &a, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - sleep(1); - - ret = pthread_mutex_unlock(&g_muxLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - - ICUNIT_ASSERT_EQUAL(g_testCnt, 0, g_testCnt); - - pthread_mutex_destroy(&g_muxLock); - return 0; -} - -void ItTestPthreadMutex003(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_003", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_004.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_004.cpp deleted file mode 100644 index f5affe14..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_004.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_muxLock001; -static pthread_mutex_t g_muxLock002; -static pthread_mutex_t g_muxLock003; - -static const unsigned int THREAD_COUNT = 10; - -static int g_testInfo[3][10] = { 0 }; -static int g_testToCount001 = 0; -static int g_testBackCount001 = 0; -static int g_testToCount002 = 0; -static int g_testBackCount002 = 0; -static int g_testToCount003 = 0; -static int g_testBackCount003 = 0; - -static void *ThreadFuncTest3(void *a) -{ - int ret; - int tid = Gettid(); - pthread_t thread = pthread_self(); - int currThreadPri, currThreadPolicy; - struct sched_param param = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testInfo[2][g_testToCount003] = tid; // 2, max indx - g_testToCount003++; - - ret = pthread_mutex_lock(&g_muxLock003); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testInfo[2][g_testBackCount003], tid, tid, EXIT); // 2, max indx - g_testBackCount003++; - - ret = pthread_mutex_unlock(&g_muxLock003); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static void *ThreadFuncTest2(void *a) -{ - int ret; - int tid = Gettid(); - pthread_t thread = pthread_self(); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testInfo[1][g_testToCount002] = tid; - g_testToCount002++; - - ret = pthread_mutex_lock(&g_muxLock002); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testInfo[1][g_testBackCount002], tid, tid, EXIT); - g_testBackCount002++; - - ret = pthread_mutex_unlock(&g_muxLock002); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static void *ThreadFuncTest1(void *a) -{ - int ret; - int tid = Gettid(); - ; - pthread_t thread = pthread_self(); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testInfo[0][g_testToCount001] = tid; - g_testToCount001++; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testInfo[0][g_testBackCount001], tid, tid, EXIT); - g_testBackCount001++; - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread, newPthread1; - pthread_mutexattr_t mutex; - int index = 0; - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_muxLock001, &mutex); - pthread_mutex_init(&g_muxLock002, &mutex); - pthread_mutex_init(&g_muxLock003, &mutex); - - g_testToCount001 = 0; - g_testBackCount001 = 0; - g_testToCount002 = 0; - g_testBackCount002 = 0; - g_testToCount003 = 0; - g_testBackCount003 = 0; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_muxLock002); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_muxLock003); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - for (int count = 0; count < THREAD_COUNT; count++) { - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest1, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - } - - for (int count = 0; count < THREAD_COUNT; count++) { - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - } - - for (int count = 0; count < THREAD_COUNT; count++) { - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - } - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - - ret = pthread_mutex_unlock(&g_muxLock002); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - - ret = pthread_mutex_unlock(&g_muxLock003); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - - pthread_mutex_destroy(&g_muxLock001); - pthread_mutex_destroy(&g_muxLock002); - pthread_mutex_destroy(&g_muxLock003); - return 0; -} - -void ItTestPthreadMutex004(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_004", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_005.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_005.cpp deleted file mode 100644 index 9d86a82c..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_005.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_muxLock001; -static pthread_mutex_t g_muxLock002; -static pthread_mutex_t g_muxLock003; - -static const unsigned int THREAD_COUNT = 10; - -static int g_testInfo[3][10] = { 0 }; -static int g_testToCount001 = 0; -static int g_testBackCount001 = 0; -static int g_testToCount002 = 0; -static int g_testBackCount002 = 0; -static int g_testToCount003 = 0; -static int g_testBackCount003 = 0; - -static void *ThreadFuncTest3(void *a) -{ - int ret; - int tid; - pthread_t thread = pthread_self(); - int currThreadPri, currThreadPolicy; - struct sched_param param = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testInfo[2][g_testToCount003] = Gettid(); // 2, max indx - g_testToCount003++; - - ret = pthread_mutex_lock(&g_muxLock003); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - tid = Gettid(); - ICUNIT_GOTO_EQUAL(g_testInfo[2][g_testBackCount003], tid, tid, EXIT); // 2, max indx - g_testBackCount003++; - - ret = pthread_mutex_unlock(&g_muxLock003); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static void *ThreadFuncTest2(void *a) -{ - int ret; - int tid; - pthread_t thread = pthread_self(); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testInfo[1][g_testToCount002] = Gettid(); - g_testToCount002++; - - ret = pthread_mutex_lock(&g_muxLock002); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - tid = Gettid(); - ICUNIT_GOTO_EQUAL(g_testInfo[1][g_testBackCount002], tid, tid, EXIT); - g_testBackCount002++; - - ret = pthread_mutex_unlock(&g_muxLock002); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static void *ThreadFuncTest1(void *a) -{ - int ret; - int tid; - pthread_t thread = pthread_self(); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testInfo[0][g_testToCount001] = Gettid(); - g_testToCount001++; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - tid = Gettid(); - ICUNIT_GOTO_EQUAL(g_testInfo[0][g_testBackCount001], tid, tid, EXIT); - g_testBackCount001++; - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread, newPthread1; - pthread_mutexattr_t mutex; - int index = 0; - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_muxLock001, &mutex); - pthread_mutex_init(&g_muxLock002, &mutex); - pthread_mutex_init(&g_muxLock003, &mutex); - - g_testToCount001 = 0; - g_testBackCount001 = 0; - g_testToCount002 = 0; - g_testBackCount002 = 0; - g_testToCount003 = 0; - g_testBackCount003 = 0; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_muxLock002); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_muxLock003); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - for (int count = 0; count < THREAD_COUNT; count++) { - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - } - - for (int count = 0; count < THREAD_COUNT; count++) { - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - } - - for (int count = 0; count < THREAD_COUNT; count++) { - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest1, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - } - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - ret = pthread_mutex_unlock(&g_muxLock002); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - ret = pthread_mutex_unlock(&g_muxLock003); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - - pthread_mutex_destroy(&g_muxLock001); - pthread_mutex_destroy(&g_muxLock002); - pthread_mutex_destroy(&g_muxLock003); - return 0; -} - -void ItTestPthreadMutex005(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_005", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_006.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_006.cpp deleted file mode 100644 index ee263599..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_006.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_mutexLock001; -static pthread_mutex_t g_mutexLock002; -static pthread_mutex_t g_mutexLock003; - -static const unsigned int THREAD_COUNT = 10; - -static int g_testInfo[3][10] = { 0 }; -static int g_testToCount001 = 0; -static int g_testBackCount001 = 0; -static int g_testToCount002 = 0; -static int g_testBackCount002 = 0; -static int g_testToCount003 = 0; -static int g_testBackCount003 = 0; - -static void *ThreadFuncTest3(void *a) -{ - int ret; - int tid = Gettid(); - int currThreadPri, currThreadPolicy; - struct sched_param param = { 0 }; - pthread_t thread = pthread_self(); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testInfo[2][g_testToCount003] = tid; // 2, max indx - g_testToCount003++; - - ret = pthread_mutex_lock(&g_mutexLock003); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testInfo[2][g_testBackCount003], tid, tid, EXIT); // 2, max indx - g_testBackCount003++; - - ret = pthread_mutex_unlock(&g_mutexLock003); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static void *ThreadFuncTest2(void *a) -{ - int ret; - int tid = Gettid(); - pthread_t thread = pthread_self(); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testInfo[1][g_testToCount002] = tid; - g_testToCount002++; - - ret = pthread_mutex_lock(&g_mutexLock002); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testInfo[1][g_testBackCount002], tid, tid, EXIT); - g_testBackCount002++; - - ret = pthread_mutex_unlock(&g_mutexLock002); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static void *ThreadFuncTest1(void *a) -{ - int ret; - int tid = Gettid(); - pthread_t thread = pthread_self(); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testInfo[0][g_testToCount001] = tid; - g_testToCount001++; - - ret = pthread_mutex_lock(&g_mutexLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testInfo[0][g_testBackCount001], tid, tid, EXIT); - g_testBackCount001++; - - ret = pthread_mutex_unlock(&g_mutexLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t newPthread, newPthread1; - pthread_mutexattr_t mutex; - int index = 0; - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_mutexLock001, &mutex); - pthread_mutex_init(&g_mutexLock002, &mutex); - pthread_mutex_init(&g_mutexLock003, &mutex); - - g_testToCount001 = 0; - g_testBackCount001 = 0; - g_testToCount002 = 0; - g_testBackCount002 = 0; - g_testToCount003 = 0; - g_testBackCount003 = 0; - - ret = pthread_mutex_lock(&g_mutexLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_mutexLock002); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_mutexLock003); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - for (int count = 0; count < THREAD_COUNT; count++) { - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest1, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - } - - for (int count = 0; count < THREAD_COUNT; count++) { - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - } - - for (int count = 0; count < THREAD_COUNT; count++) { - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - } - - ret = pthread_mutex_unlock(&g_mutexLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - ret = pthread_mutex_unlock(&g_mutexLock002); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - ret = pthread_mutex_unlock(&g_mutexLock003); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(1); - - pthread_mutex_destroy(&g_mutexLock001); - pthread_mutex_destroy(&g_mutexLock002); - pthread_mutex_destroy(&g_mutexLock003); - return 0; -} - -void ItTestPthreadMutex006(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_006", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_007.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_007.cpp deleted file mode 100644 index e8bda9c5..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_007.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_muxLock001; -static pthread_mutex_t g_muxLock002; -static pthread_mutex_t g_muxLock003; - -static const unsigned int TEST_COUNT = 1; -static volatile int g_testToCount001 = 0; -static volatile int g_testToCount002 = 0; -static volatile int g_testToCount003 = 0; - -static void *ThreadFuncTest3(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - int currThreadPri, currThreadPolicy; - struct sched_param param = { 0 }; - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - gettimeofday(&timeVal, nullptr); - - time.tv_sec = timeVal.tv_sec + 10; // 10, for test - time.tv_nsec = timeVal.tv_usec + 0; - - ret = pthread_mutex_timedlock(&g_muxLock003, &time); - ICUNIT_GOTO_EQUAL(ret, ETIMEDOUT, ret, EXIT); - - g_testToCount003++; - - while (g_testToCount002 == 0) { - SLEEP_AND_YIELD(2); // 2, delay enouge time - } - - ret = pthread_mutex_unlock(&g_muxLock003); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return nullptr; - -EXIT: - g_testToCount003 = -1; - return nullptr; -} - -static void *ThreadFuncTest2(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - gettimeofday(&timeVal, nullptr); - - time.tv_sec = timeVal.tv_sec + 5; // 5, for test - time.tv_nsec = timeVal.tv_usec + 0; - - ret = pthread_mutex_timedlock(&g_muxLock002, &time); - ICUNIT_GOTO_EQUAL(ret, ETIMEDOUT, ret, EXIT); - - g_testToCount002++; - - while (g_testToCount001 == 0) { - SLEEP_AND_YIELD(2); // 2, delay enouge time - } - - ret = pthread_mutex_unlock(&g_muxLock002); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return nullptr; - -EXIT: - g_testToCount002 = -1; - return nullptr; -} - -static void *ThreadFuncTest1(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - gettimeofday(&timeVal, nullptr); - - time.tv_sec = timeVal.tv_sec + 2; // 2, for test - time.tv_nsec = timeVal.tv_usec + 0; - - ret = pthread_mutex_timedlock(&g_muxLock001, &time); - ICUNIT_GOTO_EQUAL(ret, ETIMEDOUT, ret, EXIT); - - g_testToCount001++; - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return nullptr; - -EXIT: - g_testToCount001 = -1; - return nullptr; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread, newPthread1; - pthread_mutexattr_t mutex = { 0 }; - int index = TEST_COUNT; - - while (index) { - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_muxLock001, &mutex); - pthread_mutex_init(&g_muxLock002, &mutex); - pthread_mutex_init(&g_muxLock003, &mutex); - - g_testToCount001 = 0; - g_testToCount002 = 0; - g_testToCount003 = 0; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_muxLock002); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_muxLock003); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest1, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - while (g_testToCount001 == 0 || g_testToCount002 == 0 || g_testToCount003 == 0) { - } - - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount001, -1, g_testToCount001); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount002, -1, g_testToCount002); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount003, -1, g_testToCount003); - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&g_muxLock002); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&g_muxLock003); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - index--; - - SLEEP_AND_YIELD(2); // 2, delay enouge time - } - - pthread_mutex_destroy(&g_muxLock001); - pthread_mutex_destroy(&g_muxLock002); - pthread_mutex_destroy(&g_muxLock003); - return 0; -} - -void ItTestPthreadMutex007(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_007", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_008.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_008.cpp deleted file mode 100644 index 347b3941..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_008.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_muxLock001; - -static const unsigned int TEST_COUNT = 1; -static volatile int g_testToCount001 = 0; -static volatile int g_testToCount002 = 0; -static volatile int g_testToCount003 = 0; - -static void *ThreadFuncTest3(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - int currThreadPri, currThreadPolicy; - struct sched_param param = { 0 }; - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - gettimeofday(&timeVal, nullptr); - - time.tv_sec = timeVal.tv_sec + 15; // 15 - time.tv_nsec = timeVal.tv_usec + 0; - - ret = pthread_mutex_timedlock(&g_muxLock001, &time); - ICUNIT_GOTO_EQUAL(ret, ETIMEDOUT, ret, EXIT); - - g_testToCount003++; - - return nullptr; -EXIT: - g_testToCount003 = -1; - return nullptr; -} - -static void *ThreadFuncTest2(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - gettimeofday(&timeVal, nullptr); - - time.tv_sec = timeVal.tv_sec + 10; // 10 - time.tv_nsec = timeVal.tv_usec + 0; - - ret = pthread_mutex_timedlock(&g_muxLock001, &time); - ICUNIT_GOTO_EQUAL(ret, ETIMEDOUT, ret, EXIT); - - g_testToCount002++; - - return nullptr; - -EXIT: - g_testToCount002 = -1; - return nullptr; -} - -static void *ThreadFuncTest1(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - gettimeofday(&timeVal, nullptr); - - time.tv_sec = timeVal.tv_sec + 5; // 5 - time.tv_nsec = timeVal.tv_usec + 0; - - ret = pthread_mutex_timedlock(&g_muxLock001, &time); - ICUNIT_GOTO_EQUAL(ret, ETIMEDOUT, ret, EXIT); - - g_testToCount001++; - - return nullptr; -EXIT: - g_testToCount001 = -1; - return nullptr; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread, newPthread1; - pthread_mutexattr_t mutex; - int index = TEST_COUNT; - - while (index) { - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_muxLock001, &mutex); - - g_testToCount001 = 0; - g_testToCount002 = 0; - g_testToCount003 = 0; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest1, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - while (g_testToCount001 == 0 || g_testToCount002 == 0 || g_testToCount003 == 0) { - } - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - index--; - - SLEEP_AND_YIELD(2); // 2, delay enouge time - - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount001, -1, g_testToCount001); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount002, -1, g_testToCount002); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount003, -1, g_testToCount003); - } - - pthread_mutex_destroy(&g_muxLock001); - return 0; -} - -void ItTestPthreadMutex008(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_008", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_009.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_009.cpp deleted file mode 100644 index f63ad01d..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_009.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - - -static pthread_mutex_t g_muxLock; - -static void *TaskF01(void *arg) -{ - unsigned int ret; - ret = pthread_mutex_trylock(&g_muxLock); - ICUNIT_TRACK_EQUAL(ret, EBUSY, ret); - - g_testCount++; - - ret = pthread_mutex_lock(&g_muxLock); - ICUNIT_TRACK_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&g_muxLock); - ICUNIT_TRACK_EQUAL(ret, 0, ret); - g_testCount++; - - return nullptr; -} - -static unsigned int TestCase(void) -{ - unsigned int ret; - pthread_t newThread; - pthread_attr_t attr; - pthread_mutexattr_t mutexAttr; - struct sched_param sp; - - g_testCount = 0; - - pthread_mutexattr_init(&mutexAttr); - pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_ERRORCHECK); - - ret = pthread_mutex_init(&g_muxLock, &mutexAttr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_muxLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - sp.sched_priority = 4; // 4, Set the priority according to the task purpose,a smaller number means a higher priority. - ret = pthread_attr_setschedparam(&attr, &sp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - ret = pthread_create(&newThread, &attr, TaskF01, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(5); // 5, delay enouge time - ICUNIT_ASSERT_EQUAL(g_testCount, 1, g_testCount); - - ret = pthread_mutex_unlock(&g_muxLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - -#ifdef LOSCFG_USER_TEST_SMP - LosTaskDelay(5); // 5, delay enouge time -#endif - ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2,The expected value - - ret = pthread_mutex_lock(&g_muxLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_muxLock); - ICUNIT_ASSERT_EQUAL(ret, EDEADLK, ret); - - ret = pthread_mutex_lock(&g_muxLock); - ICUNIT_ASSERT_EQUAL(ret, EDEADLK, ret); - - ret = pthread_mutex_unlock(&g_muxLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&g_muxLock); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&g_muxLock); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_destroy(&g_muxLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newThread, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -void ItTestPthreadMutex009(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_009", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_010.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_010.cpp deleted file mode 100644 index 040bc0fb..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_010.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - - -static pthread_mutex_t g_mutexLock001; -static pthread_mutex_t g_mutexLock002; - -static void *TaskF01(void *arg) -{ - unsigned int ret; - ret = pthread_mutex_lock(&g_mutexLock001); - ICUNIT_TRACK_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&g_mutexLock001); - ICUNIT_TRACK_EQUAL(ret, 0, ret); - - return nullptr; -} - -static unsigned int TestCase(void) -{ - unsigned int ret; - pthread_t newThread; - pthread_attr_t attr; - pthread_mutexattr_t mutexAttr; - struct sched_param sp; - - g_testCount = 0; - - pthread_mutexattr_init(&mutexAttr); - - pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_ERRORCHECK); - - ret = pthread_mutex_init(&g_mutexLock001, &mutexAttr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_init(&g_mutexLock002, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_mutexLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&g_mutexLock001); - ICUNIT_ASSERT_EQUAL(ret, EDEADLK, ret); - - ret = pthread_mutex_unlock(&g_mutexLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - sp.sched_priority = 4; // 4, Set the priority according to the task purpose,a smaller number means a higher priority. - ret = pthread_attr_setschedparam(&attr, &sp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - ret = pthread_create(&newThread, &attr, TaskF01, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LosTaskDelay(5); // 5, delay enouge time - - ret = pthread_mutex_destroy(&g_mutexLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&g_mutexLock001); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_destroy(&g_mutexLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_destroy(&g_mutexLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_destroy(&g_mutexLock002); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newThread, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadMutex010(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_010", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_011.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_011.cpp deleted file mode 100644 index a79521f3..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_011.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - - -static unsigned int TestCase(void) -{ - unsigned int ret; - pthread_mutexattr_t mutexAttr; - pthread_mutex_t mutex; - - pthread_mutexattr_init(&mutexAttr); - - pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_ERRORCHECK); - - ret = pthread_mutex_init(&mutex, &mutexAttr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, EDEADLK, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_destroy(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadMutex011(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_011", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_012.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_012.cpp deleted file mode 100644 index a3ffda5a..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_012.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - - -static unsigned int TestCase(void) -{ - int ret; - pthread_mutex_t mutex; - pthread_mutexattr_t mutexAttr; - - pthread_mutexattr_init(&mutexAttr); - pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_ERRORCHECK); - - ret = pthread_mutex_init(&mutex, &mutexAttr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, EDEADLK, ret); - - ret = pthread_mutex_trylock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, EBUSY, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_destroy(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadMutex012(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_012", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_013.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_013.cpp deleted file mode 100644 index 68a9a050..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_013.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - - -static unsigned int TestCase(void) -{ - int ret; - pthread_mutex_t mutex; - pthread_mutexattr_t mutexAttr; - - pthread_mutexattr_init(&mutexAttr); - pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_RECURSIVE); - - ret = pthread_mutex_init(&mutex, &mutexAttr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_trylock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_destroy(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadMutex013(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_013", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_014.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_014.cpp deleted file mode 100644 index 47ef4fe3..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_014.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - - -static UINT32 TestCase(VOID) -{ - int ret; - pthread_mutex_t mutex; - pthread_mutexattr_t ma; - - ret = pthread_mutexattr_init(&ma); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_RECURSIVE); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_init(&mutex, &ma); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutexattr_destroy(&ma); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_destroy(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadMutex014(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_014", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_015.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_015.cpp deleted file mode 100644 index bfe38e7d..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_015.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - - -static unsigned int TestCase(void) -{ - int ret; - pthread_mutex_t mutex; - pthread_mutexattr_t mutexAttr; - - pthread_mutexattr_init(&mutexAttr); - pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_RECURSIVE); - - ret = pthread_mutex_init(&mutex, &mutexAttr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_trylock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_destroy(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadMutex015(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_015", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_016.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_016.cpp deleted file mode 100644 index 84117e85..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_016.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - - -static unsigned int TestCase(void) -{ - int ret; - pthread_mutex_t mutex; - pthread_mutexattr_t mutexAttr; - - pthread_mutexattr_init(&mutexAttr); - pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_RECURSIVE); - ret = pthread_mutex_init(&mutex, &mutexAttr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_lock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_unlock(&mutex); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - - ret = pthread_mutex_destroy(&mutex); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadMutex016(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_016", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_017.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_017.cpp deleted file mode 100644 index 5d7ef7d7..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_017.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_mutexLock; - -static int g_testToCount = 0; -static int g_testBackCount = 0; - -static void *ThreadFuncTest3(void *a) -{ - int ret; - int tid = Gettid(); - pthread_t thread = pthread_self(); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount++; - ret = pthread_mutex_lock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount++; - ret = pthread_mutex_unlock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static void *ThreadFuncTest2(void *a) -{ - int ret; - int tid = Gettid(); - pthread_t thread = pthread_self(); - - g_testBackCount++; - ret = pthread_mutex_lock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testBackCount++; - ret = pthread_mutex_unlock(&g_mutexLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return nullptr; -} - -static int TestCase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - int currThreadPri, currThreadPolicy; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread; - pthread_mutexattr_t mutex; - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_mutexLock, &mutex); - - g_testToCount = 0; - g_testBackCount = 0; - - SLEEP_AND_YIELD(1); - - ret = pthread_mutex_lock(&g_mutexLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - currThreadPri = param.sched_priority; - - // 2, Set the priority according to the task purpose,a smaller number means a higher priority. - param.sched_priority = currThreadPri - 2; - pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedparam(&a, ¶m); - pthread_attr_setschedpolicy(&a, currThreadPolicy); - ret = pthread_create(&newPthread, &a, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(5); // 5, delay enouge time - - ICUNIT_ASSERT_EQUAL(g_testToCount, 1, g_testToCount); - - ret = pthread_create(&newPthread, nullptr, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - SLEEP_AND_YIELD(5); // 5, delay enouge time - - ICUNIT_ASSERT_EQUAL(g_testBackCount, 1, g_testBackCount); - - ret = pthread_mutex_unlock(&g_mutexLock); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testBackCount, 2, g_testBackCount); // 2,The expected value - ICUNIT_ASSERT_EQUAL(g_testToCount, 2, g_testToCount); // 2,The expected value - - pthread_mutex_destroy(&g_mutexLock); - return 0; -} - -void ItTestPthreadMutex017(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_017", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_019.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_019.cpp deleted file mode 100644 index a82af29a..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_019.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_muxLock001; -static pthread_mutex_t g_muxLock002; -static pthread_mutex_t g_muxLock003; - -static const unsigned int TEST_COUNT = 10; -static const unsigned int NEW_THREAD_COUNT = 10; - -static volatile int g_testToCount001 = 0; -static volatile int g_testToCount002 = 0; -static volatile int g_testToCount003 = 0; - -static void *ThreadFuncTest2(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount002 = 1; - - return nullptr; - -EXIT: - g_testToCount002 = -1; - return nullptr; -} - -static void *ThreadFuncTest1(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - gettimeofday(&timeVal, nullptr); - - if(timeVal.tv_usec + 100000 >= 1000000) { // 100000us, delay time; 1000000us, compare - time.tv_sec = timeVal.tv_sec + 1; - time.tv_nsec = (timeVal.tv_usec + 100000 - 1000000) * 1000; // 100000, delaytime; 1000, us to ns; 1000000us=1s; - } else { - time.tv_sec = timeVal.tv_sec + 0; - time.tv_nsec = (timeVal.tv_usec + 100000) * 1000; // 1000, 100000us to ns - } - - ret = pthread_mutex_timedlock(&g_muxLock001, &time); - ICUNIT_GOTO_EQUAL(ret, ETIMEDOUT, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testToCount002, 1, g_testToCount002, EXIT); - - g_testToCount001++; - return nullptr; - -EXIT: - g_testToCount001 = -1; - return nullptr; -} - -/* futexList : - * 30(20) -> -1(-1) -> -1(-1) -> -1(-1) -> -1(-1) -> -1(-1) -> -1(-1) -> - * -1(-1) -> -1(-1) -> -1(-1) -> -1(-1) -> -1(-1) -> -1(-1) -> - * - */ -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - int threadCount; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread[10], newPthread1; - pthread_mutexattr_t mutex; - int index = TEST_COUNT; - int gCurrThreadPri, gCurrThreadPolicy; - struct timeval time = { 0 }; - struct timeval timeVal = { 0 }; - - ret = pthread_getschedparam(pthread_self(), &gCurrThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - gCurrThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - // 2, Set the priority according to the task purpose,a smaller number means a higher priority. - param.sched_priority = gCurrThreadPri + 2; - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedparam(&a, ¶m); - - while (index) { - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_muxLock001, &mutex); - - g_testToCount001 = 0; - g_testToCount002 = 0; - threadCount = 0; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - while (threadCount < NEW_THREAD_COUNT) { - ret = pthread_create(&newPthread[threadCount], &a, ThreadFuncTest1, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - threadCount++; - } - - usleep(1000 * 10 * 7); // 1000, 10, 7 - - ret = pthread_create(&newPthread1, nullptr, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - gettimeofday(&timeVal, nullptr); - while (1) { - gettimeofday(&time, nullptr); - if ((time.tv_sec - timeVal.tv_sec) >= 1) { - break; - } - } - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - threadCount = 0; - while (threadCount < NEW_THREAD_COUNT) { - ret = pthread_join(newPthread[threadCount], nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - threadCount++; - } - - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount001, -1, g_testToCount001); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount002, -1, g_testToCount002); - ICUNIT_ASSERT_EQUAL(g_testToCount001, NEW_THREAD_COUNT, g_testToCount001); - - pthread_mutex_destroy(&g_muxLock003); - index--; - } - return 0; -} - -void ItTestPthreadMutex019(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_019", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_020.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_020.cpp deleted file mode 100644 index 34d7fa91..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_020.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_muxLock001; -static pthread_mutex_t g_muxLock002; -static pthread_mutex_t g_muxLock003; - -static const unsigned int TEST_COUNT = 10; -static const unsigned int NEW_THREAD_COUNT = 10; - -static volatile int g_testToCount001 = 0; -static volatile int g_testToCount002 = 0; -static volatile int g_testToCount000 = 0; - -static void *ThreadFuncTest2(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount002 = 1; - - return nullptr; - -EXIT: - g_testToCount002 = -1; - return nullptr; -} - -static void *ThreadFuncTest1(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - while (g_testToCount002 != 1) { - if (g_testToCount002 == -1) { - return nullptr; - } - } - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount001++; - return nullptr; - -EXIT: - g_testToCount001 = -1; - return nullptr; -} - -static void *ThreadFuncTest0(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - gettimeofday(&timeVal, nullptr); - - time.tv_sec = timeVal.tv_sec + 0; - time.tv_nsec = (timeVal.tv_usec + 1000 * 10 * 10) * 1000; // 1000, 10 ms to ns - - ret = pthread_mutex_timedlock(&g_muxLock001, &time); - - while (g_testToCount002 != 1) { - if (g_testToCount002 == -1) { - return nullptr; - } - } - - if (ret == 0) { - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - g_testToCount000++; - return nullptr; - -EXIT: - g_testToCount000 = -1; - return nullptr; -} - -/* futexlist: - * 21(20) -> -1(-1) -> 28(22) -> 27(22) -> 26(22) -> 25(22) -> 24(22) -> 23(22) -> - * -1(-1) -> 28(22) -> 27(22) -> 26(22) -> 25(22) -> 24(22) -> 23(22) -> - * 27(22) -> 26(22) -> 25(22) -> 24(22) -> 23(22) -> - */ -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - int threadCount; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread[10], newPthread1; - pthread_mutexattr_t mutex; - int index = TEST_COUNT; - int gCurrThreadPri, gCurrThreadPolicy; - struct timeval time = { 0 }; - struct timeval timeVal = { 0 }; - - ret = pthread_getschedparam(pthread_self(), &gCurrThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - gCurrThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - // 2, Set the priority according to the task purpose,a smaller number means a higher priority. - param.sched_priority = gCurrThreadPri + 2; - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedparam(&a, ¶m); - - while (index) { - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_muxLock001, &mutex); - - g_testToCount001 = 0; - g_testToCount002 = 0; - g_testToCount000 = 0; - threadCount = 0; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newPthread[threadCount], &a, ThreadFuncTest0, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - threadCount = 1; - ret = pthread_create(&newPthread[threadCount], &a, ThreadFuncTest0, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - threadCount = 2; // 2 - while (threadCount < NEW_THREAD_COUNT) { - ret = pthread_create(&newPthread[threadCount], &a, ThreadFuncTest1, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - threadCount++; - } - - usleep(1000 * 10 * 8); // 1000, 10, 8 - - ret = pthread_create(&newPthread1, nullptr, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - gettimeofday(&timeVal, nullptr); - while (1) { - gettimeofday(&time, nullptr); - if ((time.tv_sec - timeVal.tv_sec) >= 1) { - break; - } - } - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - threadCount = 0; - while (threadCount < NEW_THREAD_COUNT) { - ret = pthread_join(newPthread[threadCount], nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - threadCount++; - } - - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount001, -1, g_testToCount001); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount002, -1, g_testToCount002); - ICUNIT_ASSERT_EQUAL(g_testToCount001, NEW_THREAD_COUNT - 2, g_testToCount001); // 2, test value - - pthread_mutex_destroy(&g_muxLock003); - index--; - } - return 0; -} - -void ItTestPthreadMutex020(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_020", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_021.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_021.cpp deleted file mode 100644 index 11b41103..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_021.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_muxLock001; -static pthread_mutex_t g_muxLock002; -static pthread_mutex_t g_muxLock003; - -static const unsigned int TEST_COUNT = 10; -static const unsigned int NEW_THREAD_COUNT = 10; - -static volatile int g_testToCount001 = 0; -static volatile int g_testToCount002 = 0; -static volatile int g_testToCount000 = 0; - -static void *ThreadFuncTest2(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount002 = 1; - - return nullptr; - -EXIT: - g_testToCount002 = -1; - return nullptr; -} - -static void *ThreadFuncTest1(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - while (g_testToCount002 != 1) { - if (g_testToCount002 == -1) { - return nullptr; - } - } - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount001++; - return nullptr; - -EXIT: - g_testToCount001 = -1; - return nullptr; -} - -static void *ThreadFuncTest0(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - gettimeofday(&timeVal, nullptr); - - time.tv_sec = timeVal.tv_sec + 0; - time.tv_nsec = (timeVal.tv_usec + 1000 * 10 * 10) * 1000; // 1000, 10 ms to ns - - ret = pthread_mutex_timedlock(&g_muxLock001, &time); - - while (g_testToCount002 != 1) { - if (g_testToCount002 == -1) { - return nullptr; - } - } - - if (ret == 0) { - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - g_testToCount000++; - return nullptr; - -EXIT: - g_testToCount000 = -1; - return nullptr; -} - -/* futexlist: - * 21(20) -> -1(-1) -> 28(22) -> 27(22) -> 26(22) -> 25(22) -> 24(22) -> 23(22) -> - * -1(-1) -> 28(22) -> 27(22) -> 26(22) -> 25(22) -> 24(22) -> 23(22) -> - * 27(22) -> 26(22) -> 25(22) -> 24(22) -> 23(22) -> - */ -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - int threadCount; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread[10], newPthread1; - pthread_mutexattr_t mutex; - int index = TEST_COUNT; - int gCurrThreadPri, gCurrThreadPolicy; - struct timeval time = { 0 }; - struct timeval timeVal = { 0 }; - - ret = pthread_getschedparam(pthread_self(), &gCurrThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - gCurrThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - // 2, Set the priority according to the task purpose,a smaller number means a higher priority. - param.sched_priority = gCurrThreadPri + 2; - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedparam(&a, ¶m); - - while (index) { - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_muxLock001, &mutex); - - g_testToCount001 = 0; - g_testToCount002 = 0; - g_testToCount000 = 0; - threadCount = 0; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - while (threadCount < NEW_THREAD_COUNT) { - if ((threadCount % 2) == 0) { // 2, for index - ret = pthread_create(&newPthread[threadCount], &a, ThreadFuncTest0, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } else { - ret = pthread_create(&newPthread[threadCount], &a, ThreadFuncTest1, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - threadCount++; - } - - usleep(1000 * 10 * 8); // 1000, 10, 8 - - ret = pthread_create(&newPthread1, nullptr, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - gettimeofday(&timeVal, nullptr); - while (1) { - gettimeofday(&time, nullptr); - if ((time.tv_sec - timeVal.tv_sec) >= 1) { - break; - } - } - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - threadCount = 0; - while (threadCount < NEW_THREAD_COUNT) { - ret = pthread_join(newPthread[threadCount], nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - threadCount++; - } - - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount001, -1, g_testToCount001); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount002, -1, g_testToCount002); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount000, -1, g_testToCount000); - - pthread_mutex_destroy(&g_muxLock003); - index--; - } - return 0; -} - -void ItTestPthreadMutex021(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_021", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_022.cpp b/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_022.cpp deleted file mode 100644 index 5ff82980..00000000 --- a/testsuites/unittest_old/process/mutex/smoke/pthread_mutex_test_022.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/* - * 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. - */ -#include "it_mutex_test.h" - -static pthread_mutex_t g_muxLock001; -static pthread_mutex_t g_muxLock002; -static pthread_mutex_t g_muxLock003; - -static const unsigned int TEST_COUNT = 10; -static const unsigned int NEW_THREAD_COUNT = 10; - -static volatile int g_testToCount001 = 0; -static volatile int g_testToCount002 = 0; -static volatile int g_testToCount000 = 0; - -static void *ThreadFuncTest2(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount002 = 1; - - return nullptr; - -EXIT: - g_testToCount002 = -1; - return nullptr; -} - -static void *ThreadFuncTest1(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - while (g_testToCount002 != 1) { - if (g_testToCount002 == -1) { - return nullptr; - } - } - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testToCount001++; - return nullptr; - -EXIT: - g_testToCount001 = -1; - return nullptr; -} - -static void *ThreadFuncTest0(void *a) -{ - int ret; - pthread_t thread = pthread_self(); - struct timespec time; - struct timeval timeVal = { 0 }; - - gettimeofday(&timeVal, nullptr); - - time.tv_sec = timeVal.tv_sec + 0; - time.tv_nsec = (timeVal.tv_usec + 1000 * 10 * 10) * 1000; // 1000, 10 ms to ns - - ret = pthread_mutex_timedlock(&g_muxLock001, &time); - - while (g_testToCount002 != 1) { - if (g_testToCount002 == -1) { - return nullptr; - } - } - - if (ret == 0) { - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - g_testToCount000++; - return nullptr; - -EXIT: - g_testToCount000 = -1; - return nullptr; -} - -/* futexlist: - * 21(20) -> -1(-1) -> 28(22) -> 27(22) -> 26(22) -> 25(22) -> 24(22) -> 23(22) -> - * -1(-1) -> 28(22) -> 27(22) -> 26(22) -> 25(22) -> 24(22) -> 23(22) -> - * 27(22) -> 26(22) -> 25(22) -> 24(22) -> 23(22) -> - */ -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - int threadCount; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread[10], newPthread1; - pthread_mutexattr_t mutex; - int index = TEST_COUNT; - int gCurrThreadPri, gCurrThreadPolicy; - struct timeval time = { 0 }; - struct timeval timeVal = { 0 }; - - ret = pthread_getschedparam(pthread_self(), &gCurrThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - gCurrThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - // 2, Set the priority according to the task purpose,a smaller number means a higher priority. - param.sched_priority = gCurrThreadPri + 2; - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedparam(&a, ¶m); - - while (index) { - pthread_mutexattr_settype(&mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&g_muxLock001, &mutex); - - g_testToCount001 = 0; - g_testToCount002 = 0; - g_testToCount000 = 0; - threadCount = 0; - - ret = pthread_mutex_lock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - while (threadCount < NEW_THREAD_COUNT) { - if ((threadCount % 2) == 0) { // 2, for index - ret = pthread_create(&newPthread[threadCount], &a, ThreadFuncTest1, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } else { - ret = pthread_create(&newPthread[threadCount], &a, ThreadFuncTest0, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - threadCount++; - } - - usleep(1000 * 10 * 8); // 1000, 10, 8 - - ret = pthread_create(&newPthread1, nullptr, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - gettimeofday(&timeVal, nullptr); - while (1) { - gettimeofday(&time, nullptr); - if ((time.tv_sec - timeVal.tv_sec) >= 1) { - break; - } - } - - ret = pthread_mutex_unlock(&g_muxLock001); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - threadCount = 0; - while (threadCount < NEW_THREAD_COUNT) { - ret = pthread_join(newPthread[threadCount], nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - threadCount++; - } - - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount001, -1, g_testToCount001); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount002, -1, g_testToCount002); - ICUNIT_ASSERT_NOT_EQUAL(g_testToCount000, -1, g_testToCount000); - - pthread_mutex_destroy(&g_muxLock003); - index--; - } - return 0; -} - -void ItTestPthreadMutex022(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_MUTEX_022", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/BUILD.gn b/testsuites/unittest_old/process/process/BUILD.gn deleted file mode 100644 index 05c26d51..00000000 --- a/testsuites/unittest_old/process/process/BUILD.gn +++ /dev/null @@ -1,149 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "process_process_test.cpp", -] - -sources_smoke = [ - "smoke/process_test_001.cpp", - "smoke/process_test_002.cpp", - "smoke/process_test_004.cpp", - "smoke/process_test_005.cpp", - "smoke/process_test_006.cpp", - "smoke/process_test_008.cpp", - "smoke/process_test_009.cpp", - "smoke/process_test_010.cpp", - "smoke/process_test_011.cpp", - "smoke/process_test_012.cpp", - "smoke/process_test_013.cpp", - "smoke/process_test_014.cpp", - "smoke/process_test_015.cpp", - "smoke/process_test_016.cpp", - "smoke/process_test_017.cpp", - "smoke/process_test_018.cpp", - "smoke/process_test_019.cpp", - "smoke/process_test_020.cpp", - "smoke/process_test_021.cpp", - "smoke/process_test_022.cpp", - "smoke/process_test_023.cpp", - "smoke/process_test_024.cpp", - "smoke/process_test_025.cpp", - "smoke/process_test_026.cpp", - "smoke/process_test_027.cpp", - "smoke/process_test_029.cpp", - "smoke/process_test_030.cpp", - "smoke/process_test_038.cpp", - "smoke/process_test_039.cpp", - "smoke/process_test_043.cpp", - "smoke/process_test_044.cpp", - "smoke/process_test_045.cpp", - "smoke/process_test_046.cpp", - "smoke/process_test_047.cpp", - "smoke/process_test_048.cpp", - "smoke/process_test_054.cpp", - "smoke/process_test_061.cpp", - "smp/process_test_smp_001.cpp", - "smp/process_test_smp_002.cpp", - "smp/process_test_smp_003.cpp", - "smp/process_test_smp_004.cpp", - "smp/process_test_smp_005.cpp", - "smp/process_test_smp_006.cpp", - "smp/process_test_smp_007.cpp", - "smp/process_test_smp_008.cpp", -] - -sources_full = [ - "full/process_test_007.cpp", - "full/process_test_031.cpp", - "full/process_test_032.cpp", - "full/process_test_033.cpp", - "full/process_test_034.cpp", - "full/process_test_035.cpp", - "full/process_test_036.cpp", - "full/process_test_037.cpp", - "full/process_test_040.cpp", - "full/process_test_041.cpp", - "full/process_test_042.cpp", - "full/process_test_049.cpp", - "full/process_test_050.cpp", - "full/process_test_051.cpp", - "full/process_test_055.cpp", - "full/process_test_056.cpp", - "full/process_test_057.cpp", - "full/process_test_058.cpp", - "full/process_test_059.cpp", - "full/process_test_060.cpp", - "full/process_test_063.cpp", - "full/process_test_064.cpp", - "full/process_test_065.cpp", - "full/process_test_066.cpp", - "full/process_test_067.cpp", - "full/process_test_068.cpp", - "full/process_test_069.cpp", - "full/process_test_053.cpp", - "full/process_test_062.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_process_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_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_old/process/process/full/process_test_007.cpp b/testsuites/unittest_old/process/process/full/process_test_007.cpp deleted file mode 100644 index 58587ca9..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_007.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static const int TEST_COUNT = 10; - -static void *ThreadFunc2(void *arg) -{ - exit(254); // 254, exit args -} - -static int ProcessTest001(void) -{ - int ret; - int status; - int pid; - int data; - int pri; - pthread_t newPthread, newPthread1; - int count = 4; - int currProcessPri = getpriority(PRIO_PROCESS, getpid()); - ICUNIT_ASSERT_WITHIN_EQUAL(currProcessPri, 0, 31, currProcessPri); // 31, assert that function Result is equal to this. - - ret = setpriority(PRIO_PROCESS, getpid(), currProcessPri - 2); // 2, Used to calculate priorities. - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - data = ret; - ret = pthread_create(&newPthread, NULL, ThreadFunc2, &data); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(255); // 255, exit args - return 0; -} - -static int Testcase(void) -{ - int ret; - int status; - int pid; - int count = TEST_COUNT; - int temp = GetCpuCount(); - if (temp <= 1) { - return 0; - } - - while (count > 0) { - ret = fork(); - if (ret == 0) { - ret = ProcessTest001(); - exit(10); // 10, exit args - } else if (ret > 0) { - pid = ret; - ret = wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_TWO_EQUAL(status, 255, 254, status); // 255, 254, assert that function Result is equal to this. - } - - ICUNIT_ASSERT_WITHIN_EQUAL(ret, 0, 100000, ret); // 100000, assert that function Result is equal to this. - count--; - } - return 0; -} - -void ItTestProcess007(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_007", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_031.cpp b/testsuites/unittest_old/process/process/full/process_test_031.cpp deleted file mode 100644 index ab00f279..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_031.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Child1(int currGid) -{ - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - ICUNIT_ASSERT_EQUAL(getpgrp(), getpid(), getpgrp()); - - exit(255); // 255, exit args -} - -static int Child2(int currGid, int gid) -{ - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - ICUNIT_ASSERT_EQUAL(getpgrp(), gid, getpgrp()); - exit(255); // 255, exit args -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - Child1(currGid); - exit(0); - } - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = setpgid(pid, pid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid1, EXIT); // 100000, assert pid1 equal to this. - if (pid1 == 0) { - Child2(currGid, pid); - exit(0); - } - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = setpgid(pid1, pid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - status = 0; - ret = waitpid(pid1, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid1, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess031(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_031", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_032.cpp b/testsuites/unittest_old/process/process/full/process_test_032.cpp deleted file mode 100644 index 0b75072b..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_032.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Child1(int currGid) -{ - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - ICUNIT_ASSERT_EQUAL(getpgrp(), getpid(), getpgrp()); - - exit(255); // 255, exit args -} - -static int Child2(int currGid, int gid) -{ - int ret; - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - ret = setpgid(getpid(), gid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(getpgrp(), gid, getpgrp()); - exit(255); // 255, exit args -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - Child1(currGid); - exit(0); - } - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = setpgid(pid, pid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid1, EXIT); // 100000, assert pid1 equal to this. - if (pid1 == 0) { - Child2(currGid, pid); - exit(0); - } - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - status = 0; - ret = waitpid(pid1, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid1, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess032(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_032", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_033.cpp b/testsuites/unittest_old/process/process/full/process_test_033.cpp deleted file mode 100644 index 16db771f..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_033.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Child1(int currGid) -{ - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - ICUNIT_ASSERT_EQUAL(getpgrp(), getpid(), getpgrp()); - - exit(255); // 255, exit args -} - -static int Child2(int currGid, int gid) -{ - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - exit(255); // 255, exit args -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - Child1(currGid); - exit(0); - } - - usleep(1000 * 10 * 1); // 1000, 10, Used to calculate the delay time. - ret = setpgid(pid, pid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid1, EXIT); // 100000, assert pid1 equal to this. - ICUNIT_GOTO_NOT_EQUAL(pid1, pid, pid1, EXIT); - - if (pid1 == 0) { - Child2(currGid, pid); - exit(0); - } - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = setpgid(pid1, pid); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EPERM, errno); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - status = 0; - ret = waitpid(pid1, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid1, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess033(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_033", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_034.cpp b/testsuites/unittest_old/process/process/full/process_test_034.cpp deleted file mode 100644 index 7c6cb926..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_034.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Child1(int currGid) -{ - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - sleep(1); - - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - exit(255); // 255, exit args -} - -static int Child2(int currGid, int gid) -{ - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - sleep(1); - - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - exit(255); // 255, exit args -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - Child1(currGid); - exit(0); - } - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid1, EXIT); // 100000, assert pid1 equal to this. - ICUNIT_GOTO_NOT_EQUAL(pid1, pid, pid1, EXIT); - - if (pid1 == 0) { - Child2(currGid, pid); - exit(0); - } - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = setpgid(pid1, pid); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EPERM, errno); - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - status = 0; - ret = waitpid(pid1, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid1, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess034(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_034", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_035.cpp b/testsuites/unittest_old/process/process/full/process_test_035.cpp deleted file mode 100644 index eb21368c..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_035.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Child1(int currGid) -{ - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - sleep(1); - - exit(255); // 255, exit args -} - -static int Child2(int currGid, int gid) -{ - int ret; - - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - ret = setpgid(getpid(), gid); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EPERM, errno); - - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - exit(255); // 255, exit args -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - Child1(currGid); - exit(0); - } - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid1, EXIT); // 100000, assert pid1 equal to this. - ICUNIT_GOTO_NOT_EQUAL(pid1, pid, pid1, EXIT); - - if (pid1 == 0) { - Child2(currGid, pid); - exit(0); - } - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - status = 0; - ret = waitpid(pid1, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid1, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess035(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_035", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_036.cpp b/testsuites/unittest_old/process/process/full/process_test_036.cpp deleted file mode 100644 index 1d8efc76..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_036.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Child1(int currGid) -{ - int ret; - - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - ret = setpgrp(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(getpid(), getpgrp(), getpgrp()); - - usleep(1000 * 10 * 10); // 1000, 10, 10, Used to calculate the delay time. - - ret = setpgid(getpid(), currGid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(getpgrp(), currGid, getpgrp()); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - exit(255); // 255, exit args -} - -static int Child2(int currGid, int gid) -{ - int ret; - - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - ret = setpgid(getpid(), gid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(getpgrp(), gid, getpgrp()); - - usleep(1000 * 10 * 12); // 1000, 10, 12, Used to calculate the delay time. - - ret = setpgrp(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(getpgrp(), getpid(), getpgrp()); - - exit(255); // 255, exit args -} - -static int ProcessGroup(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - ret = setpgrp(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - currGid = getpgrp(); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - Child1(currGid); - exit(g_iCunitErrLineNo); - } - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid1, EXIT); // 100000, assert pid1 equal to this. - ICUNIT_GOTO_NOT_EQUAL(pid1, pid, pid1, EXIT); - - if (pid1 == 0) { - Child2(currGid, pid); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - status = 0; - ret = waitpid(pid1, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid1, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - ProcessGroup(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess036(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_036", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_037.cpp b/testsuites/unittest_old/process/process/full/process_test_037.cpp deleted file mode 100644 index 29f8c6a4..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_037.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Child1(int currGid) -{ - int ret; - - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - ret = setpgrp(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(getpid(), getpgrp(), getpgrp()); - - usleep(1000 * 10 * 12); // 1000, 10, 12, Used to calculate the delay time. - - exit(255); // 255, exit args -} - -static int Child2(int currGid, int gid) -{ - int ret; - - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - ret = setpgid(getpid(), getpid()); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(getpgrp(), getpid(), getpgrp()); - - usleep(1000 * 10 * 12); // 1000, 10, 12, Used to calculate the delay time. - - ICUNIT_ASSERT_EQUAL(getpgrp(), gid, getpgrp()); - - exit(255); // 255, exit args -} - -static int ProcessGroup(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - ret = setpgrp(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - currGid = getpgrp(); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - Child1(currGid); - exit(g_iCunitErrLineNo); - } - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid1, EXIT); // 100000, assert pid1 equal to this. - ICUNIT_GOTO_NOT_EQUAL(pid1, pid, pid1, EXIT); - - if (pid1 == 0) { - Child2(currGid, pid); - exit(g_iCunitErrLineNo); - } - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = setpgid(pid1, pid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - status = 0; - ret = waitpid(pid1, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid1, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - ProcessGroup(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess037(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_037", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_040.cpp b/testsuites/unittest_old/process/process/full/process_test_040.cpp deleted file mode 100644 index cadf457c..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_040.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int GroupProcess(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int count = 1000; - int waitProcess = 0; - int testPid; - bool thread = false; - int processCount = 0; - - for (int i = 0; i < count; i++) { - pid = fork(); - if (pid == 0) { - usleep(1000 * 10 * 50); // 1000, 10, 50, Used to calculate the delay time. - exit(0); - } else if (pid < 0) { - if (errno != EAGAIN) { - sleep(1); - } - ret = wait(&status); - if (ret > 0) { - processCount--; - } - continue; - } else { - testPid = pid; - processCount++; - continue; - } - } - - ret = 0; - while (processCount > 0) { - ret = wait(&status); - if (ret > 0) { - processCount--; - } else { - sleep(1); - } - } - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - prctl(PR_SET_NAME, "mainFork", 0UL, 0UL, 0UL); - GroupProcess(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess040(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_040", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_041.cpp b/testsuites/unittest_old/process/process/full/process_test_041.cpp deleted file mode 100644 index d2356961..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_041.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static void *Thread(void *arg) -{ - sleep(1); - return NULL; -} - -static int GroupProcess(void) -{ - int testPid; - int ret; - int status = 0; - pid_t pid, pid1; - int count = 500; - int waitProcess = 0; - pthread_attr_t a = { 0 }; - pthread_t pthread[1000] = { 0 }; - struct sched_param param = { 0 }; - bool thread = false; - - int processCount = 0; - - pthread_attr_init(&a); - param.sched_priority = 31; // 31, set pthread priority. - pthread_attr_setschedparam(&a, ¶m); - for (int i = 0; i < 40; i++) { // 40, number of cycles - ret = pthread_create(&pthread[i], &a, Thread, NULL); - if (ret != 0) { - exit(10); // 10, exit args - break; - } - } - - for (int i = 0; i < count; i++) { - pid = fork(); - if (pid == 0) { - pthread_create(&pthread[100], &a, Thread, NULL); // 100, pthread array subscript - pthread_create(&pthread[100], &a, Thread, NULL); // 100, pthread array subscript - pthread_create(&pthread[100], &a, Thread, NULL); // 100, pthread array subscript - usleep(1000 * 10 * 50); // 1000, 10, 50, Used to calculate the delay time. - exit(0); - } else if (pid < 0) { - if (errno != EAGAIN) { - sleep(1); - } - ret = wait(&status); - if (ret > 0) { - processCount--; - } - continue; - } else { - processCount++; - testPid = pid; - continue; - } - } - - ret = 0; - while (processCount > 0) { - ret = wait(&status); - if (ret > 0) { - processCount--; - } else { - sleep(1); - } - } - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - prctl(PR_SET_NAME, "mainFork", 0UL, 0UL, 0UL); - GroupProcess(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess041(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_041", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_042.cpp b/testsuites/unittest_old/process/process/full/process_test_042.cpp deleted file mode 100644 index 188cdf79..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_042.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include "sys/shm.h" - -static const int TEST_THREAD = 40; -static const int TEST_LOOP = 3000; - -static void Child2(int shmid) -{ - int count = 2; // 2, Set the calculation number to determine the cycle status. - int *shared = (int *)shmat(shmid, nullptr, 0); - ICUNIT_ASSERT_NOT_EQUAL_VOID(shared, (void *)-1, shared); - - while ((*shared) < (TEST_LOOP + 2)) { // 2, Set the cycle number. - ICUNIT_ASSERT_EQUAL_VOID(*shared, count, *shared); - (*shared)++; - count += 3; // 3, Set the calculation number to determine the cycle status. - sched_yield(); - } - - exit(255); // 255, exit args - return; -} - -static void Child1(int shmid) -{ - int count = 1; - int *shared = (int *)shmat(shmid, nullptr, 0); - ICUNIT_ASSERT_NOT_EQUAL_VOID(shared, (void *)-1, shared); - - while ((*shared) < (TEST_LOOP + 1)) { - ICUNIT_ASSERT_EQUAL_VOID(*shared, count, *shared); - (*shared)++; - count += 3; // 3, Set the calculation number to determine the cycle status. - sched_yield(); - } - - (*shared) = 100000; // 100000, shared num. - - exit(255); // 255, exit args - return; -} - -static int GroupProcess(void) -{ - int testPid; - int ret; - int policy = 0; - struct sched_param param = { 0 }; - int status = 0; - pid_t pid, pid1; - const int memSize = 1024; - int shmid; - int *shared = NULL; - - ret = sched_getparam(getpid(), ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - int processPrio = param.sched_priority; - - ret = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - shmid = shmget((key_t)1234, memSize, 0666 | IPC_CREAT); // 1234, Sets the shmget key; 0666 config of shmget - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - Child1(shmid); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(0); - } - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid1, EXIT); // 100000, assert pid equal to this. - if (pid1 == 0) { - Child2(shmid); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(0); - } - - shared = (int *)shmat(shmid, nullptr, 0); - ICUNIT_ASSERT_NOT_EQUAL(shared, (void *)-1, shared); - - (*shared) = 0; - - while ((*shared) < TEST_LOOP) { - (*shared)++; - sched_yield(); - } - - (*shared) = TEST_LOOP + 10; // 10, Set the cycle number. - - param.sched_priority = processPrio - 2; // 2, set pthread priority. - ret = sched_setscheduler(pid, SCHED_RR, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(*shared, 100000, *shared); // 100000, assert that function Result is equal to this. - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 255, status); // 255, assert that function Result is equal to this. - - ret = waitpid(pid1, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid1, ret); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 255, status); // 255, assert that function Result is equal to this. - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - - int temp = GetCpuCount(); - if (temp != 1) { - return 0; - } - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - prctl(PR_SET_NAME, "mainFork", 0UL, 0UL, 0UL); - GroupProcess(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess042(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_042", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_049.cpp b/testsuites/unittest_old/process/process/full/process_test_049.cpp deleted file mode 100644 index ff3f5832..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_049.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include "sys/shm.h" - -static int *g_shmptr = NULL; -static int g_usetTestCount = 0; -static VOID *PthreadTest115(VOID *arg) -{ - g_usetTestCount++; - return NULL; -} - -static int TestThread(void *arg) -{ - int data = *((int *)arg); - int ret = 0; - pthread_t gTh; - ret = pthread_create(&gTh, NULL, PthreadTest115, NULL); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, ret); - - ret = pthread_join(gTh, NULL); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL_NULL(g_usetTestCount, 1, g_usetTestCount); - - *g_shmptr = 100; // 100, set shared num. - - pid_t pid = fork(); - - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - sleep(1); - exit(0); - } - - *g_shmptr = 200; // 200, set shared num. - - ret = waitpid(pid, NULL, 0); - printf("waitpid ret : %d errno : %d pid : %d getpid : %d\n", ret, errno, pid, getpid()); - - ICUNIT_ASSERT_EQUAL_NULL(ret, pid, ret); - - *g_shmptr = data; -EXIT: - return NULL; -} - -// This testcase us used for undefination of LOSCFG_USER_TEST_SMP -static int Testcase(void) -{ - int arg = 0x2000; - int status; - int ret; - char *stackTop; - char *stack; - pid_t pid; - - g_usetTestCount = 0; - int shmid = shmget(IPC_PRIVATE, sizeof(int), IPC_CREAT | 0600); // // 0600, set shmget config. - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - g_shmptr = (int *)shmat(shmid, nullptr, 0); - ICUNIT_ASSERT_NOT_EQUAL(g_shmptr, (int *)-1, g_shmptr); - - *g_shmptr = 0; - - stack = (char *)malloc(arg); - ICUNIT_GOTO_NOT_EQUAL(stack, NULL, stack, EXIT1); - - stackTop = (char *)((unsigned long)stack + arg); - pid = clone(TestThread, (void *)stackTop, CLONE_VFORK, &arg); - - ICUNIT_GOTO_EQUAL(*g_shmptr, arg, *g_shmptr, EXIT2); - - ret = waitpid(pid, &status, NULL); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT2); - -EXIT2: - free(stack); - -EXIT1: - shmdt(g_shmptr); - shmctl(shmid, IPC_RMID, NULL); - - return 0; -} - -void ItTestProcess049(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_049", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_050.cpp b/testsuites/unittest_old/process/process/full/process_test_050.cpp deleted file mode 100644 index 839cb151..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_050.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include "sys/shm.h" - -static int *g_shmptr = NULL; -static int g_ppid; -static int TestThread(void *arg) -{ - pid_t ppid = getppid(); - - printf("TestThread ppid : %d g_ppid : %d\n", ppid, g_ppid); - - ICUNIT_ASSERT_EQUAL_NULL(ppid, g_ppid, g_ppid); - - *g_shmptr = 100; // 100, set shared num. - return NULL; -} - -// This testcase us used for undefination of LOSCFG_USER_TEST_SMP -static int Testcase(void) -{ - int arg = 0x2000; - int status; - void *stack; - char *stackTop; - int ret; - int count; - pid_t pid; - - int shmid = shmget(IPC_PRIVATE, sizeof(int), IPC_CREAT | 0600); // 0600 config of shmget - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - g_shmptr = (int *)shmat(shmid, nullptr, 0); - ICUNIT_ASSERT_NOT_EQUAL(g_shmptr, (int *)-1, g_shmptr); - - *g_shmptr = 0; - - g_ppid = getppid(); - printf("testcase ppid : %d\n", g_ppid); - - stack = malloc(arg); - ICUNIT_GOTO_NOT_EQUAL(stack, NULL, stack, EXIT1); - - stackTop = (char *)((unsigned long)stack + arg); - pid = clone(TestThread, (void *)stackTop, CLONE_PARENT, &arg); - - ret = waitpid(pid, &status, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - - count = 0; - while ((count < 100) || (*g_shmptr == 0)) { // 100, Number of cycles. - usleep(1000 * 100); // 1000, 100, set usleep time. - count++; - } - - ICUNIT_GOTO_EQUAL(*g_shmptr, 100, *g_shmptr, EXIT2); // 100, assert g_shmptr equal to this. -EXIT2: - free(stack); - -EXIT1: - shmdt(g_shmptr); - shmctl(shmid, IPC_RMID, NULL); - - return 0; -} - -void ItTestProcess050(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_050", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_051.cpp b/testsuites/unittest_old/process/process/full/process_test_051.cpp deleted file mode 100644 index 4eed4367..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_051.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include "sys/shm.h" - -static int *g_shmptr = NULL; -static int g_ppid; -static int TestThread(void *arg) -{ - int ret = 0; - pid_t pid; - pid_t ppid = getppid(); - - printf("TestThread ppid : %d g_ppid : %d\n", ppid, g_ppid); - - ICUNIT_ASSERT_EQUAL_NULL(ppid, g_ppid, g_ppid); - - *g_shmptr = 1000; // 1000, set shared num. - - pid = fork(); - - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - sleep(1); - exit(0); - } - - ret = waitpid(pid, NULL, 0); - ICUNIT_ASSERT_EQUAL_NULL(ret, pid, ret); - - *g_shmptr = 100; // 100, set shared num. -EXIT: - return NULL; -} - -// This testcase us used for undefination of LOSCFG_USER_TEST_SMP -static int Testcase(void) -{ - int arg = 0x2000; - int status; - pid_t pid; - void *stack; - char *stackTop; - int ret; - - int shmid = shmget(IPC_PRIVATE, sizeof(int), IPC_CREAT | 0600); // 0600 config of shmget - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - g_shmptr = (int *)shmat(shmid, nullptr, 0); - ICUNIT_ASSERT_NOT_EQUAL(g_shmptr, (int *)-1, g_shmptr); - - *g_shmptr = 0; - - g_ppid = getppid(); - printf("testcase ppid : %d\n", g_ppid); - - stack = malloc(arg); - ICUNIT_GOTO_NOT_EQUAL(stack, NULL, stack, EXIT1); - - stackTop = (char *)((unsigned long)stack + arg); - pid = clone(TestThread, (void *)stackTop, CLONE_PARENT | CLONE_VFORK, &arg); - - ICUNIT_GOTO_EQUAL(*g_shmptr, 100, *g_shmptr, EXIT2); // 100, assert g_shmptr equal to this. - - ret = waitpid(pid, &status, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - -EXIT2: - free(stack); - -EXIT1: - shmdt(g_shmptr); - shmctl(shmid, IPC_RMID, NULL); - - return 0; -} - -void ItTestProcess051(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_051", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_052.cpp b/testsuites/unittest_old/process/process/full/process_test_052.cpp deleted file mode 100644 index 9b88ddb6..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_052.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include "sys/shm.h" - -static int *g_shmptr = NULL; -static int g_ppid; -static void *TestThread(void *arg) -{ - int data = *((int *)arg); - int ret = 0; - - pid_t ppid = getppid(); - - printf("TestThread ppid : %d g_ppid : %d\n", ppid, g_ppid); - - ICUNIT_ASSERT_EQUAL(ppid, g_ppid, g_ppid); - - *g_shmptr = 100; // 100, set shared num. - return NULL; -} - -// This testcase us used for undefination of LOSCFG_USER_TEST_SMP -static int Testcase(void) -{ - int arg = 0x2000; - int status; - - int shmid = shmget(IPC_PRIVATE, sizeof(int), IPC_CREAT | 0600); // 0600 config of shmget - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - g_shmptr = (int *)shmat(shmid, nullptr, 0); - ICUNIT_ASSERT_NOT_EQUAL(g_shmptr, (int *)-1, g_shmptr); - - *g_shmptr = 0; - - g_ppid = getppid(); - printf("testcase ppid : %d\n", g_ppid); - - void *stack = (void *)malloc(arg); - ICUNIT_GOTO_NOT_EQUAL(stack, NULL, stack, EXIT1); - - char *stackTop = (char *)((unsigned long)stack + arg); - pid_t pid = clone(TestThread, (char *)stackTop, CLONE_PARENT | CLONE_VFORK | CLONE_FILES, &arg); - - ICUNIT_GOTO_EQUAL(*g_shmptr, 100, *g_shmptr, EXIT2); // 100, assert g_shmptr equal to this. - - int ret = waitpid(pid, &status, NULL); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT2); - -EXIT2: - free(stack); - -EXIT1: - shmdt(g_shmptr); - shmctl(shmid, IPC_RMID, NULL); - - return 0; -} - -void ItTestProcess052(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_052", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_053.cpp b/testsuites/unittest_old/process/process/full/process_test_053.cpp deleted file mode 100644 index d0a15c46..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_053.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_signal = 0; - -static void Handler(int sig) -{ - g_signal = sig; -} - -static int TestCase(void) -{ - void (*retSig)(int); - int status; - int ret; - retSig = signal(SIGUSR1, Handler); - ICUNIT_ASSERT_NOT_EQUAL(retSig, SIG_ERR, retSig); - - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - ret = killpg(getpgrp(), SIGUSR1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - exit(10); // 10, exit args - } - - while (g_signal == 0) { - sleep(1); - } - ICUNIT_ASSERT_EQUAL(g_signal, SIGUSR1, g_signal); - - ret = wait(&status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 10, status); // 10, assert that function Result is equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess053(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_053", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/full/process_test_055.cpp b/testsuites/unittest_old/process/process/full/process_test_055.cpp deleted file mode 100644 index 30ce7ed1..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_055.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Child1(void) -{ - int ret; - siginfo_t info = { 0 }; - - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ret = kill(getpid(), SIGKILL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - - ret = waitid(P_PID, pid, &info, WEXITED); - - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(info.si_status, SIGKILL, info.si_status); - ICUNIT_ASSERT_EQUAL(info.si_code, 2, info.si_code); // 2, assert that function Result is equal to this. - ICUNIT_ASSERT_EQUAL(info.si_pid, pid, info.si_pid); - exit(8); // 8, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - pid_t pid; - int status; - int ret; - pid = fork(); - - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - Child1(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } else { - siginfo_t info = { 0 }; - - ret = waitid(P_ALL, getpgrp(), &info, WEXITED); - - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(info.si_status, 8, info.si_status); // 8, assert that function Result is equal to this. - ICUNIT_ASSERT_EQUAL(info.si_code, 1, info.si_code); - ICUNIT_ASSERT_EQUAL(info.si_pid, pid, info.si_pid); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - exit(11); // 11, exit args - } - - sleep(1); - - ret = waitid(P_PGID, getpgrp(), &info, WNOHANG); - - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(info.si_status, 11, info.si_status); // 11, assert that function Result is equal to this. - ICUNIT_ASSERT_EQUAL(info.si_code, 1, info.si_code); - ICUNIT_ASSERT_EQUAL(info.si_pid, pid, info.si_pid); - } - return 0; -EXIT: - return 1; -} - -void ItTestProcess055(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_055", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/full/process_test_056.cpp b/testsuites/unittest_old/process/process/full/process_test_056.cpp deleted file mode 100644 index d2ca28cd..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_056.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static int TestCase(void) -{ - pid_t pid; - int ret; - int status = 0; - char *argv1[] = {"tftp", NULL}; - - ret = posix_spawn(&pid, "/bin/tftp", NULL, NULL, argv1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - - return 0; -} - -void ItTestProcess056(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_056", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/full/process_test_057.cpp b/testsuites/unittest_old/process/process/full/process_test_057.cpp deleted file mode 100644 index e24af5c4..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_057.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static int TestCase(void) -{ - pid_t pid; - int ret; - int status = 0; - char *argv1[] = {"tftp", NULL}; - - ret = posix_spawnp(&pid, "tftp", NULL, NULL, argv1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - - return 0; -} - -void ItTestProcess057(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_057", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/full/process_test_058.cpp b/testsuites/unittest_old/process/process/full/process_test_058.cpp deleted file mode 100644 index be042a22..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_058.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static const int HIGH_PRIORITY = 10; // 10, set high prio. - -static int TestSpawnAttrDef(posix_spawnattr_t *attr) -{ - sigset_t signalset; - sigset_t signalset1; - int ret; - - ret = sigemptyset(&signalset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = sigaddset(&signalset, SIGPIPE); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = posix_spawnattr_setsigdefault(attr, &signalset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getsigdefault(attr, &signalset1); - ret = memcmp(&signalset, &signalset1, sizeof(sigset_t)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = sigismember(&signalset, SIGPIPE); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrMask(posix_spawnattr_t *attr) -{ - sigset_t signalset; - sigset_t signalset1; - int ret; - - ret = sigemptyset(&signalset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = sigaddset(&signalset, SIGPIPE); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = posix_spawnattr_setsigmask(attr, &signalset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getsigmask(attr, &signalset1); - ret = memcmp(&signalset, &signalset1, sizeof(sigset_t)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = sigismember(&signalset, SIGPIPE); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrGroup(posix_spawnattr_t *attr) -{ - pid_t val = -1; - pid_t pid = getpgrp(); - int ret; - posix_spawnattr_getpgroup(attr, &val); - ICUNIT_GOTO_EQUAL(val, 0, val, EXIT); - - val = getpgid(getpid()); - ret = posix_spawnattr_setpgroup(attr, val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - val = -1; - - posix_spawnattr_getpgroup(attr, &val); - ICUNIT_GOTO_EQUAL(val, pid, val, EXIT); - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrPrio(posix_spawnattr_t *attr) -{ - struct sched_param val = { -1 }; - struct sched_param val1 = { -1 }; - int ret; - posix_spawnattr_getschedparam(attr, &val); - ICUNIT_GOTO_EQUAL(val.sched_priority, 0, ret, EXIT); - - val.sched_priority = HIGH_PRIORITY; - ret = posix_spawnattr_setschedparam(attr, &val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getschedparam(attr, &val1); - ICUNIT_GOTO_EQUAL(val1.sched_priority, HIGH_PRIORITY, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrPol(posix_spawnattr_t *attr) -{ - int val = -1; - int ret; - - posix_spawnattr_getschedpolicy(attr, &val); - ICUNIT_GOTO_EQUAL(val, 0, val, EXIT); - - val = SCHED_RR; - ret = posix_spawnattr_setschedpolicy(attr, val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - val = -1; - - posix_spawnattr_getschedpolicy(attr, &val); - ICUNIT_GOTO_EQUAL(val, SCHED_RR, val, EXIT); - - ret = TestSpawnAttrPrio(attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttr(short flag) -{ - pid_t pid; - posix_spawnattr_t attr; - int status = 1; - char *argv1[] = {"tftp", NULL}; - short iflag = -1; - int ret; - - ret = posix_spawnattr_init(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getflags(&attr, &iflag); - ICUNIT_GOTO_EQUAL(iflag, 0, iflag, EXIT); - - ret = posix_spawnattr_setflags(&attr, flag); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - iflag = -1; - - posix_spawnattr_getflags(&attr, &iflag); - ICUNIT_GOTO_EQUAL(iflag, flag, iflag, EXIT); - - if (POSIX_SPAWN_SETSIGDEF == flag) { - ret = TestSpawnAttrDef(&attr); - } else if (POSIX_SPAWN_SETSIGMASK == flag) { - ret = TestSpawnAttrMask(&attr); - } else if (POSIX_SPAWN_SETPGROUP == flag) { - ret = TestSpawnAttrGroup(&attr); - } else if (POSIX_SPAWN_SETSCHEDPARAM == flag) { - ret = TestSpawnAttrPrio(&attr); - } else if (POSIX_SPAWN_SETSCHEDULER == flag) { - ret = TestSpawnAttrPol(&attr); - } - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = posix_spawn(&pid, "/bin/tftp", NULL, &attr, argv1, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = posix_spawnattr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -static int TestCase(void) -{ - int ret; - - ret = TestSpawnAttr(POSIX_SPAWN_RESETIDS); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnAttr(POSIX_SPAWN_SETPGROUP); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnAttr(POSIX_SPAWN_SETSIGDEF); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnAttr(POSIX_SPAWN_SETSIGMASK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnAttr(POSIX_SPAWN_SETSCHEDPARAM); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnAttr(POSIX_SPAWN_SETSCHEDULER); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -void ItTestProcess058(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_058", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/full/process_test_059.cpp b/testsuites/unittest_old/process/process/full/process_test_059.cpp deleted file mode 100644 index 0eff40c7..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_059.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static const int HIGH_PRIORITY = 31; - -static int TestSpawnAttrDef(posix_spawnattr_t *attr) -{ - sigset_t signalset; - sigset_t signalset1; - int ret; - - ret = sigemptyset(&signalset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = sigaddset(&signalset, SIGPIPE); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = posix_spawnattr_setsigdefault(attr, &signalset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getsigdefault(attr, &signalset1); - ret = memcmp(&signalset, &signalset1, sizeof(sigset_t)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = sigismember(&signalset, SIGPIPE); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrMask(posix_spawnattr_t *attr) -{ - sigset_t signalset; - sigset_t signalset1; - int ret; - - ret = sigemptyset(&signalset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = sigaddset(&signalset, SIGPIPE); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = posix_spawnattr_setsigmask(attr, &signalset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getsigmask(attr, &signalset1); - ret = memcmp(&signalset, &signalset1, sizeof(sigset_t)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = sigismember(&signalset, SIGPIPE); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrGroup(posix_spawnattr_t *attr) -{ - pid_t val = -1; - pid_t pid = getpgrp(); - int ret; - posix_spawnattr_getpgroup(attr, &val); - ICUNIT_GOTO_EQUAL(val, 0, val, EXIT); - - val = getpgid(getpid()); - ret = posix_spawnattr_setpgroup(attr, val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - val = -1; - - posix_spawnattr_getpgroup(attr, &val); - ICUNIT_GOTO_EQUAL(val, pid, val, EXIT); - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrPrio(posix_spawnattr_t *attr) -{ - struct sched_param val = { -1 }; - struct sched_param val1 = { -1 }; - int ret; - posix_spawnattr_getschedparam(attr, &val); - ICUNIT_GOTO_EQUAL(val.sched_priority, 0, ret, EXIT); - - val.sched_priority = HIGH_PRIORITY; - ret = posix_spawnattr_setschedparam(attr, &val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getschedparam(attr, &val1); - ICUNIT_GOTO_EQUAL(val1.sched_priority, HIGH_PRIORITY, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrPol(posix_spawnattr_t *attr) -{ - int val = -1; - int ret; - - posix_spawnattr_getschedpolicy(attr, &val); - ICUNIT_GOTO_EQUAL(val, 0, val, EXIT); - - val = SCHED_RR; - ret = posix_spawnattr_setschedpolicy(attr, val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - val = -1; - - posix_spawnattr_getschedpolicy(attr, &val); - ICUNIT_GOTO_EQUAL(val, SCHED_RR, val, EXIT); - - ret = TestSpawnAttrPrio(attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -static int TestSpawnpAttr(short flag) -{ - pid_t pid; - posix_spawnattr_t attr; - int status = 1; - char *argv1[] = {"tftp", NULL}; - short iflag = -1; - int ret; - - ret = posix_spawnattr_init(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getflags(&attr, &iflag); - ICUNIT_GOTO_EQUAL(iflag, 0, iflag, EXIT); - - ret = posix_spawnattr_setflags(&attr, flag); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - iflag = -1; - - posix_spawnattr_getflags(&attr, &iflag); - ICUNIT_GOTO_EQUAL(iflag, flag, iflag, EXIT); - - if (POSIX_SPAWN_SETSIGDEF == flag) { - ret = TestSpawnAttrDef(&attr); - } else if (POSIX_SPAWN_SETSIGMASK == flag) { - ret = TestSpawnAttrMask(&attr); - } else if (POSIX_SPAWN_SETPGROUP == flag) { - ret = TestSpawnAttrGroup(&attr); - } else if (POSIX_SPAWN_SETSCHEDPARAM == flag) { - ret = TestSpawnAttrPrio(&attr); - } else if (POSIX_SPAWN_SETSCHEDULER == flag) { - ret = TestSpawnAttrPol(&attr); - } - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = posix_spawnp(&pid, "/bin/tftp", NULL, &attr, argv1, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = posix_spawnattr_destroy(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -static int TestCase(void) -{ - int ret; - - ret = TestSpawnpAttr(POSIX_SPAWN_RESETIDS); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnpAttr(POSIX_SPAWN_SETSIGDEF); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnpAttr(POSIX_SPAWN_SETSIGMASK); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnpAttr(POSIX_SPAWN_SETSCHEDPARAM); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnpAttr(POSIX_SPAWN_SETSCHEDULER); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnpAttr(POSIX_SPAWN_SETPGROUP); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -void ItTestProcess059(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_059", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_060.cpp b/testsuites/unittest_old/process/process/full/process_test_060.cpp deleted file mode 100644 index 6f96f65c..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_060.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static int TestGroupError(void) -{ - int ret; - posix_spawnattr_t attr; - - posix_spawnattr_init(&attr); - posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETPGROUP); - posix_spawnattr_setpgroup(&attr, 1); - ret = posix_spawnp(NULL, "/bin/tftp", NULL, &attr, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EPERM, ret); - - posix_spawnattr_setpgroup(&attr, 65); // 65, set group num. - ret = posix_spawnp(NULL, "/bin/tftp", NULL, &attr, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - return 0; -} -static int TestPolError(void) -{ - int ret; - posix_spawnattr_t attr; - struct sched_param val = { -1 }; - - posix_spawnattr_init(&attr); - posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSCHEDULER); - val.sched_priority = 15; // 15, set pthread priority. - posix_spawnattr_setschedparam(&attr, &val); - posix_spawnattr_setschedpolicy(&attr, SCHED_FIFO); - ret = posix_spawnp(NULL, "/bin/tftp", NULL, &attr, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - return 0; -} -static int TestPrioError(void) -{ - int ret; - posix_spawnattr_t attr; - struct sched_param val = { -1 }; - - posix_spawnattr_init(&attr); - posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSCHEDPARAM); - posix_spawnattr_getschedparam(&attr, &val); - - val.sched_priority = 0; - ret = posix_spawnattr_setschedparam(&attr, &val); - ret = posix_spawnp(NULL, "/bin/tftp", NULL, &attr, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - val.sched_priority = 32; // 32, set pthread priority. - ret = posix_spawnattr_setschedparam(&attr, &val); - ret = posix_spawnp(NULL, "/bin/tftp", NULL, &attr, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - return 0; -} -static int TestCase(void) -{ - pid_t pid; - posix_spawnattr_t attr; - int status = 1; - int ret; - - posix_spawnattr_init(&attr); - - ret = posix_spawnattr_setflags(&attr, -1); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = posix_spawnattr_setflags(&attr, 128); // 128, set flags num. - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = posix_spawnattr_setflags(&attr, 0xff); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = posix_spawnattr_setschedpolicy(&attr, 0); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = posix_spawnattr_setschedpolicy(&attr, 3); // 3, set policy num. - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - posix_spawnattr_destroy(&attr); - - ret = TestGroupError(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = TestPolError(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = TestPrioError(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -void ItTestProcess060(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_060", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_062.cpp b/testsuites/unittest_old/process/process/full/process_test_062.cpp deleted file mode 100644 index 3f2398a5..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_062.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include "sys/shm.h" - -static volatile int *g_shmptr = NULL; - -static void Handler(int sig) -{ - (*g_shmptr)++; -} - -static int TestCase(void) -{ - int status; - (void)signal(SIGUSR2, Handler); - int ret; - pid_t pid; - - int shmid = shmget(IPC_PRIVATE, sizeof(int), IPC_CREAT | 0600); // 0600 config of shmget - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - - g_shmptr = (int *)shmat(shmid, nullptr, 0); - ICUNIT_GOTO_NOT_EQUAL(g_shmptr, (int *)-1, g_shmptr, EXIT); - - *g_shmptr = 0; - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - pid_t pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid1, EXIT); // 100000, assert pid1 equal to this. - - if (pid1 == 0) { - ret = killpg(getpgrp(), SIGUSR2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - while (*g_shmptr < 3) { // 3, Number of cycles. - sleep(1); - } - - exit(11); // 11, exit args - } - - while (*g_shmptr < 3) { // 3, Number of cycles. - sleep(1); - } - - ret = waitpid(pid1, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid1, ret, EXIT); - - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 11, status, EXIT); // 11, assert status equal to this. - - exit(10); // 10, exit args - } - - while (*g_shmptr < 3) { // 3, wait function running. - sleep(1); - } - ICUNIT_ASSERT_EQUAL(*g_shmptr, 3, *g_shmptr); // 3, assert that function Result is equal to this. - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 10, status, EXIT); // 10, assert that function Result is equal to this. - - shmdt((void *)g_shmptr); - shmctl(shmid, IPC_RMID, NULL); - - return 0; -EXIT: - shmdt((void *)g_shmptr); - shmctl(shmid, IPC_RMID, NULL); - return 1; -} - -void ItTestProcess062(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_062", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/full/process_test_063.cpp b/testsuites/unittest_old/process/process/full/process_test_063.cpp deleted file mode 100644 index d6895653..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_063.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static const int FILE_NAME_BYTES = 200; // 200, set test name len. -static const int LONG_FILE_NAME_BYTES = 500; // 500, set test name len. -static const int RANDOM_MAX = 127; // 127, set random max. -static const unsigned int INVALID_USER_VADDR = 0x1200000; - -static int GetRandomNumber(int max) -{ - int n = 0; - - if (max > 0) { - n = rand() % max; - } - - return n + 1; -} - -static void GetRandomData(char **buf, int bufSize) -{ - char *p = *buf; - int i; - - srand((unsigned)time(0)); - for (i = 0; i < bufSize - 1; ++i) { - int r = GetRandomNumber(RANDOM_MAX); - *(p + i) = (char)r; - } - *(p + i) = (char)0; -} - -static int TestCase(VOID) -{ - int ret; - int err; - pid_t pid; - char *fileName = NULL; - char *childFileName = NULL; - char **childArgv = NULL; - char **childEnvp = NULL; - - ret = posix_spawn(&pid, NULL, NULL, NULL, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - childFileName = (char *)1; - ret = posix_spawn(&pid, childFileName, NULL, NULL, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - childArgv = (char **)1; - ret = posix_spawn(&pid, "/usr/bin/testsuits_app", NULL, NULL, childArgv, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - childEnvp = (char **)1; - ret = posix_spawn(&pid, "/usr/bin/testsuits_app", NULL, NULL, NULL, childEnvp); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = posix_spawn(&pid, "/bin", NULL, NULL, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, ENOENT, ret); - - fileName = (char *)malloc(FILE_NAME_BYTES); - ICUNIT_ASSERT_NOT_EQUAL(fileName, NULL, fileName); - GetRandomData(&fileName, FILE_NAME_BYTES); - ret = posix_spawn(&pid, fileName, NULL, NULL, NULL, NULL); - free(fileName); - ICUNIT_ASSERT_EQUAL(ret, ENOENT, ret); - - fileName = (char *)malloc(LONG_FILE_NAME_BYTES); - ICUNIT_ASSERT_NOT_EQUAL(fileName, NULL, fileName); - GetRandomData(&fileName, LONG_FILE_NAME_BYTES); - ret = posix_spawn(&pid, fileName, NULL, NULL, NULL, NULL); - free(fileName); - ICUNIT_ASSERT_EQUAL(ret, ENAMETOOLONG, ret); - - ret = posix_spawn(&pid, (char *)INVALID_USER_VADDR, NULL, NULL, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EFAULT, ret); - - return 0; -} -void ItTestProcess063(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_063", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/full/process_test_064.cpp b/testsuites/unittest_old/process/process/full/process_test_064.cpp deleted file mode 100644 index 3b84cbbb..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_064.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static const int FILE_NAME_BYTES = 200; // 200, set test name len. -static const int LONG_FILE_NAME_BYTES = 500; // 500, set test name len. -static const int RANDOM_MAX = 127; // 127, set random max. -static const unsigned int INVALID_USER_VADDR = 0x1200000; - -static int GetRandomNumber(int max) -{ - int n = 0; - - if (max > 0) { - n = rand() % max; - } - - return n + 1; -} - -static void GetRandomData(char **buf, int bufSize) -{ - char *p = *buf; - int i; - - srand((unsigned)time(0)); - for (i = 0; i < bufSize - 1; ++i) { - int r = GetRandomNumber(RANDOM_MAX); - *(p + i) = (char)r; - } - *(p + i) = (char)0; -} - -static int TestCase(VOID) -{ - int ret; - int err; - pid_t pid; - char *fileName = NULL; - char *childFileName = NULL; - char **childArgv = NULL; - char **childEnvp = NULL; - - childArgv = (char **)1; - ret = posix_spawnp(&pid, "/usr/bin/testsuits_app", NULL, NULL, childArgv, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - childEnvp = (char **)1; - ret = posix_spawnp(&pid, "/usr/bin/testsuits_app", NULL, NULL, NULL, childEnvp); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = posix_spawnp(&pid, "/bin", NULL, NULL, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, ENOENT, ret); - - fileName = (char *)malloc(FILE_NAME_BYTES); - ICUNIT_ASSERT_NOT_EQUAL(fileName, NULL, fileName); - GetRandomData(&fileName, FILE_NAME_BYTES); - ret = posix_spawnp(&pid, fileName, NULL, NULL, NULL, NULL); - free(fileName); - ICUNIT_ASSERT_EQUAL(ret, ENOENT, ret); - - fileName = (char *)malloc(LONG_FILE_NAME_BYTES); - ICUNIT_ASSERT_NOT_EQUAL(fileName, NULL, fileName); - GetRandomData(&fileName, LONG_FILE_NAME_BYTES); - ret = posix_spawnp(&pid, fileName, NULL, NULL, NULL, NULL); - free(fileName); - ICUNIT_ASSERT_EQUAL(ret, ENAMETOOLONG, ret); - - ret = posix_spawnp(&pid, "test_spawnp", NULL, NULL, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, ENOENT, ret); - - return 0; -} -void ItTestProcess064(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_064", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/full/process_test_065.cpp b/testsuites/unittest_old/process/process/full/process_test_065.cpp deleted file mode 100644 index 15f3fd82..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_065.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static int TestGroupError(void) -{ - int ret; - posix_spawnattr_t attr; - - posix_spawnattr_init(&attr); - posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETPGROUP); - posix_spawnattr_setpgroup(&attr, 1); - ret = posix_spawn(NULL, "/bin/tftp", NULL, &attr, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EPERM, ret); - - posix_spawnattr_setpgroup(&attr, 65); // 65, set group num. - ret = posix_spawn(NULL, "/bin/tftp", NULL, &attr, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - return 0; -} -static int TestPolError(void) -{ - int ret; - posix_spawnattr_t attr; - struct sched_param val = { -1 }; - - posix_spawnattr_init(&attr); - posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSCHEDULER); - val.sched_priority = 15; // 15, set pthread priority. - posix_spawnattr_setschedparam(&attr, &val); - posix_spawnattr_setschedpolicy(&attr, SCHED_FIFO); - ret = posix_spawn(NULL, "/bin/tftp", NULL, &attr, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - return 0; -} -static int TestPrioError(void) -{ - int ret; - posix_spawnattr_t attr; - struct sched_param val = { -1 }; - - posix_spawnattr_init(&attr); - posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSCHEDPARAM); - posix_spawnattr_getschedparam(&attr, &val); - - val.sched_priority = 0; - ret = posix_spawnattr_setschedparam(&attr, &val); - ret = posix_spawn(NULL, "/bin/tftp", NULL, &attr, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - val.sched_priority = 32; // 32, set pthread priority. - ret = posix_spawnattr_setschedparam(&attr, &val); - ret = posix_spawn(NULL, "/bin/tftp", NULL, &attr, NULL, NULL); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - return 0; -} -static int TestCase(void) -{ - pid_t pid; - posix_spawnattr_t attr; - int status = 1; - int ret; - - posix_spawnattr_init(&attr); - - ret = posix_spawnattr_setflags(&attr, -1); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = posix_spawnattr_setflags(&attr, 128); // 128, set group num. - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = posix_spawnattr_setflags(&attr, 0xff); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = posix_spawnattr_setschedpolicy(&attr, 0); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = posix_spawnattr_setschedpolicy(&attr, 3); // 3, set policy num. - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - posix_spawnattr_destroy(&attr); - - ret = TestGroupError(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = TestPolError(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = TestPrioError(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -void ItTestProcess065(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_065", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/full/process_test_066.cpp b/testsuites/unittest_old/process/process/full/process_test_066.cpp deleted file mode 100644 index 2b738d9a..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_066.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static const int HIGH_PRIORITY = 10; -static const int NUMMAX = 16; - -static int TestSpawnAttrGroup(posix_spawnattr_t *attr) -{ - pid_t val = -1; - pid_t pid = getpgrp(); - int ret; - posix_spawnattr_getpgroup(attr, &val); - ICUNIT_GOTO_EQUAL(val, 0, val, EXIT); - - val = getpgid(getpid()); - ret = posix_spawnattr_setpgroup(attr, val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - val = -1; - - posix_spawnattr_getpgroup(attr, &val); - ICUNIT_GOTO_EQUAL(val, pid, val, EXIT); - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrPrio(posix_spawnattr_t *attr) -{ - struct sched_param val = { -1 }; - struct sched_param val1 = { -1 }; - int ret; - posix_spawnattr_getschedparam(attr, &val); - ICUNIT_GOTO_EQUAL(val.sched_priority, 0, ret, EXIT); - - val.sched_priority = HIGH_PRIORITY; - ret = posix_spawnattr_setschedparam(attr, &val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getschedparam(attr, &val1); - ICUNIT_GOTO_EQUAL(val1.sched_priority, HIGH_PRIORITY, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrPol(posix_spawnattr_t *attr) -{ - int val = -1; - int ret; - - posix_spawnattr_getschedpolicy(attr, &val); - ICUNIT_GOTO_EQUAL(val, 0, val, EXIT); - - val = SCHED_RR; - ret = posix_spawnattr_setschedpolicy(attr, val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - val = -1; - - posix_spawnattr_getschedpolicy(attr, &val); - ICUNIT_GOTO_EQUAL(val, SCHED_RR, val, EXIT); - - ret = TestSpawnAttrPrio(attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttr(short flag) -{ - pid_t pid; - posix_spawnattr_t attr; - int status = 1; - char *argv1[] = {"xxx", NULL}; - char temp[NUMMAX] = {0}; - char temp1[NUMMAX] = {0}; - short iflag = -1; - int ret; - int fd; - ret = posix_spawnattr_init(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getflags(&attr, &iflag); - ICUNIT_GOTO_EQUAL(iflag, 0, iflag, EXIT); - - ret = posix_spawnattr_setflags(&attr, flag); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - iflag = -1; - - posix_spawnattr_getflags(&attr, &iflag); - ICUNIT_GOTO_EQUAL(iflag, flag, iflag, EXIT); - - if (POSIX_SPAWN_SETPGROUP == flag) { - ret = TestSpawnAttrGroup(&attr); - argv1[0] = "group"; - } else if (POSIX_SPAWN_SETSCHEDPARAM == flag) { - ret = TestSpawnAttrPrio(&attr); - argv1[0] = "prio"; - } else if (POSIX_SPAWN_SETSCHEDULER == flag) { - ret = TestSpawnAttrPol(&attr); - argv1[0] = "pol"; - } else if (POSIX_SPAWN_RESETIDS == flag) { - argv1[0] = "ids"; - } - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = posix_spawn(&pid, "/storage/test_spawn", NULL, &attr, argv1, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT); - - fd = open("/storage/testspawnattr.txt", O_RDWR | O_CREAT, 0644); // 0644, open config - ret = read(fd, temp, NUMMAX); - ICUNIT_GOTO_EQUAL(ret, NUMMAX, ret, EXIT1); - - if (POSIX_SPAWN_SETPGROUP == flag) { - sprintf_s(temp1, NUMMAX, "pgid = %d", attr.__pgrp); - } else if (POSIX_SPAWN_SETSCHEDPARAM == flag) { - sprintf_s(temp1, NUMMAX, "prio = %d", attr.__prio); - } else if (POSIX_SPAWN_SETSCHEDULER == flag) { - sprintf_s(temp1, NUMMAX, "pol = %d", attr.__pol); - } else if (POSIX_SPAWN_RESETIDS == flag) { - sprintf_s(temp1, NUMMAX, "uid = %d", getuid()); - } - ret = strncmp(temp, temp1, strlen(temp)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - close(fd); - unlink("/storage/testspawnattr.txt"); - return 0; -EXIT1: - unlink("/storage/testspawnattr.txt"); - close(fd); -EXIT: - return 1; -} - -static int TestCase(void) -{ - int ret; - - ret = TestSpawnAttr(POSIX_SPAWN_RESETIDS); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnAttr(POSIX_SPAWN_SETSCHEDPARAM); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnAttr(POSIX_SPAWN_SETSCHEDULER); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnAttr(POSIX_SPAWN_SETPGROUP); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -void ItTestProcess066(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_066", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/full/process_test_067.cpp b/testsuites/unittest_old/process/process/full/process_test_067.cpp deleted file mode 100644 index 032f6ccf..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_067.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static const int HIGH_PRIORITY = 10; -static const int NUMMAX = 16; - -static int TestSpawnAttrGroup(posix_spawnattr_t *attr) -{ - pid_t val = -1; - pid_t pid = getpgrp(); - int ret; - posix_spawnattr_getpgroup(attr, &val); - ICUNIT_GOTO_EQUAL(val, 0, val, EXIT); - - val = getpgid(getpid()); - ret = posix_spawnattr_setpgroup(attr, val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - val = -1; - - posix_spawnattr_getpgroup(attr, &val); - ICUNIT_GOTO_EQUAL(val, pid, val, EXIT); - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrPrio(posix_spawnattr_t *attr) -{ - struct sched_param val = { -1 }; - struct sched_param val1 = { -1 }; - int ret; - posix_spawnattr_getschedparam(attr, &val); - ICUNIT_GOTO_EQUAL(val.sched_priority, 0, ret, EXIT); - - val.sched_priority = HIGH_PRIORITY; - ret = posix_spawnattr_setschedparam(attr, &val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getschedparam(attr, &val1); - ICUNIT_GOTO_EQUAL(val1.sched_priority, HIGH_PRIORITY, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttrPol(posix_spawnattr_t *attr) -{ - int val = -1; - int ret; - - posix_spawnattr_getschedpolicy(attr, &val); - ICUNIT_GOTO_EQUAL(val, 0, val, EXIT); - - val = SCHED_RR; - ret = posix_spawnattr_setschedpolicy(attr, val); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - val = -1; - - posix_spawnattr_getschedpolicy(attr, &val); - ICUNIT_GOTO_EQUAL(val, SCHED_RR, val, EXIT); - - ret = TestSpawnAttrPrio(attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -static int TestSpawnAttr(short flag) -{ - pid_t pid; - posix_spawnattr_t attr; - int status = 1; - char *argv1[] = {"xxx", NULL}; - char temp[NUMMAX] = {0}; - char temp1[NUMMAX] = {0}; - short iflag = -1; - int ret; - int fd; - - ret = posix_spawnattr_init(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - posix_spawnattr_getflags(&attr, &iflag); - ICUNIT_GOTO_EQUAL(iflag, 0, iflag, EXIT); - - ret = posix_spawnattr_setflags(&attr, flag); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - iflag = -1; - - posix_spawnattr_getflags(&attr, &iflag); - ICUNIT_GOTO_EQUAL(iflag, flag, iflag, EXIT); - - if (POSIX_SPAWN_SETPGROUP == flag) { - ret = TestSpawnAttrGroup(&attr); - argv1[0] = "group"; - } else if (POSIX_SPAWN_SETSCHEDPARAM == flag) { - ret = TestSpawnAttrPrio(&attr); - argv1[0] = "prio"; - } else if (POSIX_SPAWN_SETSCHEDULER == flag) { - ret = TestSpawnAttrPol(&attr); - argv1[0] = "pol"; - } else if (POSIX_SPAWN_RESETIDS == flag) { - argv1[0] = "ids"; - } - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = posix_spawnp(&pid, "/storage/test_spawn", NULL, &attr, argv1, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT); - - fd = open("/storage/testspawnattr.txt", O_RDWR | O_CREAT, 0644); // 0644, open config - ret = read(fd, temp, NUMMAX); - ICUNIT_GOTO_EQUAL(ret, NUMMAX, ret, EXIT1); - - if (POSIX_SPAWN_SETPGROUP == flag) { - sprintf_s(temp1, NUMMAX, "pgid = %d", attr.__pgrp); - } else if (POSIX_SPAWN_SETSCHEDPARAM == flag) { - sprintf_s(temp1, NUMMAX, "prio = %d", attr.__prio); - } else if (POSIX_SPAWN_SETSCHEDULER == flag) { - sprintf_s(temp1, NUMMAX, "pol = %d", attr.__pol); - } else if (POSIX_SPAWN_RESETIDS == flag) { - sprintf_s(temp1, NUMMAX, "uid = %d", getuid()); - } - ret = strncmp(temp, temp1, strlen(temp)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - close(fd); - unlink("/storage/testspawnattr.txt"); - return 0; -EXIT1: - close(fd); - unlink("/storage/testspawnattr.txt"); -EXIT: - return 1; -} - -static int TestCase(void) -{ - int ret; - - ret = TestSpawnAttr(POSIX_SPAWN_RESETIDS); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnAttr(POSIX_SPAWN_SETSCHEDPARAM); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnAttr(POSIX_SPAWN_SETSCHEDULER); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = TestSpawnAttr(POSIX_SPAWN_SETPGROUP); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -void ItTestProcess067(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_067", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/full/process_test_068.cpp b/testsuites/unittest_old/process/process/full/process_test_068.cpp deleted file mode 100644 index f31338a7..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_068.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static const int NUMMAX = 16; - -static int TestCase(void) -{ - char *envp[] = {"ABC=asddfg", NULL}; - char *argv1[] = {"envp", NULL}; - pid_t pid; - int status = 1; - char temp[NUMMAX] = {0}; - int fd; - - int ret = posix_spawn(&pid, "/storage/test_spawn", NULL, NULL, argv1, envp); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT); - - fd = open("/storage/testspawnattr.txt", O_RDWR | O_CREAT, 0644); // 0644, open config - ret = read(fd, temp, NUMMAX); - ICUNIT_GOTO_EQUAL(ret, NUMMAX, ret, EXIT1); - - ret = strncmp(temp, "ABC=asddfg", strlen(temp)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - close(fd); - unlink("/storage/testspawnattr.txt"); - return 0; -EXIT1: - close(fd); - unlink("/storage/testspawnattr.txt"); -EXIT: - return 1; -} - -void ItTestProcess068(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_068", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/full/process_test_069.cpp b/testsuites/unittest_old/process/process/full/process_test_069.cpp deleted file mode 100644 index df8ae063..00000000 --- a/testsuites/unittest_old/process/process/full/process_test_069.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include - -static const int NUMMAX = 16; - -static int TestCase(void) -{ - char *envp[] = {"ABC=asddfg", NULL}; - char *argv1[] = {"envp", NULL}; - pid_t pid; - int status = 1; - char temp[NUMMAX] = {0}; - int ret; - int fd; - - ret = posix_spawnp(&pid, "/storage/test_spawn", NULL, NULL, argv1, envp); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT); - - fd = open("/storage/testspawnattr.txt", O_RDWR | O_CREAT, 0644); // 0644, open config - ret = read(fd, temp, NUMMAX); - ICUNIT_GOTO_EQUAL(ret, NUMMAX, ret, EXIT1); - - ret = strncmp(temp, "ABC=asddfg", strlen(temp)); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - close(fd); - unlink("/storage/testspawnattr.txt"); - return 0; -EXIT1: - close(fd); - unlink("/storage/testspawnattr.txt"); -EXIT: - return 1; -} - -void ItTestProcess069(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_069", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/it_test_process.h b/testsuites/unittest_old/process/process/it_test_process.h deleted file mode 100644 index 19803d4a..00000000 --- a/testsuites/unittest_old/process/process/it_test_process.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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. - */ -#ifndef IT_TEST_PROCESS_H -#define IT_TEST_PROCESS_H - -#include "osTest.h" -#include "sys/resource.h" -#include "sys/wait.h" - -#define WAIT_PARENT_FIRST_TO_RUN(tick) usleep((tick)*10 * 1000) // 10, 1000, wait time. -#include "sys/syscall.h" - -static inline int Syscall(int nbr, int parm1, int parm2, int parm3, int parm4) -{ - register int reg7 __asm__("r7") = (int)(nbr); - register int reg3 __asm__("r3") = (int)(parm4); - register int reg2 __asm__("r2") = (int)(parm3); - register int reg1 __asm__("r1") = (int)(parm2); - register int reg0 __asm__("r0") = (int)(parm1); - - __asm__ __volatile__("svc 0" : "=r"(reg0) : "r"(reg7), "r"(reg0), "r"(reg1), "r"(reg2), "r"(reg3) : "memory"); - - return reg0; -} -extern INT32 g_iCunitErrCode; -extern INT32 g_iCunitErrLineNo; -extern int GetCpuCount(void); - -extern void Wait(const char *ptr, int scount); -extern void ItTestProcess001(void); -extern void ItTestProcess002(void); -extern void ItTestProcess004(void); -extern void ItTestProcess005(void); -extern void ItTestProcess006(void); -extern void ItTestProcess007(void); -extern void ItTestProcess008(void); -extern void ItTestProcess009(void); -extern void ItTestProcess010(void); -extern void ItTestProcess011(void); -extern void ItTestProcess012(void); -extern void ItTestProcess013(void); -extern void ItTestProcess014(void); -extern void ItTestProcess015(void); -extern void ItTestProcess016(void); -extern void ItTestProcess017(void); -extern void ItTestProcess018(void); -extern void ItTestProcess019(void); -extern void ItTestProcess020(void); -extern void ItTestProcess021(void); -extern void ItTestProcess022(void); -extern void ItTestProcess023(void); -extern void ItTestProcess024(void); -extern void ItTestProcess025(void); -extern void ItTestProcess026(void); -extern void ItTestProcess027(void); -extern void ItTestProcess029(void); -extern void ItTestProcess030(void); -extern void ItTestProcess031(void); -extern void ItTestProcess032(void); -extern void ItTestProcess033(void); -extern void ItTestProcess034(void); -extern void ItTestProcess035(void); -extern void ItTestProcess036(void); -extern void ItTestProcess037(void); -extern void ItTestProcess038(void); -extern void ItTestProcess039(void); -extern void ItTestProcess040(void); -extern void ItTestProcess041(void); -extern void ItTestProcess042(void); -extern void ItTestProcess043(void); -extern void ItTestProcess044(void); -extern void ItTestProcess045(void); -extern void ItTestProcess046(void); -extern void ItTestProcess047(void); -extern void ItTestProcess048(void); -extern void ItTestProcess049(void); -extern void ItTestProcess050(void); -extern void ItTestProcess051(void); -extern void ItTestProcess052(void); -extern void ItTestProcess053(void); -extern void ItTestProcess054(void); -extern void ItTestProcess055(void); -extern void ItTestProcess056(void); -extern void ItTestProcess057(void); -extern void ItTestProcess058(void); -extern void ItTestProcess059(void); -extern void ItTestProcess060(void); -extern void ItTestProcess061(void); -extern void ItTestProcess062(void); -extern void ItTestProcess063(void); -extern void ItTestProcess064(void); -extern void ItTestProcess065(void); -extern void ItTestProcess066(void); -extern void ItTestProcess067(void); -extern void ItTestProcess068(void); -extern void ItTestProcess069(void); -extern void ItTestProcessSmp001(void); -extern void ItTestProcessSmp002(void); -extern void ItTestProcessSmp003(void); -extern void ItTestProcessSmp004(void); -extern void ItTestProcessSmp005(void); -extern void ItTestProcessSmp006(void); -extern void ItTestProcessSmp007(void); -extern void ItTestProcessSmp008(void); -#endif diff --git a/testsuites/unittest_old/process/process/process_process_test.cpp b/testsuites/unittest_old/process/process/process_process_test.cpp deleted file mode 100644 index d2040487..00000000 --- a/testsuites/unittest_old/process/process/process_process_test.cpp +++ /dev/null @@ -1,729 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include -#include "it_test_process.h" - -void Wait(const char *ptr, int scount) -{ - int count = 0xffffffff; - while (scount > 0) { - while (count > 0) { - printf("\r"); - count--; - } - count = 0xffffffff; - scount--; - if (ptr) { - printf("%s\n", ptr); - } - } -} - -int GetCpuCount(void) -{ - cpu_set_t cpuset; - - CPU_ZERO(&cpuset); - int temp = sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - if (temp != 0) { - printf("%s %d Error : %d\n", __FUNCTION__, __LINE__, temp); - } - - return CPU_COUNT(&cpuset); -} - -using namespace testing::ext; -namespace OHOS { -class ProcessProcessTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: it_test_process_001 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess001, TestSize.Level0) -{ - ItTestProcess001(); -} - -/* * - * @tc.name: it_test_process_002 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess002, TestSize.Level0) -{ - ItTestProcess002(); -} - -/* * - * @tc.name: it_test_process_004 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess004, TestSize.Level0) -{ - ItTestProcess004(); -} - -/* * - * @tc.name: it_test_process_005 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess005, TestSize.Level0) -{ - ItTestProcess005(); -} - -/* * - * @tc.name: it_test_process_006 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess006, TestSize.Level0) -{ - ItTestProcess006(); -} - -/* * - * @tc.name: it_test_process_008 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess008, TestSize.Level0) -{ - ItTestProcess008(); -} - -/* * - * @tc.name: it_test_process_010 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess010, TestSize.Level0) -{ - ItTestProcess010(); -} - -/* * - * @tc.name: it_test_process_009 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess009, TestSize.Level0) -{ - ItTestProcess009(); -} - -/* * - * @tc.name: it_test_process_011 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess011, TestSize.Level0) -{ - ItTestProcess011(); -} - -/* * - * @tc.name: it_test_process_012 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess012, TestSize.Level0) -{ - ItTestProcess012(); -} - -/* * - * @tc.name: it_test_process_013 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess013, TestSize.Level0) -{ - ItTestProcess013(); -} - -/* * - * @tc.name: it_test_process_014 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess014, TestSize.Level0) -{ - ItTestProcess014(); -} - -/* * - * @tc.name: it_test_process_015 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess015, TestSize.Level0) -{ - ItTestProcess015(); -} - -/* * - * @tc.name: it_test_process_016 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess016, TestSize.Level0) -{ - ItTestProcess016(); -} - -/* * - * @tc.name: it_test_process_017 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess017, TestSize.Level0) -{ - ItTestProcess017(); -} - -/* * - * @tc.name: it_test_process_018 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess018, TestSize.Level0) -{ - ItTestProcess018(); -} - -/* * - * @tc.name: it_test_process_019 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess019, TestSize.Level0) -{ - ItTestProcess019(); -} - -/* * - * @tc.name: it_test_process_020 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess020, TestSize.Level0) -{ - ItTestProcess020(); -} - -/* * - * @tc.name: it_test_process_021 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess021, TestSize.Level0) -{ - ItTestProcess021(); -} - -/* * - * @tc.name: it_test_process_022 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess022, TestSize.Level0) -{ - ItTestProcess022(); -} - -/* * - * @tc.name: it_test_process_023 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess023, TestSize.Level0) -{ - ItTestProcess023(); -} - -/* * - * @tc.name: it_test_process_024 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess024, TestSize.Level0) -{ - ItTestProcess024(); -} - -/* * - * @tc.name: it_test_process_025 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess025, TestSize.Level0) -{ - ItTestProcess025(); -} - -/* * - * @tc.name: it_test_process_026 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess026, TestSize.Level0) -{ - ItTestProcess026(); -} - -/* * - * @tc.name: it_test_process_027 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess027, TestSize.Level0) -{ - ItTestProcess027(); -} - -/* * - * @tc.name: it_test_process_029 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess029, TestSize.Level0) -{ - ItTestProcess029(); -} - -/* * - * @tc.name: it_test_process_030 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess030, TestSize.Level0) -{ - ItTestProcess030(); -} - -/* * - * @tc.name: it_test_process_038 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess038, TestSize.Level0) -{ - ItTestProcess038(); -} - -/* * - * @tc.name: it_test_process_039 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess039, TestSize.Level0) -{ - ItTestProcess039(); -} - -/* * - * @tc.name: it_test_process_043 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess043, TestSize.Level0) -{ - ItTestProcess043(); -} - -/* * - * @tc.name: it_test_process_044 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess044, TestSize.Level0) -{ - ItTestProcess044(); -} - -/* * - * @tc.name: it_test_process_045 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: DTS202101040I5J4KP0H00 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess045, TestSize.Level0) -{ - ItTestProcess045(); -} - -/* * - * @tc.name: it_test_process_046 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: DTS202101040I5J4KP0H00 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess046, TestSize.Level0) -{ - ItTestProcess046(); -} - -/* * - * @tc.name: it_test_process_047 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: DTS202101040I5J4KP0H00 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess047, TestSize.Level0) -{ - ItTestProcess047(); -} - -/* * - * @tc.name: it_test_process_048 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: DTS202101040I5J4KP0H00 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess048, TestSize.Level0) -{ - ItTestProcess048(); -} - -/* * - * @tc.name: it_test_process_054 - * @tc.desc: function for waitid: The waitid parameter is incorrect and the error code is verified. - * @tc.type: FUNC - * @tc.require: AR000E0QAB - */ -HWTEST_F(ProcessProcessTest, ItTestProcess054, TestSize.Level0) -{ - ItTestProcess054(); -} - -/* * - * @tc.name: it_test_process_061 - * @tc.desc: function for killpg: The killpg parameter is incorrect and the error code is verified. - * @tc.type: FUNC - * @tc.require: AR000E0QAB - */ -HWTEST_F(ProcessProcessTest, ItTestProcess061, TestSize.Level0) -{ - ItTestProcess061(); -} - -#ifdef LOSCFG_USER_TEST_SMP -/* * - * @tc.name: it_test_process_smp_001 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcessSmp001, TestSize.Level0) -{ - ItTestProcessSmp001(); -} - -/* * - * @tc.name: it_test_process_smp_002 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcessSmp002, TestSize.Level0) -{ - ItTestProcessSmp002(); -} - -/* * - * @tc.name: it_test_process_smp_003 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcessSmp003, TestSize.Level0) -{ - ItTestProcessSmp003(); -} - -/* * - * @tc.name: it_test_process_smp_004 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcessSmp004, TestSize.Level0) -{ - ItTestProcessSmp004(); -} - -/* * - * @tc.name: it_test_process_smp_005 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcessSmp005, TestSize.Level0) -{ - ItTestProcessSmp005(); -} - -/* * - * @tc.name: it_test_process_smp_006 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcessSmp006, TestSize.Level0) -{ - ItTestProcessSmp006(); -} - -/* * - * @tc.name: it_test_process_smp_007 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcessSmp007, TestSize.Level0) -{ - ItTestProcessSmp007(); -} - -/* * - * @tc.name: it_test_process_smp_008 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcessSmp008, TestSize.Level0) -{ - ItTestProcessSmp008(); -} -#endif -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: it_test_process_007 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess007, TestSize.Level0) -{ - ItTestProcess007(); -} - -/* * - * @tc.name: it_test_process_031 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess031, TestSize.Level0) -{ - ItTestProcess031(); -} - -/* * - * @tc.name: it_test_process_032 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess032, TestSize.Level0) -{ - ItTestProcess032(); -} - -/* * - * @tc.name: it_test_process_033 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess033, TestSize.Level0) -{ - ItTestProcess033(); -} - -/* * - * @tc.name: it_test_process_034 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess034, TestSize.Level0) -{ - ItTestProcess034(); -} - -/* * - * @tc.name: it_test_process_035 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess035, TestSize.Level0) -{ - ItTestProcess035(); -} - -/* * - * @tc.name: it_test_process_036 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess036, TestSize.Level0) -{ - ItTestProcess036(); -} - -/* * - * @tc.name: it_test_process_037 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess037, TestSize.Level0) -{ - ItTestProcess037(); -} - -/* * - * @tc.name: it_test_process_040 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess040, TestSize.Level0) -{ - ItTestProcess040(); -} - -/* * - * @tc.name: it_test_process_041 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess041, TestSize.Level0) -{ - ItTestProcess041(); -} - -/* * - * @tc.name: it_test_process_042 - * @tc.desc: function for ProcessProcessTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessProcessTest, ItTestProcess042, TestSize.Level0) -{ - ItTestProcess042(); -} - -/* * - * @tc.name: it_test_process_053 - * @tc.desc: function for killpg:Sends a signal to the process group, - * Other processes in the process group can receive the signal. - * @tc.type: FUNC - * @tc.require: AR000E0QAB - */ -HWTEST_F(ProcessProcessTest, ItTestProcess053, TestSize.Level0) -{ - ItTestProcess053(); -} - -/* * - * @tc.name: it_test_process_055 - * @tc.desc: function for waitid:To test the function of transferring different parameters of the waitid. - * @tc.type: FUNC - * @tc.require: AR000E0QAB - */ -HWTEST_F(ProcessProcessTest, ItTestProcess055, TestSize.Level0) -{ - ItTestProcess055(); -} - -/* * - * @tc.name: it_test_process_062 - * @tc.desc: function for killpg:Fork two processes. The killpg sends a signal to the current process group. - * The other two processes can receive the signal. - * @tc.type: FUNC - * @tc.require: AR000E0QAB - */ -HWTEST_F(ProcessProcessTest, ItTestProcess062, TestSize.Level0) -{ - ItTestProcess062(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/process/process/smoke/process_test_001.cpp b/testsuites/unittest_old/process/process/smoke/process_test_001.cpp deleted file mode 100644 index 1eab1e2d..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_001.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* - * 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. - */ - -#include "it_test_process.h" - -static const int PROCESS_PRIORITY_MAX = 10; -static const int PROCESS_PRIORITY_MIN = 31; -static const int PROCESS_SCHED_RR_INTERVAL = 20000000; - -static int Testcase(VOID) -{ - int ret; - struct sched_param param = { 0 }; - struct timespec ts = { 0 }; - int err; - ret = sched_getparam(getpid(), NULL); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - ret = sched_getparam(-1, ¶m); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - ret = sched_setparam(getpid(), NULL); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - ret = sched_setparam(-1, ¶m); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - param.sched_priority = PROCESS_PRIORITY_MIN + 1; - ret = sched_setparam(getpid(), ¶m); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - param.sched_priority = 15; // 15, set pthread priority. - ret = sched_setparam(20, ¶m); // 20, set the param. - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, ESRCH, err); - - ret = getpriority(PRIO_USER, getpid()); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - ret = sched_get_priority_min(SCHED_RR); - ICUNIT_ASSERT_EQUAL(ret, PROCESS_PRIORITY_MAX, ret); - - ret = sched_get_priority_max(SCHED_FIFO); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - ret = sched_get_priority_max(SCHED_OTHER); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - ret = sched_get_priority_max(SCHED_RR); - ICUNIT_ASSERT_EQUAL(ret, PROCESS_PRIORITY_MIN, ret); - - ret = sched_get_priority_min(SCHED_OTHER); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - ret = sched_get_priority_min(SCHED_FIFO); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - param.sched_priority = PROCESS_PRIORITY_MAX - 1; - ret = sched_setparam(getpid(), ¶m); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - param.sched_priority = PROCESS_PRIORITY_MAX - 1; - ret = sched_setscheduler(getpid(), SCHED_RR, ¶m); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - param.sched_priority = 11; // 11, set pthread priority. - ret = sched_setscheduler(1000, SCHED_RR, ¶m); // 1000, input the pid. - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - param.sched_priority = PROCESS_PRIORITY_MAX - 1; - ret = setpriority(PRIO_PROCESS, getpid(), param.sched_priority); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - err = errno; - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - ret = sched_getscheduler(getpid()); - ICUNIT_ASSERT_EQUAL(ret, SCHED_RR, ret); - - ret = sched_getscheduler(10000); // 10000, input the pid. - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - err = errno; - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - ret = sched_getscheduler(-1); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - err = errno; - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - param.sched_priority = PROCESS_PRIORITY_MAX - 1; - ret = sched_setscheduler(getpid(), SCHED_FIFO, ¶m); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - err = errno; - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - return 0; - -ERROR_OUT: - return -1; -} - -void ItTestProcess001(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_001", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_002.cpp b/testsuites/unittest_old/process/process/smoke/process_test_002.cpp deleted file mode 100644 index 59a157ed..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_002.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include "sched.h" - -static int Testcase() -{ -#define CURRENT_PROCESS_POLICY SCHED_RR - - struct sched_param param = { 0 }; - int ret; - - int currProcessPri = getpriority(PRIO_PROCESS, getpid()); - ICUNIT_GOTO_WITHIN_EQUAL(currProcessPri, 0, 31, currProcessPri, ERROR_OUT); // 31, assert function Result equal to this. - -#define PROCESS_TEST_PRI1 (currProcessPri + 1) -#define PROCESS_TEST_PRI2 (currProcessPri - 1) - - ret = sched_getparam(getpid(), ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ICUNIT_GOTO_EQUAL(param.sched_priority, currProcessPri, param.sched_priority, ERROR_OUT); - - ret = sched_getscheduler(getpid()); - ICUNIT_GOTO_EQUAL(ret, CURRENT_PROCESS_POLICY, ret, ERROR_OUT); - - param.sched_priority = PROCESS_TEST_PRI1; - ret = sched_setscheduler(getpid(), SCHED_RR, ¶m); - ICUNIT_GOTO_WITHIN_EQUAL(ret, 0, 100000, ret, ERROR_OUT); // 100000, assert ret equal to this. - - ret = sched_getparam(getpid(), ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ICUNIT_GOTO_EQUAL(param.sched_priority, PROCESS_TEST_PRI1, param.sched_priority, ERROR_OUT); - - param.sched_priority = PROCESS_TEST_PRI2; - ret = sched_setparam(getpid(), ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - ret = getpriority(PRIO_PROCESS, getpid()); - ICUNIT_GOTO_EQUAL(ret, PROCESS_TEST_PRI2, ret, ERROR_OUT); - - ret = setpriority(PRIO_PROCESS, getpid(), currProcessPri); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - ret = getpriority(PRIO_PROCESS, getpid()); - ICUNIT_GOTO_EQUAL(ret, currProcessPri, ret, ERROR_OUT); - - param.sched_priority = currProcessPri; - ret = sched_setscheduler(getpid(), CURRENT_PROCESS_POLICY, ¶m); - ICUNIT_GOTO_WITHIN_EQUAL(ret, 0, 100000, ret, ERROR_OUT); // 100000, assert ret equal to this. - - ret = setpgid(getpid(), 1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, ERROR_OUT); - ICUNIT_GOTO_EQUAL(errno, EPERM, errno, ERROR_OUT); - - ret = setpgid(getpid(), 2); // 2, set pid num. - ICUNIT_GOTO_EQUAL(ret, -1, ret, ERROR_OUT); - ICUNIT_GOTO_EQUAL(errno, EPERM, errno, ERROR_OUT); - - return 0; -ERROR_OUT: - return ret; -} - -void ItTestProcess002(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_002", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_004.cpp b/testsuites/unittest_old/process/process/smoke/process_test_004.cpp deleted file mode 100644 index fae512ff..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_004.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Testcase(void) -{ - int ret; - int status; - int pid; - - ret = fork(); - if (ret == 0) { - exit(5); // 5, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(0, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 5, status); // 5, assert that function Result is equal to this. - ICUNIT_ASSERT_EQUAL(WIFEXITED(status), 1, status); - } - ICUNIT_ASSERT_WITHIN_EQUAL(ret, 0, 100000, ret); // 100000, assert that function Result is equal to this. - - ret = fork(); - if (ret == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(6); // 6, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(0, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 6, status); // 6, assert that function Result is equal to this. - } - - ICUNIT_ASSERT_WITHIN_EQUAL(ret, 0, 100000, ret); // 100000, assert that function Result is equal to this. - - ret = fork(); - if (ret == 0) { - exit(1); - } else if (ret > 0) { - pid = ret; - ret = wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 1, status); - } - - ICUNIT_ASSERT_WITHIN_EQUAL(ret, 0, 100000, ret); // 100000, assert that function Result is equal to this. - - ret = fork(); - if (ret == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(2); // 2, exit args - } else if (ret > 0) { - pid = ret; - ret = wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 2, status); // 2, assert that function Result is equal to this. - } - ICUNIT_ASSERT_WITHIN_EQUAL(ret, 0, 100000, ret); // 100000, assert that function Result is equal to this. - - ret = fork(); - if (ret == 0) { - exit(3); // 3, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(pid, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 3, status); // 3, assert that function Result is equal to this. - } - ICUNIT_ASSERT_WITHIN_EQUAL(ret, 0, 100000, ret); // 100000, assert that function Result is equal to this. - - ret = fork(); - if (ret == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(4); // 4, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(ret, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 4, status); // 4, assert that function Result is equal to this. - } - ICUNIT_ASSERT_WITHIN_EQUAL(ret, 0, 100000, ret); // 100000, assert that function Result is equal to this. - - return 0; -} - -void ItTestProcess004(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_004", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_005.cpp b/testsuites/unittest_old/process/process/smoke/process_test_005.cpp deleted file mode 100644 index 8a94237b..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_005.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int ProcessTest002(void) -{ - int pid; - - pid = fork(); - if (pid == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(12); // 12, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - pid = fork(); - if (pid == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(12); // 12, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - pid = fork(); - if (pid == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(12); // 12, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - pid = fork(); - if (pid == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(12); // 12, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - pid = fork(); - if (pid == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(12); // 12, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - pid = fork(); - if (pid == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(12); // 12, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - pid = fork(); - if (pid == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(12); // 12, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - pid = fork(); - if (pid == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(12); // 12, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - pid = fork(); - if (pid == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(12); // 12, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - pid = fork(); - if (pid == 0) { - WAIT_PARENT_FIRST_TO_RUN(1); - exit(8); // 8, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - return 0; -} - -static int ProcessTest001(int *id) -{ - int ret; - int status; - int pid; - - pid = fork(); - if (pid == 0) { - ret = ProcessTest002(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - WAIT_PARENT_FIRST_TO_RUN(200); // 200, wait time. - exit(7); // 7, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - *id = pid; - return 0; -} - -static int Testcase(void) -{ - int ret; - int status; - int pid; - - ret = fork(); - if (ret == 0) { - ret = ProcessTest001(&pid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = waitpid(pid, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 7, status); // 7, assert that function Result is equal to this. - exit(8); // 8, exit args - } else if (ret > 0) { - pid = ret; - ret = wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 8, status); // 8, assert that function Result is equal to this. - } - - return 0; -} - -void ItTestProcess005(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_005", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_006.cpp b/testsuites/unittest_old/process/process/smoke/process_test_006.cpp deleted file mode 100644 index 909c4e74..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_006.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static const int TEST_COUNT = 10; - -static void *ThreadFunc2(void *arg) -{ - pid_t pid = *((pid_t *)arg); - int ret; - int status = 0; - ret = waitpid(pid, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL_NULL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL_NULL(status, 12, status); // 12, assert that function Result is equal to this. -} - -static int ProcessTest001(void) -{ - int ret; - int status = 0; - int pid, pid1; - int data; - int pri; - pthread_t newPthread, newPthread1; - int count = 4; - pthread_attr_t a = { 0 }; - struct sched_param param = { 0 }; - int currProcessPri = getpriority(PRIO_PROCESS, getpid()); - ICUNIT_ASSERT_WITHIN_EQUAL(currProcessPri, 0, 31, currProcessPri); // 31, assert that function Result is equal to this. - - ret = setpriority(PRIO_PROCESS, getpid(), currProcessPri - 2); // 2, Used to calculate priorities. - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pid = fork(); - if (pid == 0) { - WAIT_PARENT_FIRST_TO_RUN(50); // 50, wait time. - exit(12); // 12, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - pid1 = fork(); - if (pid1 == 0) { - WAIT_PARENT_FIRST_TO_RUN(40); // 40, wait time. - exit(10); // 10, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid1, 0, 100000, pid1); // 100000, assert that function Result is equal to this. - data = pid; - ret = pthread_create(&newPthread, NULL, ThreadFunc2, &data); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = waitpid(pid1, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid1, ret); - ICUNIT_ASSERT_EQUAL(status, 10, status); // 10, assert that function Result is equal to this. - - ret = pthread_detach(newPthread); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -static int TestCase(void) -{ - int ret; - int status; - int pid; - int count = TEST_COUNT; - - int temp = GetCpuCount(); - if (temp <= 1) { - return 0; - } - - while (count > 0) { - ret = fork(); - if (ret == 0) { - ret = ProcessTest001(); - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 11, status); // 11, assert that function Result is equal to this. - } - count--; - } - return 0; -} - -void ItTestProcess006(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_006", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_008.cpp b/testsuites/unittest_old/process/process/smoke/process_test_008.cpp deleted file mode 100644 index c7245658..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_008.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static const int TEST_COUNT = 10; - -static void *ThreadFunc2(void *arg) -{ - exit(254); // 254, exit args -} - -static void *ThreadFunc3(void *arg) -{ - while (1) { - } -} - -static int ProcessTest001(void) -{ - int ret; - int status; - int pid; - int policy = 0; - int data; - int pri; - pthread_t newPthread, newPthread1; - int count = 4; - pthread_attr_t a = { 0 }; - struct sched_param param = { 0 }; - int currProcessPri = getpriority(PRIO_PROCESS, getpid()); - ICUNIT_ASSERT_WITHIN_EQUAL(currProcessPri, 0, 31, currProcessPri); // 31, assert that function Result is equal to this. - - ret = setpriority(PRIO_PROCESS, getpid(), currProcessPri - 2); // 2, Used to calculate priorities. - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_init(&a); - param.sched_priority += 1; - pthread_attr_setschedparam(&a, ¶m); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - ret = pthread_create(&newPthread, &a, ThreadFunc3, &data); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - data = ret; - ret = pthread_create(&newPthread, NULL, ThreadFunc2, &data); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(255); // 255, exit args - return 0; -} - -static int Testcase(void) -{ - int ret; - int status; - int pid; - int count = TEST_COUNT; - int temp = GetCpuCount(); - if (temp <= 1) { - return 0; - } - - while (count > 0) { - ret = fork(); - if (ret == 0) { - ret = ProcessTest001(); - exit(10); // 10, exit args - } else if (ret > 0) { - pid = ret; - ret = wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_TWO_EQUAL(status, 255, 254, status); // 255, 254, assert that function Result is equal to this. - } - - ICUNIT_ASSERT_WITHIN_EQUAL(ret, 0, 100000, ret); // 100000, assert that function Result is equal to this. - count--; - } - - return 0; -} - -void ItTestProcess008(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_008", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_009.cpp b/testsuites/unittest_old/process/process/smoke/process_test_009.cpp deleted file mode 100644 index ac38c08f..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_009.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static void *ThreadFunc2(void *arg) -{ - while (1) { - } -} - -static int ProcessTest001(void) -{ - int ret; - int status = 0; - int pid; - int data; - int pri; - pthread_t newPthread, newPthread1; - int count = 4; - pthread_attr_t a = { 0 }; - struct sched_param param = { 0 }; - int currProcessPri = getpriority(PRIO_PROCESS, getpid()); - ICUNIT_ASSERT_WITHIN_EQUAL(currProcessPri, 0, 31, currProcessPri); // 31, assert that function Result is equal to this. - - ret = setpriority(PRIO_PROCESS, getpid(), currProcessPri - 2); // 2, Used to calculate priorities. - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pid = fork(); - if (pid == 0) { - sleep(1); - exit(12); // 12, exit args - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - ret = pthread_create(&newPthread, NULL, ThreadFunc2, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newPthread, NULL, ThreadFunc2, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = waitpid(pid, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 12, status); // 12, assert that function Result is equal to this. - - exit(255); // 255, exit args - return 0; -} - -static int Testcase(void) -{ - int ret; - int status; - int pid; - int temp = GetCpuCount(); - if (temp <= 1) { - return 0; - } - - ret = fork(); - if (ret == 0) { - ret = ProcessTest001(); - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 255, status); // 255, assert that function Result is equal to this. - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - - return 0; -} - -void ItTestProcess009(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_009", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_010.cpp b/testsuites/unittest_old/process/process/smoke/process_test_010.cpp deleted file mode 100644 index be10618b..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_010.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static const int TEST_COUNT = 10; - -static void *ThreadFunc2(void *arg) {} - -static int ProcessTest001(void) -{ - int ret; - int status; - int pid; - int data; - pthread_t newPthread, newPthread1; - int currProcessPri = getpriority(PRIO_PROCESS, getpid()); - ICUNIT_ASSERT_WITHIN_EQUAL(currProcessPri, 0, 31, currProcessPri); // 31, assert currProcessPri equal to this. - - ret = setpriority(PRIO_PROCESS, getpid(), currProcessPri - 2); // 2, Used to calculate priorities. - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - data = ret; - ret = pthread_create(&newPthread, NULL, ThreadFunc2, &data); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(255); // 255, exit args - return 0; -} - -static int Testcase(void) -{ - int ret; - int status; - int pid; - int count = TEST_COUNT; - - int temp = GetCpuCount(); - if (temp <= 1) { - return 0; - } - - while (count > 0) { - ret = fork(); - if (ret == 0) { - ret = ProcessTest001(); - exit(10); // 10, exit args - } else if (ret > 0) { - pid = ret; - ret = wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 255, status); // 255, assert that function Result is equal to this. - } - - ICUNIT_ASSERT_WITHIN_EQUAL(ret, 0, 100000, ret); // 100000, assert that function Result is equal to this. - count--; - } - - return 0; -} - -void ItTestProcess010(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_010", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_011.cpp b/testsuites/unittest_old/process/process/smoke/process_test_011.cpp deleted file mode 100644 index 2e86789e..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_011.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_testThreadExit = 0; -static int g_testExit = 0; - -static void *ThreadFunc2(void *arg) -{ - sleep(10); // 10, sleep 10 second. - g_testThreadExit++; - return NULL; -} - -static void *ThreadFunc(void *arg) -{ - int ret; - int status = 100; - pthread_t newPthread; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - ret = pthread_create(&newPthread, NULL, ThreadFunc2, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } else { - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT); - - ICUNIT_GOTO_EQUAL(g_testThreadExit, 0, g_testThreadExit, EXIT); - - g_testExit++; - } - - return NULL; -EXIT: - if (pid == 0) { - while (1) { - } - } - return NULL; -} - -static int TestCase(void) -{ - int ret; - int status = 100; - pthread_t newPthread; - - g_testThreadExit = 0; - g_testExit = 0; - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testExit, 1, g_testExit); - return 0; -} - -void ItTestProcess011(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_011", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_012.cpp b/testsuites/unittest_old/process/process/smoke/process_test_012.cpp deleted file mode 100644 index ea204195..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_012.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_testThreadExit = 0; -static int g_testExit = 0; - -static void *ThreadFunc2(void *arg) -{ - sleep(10); // 10, sleep 10 second. - g_testThreadExit++; - return NULL; -} - -static void *ThreadFunc001(void *arg) -{ - int ret; - int status = 100; - pthread_t newPthread; - - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - ret = pthread_create(&newPthread, NULL, ThreadFunc2, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } else { - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT); - - ICUNIT_GOTO_EQUAL(g_testThreadExit, 0, g_testThreadExit, EXIT); - - g_testExit++; - } - - return NULL; - -EXIT: - if (pid == 0) { - while (1) { - } - } - return NULL; -} - -static void *ThreadFunc(void *arg) -{ - struct sched_param param = { 0 }; - pthread_t newPthread; - int curThreadPri, curThreadPolicy; - pthread_attr_t a = { 0 }; - - int ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, -ret, EXIT); - - curThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - param.sched_priority = curThreadPri - 2; // 2, set pthread priority. - pthread_attr_setschedparam(&a, ¶m); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - ret = pthread_create(&newPthread, &a, ThreadFunc001, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_join(newPthread, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return NULL; - -EXIT: - g_testExit = 0; - return NULL; -} - -static int TestCase(void) -{ - int ret; - int status = 100; - pthread_t newPthread; - - g_testThreadExit = 0; - g_testExit = 0; - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testExit, 1, g_testExit); - return 0; -} - -void ItTestProcess012(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_012", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_013.cpp b/testsuites/unittest_old/process/process/smoke/process_test_013.cpp deleted file mode 100644 index 76a58d53..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_013.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" -#include "sched.h" - -static int TestCase() -{ -#define PROCESS_TEST_PRI1 (currProcessPri + 1) - struct sched_param param = { 0 }; - int ret; - int val, currPolicy; - int currProcessPri = getpriority(PRIO_PROCESS, getpid()); - ICUNIT_GOTO_WITHIN_EQUAL(currProcessPri, 0, 31, currProcessPri, ERROR_OUT); // 31, assert currProcessPri equal to this. - - currPolicy = sched_getscheduler(getpid()); - ICUNIT_GOTO_EQUAL(currPolicy, SCHED_RR, currPolicy, ERROR_OUT); - - val = getpriority(PRIO_PROCESS, 0); - ICUNIT_GOTO_EQUAL(val, currProcessPri, val, ERROR_OUT); - - ret = sched_getparam(0, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ICUNIT_GOTO_EQUAL(param.sched_priority, currProcessPri, param.sched_priority, ERROR_OUT); - - val = sched_getscheduler(0); - ICUNIT_GOTO_EQUAL(val, currPolicy, val, ERROR_OUT); - - ret = setpriority(PRIO_PROCESS, 0, PROCESS_TEST_PRI1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - ret = getpriority(PRIO_PROCESS, 0); - ICUNIT_GOTO_EQUAL(ret, PROCESS_TEST_PRI1, ret, ERROR_OUT); - - param.sched_priority = currProcessPri; - ret = sched_setparam(0, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - ret = getpriority(PRIO_PROCESS, getpid()); - ICUNIT_GOTO_EQUAL(ret, currProcessPri, ret, ERROR_OUT); - - ret = sched_setscheduler(0, SCHED_FIFO, ¶m); - ICUNIT_GOTO_EQUAL(ret, -1, ret, ERROR_OUT); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, ERROR_OUT); - - ret = sched_setscheduler(0, SCHED_RR, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - ret = sched_setscheduler(1, SCHED_FIFO, ¶m); - ICUNIT_GOTO_EQUAL(ret, -1, ret, ERROR_OUT); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EPERM, ret, ERROR_OUT); - - ret = sched_setscheduler(2, SCHED_FIFO, ¶m); // 2, input the pid. - ICUNIT_GOTO_EQUAL(ret, -1, ret, ERROR_OUT); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EPERM, ret, ERROR_OUT); - - ret = sched_setparam(1, ¶m); - ICUNIT_GOTO_EQUAL(ret, -1, ret, ERROR_OUT); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EPERM, ret, ERROR_OUT); - - ret = sched_setparam(2, ¶m); // 2, set the param. - ICUNIT_GOTO_EQUAL(ret, -1, ret, ERROR_OUT); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EPERM, ret, ERROR_OUT); - - ret = setpriority(PRIO_PROCESS, 1, PROCESS_TEST_PRI1); - ICUNIT_GOTO_EQUAL(ret, -1, ret, ERROR_OUT); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EPERM, ret, ERROR_OUT); - - ret = setpriority(PRIO_PROCESS, 2, PROCESS_TEST_PRI1); // 2, Used to calculate priorities. - ICUNIT_GOTO_EQUAL(ret, -1, ret, ERROR_OUT); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EPERM, ret, ERROR_OUT); - - return 0; - -ERROR_OUT: - return ret; -} - -void ItTestProcess013(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_013", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_014.cpp b/testsuites/unittest_old/process/process/smoke/process_test_014.cpp deleted file mode 100644 index f69c245a..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_014.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_testThreadExit = 0; -static int g_testExit = 0; - -static void *ThreadFunc(void *arg) -{ - int count = 0; - - while (count < 5) { // 5, Number of cycles. - g_testExit++; - count++; - usleep(1000 * 10 * 1); // 1000, 10, Used to calculate the delay time. - } - - return NULL; -} - -static int TestCase(void) -{ - int ret; - int status = 100; - pthread_t newPthread; - pid_t pid; - int count = 0; - g_testThreadExit = 0; - g_testExit = 0; - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - while (count < 10) { // 10, Number of cycles. - count++; - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - } - exit(0); - } else { - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 0, status, EXIT); - ICUNIT_GOTO_EQUAL(g_testExit, 5, g_testExit, EXIT); // 5, assert status equal to this. - } - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - -EXIT: - return 0; -} - -void ItTestProcess014(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_014", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_015.cpp b/testsuites/unittest_old/process/process/smoke/process_test_015.cpp deleted file mode 100644 index 967a68ff..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_015.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_testThreadExit = 0; -static int g_testExit = 0; -static int g_waitPid; -static int g_backPid; - -static void *ThreadFunc(void *arg) -{ - int status = 0; - - int ret = waitpid(g_waitPid, NULL, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - status = errno; - ICUNIT_GOTO_EQUAL(status, ECHILD, status, EXIT); - -EXIT: - return NULL; -} - -static int ProcessTest(void) -{ - int ret; - int status = 100; - pthread_t newPthread; - pid_t pid; - int count = 0; - g_testThreadExit = 0; - g_testExit = 0; - g_waitPid = 0; - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - g_waitPid = -1; - - if (pid == 0) { - usleep(1000 * 10 * 20); // 1000, 10, 20, Used to calculate the delay time. - exit(3); // 3, exit args - } - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - return 0; -EXIT: - return 1; -} - -void ItTestProcess015(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_015", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_016.cpp b/testsuites/unittest_old/process/process/smoke/process_test_016.cpp deleted file mode 100644 index 32394bdf..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_016.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_testThreadExit = 0; -static int g_testExit = 0; -static int g_waitPid; -static int g_backPid; - -static void *ThreadFunc(void *arg) -{ - int status = 0; - - int ret = waitpid(g_waitPid, NULL, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - status = errno; - ICUNIT_GOTO_EQUAL(status, ECHILD, status, EXIT); - -EXIT: - return NULL; -} - -static int ProcessTest(void) -{ - int ret; - int status = 100; - pthread_t newPthread; - pid_t pid; - int count = 0; - g_testThreadExit = 0; - g_testExit = 0; - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - g_waitPid = 0; - - if (pid == 0) { - while (count < 10) { // 10, Number of cycles. - count++; - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - } - exit(3); // 3, exit args - } - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; - -EXIT: - return 1; -} - - -void ItTestProcess016(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_016", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_017.cpp b/testsuites/unittest_old/process/process/smoke/process_test_017.cpp deleted file mode 100644 index 7519aecc..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_017.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_testThreadExit = 0; -static int g_testExit = 0; -static int g_waitPid; -static int g_backPid; - -static void *ThreadFunc(void *arg) -{ - int status = 0; - - int ret = waitpid(g_waitPid, NULL, 0); - printf("%s 22222 pid : %d\n", __FUNCTION__, ret); - - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - status = errno; - ICUNIT_GOTO_EQUAL(status, ECHILD, status, EXIT); - -EXIT: - return NULL; -} - -static int ProcessTest(void) -{ - int ret; - int status = 100; - pthread_t newPthread; - pid_t pid; - int count = 0; - g_testThreadExit = 0; - g_testExit = 0; - - g_waitPid = 0; - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - usleep(1000 * 10 * 10); // 1000, 10, 10, Used to calculate the delay time. - exit(3); // 3, exit args - } - - g_waitPid = pid; - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - ret = waitpid(pid, &status, 0); - printf("%s 11111 pid : %d\n", __FUNCTION__, ret); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(0); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - return 0; -EXIT: - return 1; -} - -void ItTestProcess017(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_017", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_018.cpp b/testsuites/unittest_old/process/process/smoke/process_test_018.cpp deleted file mode 100644 index 8e92d185..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_018.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_testThreadExit = 0; -static int g_testExit = 0; -static int g_waitPid; -static int g_backPid; - -static void *ThreadFunc(void *arg) -{ - int status = 0; - - int ret = waitpid(g_waitPid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, g_waitPid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - -EXIT: - return NULL; -} - -static int ProcessTest(void) -{ - int ret; - int status = 100; - pthread_t newPthread; - pid_t pid, pid1, pid2; - int count = 0; - g_testThreadExit = 0; - g_testExit = 0; - - g_waitPid = 0; - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - g_waitPid = pid; - - if (pid == 0) { - while (count < 10) { // 10, Number of cycles. - count++; - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - } - exit(3); // 3, exit args - } - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid, EXIT); // 100000, assert pid1 equal to this. - if (pid1 == 0) { - while (count < 10) { // 10, Number of cycles. - count++; - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - } - exit(4); // 4, exit args - } - - ret = waitpid(pid1, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid1, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 4, status, EXIT); // 4, assert status equal to this. - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert that function Result is equal to this. - return 0; -EXIT: - return 1; -} - -void ItTestProcess018(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_018", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_019.cpp b/testsuites/unittest_old/process/process/smoke/process_test_019.cpp deleted file mode 100644 index c51b59d8..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_019.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_testThreadExit = 0; -static int g_testExit = 0; -static int g_waitPid; -static int g_backPid; - -static void *ThreadFunc(void *arg) -{ - int status = 0; - - int ret = waitpid(g_waitPid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, g_waitPid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert that function Result is equal to this. - -EXIT: - return NULL; -} - -static int ProcessTest(void) -{ - int ret; - int status = 100; - pthread_t newPthread; - pid_t pid, pid1, pid2; - int count = 0; - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - while (count < 20) { // 20, number of cycles - count++; - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - } - exit(3); // 3, exit args - } - - g_waitPid = pid; - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid, EXIT); // 100000, assert pid1 equal to this. - if (pid1 == 0) { - while (count < 15) { // 15, number of cycles - count++; - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - } - exit(4); // 4, exit args - } - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = waitpid(-1, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid1, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 4, status, EXIT); // 4, assert status equal to this. - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - return 0; -EXIT: - return 1; -} - -void ItTestProcess019(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_019", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_020.cpp b/testsuites/unittest_old/process/process/smoke/process_test_020.cpp deleted file mode 100644 index 16701c6e..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_020.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_waitPid; -static int g_backPid; -static int g_backPid1; - -static void *ThreadFunc(void *arg) -{ - int status = 0; - - int ret = waitpid(g_waitPid, &status, 0); - if (ret == g_backPid) { - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - } else if (ret == g_backPid1) { - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 4, status, EXIT); // 4, assert status equal to this. - } else { - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - -EXIT: - return NULL; -} - -static int ProcessTest(void) -{ - int ret; - int status = 100; - pthread_t newPthread; - pid_t pid, pid1, pid2; - int count = 0; - - g_waitPid = 0; - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - g_waitPid = -1; - g_backPid = pid; - - if (pid == 0) { - while (count < 20) { // 20, Number of cycles. - count++; - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - } - exit(3); // 3, exit args - } - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid, EXIT); // 100000, assert pid1 equal to this. - g_backPid1 = pid1; - if (pid1 == 0) { - while (count < 15) { // 15, Number of cycles. - count++; - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - } - exit(4); // 4, exit args - } - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = waitpid(-1, &status, 0); - if (ret == pid) { - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - } else if (ret == pid1) { - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 4, status, EXIT); // 4, assert status equal to this. - } else { - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess020(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_020", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_021.cpp b/testsuites/unittest_old/process/process/smoke/process_test_021.cpp deleted file mode 100644 index 792996c7..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_021.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_waitPid; -static int g_backPid; -static int g_backPid1; -static int g_backPidFlag = 0; -static int g_backPid1Flag = 0; -static int g_errorFalg = 0; - -static void *ThreadFunc(void *arg) -{ - int status = 0; - - int ret = waitpid(g_waitPid, &status, 0); - if ((ret == g_backPid) && (g_backPidFlag == 0)) { - g_backPidFlag = 1; - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - } else if ((ret == g_backPid1) && (g_backPid1Flag == 0)) { - g_backPid1Flag = 1; - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 4, status, EXIT); // 4, assert status equal to this. - } else if (g_errorFalg == 0) { - g_errorFalg = 1; - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - } else { - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - -EXIT: - return NULL; -} - -static void *ThreadFunc1(void *arg) -{ - int status = 0; - int ret = waitpid(g_waitPid, &status, 0); - if ((ret == g_backPid) && (g_backPidFlag == 0)) { - g_backPidFlag = 1; - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - } else if ((ret == g_backPid1) && (g_backPid1Flag == 0)) { - g_backPid1Flag = 1; - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 4, status, EXIT); // 4, assert status equal to this. - } else if (g_errorFalg == 0) { - g_errorFalg = 1; - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - } else { - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - -EXIT: - return NULL; -} - -static int ProcessTest(void) -{ - int ret; - int status = 100; - pthread_t newPthread, newPthread1; - pid_t pid, pid1, pid2; - int count = 0; - - g_errorFalg = 0; - g_backPid1Flag = 0; - g_errorFalg = 0; - - g_waitPid = 0; - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - g_waitPid = -1; - g_backPid = pid; - - if (pid == 0) { - while (count < 20) { // 20, Number of cycles. - count++; - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - } - exit(3); // 3, exit args - } - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid, EXIT); // 100000, assert pid1 equal to this. - g_backPid1 = pid1; - if (pid1 == 0) { - while (count < 15) { // 15, Number of cycles. - count++; - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - } - exit(4); // 4, exit args - } - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = pthread_create(&newPthread1, NULL, ThreadFunc1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = waitpid(-1, &status, 0); - if ((ret == pid) && (g_backPidFlag == 0)) { - g_backPidFlag = 1; - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - } else if ((ret == pid1) && (g_backPid1Flag == 0)) { - g_backPid1Flag = 1; - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 4, status, EXIT); // 4, assert status equal to this. - } else if (g_errorFalg == 0) { - g_errorFalg = 1; - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - } else { - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - return 0; -EXIT: - return 1; -} - -void ItTestProcess021(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_021", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_022.cpp b/testsuites/unittest_old/process/process/smoke/process_test_022.cpp deleted file mode 100644 index 10d9c112..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_022.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_waitPid; -static int g_backPid; -static int g_backPid1; - -static int g_thread001; -static int g_thread002; -static void *ThreadFunc(void *arg) -{ - int status = 0; - - int ret = waitpid(0, &status, 0); - printf("3333333333333 pid : %u\n", ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, -1, ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(g_thread002, 0, g_thread002); - g_thread001++; - -EXIT: - return NULL; -} - -static void *ThreadFunc2(void *arg) -{ - int status = 0; - - int ret = waitpid(0, &status, 0); - printf("222222222222222222 pid : %u\n", ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, -1, ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(g_thread001, 0, g_thread001); - g_thread002++; - -EXIT: - return NULL; -} - -static int ProcessTest(void) -{ - int ret; - int status = 100; - pthread_t newPthread, newPthread1; - pid_t pid, pid1, pid2; - int count = 0; - - ret = setpgrp(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - g_thread001 = 0; - g_thread002 = 0; - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - g_backPid = pid; - - if (pid == 0) { - usleep(1000 * 10 * 30); // 1000, 10, 30, Used to calculate the delay time. - exit(3); // 3, exit args - } - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid, EXIT); // 100000, assert pid1 equal to this. - g_backPid1 = pid1; - if (pid1 == 0) { - usleep(1000 * 10 * 20); // 1000, 10, 20, Used to calculate the delay time. - exit(4); // 4, exit args - } - - pid2 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid2, 0, 100000, pid, EXIT); // 100000, assert pid2 equal to this. - if (pid2 == 0) { - usleep(1000 * 10 * 15); // 1000, 10, 15, Used to calculate the delay time. - exit(4); // 4, exit args - } - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - ret = pthread_create(&newPthread1, NULL, ThreadFunc2, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - ret = waitpid(0, &status, 0); - printf("111111111111111 pid : %u\n", ret); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - g_thread001++; - ICUNIT_ASSERT_NOT_EQUAL(g_thread002, 1, g_thread001); - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_thread001, 2, g_thread001); // 2, assert that function Result is equal to this. - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - return 0; -EXIT: - return 1; -} - -void ItTestProcess022(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_022", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_023.cpp b/testsuites/unittest_old/process/process/smoke/process_test_023.cpp deleted file mode 100644 index 578b9f18..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_023.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_waitPid; -static int g_backPid; -static int g_backPid1; - -static int g_thread001; -static int g_thread002; -static void *ThreadFunc(void *arg) -{ - int status = 0; - - int ret = waitpid(-1, &status, 0); - printf("%s 33333 pid : %d\n", __FUNCTION__, ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, -1, ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(g_thread002, 0, g_thread002); - g_thread001++; - - return (void *)9; // 9, set thread return value. -EXIT: - return NULL; -} - -static void *ThreadFunc2(void *arg) -{ - int status = 0; - - int ret = waitpid(-1, &status, 0); - g_thread002++; - printf("%s 222222 pid : %d\n", __FUNCTION__, ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, -1, ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(g_thread001, 0, g_thread001); - - return (void *)9; // 9, set thread return value. -EXIT: - return NULL; -} - -static int ProcessTest(void) -{ - int ret; - int *error = nullptr; - int status = 100; - pthread_t newPthread, newPthread1; - pid_t pid, pid1, pid2; - int count = 0; - - g_thread001 = 0; - g_thread002 = 0; - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - g_backPid = pid; - - if (pid == 0) { - usleep(1000 * 10 * 20); // 1000, 10, 20, Used to calculate the delay time. - exit(3); // 3, exit args - } - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid, EXIT); // 100000, assert pid1 equal to this. - g_backPid1 = pid1; - if (pid1 == 0) { - usleep(1000 * 10 * 15); // 1000, 10, 15, Used to calculate the delay time. - exit(4); // 4, exit args - } - - pid2 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid2, 0, 100000, pid, EXIT); // 100000, assert pid2 equal to this. - if (pid2 == 0) { - usleep(1000 * 10 * 10); // 1000, 10, 10, Used to calculate the delay time. - exit(4); // 4, exit args - } - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - ret = pthread_create(&newPthread1, NULL, ThreadFunc2, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = waitpid(-1, &status, 0); - g_thread001++; - printf("%s 11111 pid : %d\n", __FUNCTION__, ret); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_NOT_EQUAL(g_thread002, 1, g_thread001); - - ret = pthread_join(newPthread1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_thread001, 2, g_thread001); // 2, assert that function Result is equal to this. - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess023(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_023", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_024.cpp b/testsuites/unittest_old/process/process/smoke/process_test_024.cpp deleted file mode 100644 index ed927868..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_024.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_waitPid; -static int g_backPid; -static int g_backPid1; - -static int g_thread001; -static int g_thread002; -static void *ThreadFunc(void *arg) -{ - int status = 0; - - int ret = waitpid(-1, &status, 0); - printf("%s 3333333 pid : %d\n", __FUNCTION__, ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, -1, ret); - g_thread001++; - -EXIT: - return NULL; -} - -static void *ThreadFunc2(void *arg) -{ - int status = 0; - - int ret = waitpid(0, &status, 0); - g_thread002++; - printf("%s 11111111 pid %d\n", __FUNCTION__, ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, -1, ret); - -EXIT: - return NULL; -} - -static int ProcessTest(void) -{ - int ret; - int status = 100; - pthread_t newPthread, newPthread1; - pid_t pid, pid1, pid2; - int count = 0; - - g_thread001 = 0; - g_thread002 = 0; - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - g_backPid = pid; - if (pid == 0) { - usleep(1000 * 10 * 20); // 1000, 10, 20, Used to calculate the delay time. - exit(3); // 3, exit args - } - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid, EXIT); // 100000, assert pid1 equal to this. - g_backPid1 = pid1; - if (pid1 == 0) { - usleep(1000 * 10 * 15); // 1000, 10, 15, Used to calculate the delay time. - exit(4); // 4, exit args - } - - pid2 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid2, 0, 100000, pid, EXIT); // 100000, assert pid2 equal to this. - if (pid2 == 0) { - usleep(1000 * 10 * 10); // 1000, 10, 10, Used to calculate the delay time. - exit(4); // 4, exit args - } - - ret = pthread_create(&newPthread, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = pthread_create(&newPthread1, NULL, ThreadFunc2, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = waitpid(-1, &status, 0); - g_thread001++; - printf("%s 222222 pid : %d\n", __FUNCTION__, ret); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_NOT_EQUAL(g_thread002, 0, g_thread002); - - ret = pthread_join(newPthread1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_thread001, 2, g_thread001); // 2, assert that function Result is equal to this. - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess024(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_024", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_025.cpp b/testsuites/unittest_old/process/process/smoke/process_test_025.cpp deleted file mode 100644 index 631ac97d..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_025.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int g_waitPid; -static int g_backPid; -static int g_backPid1; - -static int g_thread001; -static int g_thread002; -static void *ThreadFunc(void *arg) -{ - int status = 0; - - int ret = waitpid(-1, &status, 0); - printf("%s 3333333 pid : %d\n", __FUNCTION__, ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, -1, ret); - g_thread001++; - -EXIT: - return NULL; -} - -static void *ThreadFunc2(void *arg) -{ - int status = 0; - - int ret = waitpid(g_backPid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, g_backPid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - - g_thread002++; - - printf("%s 11111111 pid %d\n", __FUNCTION__, ret); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, -1, ret); - -EXIT: - return NULL; -} - -static int ProcessTest(void) -{ - int ret; - int status = 100; - pthread_t newPthread, newPthread1; - pid_t pid, pid1, pid2; - int count = 0; - - g_thread001 = 0; - g_thread002 = 0; - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - g_backPid = pid; - if (pid == 0) { - usleep(1000 * 10 * 40); // 1000, 10, 40, Used to calculate the delay time. - printf("child exit 1\n"); - exit(3); // 3, exit args - } - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid, EXIT); // 100000, assert pid1 equal to this. - g_backPid1 = pid1; - if (pid1 == 0) { - usleep(1000 * 10 * 45); // 1000, 10, 45, Used to calculate the delay time. - printf("child exit 2\n"); - exit(4); // 4, exit args - } - - pid2 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid2, 0, 100000, pid, EXIT); // 100000, assert pid2 equal to this. - if (pid2 == 0) { - usleep(1000 * 10 * 50); // 1000, 10, 50, Used to calculate the delay time. - printf("child exit 3\n"); - exit(4); // 4, exit args - } - - ret = pthread_create(&newPthread, NULL, ThreadFunc2, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = pthread_create(&newPthread1, NULL, ThreadFunc, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = waitpid(-1, &status, 0); - g_thread001++; - printf("%s 222222 pid : %d\n", __FUNCTION__, ret); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_NOT_EQUAL(g_thread002, 0, g_thread002); - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_thread001, 2, g_thread001); // 2, assert that function Result is equal to this. - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess025(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_025", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_026.cpp b/testsuites/unittest_old/process/process/smoke/process_test_026.cpp deleted file mode 100644 index f7e49306..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_026.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int TestCase(void) -{ - int ret; - int pid = 3; - int status = 0; - - ret = waitpid(pid, &status, -1); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - ret = waitpid(pid, &status, 4); // 4, waitpid options. - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - ret = waitpid(pid, &status, WUNTRACED); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EOPNOTSUPP, ret, EXIT); - - ret = waitpid(pid, &status, WCONTINUED); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EOPNOTSUPP, ret, EXIT); - - ret = waitpid(pid, &status, 10); // 10, waitpid options. - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EOPNOTSUPP, ret, EXIT); - - ret = waitpid(pid, &status, 21); // 21, waitpid options. - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - return 0; -EXIT: - return 1; -} - -void ItTestProcess026(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_026", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_027.cpp b/testsuites/unittest_old/process/process/smoke/process_test_027.cpp deleted file mode 100644 index a1d77e38..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_027.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int ProcessTest(void) -{ - int ret; - int status = 100; - pthread_t newPthread; - pid_t pid; - int count = 0; - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - usleep(1000 * 10 * 20); // 1000, 10, 20, Used to calculate the delay time. - exit(3); // 3, exit args - } - - ret = waitpid(pid, &status, WNOHANG); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 3, status, EXIT); // 3, assert status equal to this. - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - if (pid == 0) { - ProcessTest(); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - return 0; -EXIT: - return 1; -} - -void ItTestProcess027(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_027", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_029.cpp b/testsuites/unittest_old/process/process/smoke/process_test_029.cpp deleted file mode 100644 index 71424851..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_029.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Child1(int currGid) -{ - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - usleep(1000 * 10 * 5); // 1000, 10, 5, Used to calculate the delay time. - - ICUNIT_ASSERT_EQUAL(getpgrp(), getpid(), getpgrp()); - - exit(255); // 255, exit args -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - Child1(currGid); - exit(0); - } - - usleep(1000 * 10 * 2); // 1000, 10, 2, Used to calculate the delay time. - - ret = setpgid(pid, pid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess029(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_029", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_030.cpp b/testsuites/unittest_old/process/process/smoke/process_test_030.cpp deleted file mode 100644 index e37b26f8..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_030.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Child1(int currGid) -{ - int ret; - - ICUNIT_ASSERT_EQUAL(currGid, getpgrp(), getpgrp()); - - ret = setpgrp(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(getpgrp(), getpid(), getpgrp()); - - exit(255); // 255, exit args -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - Child1(currGid); - exit(0); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess030(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_030", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_038.cpp b/testsuites/unittest_old/process/process/smoke/process_test_038.cpp deleted file mode 100644 index c8cbeba2..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_038.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Child1(int currGid) -{ - sleep(1); - - exit(255); // 255, exit args -} - -static int Child2(int currGid, int gid) -{ - sleep(1); - - exit(255); // 255, exit args -} - -static int ProcessGroup(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - - ret = setpgrp(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - currGid = getpgrp(); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - Child1(currGid); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - pid1 = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid1, 0, 100000, pid1, EXIT); // 100000, assert pid equal to this. - ICUNIT_GOTO_NOT_EQUAL(pid1, pid, pid1, EXIT); - - if (pid1 == 0) { - Child2(currGid, pid); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int GroupProcess(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - int count = 30; - - while (count > 0) { - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - ProcessGroup(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - sleep(1); - count--; - } - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - GroupProcess(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess038(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_038", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_039.cpp b/testsuites/unittest_old/process/process/smoke/process_test_039.cpp deleted file mode 100644 index 2abc9e68..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_039.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int GroupProcess(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int count = 1000; - - for (int i = 0; i < count; i++) { - pid = fork(); - if (pid == 0) { - exit(0); - } else if (pid > 0) { - ret = waitpid(pid, &status, 0); - continue; - } else { - exit(5); // 5, exit args - } - } - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - prctl(PR_SET_NAME, "mainFork", 0UL, 0UL, 0UL); - GroupProcess(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess039(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_039", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_043.cpp b/testsuites/unittest_old/process/process/smoke/process_test_043.cpp deleted file mode 100644 index c1bd271f..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_043.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Testcase(VOID) -{ - int priority; - int err; - int ret; - int currProcessPri = getpriority(PRIO_PROCESS, getpid()); - int count = 0; - priority = getpriority(PRIO_PGRP, 0); - struct sched_param param = { 0 }; - err = errno; - - priority = getpriority(PRIO_PGRP, 0); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - priority = getpriority(PRIO_USER, 0); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - for (count = 1; count < 1000; ++count) { // 1000, Number of cycles. - priority = getpriority(PRIO_USER + count, 0); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - priority = setpriority(PRIO_USER + count, getpid(), currProcessPri); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - priority = getpriority(-count, 0); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - priority = setpriority(-count, getpid(), currProcessPri); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - priority = sched_get_priority_max(SCHED_RR - count); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - priority = sched_get_priority_max(SCHED_RR + count); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - priority = sched_get_priority_min(SCHED_RR - count); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - priority = sched_get_priority_min(SCHED_RR + count); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - ret = sched_setscheduler(getpid(), SCHED_RR - count, ¶m); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - ret = sched_setscheduler(getpid(), SCHED_RR + count, ¶m); - err = errno; - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - } - - priority = setpriority(PRIO_PGRP, getpid(), currProcessPri); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - priority = setpriority(PRIO_USER, getpid(), currProcessPri); - err = errno; - ICUNIT_ASSERT_EQUAL(priority, -1, priority); - ICUNIT_ASSERT_EQUAL(err, EINVAL, err); - - return 0; -} - -void ItTestProcess043(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_043", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_044.cpp b/testsuites/unittest_old/process/process/smoke/process_test_044.cpp deleted file mode 100644 index dd790bc5..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_044.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ - -#include "it_test_process.h" - -static void *ThreadFuncTest3(void *arg) -{ - while (1) { - sleep(1); - }; - - return NULL; -} - -static int GroupProcess(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - pthread_t newPthread; - struct timespec ts = { 0 }; - - ret = sched_rr_get_interval(getpid(), &ts); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(ts.tv_sec, 0, ts.tv_sec); - if (ts.tv_nsec <= 5000000 || ts.tv_nsec > 20000000) { // 5000000, 20000000, expected range of tv_nsec. - ICUNIT_ASSERT_EQUAL(ts.tv_nsec, -1, ts.tv_nsec); - } - - ret = pthread_create(&newPthread, NULL, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = sched_rr_get_interval(getpid(), &ts); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(ts.tv_sec, 0, ts.tv_sec); - if (ts.tv_nsec <= 10000000 || ts.tv_nsec > 40000000) { // 10000000, 40000000, expected range of tv_nsec. - ICUNIT_ASSERT_EQUAL(ts.tv_nsec, -1, ts.tv_nsec); - } - - exit(255); // 255, exit args -EXIT: - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - int currGid = getpgrp(); - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, assert pid equal to this. - - if (pid == 0) { - prctl(PR_SET_NAME, "mainFork", 0UL, 0UL, 0UL); - GroupProcess(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert status equal to this. - - return 0; -EXIT: - return 1; -} - -void ItTestProcess044(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_044", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_045.cpp b/testsuites/unittest_old/process/process/smoke/process_test_045.cpp deleted file mode 100644 index a094cb7e..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_045.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ - -#include "it_test_process.h" - -static UINT32 Testcase(VOID) -{ - int ret; - cpu_set_t cpuset; - CPU_ZERO(&cpuset); - - ret = pthread_getaffinity_np(pthread_self(), 0, &cpuset); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_setaffinity_np(pthread_self(), 0, &cpuset); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = sched_setaffinity(getpid(), 0, &cpuset); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = sched_getaffinity(getpid(), 0, &cpuset); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = sched_setaffinity(-15, sizeof(cpu_set_t), &cpuset); // -15, pid num - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, ESRCH, errno); - - ret = sched_setaffinity(1, sizeof(cpu_set_t), &cpuset); // init process, no permission - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EPERM, errno); - - ret = sched_setaffinity(128, sizeof(cpu_set_t), &cpuset); // 128, pid num - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, ESRCH, errno); - - ret = sched_getaffinity(128, sizeof(cpu_set_t), &cpuset); // 128, pid num - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, ESRCH, errno); - - ret = sched_getaffinity(-15, sizeof(cpu_set_t), &cpuset); // -15, pid num - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, ESRCH, errno); - - return 0; -} - -void ItTestProcess045(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_045", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_046.cpp b/testsuites/unittest_old/process/process/smoke/process_test_046.cpp deleted file mode 100644 index 0232fff3..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_046.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -// This testcase us used for undefination of LOSCFG_USER_TEST_SMP -static int Testcase(void) -{ - int ret; - int status; - int pid; - - int temp = GetCpuCount(); - if (temp != 1) { - return 0; - } - - ret = fork(); - if (ret == 0) { - int ret; - cpu_set_t cpuset; - - CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); /* cpu1 unsupported operation */ - ret = sched_setaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, -1, ret, ERROR_OUT); - CPU_ZERO(&cpuset); - - CPU_ZERO(&cpuset); - CPU_SET(0, &cpuset); /* cpu0 */ - ret = sched_setaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - CPU_ZERO(&cpuset); - - ret = sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - -ERROR_OUT: - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(ret, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 11, status); // 11, assert that function Result is equal to this. - } - - return 0; -} - -void ItTestProcess046(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_046", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_047.cpp b/testsuites/unittest_old/process/process/smoke/process_test_047.cpp deleted file mode 100644 index cd769a3a..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_047.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -// This testcase us used for undefination of LOSCFG_USER_TEST_SMP -static int Testcase(void) -{ - int ret; - int pid; - int status; - - int temp = GetCpuCount(); - if (temp != 1) { - return 0; - } - - ret = fork(); - if (ret == 0) { - int temp; - cpu_set_t cpuset; - - CPU_ZERO(&cpuset); - temp = sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(temp, 0, temp, ERROR_OUT); - - temp = CPU_COUNT(&cpuset); - ICUNIT_GOTO_EQUAL(temp, 1, temp, ERROR_OUT); /* one cpu with the undefination of LOSCFG_USER_TEST_SMP */ - -ERROR_OUT: - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(ret, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 11, status); // 11, assert that function Result is equal to this. - } - - return 0; -} - -void ItTestProcess047(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_047", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_048.cpp b/testsuites/unittest_old/process/process/smoke/process_test_048.cpp deleted file mode 100644 index be6e0a2a..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_048.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -// This testcase us used for undefination of LOSCFG_USER_TEST_SMP -static int Testcase(void) -{ - int ret; - int status; - int pid; - - int temp = GetCpuCount(); - if (temp != 1) { - return 0; - } - - ret = fork(); - if (ret == 0) { - int ret; - cpu_set_t cpuset; - - CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); /* cpu1 unsupported operation */ - ret = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, ERROR_OUT); - CPU_ZERO(&cpuset); - - CPU_ZERO(&cpuset); - CPU_SET(0, &cpuset); /* cpu0 */ - ret = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - CPU_ZERO(&cpuset); - - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - -ERROR_OUT: - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(ret, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 11, status); // 11, assert that function Result is equal to this. - } - - return 0; -} - -void ItTestProcess048(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_048", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smoke/process_test_054.cpp b/testsuites/unittest_old/process/process/smoke/process_test_054.cpp deleted file mode 100644 index 6de1aec0..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_054.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int TestCase(void) -{ - int ret; - int pid = 3; - siginfo_t info = { 0 }; - - ret = waitid((idtype_t)3, getpgrp(), &info, WEXITED); // 3, set tid. - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - ret = waitid(P_PID, 0, &info, WEXITED); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - ret = waitid(P_PID, 999, &info, WEXITED); // 999, set group. - ret = errno; - ICUNIT_GOTO_EQUAL(ret, ECHILD, ret, EXIT); - - ret = waitid(P_PGID, 0, &info, WEXITED); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - ret = waitid(P_ALL, getpgrp(), &info, -1); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - ret = waitid(P_ALL, getpgrp(), &info, 0); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - ret = waitid(P_ALL, getpgrp(), &info, 32); // 32, set exit num. - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - ret = waitid(P_ALL, getpgrp(), &info, WSTOPPED); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EOPNOTSUPP, ret, EXIT); - - ret = waitid(P_ALL, getpgrp(), &info, WCONTINUED); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EOPNOTSUPP, ret, EXIT); - - ret = waitid(P_ALL, getpgrp(), &info, WNOWAIT); - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EOPNOTSUPP, ret, EXIT); - - ret = waitid(P_ALL, getpgrp(), &info, 21); // 21, set exit num. - ret = errno; - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - return 0; -EXIT: - return 1; -} - -void ItTestProcess054(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_054", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/smoke/process_test_061.cpp b/testsuites/unittest_old/process/process/smoke/process_test_061.cpp deleted file mode 100644 index 69f82594..00000000 --- a/testsuites/unittest_old/process/process/smoke/process_test_061.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int TestCase(void) -{ - int ret = killpg(-1, 0); - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - ret = killpg(99999, 0); // 99999, set group - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, ESRCH, errno, EXIT); - - ret = killpg(2, 0); // 2, set group - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EPERM, errno, EXIT); - - ret = killpg(0, 65); // 65, set signal - ICUNIT_GOTO_EQUAL(ret, -1, ret, EXIT); - ICUNIT_GOTO_EQUAL(errno, EINVAL, errno, EXIT); - - return 0; -EXIT: - return 1; -} - -void ItTestProcess061(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_061", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/process/process/smp/process_test_smp_001.cpp b/testsuites/unittest_old/process/process/smp/process_test_smp_001.cpp deleted file mode 100644 index bdaa3a94..00000000 --- a/testsuites/unittest_old/process/process/smp/process_test_smp_001.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static int Testcase(void) -{ - int ret; - int status; - int pid; - - ret = fork(); - if (ret == 0) { - int ret; - cpu_set_t cpuset; - - CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); /* cpu1 */ - ret = sched_setaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - CPU_ZERO(&cpuset); - ret = sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - exit(11); // 11, exit args - ERROR_OUT: - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(ret, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 11, status); // 11, assert that function Result is equal to this. - } - - return 0; -} - -void ItTestProcessSmp001(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_SMP_001", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smp/process_test_smp_002.cpp b/testsuites/unittest_old/process/process/smp/process_test_smp_002.cpp deleted file mode 100644 index ddbb3e8a..00000000 --- a/testsuites/unittest_old/process/process/smp/process_test_smp_002.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static void *PthreadTest01(VOID *arg) -{ - int ret; - cpu_set_t cpuset; - - CPU_ZERO(&cpuset); - CPU_SET(0, &cpuset); /* cpu0 */ - ret = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - - CPU_ZERO(&cpuset); - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT1); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - - CPU_ZERO(&cpuset); - ret = sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT1); - return NULL; -ERROR_OUT1: - return NULL; -} - -static int Testcase(void) -{ - int ret; - int pid; - int status; - - ret = fork(); - if (ret == 0) { - int ret; - cpu_set_t cpuset; - pthread_t threadA; - cpu_set_t initCpuset; - - CPU_ZERO(&initCpuset); - ret = sched_getaffinity(getpid(), sizeof(cpu_set_t), &initCpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); /* cpu1 */ - ret = sched_setaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - ret = sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - - ret = pthread_create(&threadA, NULL, PthreadTest01, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = pthread_join(threadA, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - ret = sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - - ret = sched_setaffinity(getpid(), sizeof(cpu_set_t), &initCpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - exit(11); // 11, exit args - ERROR_OUT: - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(ret, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 11, status); // 11, assert that function Result is equal to this. - } - - return 0; -} - -void ItTestProcessSmp002(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_SMP_002", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smp/process_test_smp_003.cpp b/testsuites/unittest_old/process/process/smp/process_test_smp_003.cpp deleted file mode 100644 index 5e81a329..00000000 --- a/testsuites/unittest_old/process/process/smp/process_test_smp_003.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static UINT32 Testcase(VOID) -{ - int ret; - int status; - int pid; - - ret = fork(); - if (ret == 0) { - int ret; - cpu_set_t cpuset; - - CPU_ZERO(&cpuset); - CPU_SET(0, &cpuset); - ret = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); - ret = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - CPU_SET(0, &cpuset); - CPU_SET(1, &cpuset); - ret = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - exit(11); // 11, exit args - ERROR_OUT: - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(ret, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 11, status); // 11, assert that function Result is equal to this. - } - - return 0; -} - -void ItTestProcessSmp003(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_SMP_003", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smp/process_test_smp_004.cpp b/testsuites/unittest_old/process/process/smp/process_test_smp_004.cpp deleted file mode 100644 index e5d44755..00000000 --- a/testsuites/unittest_old/process/process/smp/process_test_smp_004.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static UINT32 Testcase(VOID) -{ - int ret; - cpu_set_t cpuset; - ret = pthread_getaffinity_np(pthread_self(), 0, &cpuset); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - ret = pthread_setaffinity_np(pthread_self(), 0, &cpuset); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - ret = sched_setaffinity(getpid(), 0, &cpuset); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = sched_getaffinity(getpid(), 0, &cpuset); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - return 0; -} - -void ItTestProcessSmp004(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_SMP_004", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smp/process_test_smp_005.cpp b/testsuites/unittest_old/process/process/smp/process_test_smp_005.cpp deleted file mode 100644 index e656461c..00000000 --- a/testsuites/unittest_old/process/process/smp/process_test_smp_005.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static void *PthreadTest01(VOID *arg) -{ - int ret; - cpu_set_t cpuset; - - CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); /* cpu1 */ - ret = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - - CPU_ZERO(&cpuset); - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(0, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(1, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT1); - return NULL; -ERROR_OUT1: - return NULL; -} -static UINT32 Testcase(VOID) -{ - int ret; - int status; - int pid; - - ret = fork(); - if (ret == 0) { - int ret; - cpu_set_t cpuset; - pthread_t threadA; - - CPU_ZERO(&cpuset); - CPU_SET(0, &cpuset); /* cpu0 */ - ret = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - ret = pthread_create(&threadA, NULL, PthreadTest01, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = pthread_join(threadA, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - exit(11); // 11, exit args - ERROR_OUT: - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(ret, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 11, status); // 11, assert that function Result is equal to this. - } - - return 0; -} - -void ItTestProcessSmp005(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_SMP_005", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smp/process_test_smp_006.cpp b/testsuites/unittest_old/process/process/smp/process_test_smp_006.cpp deleted file mode 100644 index ecec61a2..00000000 --- a/testsuites/unittest_old/process/process/smp/process_test_smp_006.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static void *PthreadTest01(VOID *arg) -{ - int ret; - cpu_set_t cpuset; - - CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); /* cpu1 */ - ret = sched_setaffinity(0, sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - - CPU_ZERO(&cpuset); - ret = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(0, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(1, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT1); - return NULL; -ERROR_OUT1: - return NULL; -} -static UINT32 Testcase(VOID) -{ - int ret; - int status; - int pid; - - ret = fork(); - if (ret == 0) { - int ret; - cpu_set_t cpuset; - pthread_t threadA; - - CPU_ZERO(&cpuset); - CPU_SET(0, &cpuset); /* cpu0 */ - ret = sched_setaffinity(0, sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - ret = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - ret = pthread_create(&threadA, NULL, PthreadTest01, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = pthread_join(threadA, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - ret = sched_getaffinity(0, sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - exit(11); // 11, exit args - ERROR_OUT: - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(ret, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 11, status); // 11, assert that function Result is equal to this. - } - - return 0; -} - -void ItTestProcessSmp006(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_SMP_006", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smp/process_test_smp_007.cpp b/testsuites/unittest_old/process/process/smp/process_test_smp_007.cpp deleted file mode 100644 index 76edfae4..00000000 --- a/testsuites/unittest_old/process/process/smp/process_test_smp_007.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static void *PthreadTest01(VOID *arg) -{ - int ret; - cpu_set_t cpuset; - - sleep(2); // 2, sleep 10 second. - - CPU_ZERO(&cpuset); - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(0, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(1, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT1); - return NULL; -ERROR_OUT1: - return NULL; -} -static UINT32 Testcase(VOID) -{ - int ret; - int status; - int pid; - - ret = fork(); - if (ret == 0) { - int ret; - cpu_set_t cpuset; - pthread_t threadA; - - CPU_ZERO(&cpuset); - CPU_SET(0, &cpuset); /* cpu0 */ - ret = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - ret = pthread_create(&threadA, NULL, PthreadTest01, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); /* cpu1 */ - ret = pthread_setaffinity_np(threadA, sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - ret = pthread_join(threadA, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - exit(11); // 11, exit args - ERROR_OUT: - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(ret, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 11, status); // 11, assert that function Result is equal to this. - } - - return 0; -} - -void ItTestProcessSmp007(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_SMP_007", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/process/smp/process_test_smp_008.cpp b/testsuites/unittest_old/process/process/smp/process_test_smp_008.cpp deleted file mode 100644 index bf590220..00000000 --- a/testsuites/unittest_old/process/process/smp/process_test_smp_008.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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. - */ -#include "it_test_process.h" - -static void *PthreadTest01(VOID *arg) -{ - int ret; - cpu_set_t cpuset; - - CPU_ZERO(&cpuset); - CPU_SET(0, &cpuset); /* cpu0 */ - ret = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - - CPU_ZERO(&cpuset); - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(0, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT1); - ret = (CPU_ISSET(1, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - - CPU_ZERO(&cpuset); - CPU_SET(0, &cpuset); /* cpu0 */ - CPU_SET(1, &cpuset); /* cpu1 */ - ret = sched_setaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - - CPU_ZERO(&cpuset); - ret = sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(0, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT1); - ret = (CPU_ISSET(1, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT1); - - CPU_ZERO(&cpuset); - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - ret = (CPU_ISSET(0, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT1); - ret = (CPU_ISSET(1, &cpuset)) > 0 ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT1); - return NULL; -ERROR_OUT1: - return NULL; -} - -static int Testcase(void) -{ - int ret; - int status; - int pid; - - ret = fork(); - if (ret == 0) { - int ret; - cpu_set_t cpuset; - pthread_t threadA; - CPU_ZERO(&cpuset); - CPU_SET(1, &cpuset); /* cpu1 */ - ret = sched_setaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - ret = sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - - ret = pthread_create(&threadA, NULL, PthreadTest01, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = pthread_join(threadA, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - - CPU_ZERO(&cpuset); - ret = sched_getaffinity(getpid(), sizeof(cpu_set_t), &cpuset); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROR_OUT); - ret = (CPU_ISSET(0, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - ret = (CPU_ISSET(1, &cpuset) > 0) ? 1 : 0; - ICUNIT_GOTO_EQUAL(ret, 1, ret, ERROR_OUT); - exit(11); // 11, exit args - ERROR_OUT: - exit(11); // 11, exit args - } else if (ret > 0) { - pid = ret; - ret = waitpid(ret, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 11, status); // 11, assert that function Result is equal to this. - } - - return 0; -} - -void ItTestProcessSmp008(void) -{ - TEST_ADD_CASE("IT_POSIX_PROCESS_SMP_008", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/BUILD.gn b/testsuites/unittest_old/process/pthread/BUILD.gn deleted file mode 100644 index 728a6fe4..00000000 --- a/testsuites/unittest_old/process/pthread/BUILD.gn +++ /dev/null @@ -1,101 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "process_pthread_test.cpp", -] - -sources_smoke = [ - "smoke/pthread_atfork_test_001.cpp", - "smoke/pthread_atfork_test_002.cpp", - "smoke/pthread_cond_test_001.cpp", - "smoke/pthread_cond_test_002.cpp", - "smoke/pthread_cond_test_003.cpp", - "smoke/pthread_cond_test_004.cpp", - "smoke/pthread_once_test_001.cpp", - "smoke/pthread_test_003.cpp", - "smoke/pthread_test_006.cpp", - "smoke/pthread_test_007.cpp", - "smoke/pthread_test_008.cpp", - "smoke/pthread_test_009.cpp", - "smoke/pthread_test_010.cpp", - "smoke/pthread_test_011.cpp", - "smoke/pthread_test_012.cpp", - "smoke/pthread_test_013.cpp", - "smoke/pthread_test_015.cpp", - "smoke/pthread_test_016.cpp", - "smoke/pthread_test_017.cpp", - "smoke/pthread_test_018.cpp", - "smoke/pthread_test_019.cpp", -] - -sources_full = [ - "full/pthread_test_001.cpp", - "full/pthread_test_002.cpp", - "full/pthread_test_004.cpp", - "full/pthread_test_005.cpp", - "full/pthread_test_014.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_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_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_old/process/pthread/full/pthread_test_001.cpp b/testsuites/unittest_old/process/pthread/full/pthread_test_001.cpp deleted file mode 100644 index 8c95f11f..00000000 --- a/testsuites/unittest_old/process/pthread/full/pthread_test_001.cpp +++ /dev/null @@ -1,279 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static int g_currThreadPri, g_currThreadPolicy; -static volatile int g_pthreadTestCount = 0; -static int g_threadTestCount1 = 0; - -static void *ThreadFunc5(void *ptr) -{ - pid_t pid = getpid(); - int ret; - - ICUNIT_GOTO_EQUAL(g_threadTestCount1, 2, g_threadTestCount1, EXIT); // 2, here assert the result. - g_threadTestCount1++; - - ret = pthread_detach(pthread_self()); - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - -EXIT: - return NULL; -} - -static void *ThreadFunc4(void *arg) -{ - pthread_t pthread = pthread_self(); - int i = 0; - unsigned int ret; - pid_t pid = getpid(); - - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 9, g_pthreadTestCount, EXIT); // 9, here assert the result. - g_pthreadTestCount++; // 10 - - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - - while (1) { - pthread_testcancel(); - if (++i == 5) { // 5, in loop 5, set cancel state. - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - } - - if (i == 10) { // 10, in loop 10, cancel pthread. - ret = pthread_cancel(pthread); - } - } - return (void *)i; - -EXIT: - return NULL; -} - -static void *ThreadFunc3(void *arg) -{ - pthread_t pthread = pthread_self(); - int i = 0; - unsigned int ret; - pid_t pid = getpid(); - - g_pthreadTestCount++; // 7 - - pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); - - while (1) { - pthread_testcancel(); - if (++i == 5) { // 5, in loop 5, set cancel state. - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - } - - if (i == 10) { // 10, in loop 10, cancel pthread. - ret = pthread_cancel(pthread); - } - } - - ICUNIT_GOTO_EQUAL(i, 10, i, EXIT); // 10, here assert the result. - return (void *)i; -EXIT: - return NULL; -} - -static void *ThreadFunc2(void *arg) -{ - pthread_t pthread = pthread_self(); - pid_t pid = getpid(); - unsigned int ret; - - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 3, g_pthreadTestCount, EXIT); // 3, here assert the result. - - g_pthreadTestCount++; // 4 - - ret = pthread_join(pthread_self(), 0); - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - ret = pthread_detach(pthread_self()); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return NULL; -} - -static void *ThreadFunc6(void *arg) -{ - pid_t pid = getpid(); - - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 12, g_pthreadTestCount, EXIT); // 12, here assert the result. - g_pthreadTestCount++; // 13 - - return (void *)pthread_self(); - -EXIT: - return NULL; -} - -static void *ThreadFunc(void *arg) -{ - unsigned int ret; - void *res = NULL; - pthread_attr_t a = { 0 }; - pthread_t newPthread; - struct sched_param param = { 0 }; - pid_t pid = getpid(); - int curThreadPri, curThreadPolicy; - - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 2, g_pthreadTestCount, EXIT); // 2, here assert the result. - - g_pthreadTestCount++; // 3 - - ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, -ret, EXIT); - - curThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = curThreadPri - 1; - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, ThreadFunc2, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -#ifdef LOSCFG_USER_TEST_SMP - usleep(1000 * 10 * 2); // 1000 * 10 * 2, for timing control. -#endif - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 4, g_pthreadTestCount, EXIT); // 4, here assert the result. - - g_pthreadTestCount++; // 5 - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = curThreadPri + 1; - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, ThreadFunc3, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_pthreadTestCount++; // 6 - - ret = pthread_join(newPthread, &res); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 7, g_pthreadTestCount, EXIT); // 7, here assert the result. - g_pthreadTestCount++; // 8 - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = curThreadPri + 2; // 2, adjust the priority. - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, ThreadFunc4, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 8, g_pthreadTestCount, EXIT); // 8, here assert the result. - g_pthreadTestCount++; // 9 - - ret = pthread_join(newPthread, &res); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 10, g_pthreadTestCount, EXIT); // 10, here assert the result. - g_pthreadTestCount++; // 11 - -EXIT: - return NULL; -} - -int PthreadTest001() -{ - struct sched_param param = { 0 }; - int ret; - void *res = NULL; - pthread_attr_t a = { 0 }; - pthread_t newPthread, newPthread1; - int count = 0xf0000; - g_threadTestCount1 = 0; - g_pthreadTestCount = 0; - - ret = pthread_getschedparam(pthread_self(), &g_currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - g_currThreadPri = param.sched_priority; - - g_pthreadTestCount++; - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = g_currThreadPri + 1; - pthread_attr_setschedparam(&a, ¶m); - pthread_attr_setschedpolicy(&a, g_currThreadPolicy); - ret = pthread_create(&newPthread, &a, ThreadFunc, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_pthreadTestCount, 1, g_pthreadTestCount); - g_pthreadTestCount++; // 2 - - ret = pthread_create(&newPthread1, &a, ThreadFunc5, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - g_threadTestCount1++; - ICUNIT_ASSERT_EQUAL(g_threadTestCount1, 1, g_threadTestCount1); - - ret = pthread_detach(newPthread1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - g_threadTestCount1++; - ICUNIT_ASSERT_EQUAL(g_threadTestCount1, 2, g_threadTestCount1); // 2, here assert the result. - ret = pthread_join(newPthread, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_threadTestCount1, 3, g_threadTestCount1); // 3, here assert the result. - ICUNIT_ASSERT_EQUAL(g_pthreadTestCount, 11, g_pthreadTestCount); // 11, here assert the result. - g_pthreadTestCount++; // 12 - - param.sched_priority = g_currThreadPri - 1; - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread1, &a, ThreadFunc6, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - -#ifdef LOSCFG_USER_TEST_SMP - usleep(1000 * 10 * 10); // 1000 * 10 * 10, for timing control. -#endif - - ICUNIT_ASSERT_EQUAL(g_pthreadTestCount, 13, g_pthreadTestCount); // 13, here assert the result. - g_pthreadTestCount++; // 14 - - ret = pthread_detach(newPthread1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_pthreadTestCount, 14, g_pthreadTestCount); // 14, here assert the result. - - return 0; -} - -void ItTestPthread001(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_001", PthreadTest001, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/full/pthread_test_002.cpp b/testsuites/unittest_old/process/pthread/full/pthread_test_002.cpp deleted file mode 100644 index 9df31cc1..00000000 --- a/testsuites/unittest_old/process/pthread/full/pthread_test_002.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static int g_currThreadPri, g_currThreadPolicy; -static volatile int g_testCnt1 = 0; -static volatile int g_testCnt2 = 0; -static volatile int g_testPthredCount = 0; - -static void ThreadWaitCount(int scount, volatile int *ent) -{ - int count = 0xf0000; - while (*ent < scount) { - while (count > 0) { - count--; - } - count = 0xf0000; - (*ent)++; - } -} - -static void *ThreadFuncTest2(void *arg) -{ - (void)arg; - int ret; - struct sched_param param = { 0 }; - int threadPolicy, threadPri; - int old; - const int waitCount1 = 20; - const int waitCount2 = 50; - g_testCnt2 = 0; - - ThreadWaitCount(waitCount1 + g_testCnt2, &g_testCnt2); - - while (g_testCnt1 < 10) { // 10, wait until g_testCnt1 >= 10. - printf("\r"); - } - - g_testPthredCount++; - - param.sched_priority = g_currThreadPri + 1; - ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - old = g_testCnt1; - param.sched_priority = 0; - ret = pthread_getschedparam(pthread_self(), &threadPolicy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(threadPolicy, SCHED_FIFO, threadPolicy, EXIT); - ICUNIT_GOTO_EQUAL(param.sched_priority, (g_currThreadPri + 1), param.sched_priority, EXIT); - - ThreadWaitCount(waitCount2 + g_testCnt2, &g_testCnt2); - - ICUNIT_GOTO_EQUAL(g_testCnt1, old, g_testCnt1, EXIT); - - param.sched_priority = g_currThreadPri; - ret = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - old = g_testCnt1; - param.sched_priority = 0; - ret = pthread_getschedparam(pthread_self(), &threadPolicy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(threadPolicy, SCHED_RR, threadPolicy, EXIT); - ICUNIT_GOTO_EQUAL(param.sched_priority, g_currThreadPri, param.sched_priority, EXIT); - - ThreadWaitCount(waitCount2 + g_testCnt2, &g_testCnt2); - - ICUNIT_GOTO_EQUAL(g_testCnt1, old, g_testCnt1, EXIT); - - ret = pthread_setschedprio(pthread_self(), g_currThreadPri + 1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ThreadWaitCount(waitCount2 + g_testCnt2, &g_testCnt2); - ICUNIT_GOTO_EQUAL(g_testCnt2, 170, g_testCnt2, EXIT); // 170, here assert the result. - g_testPthredCount++; - -EXIT: - return NULL; -} - -static void *ThreadFuncTest3(void *arg) -{ - (void)arg; - struct sched_param param = { 0 }; - int threadPolicy, threadPri; - int ret; - int old = 0; - const int waitCount1 = 20; - const int waitCount2 = 50; - - g_testCnt1 = 0; - - ThreadWaitCount(waitCount1 + g_testCnt1, &g_testCnt1); - - while (g_testCnt2 < 10) { // 10, wait until g_testCnt2 >= 10. - printf("\r"); - } - - g_testPthredCount++; - param.sched_priority = g_currThreadPri + 1; - ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - old = g_testCnt2; - param.sched_priority = 0; - ret = pthread_getschedparam(pthread_self(), &threadPolicy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(threadPolicy, SCHED_FIFO, threadPolicy, EXIT); - ICUNIT_GOTO_EQUAL(param.sched_priority, (g_currThreadPri + 1), param.sched_priority, EXIT); - - ThreadWaitCount(waitCount2 + g_testCnt1, &g_testCnt1); - - ICUNIT_GOTO_EQUAL(g_testCnt2, old, g_testCnt2, EXIT); - - param.sched_priority = g_currThreadPri; - ret = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - old = g_testCnt2; - param.sched_priority = 0; - ret = pthread_getschedparam(pthread_self(), &threadPolicy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(threadPolicy, SCHED_RR, threadPolicy, EXIT); - ICUNIT_GOTO_EQUAL(param.sched_priority, g_currThreadPri, param.sched_priority, EXIT); - - ThreadWaitCount(waitCount2 + g_testCnt1, &g_testCnt1); - - ICUNIT_GOTO_EQUAL(g_testCnt2, old, g_testCnt2, EXIT); - ICUNIT_GOTO_EQUAL(g_testCnt1, 120, g_testCnt1, EXIT); // 120, here assert the result. - g_testPthredCount++; - -EXIT: - return NULL; -} - -static int Testcase() -{ - struct sched_param param = { 0 }; - int ret; - void *res = NULL; - pthread_attr_t a = { 0 }; - pthread_t newPthread, newPthread1; - - g_testPthredCount = 0; - - ret = pthread_getschedparam(pthread_self(), &g_currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - g_currThreadPri = param.sched_priority; - - g_testPthredCount++; - - ret = pthread_attr_init(&a); - param.sched_priority = g_currThreadPri + 1; - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testPthredCount, 1, g_testPthredCount); - g_testPthredCount++; // 2 - - ret = pthread_create(&newPthread1, &a, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testPthredCount, 2, g_testPthredCount); // 2, here assert the result. - g_testPthredCount++; // 3 - - ret = pthread_join(newPthread, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread1, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testPthredCount, 7, g_testPthredCount); // 7, here assert the result. - - return 0; -} - -void ItTestPthread002(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_002", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/full/pthread_test_004.cpp b/testsuites/unittest_old/process/pthread/full/pthread_test_004.cpp deleted file mode 100644 index 18bc242e..00000000 --- a/testsuites/unittest_old/process/pthread/full/pthread_test_004.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static int g_currThreadPri, g_currThreadPolicy; -static volatile int g_pthreadTestCount = 0; -static volatile int g_threadTestCount1 = 0; -static pthread_spinlock_t g_spinTestLock; - -static void *ThreadFunc8(void *arg) -{ - pthread_t pthread = pthread_self(); - int ret; - - ret = pthread_detach(pthread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - g_threadTestCount1++; - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return NULL; -} - -static void *ThreadFunc7(void *arg) -{ - pthread_t pthread = pthread_self(); - int ret; - pthread_attr_t a = { 0 }; - struct sched_param param = { 0 }; - pthread_t newPthread; - int curThreadPri, curThreadPolicy; - - ret = pthread_detach(pthread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, -ret, EXIT); - - curThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = curThreadPri; - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, ThreadFunc8, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - g_threadTestCount1++; - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - sleep(2); // 2, delay -EXIT: - return NULL; -} - -static void *ThreadFunc5(void *arg) -{ - pthread_attr_t a = { 0 }; - struct sched_param param = { 0 }; - int ret; - void *res = NULL; - pthread_t newPthread; - int curThreadPri, curThreadPolicy; - - ret = pthread_detach(pthread_self()); - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, -ret, EXIT); - - curThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = curThreadPri + 1; - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, ThreadFunc7, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_join(newPthread, &res); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - g_threadTestCount1++; - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return NULL; -} - -static void *ThreadFunc6(void *arg) -{ - pthread_t pthread = pthread_self(); - - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 12, g_pthreadTestCount, EXIT); // 12, here assert the result. - g_pthreadTestCount++; // 13 - - return (void *)(uintptr_t)pthread; - -EXIT: - return NULL; -} - -static void *ThreadFunc4(void *arg) -{ - pthread_t pthread = pthread_self(); - int i = 0; - unsigned int ret; - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 9, g_pthreadTestCount, EXIT); // 9, here assert the result. - g_pthreadTestCount++; // 10 - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - - while (1) { - pthread_testcancel(); - if (++i == 5) { // 5, in loop 5, set cancel state. - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - } - - if (i == 10) { // 10, in loop 10, cancel pthread. - ret = pthread_cancel(pthread); - } - } - return (void *)i; - -EXIT: - return NULL; -} - -static void *ThreadFunc3(void *arg) -{ - pthread_t pthread = pthread_self(); - int i = 0; - unsigned int ret; - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 6, g_pthreadTestCount, EXIT); // 6, here assert the result. - g_pthreadTestCount++; // 7 - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); - - while (1) { - pthread_testcancel(); - if (++i == 5) { // 5, in loop 5, set cancel state. - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - } - - if (i == 10) { // 10, in loop 10, cancel pthread. - ret = pthread_cancel(pthread); - } - } - - ICUNIT_GOTO_EQUAL(i, 10, i, EXIT); // 10, here assert the result. - return (void *)i; - -EXIT: - return NULL; -} - -static void *threadFunc2(void *arg) -{ - unsigned int ret; - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 3, g_pthreadTestCount, EXIT); // 3, here assert the result. - g_pthreadTestCount++; - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_join(pthread_self(), 0); - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - - ret = pthread_detach(pthread_self()); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return NULL; -} - -static void *threadFunc(void *arg) -{ - unsigned int ret; - void *res = NULL; - pthread_attr_t a = { 0 }; - pthread_t newPthread; - struct sched_param param = { 0 }; - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 2, g_pthreadTestCount, EXIT); // 2, here assert the result. - g_pthreadTestCount++; - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = g_currThreadPri; - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, threadFunc2, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -#ifdef LOSCFG_USER_TEST_SMP - sleep(1); -#endif - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 4, g_pthreadTestCount, EXIT); // 4, here assert the result. - g_pthreadTestCount++; // 5 - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = g_currThreadPri + 2; // 2, adjust priority. - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, ThreadFunc3, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 5, g_pthreadTestCount, EXIT); // 5, here assert the result. - g_pthreadTestCount++; // 6 - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_join(newPthread, &res); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 7, g_pthreadTestCount, EXIT); // 7, here assert the result. - g_pthreadTestCount++; // 8 - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = g_currThreadPri + 3; // 3, adjust priority. - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, ThreadFunc4, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 8, g_pthreadTestCount, EXIT); // 8, here assert the result. - g_pthreadTestCount++; // 9 - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_join(newPthread, &res); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_spin_lock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ICUNIT_GOTO_EQUAL(g_pthreadTestCount, 10, g_pthreadTestCount, EXIT); // 10, here assert the result. - g_pthreadTestCount++; // 11 - ret = pthread_spin_unlock(&g_spinTestLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return NULL; -} - -int PthreadTest004() -{ - int exitCount = 0; - struct sched_param param = { 0 }; - int ret; - void *res = NULL; - pthread_attr_t a = { 0 }; - pthread_t newPthread, newPthread1; - const int testCount = 5; - int count = 5; - pthread_spin_init(&g_spinTestLock, 0); - - g_threadTestCount1 = 0; - g_pthreadTestCount = 0; - - ret = pthread_getschedparam(pthread_self(), &g_currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - g_currThreadPri = param.sched_priority; - - g_pthreadTestCount++; - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = g_currThreadPri + 1; - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, threadFunc, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_pthreadTestCount, 1, g_pthreadTestCount); - g_pthreadTestCount++; - - while (count > 0) { - ret = pthread_create(&newPthread1, &a, ThreadFunc5, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_detach(newPthread1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - count--; - } - - g_threadTestCount1++; - ICUNIT_ASSERT_EQUAL(g_threadTestCount1, 1, g_threadTestCount1); - - ret = pthread_join(newPthread, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - while (g_threadTestCount1 != (1 + (testCount * 3))) { // 3 - sleep(2); // 2, delay - printf("Wait for the concurrent thread to end \n"); - exitCount++; - if (exitCount > 10) { // wait time > 10 * 2s, cancel wait. - break; - } - } - - ICUNIT_ASSERT_EQUAL(g_pthreadTestCount, 11, g_pthreadTestCount); // 11, here assert the result. - g_pthreadTestCount++; // 12 - - param.sched_priority = g_currThreadPri - 1; - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread1, &a, ThreadFunc6, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread1, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_pthreadTestCount, 13, g_pthreadTestCount); // 13, here assert the result. - g_pthreadTestCount++; // 14 - - ICUNIT_ASSERT_EQUAL(g_pthreadTestCount, 14, g_pthreadTestCount); // 14, here assert the result. - - pthread_spin_destroy(&g_spinTestLock); - - return 0; -} - -void ItTestPthread004(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_004", PthreadTest004, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/full/pthread_test_005.cpp b/testsuites/unittest_old/process/pthread/full/pthread_test_005.cpp deleted file mode 100644 index 9ce521f6..00000000 --- a/testsuites/unittest_old/process/pthread/full/pthread_test_005.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -extern int PthreadTest001(void); -extern int PthreadTest004(void); - -static void *threadFunc(void *a) -{ - int ret; - int status; - int pid; - - pid = fork(); - if (pid == 0) { - (void)PthreadTest004(); - (void)PthreadTest001(); - exit(12); // 12, set a special exit code. - } - - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, The pid will never exceed 100000. - sleep(10); // 10, delay for timimg control. - - ret = PthreadTest001(); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - (void)waitpid(pid, &status, 0); - return NULL; -} - -static int Testcase(void) -{ - int ret; - int status; - int pid; - pthread_t tid; - - ret = fork(); - if (ret == 0) { - ret = pthread_create(&tid, NULL, threadFunc, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(tid, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(10); // 10, set a special exit code. - } else if (ret > 0) { - pid = ret; - sleep(10); // 10, delay for timimg control. - (void)PthreadTest004(); - ret = wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 10, status); // 10, assert the exit code. - } - - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, The pid will never exceed 100000. - - return 0; -} - -void ItTestPthread005(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_005", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/full/pthread_test_014.cpp b/testsuites/unittest_old/process/pthread/full/pthread_test_014.cpp deleted file mode 100644 index bdabbaf7..00000000 --- a/testsuites/unittest_old/process/pthread/full/pthread_test_014.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" -#include "threads.h" -static const int TEST_LOOP = 5000; - -static int g_testCnt = 0; -static void *ThreadFunc(void *arg) -{ - int count = 1; - while (g_testCnt < TEST_LOOP) { - if (g_testCnt != count) { - printf("%s %d g_testCnt should : %d but is : %d\n", __FUNCTION__, __LINE__, count, g_testCnt); - return NULL; - } - g_testCnt++; - count += 5; // total 5 pthreads. - thrd_yield(); - } - - g_testCnt = TEST_LOOP + 1000; // 1000, here set a special num. - return NULL; -} - -static void *ThreadFunc1(void *arg) -{ - int count = 2; - while (g_testCnt < TEST_LOOP) { - if (g_testCnt != count) { - printf("%s %d g_testCnt should : %d but is : %d\n", __FUNCTION__, __LINE__, count, g_testCnt); - return NULL; - } - g_testCnt++; - count += 5; // total 5 pthreads. - thrd_yield(); - } - - return NULL; -} - -static void *ThreadFunc2(void *arg) -{ - int count = 3; - while (g_testCnt < TEST_LOOP) { - if (g_testCnt != count) { - printf("%s %d g_testCnt should : %d but is : %d\n", __FUNCTION__, __LINE__, count, g_testCnt); - return NULL; - } - g_testCnt++; - count += 5; // total 5 pthreads. - thrd_yield(); - } - - return NULL; -} - -static void *ThreadFunc3(void *arg) -{ - int count = 4; - while (g_testCnt < TEST_LOOP) { - if (g_testCnt != count) { - printf("%s %d g_testCnt should : %d but is : %d\n", __FUNCTION__, __LINE__, count, g_testCnt); - return NULL; - } - g_testCnt++; - count += 5; // total 5 pthreads. - thrd_yield(); - } - - return NULL; -} - -static int TestCase(void) -{ - int ret; - pthread_t tid, tid1, tid2, tid3; - pthread_attr_t attr = { 0 }; - int scope = 0; - int threadPolicy = 0; - struct sched_param param = { 0 }; - - g_testCnt = 0; - - ret = pthread_getschedparam(pthread_self(), &threadPolicy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_create(&tid, NULL, ThreadFunc, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&tid1, NULL, ThreadFunc1, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&tid2, NULL, ThreadFunc2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&tid3, NULL, ThreadFunc3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - while (g_testCnt < TEST_LOOP) { - g_testCnt++; - thrd_yield(); - } - - param.sched_priority -= 2; // 2, adjust the priority. - ret = pthread_setschedparam(tid, SCHED_FIFO, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCnt, TEST_LOOP + 1000, g_testCnt, EXIT); // 1000, here assert the special num. - - ret = pthread_join(tid, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = pthread_join(tid1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = pthread_join(tid2, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = pthread_join(tid3, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - param.sched_priority += 2; // 2, adjust the priority. - ret = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - -EXIT: - return 0; -} - -void ItTestPthread014(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_014", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/it_pthread_test.h b/testsuites/unittest_old/process/pthread/it_pthread_test.h deleted file mode 100644 index 5b148e01..00000000 --- a/testsuites/unittest_old/process/pthread/it_pthread_test.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_PTHREAD_TEST_H -#define _IT_PTHREAD_TEST_H - -#include "osTest.h" -#include -#include -#include - -#define SLEEP_AND_YIELD(tick) usleep((tick)*10 * 1000) - -#include "sys/syscall.h" - -static inline int Syscall(int nbr, int parm1, int parm2, int parm3, int parm4) -{ - register int reg7 __asm__("r7") = (int)(nbr); - register int reg3 __asm__("r3") = (int)(parm4); - register int reg2 __asm__("r2") = (int)(parm3); - register int reg1 __asm__("r1") = (int)(parm2); - register int reg0 __asm__("r0") = (int)(parm1); - - __asm__ __volatile__("svc 0" : "=r"(reg0) : "r"(reg7), "r"(reg0), "r"(reg1), "r"(reg2), "r"(reg3) : "memory"); - - return reg0; -} -extern INT32 g_iCunitErrCode; -extern INT32 g_iCunitErrLineNo; - -extern void ItTestPthread001(void); -extern void ItTestPthread002(void); -extern void ItTestPthread003(void); -extern void ItTestPthread004(void); -extern void ItTestPthread005(void); -extern void ItTestPthread006(void); -extern void ItTestPthread007(void); -extern void ItTestPthread008(void); -extern void ItTestPthread009(void); -extern void ItTestPthread010(void); -extern void ItTestPthread012(void); -extern void ItTestPthread011(void); -extern void ItTestPthread013(void); -extern void ItTestPthread014(void); -extern void ItTestPthread015(void); -extern void ItTestPthread016(void); -extern void ItTestPthread017(void); -extern void ItTestPthread018(void); -extern void ItTestPthread019(void); -extern void ItTestPthreadAtfork001(void); -extern void ItTestPthreadAtfork002(void); -extern void ItTestPthreadOnce001(void); -extern void ItTestPthreadCond001(void); -extern void ItTestPthreadCond002(void); -extern void ItTestPthreadCond003(void); -extern void ItTestPthreadCond004(void); -#endif diff --git a/testsuites/unittest_old/process/pthread/process_pthread_test.cpp b/testsuites/unittest_old/process/pthread/process_pthread_test.cpp deleted file mode 100644 index cf49b316..00000000 --- a/testsuites/unittest_old/process/pthread/process_pthread_test.cpp +++ /dev/null @@ -1,353 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include -#include "it_pthread_test.h" -#include - -using namespace testing::ext; -namespace OHOS { -class ProcessPthreadTest : public testing::Test { -public: - static void SetUpTestCase(void) - { - struct sched_param param = { 0 }; - int currThreadPolicy, ret; - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL_VOID(ret, 0, -ret); - param.sched_priority = TASK_PRIO_TEST; - ret = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - ICUNIT_ASSERT_EQUAL_VOID(ret, 0, -ret); - } - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: it_test_pthread_003 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread003, TestSize.Level0) -{ - ItTestPthread003(); -} - -#ifndef LOSCFG_USER_TEST_SMP -/* * - * @tc.name: it_test_pthread_006 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread006, TestSize.Level0) -{ - ItTestPthread006(); -} -#endif - -/* * - * @tc.name: it_test_pthread_007 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread007, TestSize.Level0) -{ - ItTestPthread007(); -} - -/* * - * @tc.name: it_test_pthread_008 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread008, TestSize.Level0) -{ - ItTestPthread008(); -} - -/* * - * @tc.name: it_test_pthread_009 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread009, TestSize.Level0) -{ - ItTestPthread009(); -} - -#ifndef LOSCFG_USER_TEST_SMP -/* * - * @tc.name: it_test_pthread_010 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread010, TestSize.Level0) -{ - ItTestPthread010(); -} -#endif - -/* * - * @tc.name: it_test_pthread_011 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread011, TestSize.Level0) -{ - ItTestPthread011(); -} - -/* * - * @tc.name: it_test_pthread_012 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread012, TestSize.Level0) -{ - ItTestPthread012(); -} - -/* * - * @tc.name: it_test_pthread_013 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread013, TestSize.Level0) -{ - ItTestPthread013(); -} - -/* * - * @tc.name: it_test_pthread_015 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread015, TestSize.Level0) -{ - ItTestPthread015(); -} - -/* * - * @tc.name: it_test_pthread_016 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread016, TestSize.Level0) -{ - ItTestPthread016(); -} - -/* * - * @tc.name: it_test_pthread_018 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread018, TestSize.Level0) -{ - ItTestPthread018(); -} - -/* * - * @tc.name: it_test_pthread_019 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread019, TestSize.Level0) -{ - ItTestPthread019(); -} - -/* * - * @tc.name: it_test_pthread_017 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread017, TestSize.Level0) -{ - ItTestPthread017(); -} - - -/* * - * @tc.name: it_test_pthread_once_001 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthreadOnce001, TestSize.Level0) -{ - ItTestPthreadOnce001(); -} - -/* * - * @tc.name: it_test_pthread_atfork_001 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthreadAtfork001, TestSize.Level0) -{ - ItTestPthreadAtfork001(); -} - -/* * - * @tc.name: it_test_pthread_atfork_002 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthreadAtfork002, TestSize.Level0) -{ - ItTestPthreadAtfork002(); -} - -/* * - * @tc.name: it_test_pthread_cond_001 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthreadCond001, TestSize.Level0) -{ - ItTestPthreadCond001(); -} - -/* * - * @tc.name: it_test_pthread_cond_002 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthreadCond002, TestSize.Level0) -{ - ItTestPthreadCond002(); -} - -/* * - * @tc.name: it_test_pthread_cond_003 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthreadCond003, TestSize.Level0) -{ - ItTestPthreadCond003(); -} - -/* * - * @tc.name: it_test_pthread_cond_004 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthreadCond004, TestSize.Level0) -{ - ItTestPthreadCond004(); -} - -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: it_test_pthread_001 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread001, TestSize.Level0) -{ - ItTestPthread001(); -} - -#ifndef LOSCFG_USER_TEST_SMP -/* * - * @tc.name: it_test_pthread_002 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread002, TestSize.Level0) -{ - ItTestPthread002(); -} -#endif -/* * - * @tc.name: it_test_pthread_004 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread004, TestSize.Level0) -{ - ItTestPthread004(); -} - -/* * - * @tc.name: it_test_pthread_005 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread005, TestSize.Level0) -{ - ItTestPthread005(); -} - -#ifndef LOSCFG_USER_TEST_SMP -/* * - * @tc.name: it_test_pthread_014 - * @tc.desc: function for ProcessPthreadTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessPthreadTest, ItTestPthread014, TestSize.Level0) -{ - ItTestPthread014(); -} -#endif - -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_atfork_test_001.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_atfork_test_001.cpp deleted file mode 100644 index 9c3a3a3c..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_atfork_test_001.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static volatile int g_count = 0; -static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER; -static int g_testAtforkCount = 0; -static int g_testAtforkPrepare = 0; -static int g_testAtforkParent = 0; -static int g_testAtforkChild = 0; -static const int SLEEP_TIME = 2; - -static void Prepare() -{ - int err; - ICUNIT_ASSERT_EQUAL_VOID(g_testAtforkCount, 1, g_testAtforkCount); - err = pthread_mutex_lock(&g_lock); - ICUNIT_ASSERT_EQUAL_VOID(err, 0, err); - g_testAtforkPrepare++; -} - -static void Parent() -{ - int err; - ICUNIT_ASSERT_EQUAL_VOID(g_testAtforkCount, 1, g_testAtforkCount); - - err = pthread_mutex_unlock(&g_lock); - ICUNIT_ASSERT_EQUAL_VOID(err, 0, err); - g_testAtforkParent++; -} - -static void child() -{ - int err; - ICUNIT_ASSERT_EQUAL_VOID(g_testAtforkCount, 1, g_testAtforkCount); - - err = pthread_mutex_unlock(&g_lock); - ICUNIT_ASSERT_EQUAL_VOID(err, 0, err); - g_testAtforkChild++; -} - -static void *ThreadProc(void *arg) -{ - int err; - - while (g_count < 5) { // 5, wait until g_count == 5. - err = pthread_mutex_lock(&g_lock); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - g_count++; - SLEEP_AND_YIELD(SLEEP_TIME); - err = pthread_mutex_unlock(&g_lock); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - SLEEP_AND_YIELD(SLEEP_TIME); - } - -EXIT: - return NULL; -} - -static void *PthreadAtforkTest(void *arg) -{ - int err; - pid_t pid; - pthread_t tid; - int status = 0; - - g_count = 0; - g_testAtforkCount = 0; - g_testAtforkPrepare = 0; - g_testAtforkParent = 0; - g_testAtforkChild = 0; - - err = pthread_create(&tid, NULL, ThreadProc, NULL); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - err = pthread_atfork(Prepare, Parent, child); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - - g_testAtforkCount++; - - SLEEP_AND_YIELD(SLEEP_TIME); - - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, The pid will never exceed 100000. - ICUNIT_GOTO_EQUAL(g_testAtforkPrepare, 1, g_testAtforkPrepare, EXIT); - - if (pid == 0) { - ICUNIT_GOTO_EQUAL(g_testAtforkChild, 1, g_testAtforkChild, EXIT); - int status; - while (g_count < 5) { // 5, wait until g_count == 5. - err = pthread_mutex_lock(&g_lock); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - g_count++; - SLEEP_AND_YIELD(SLEEP_TIME); - err = pthread_mutex_unlock(&g_lock); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - SLEEP_AND_YIELD(SLEEP_TIME); - } - exit(15); // 15, set exit status - } - - ICUNIT_GOTO_EQUAL(g_testAtforkParent, 1, g_testAtforkParent, EXIT_WAIT); - err = pthread_join(tid, NULL); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT_WAIT); - - err = waitpid(pid, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(err, pid, err, EXIT); - ICUNIT_GOTO_EQUAL(status, 15, status, EXIT); // 15, get exit status. - -EXIT: - return NULL; - -EXIT_WAIT: - (void)waitpid(pid, &status, 0); - return NULL; -} - -static int Testcase() -{ - int ret; - pthread_t newPthread; - int curThreadPri, curThreadPolicy; - pthread_attr_t a = { 0 }; - struct sched_param param = { 0 }; - - ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - curThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = curThreadPri + 2; // 2, adjust the priority. - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, PthreadAtforkTest, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadAtfork001(void) -{ - TEST_ADD_CASE("IT_PTHREAD_ATFORK_001", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_atfork_test_002.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_atfork_test_002.cpp deleted file mode 100644 index 018d6139..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_atfork_test_002.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" -#include - -extern int nanosleep(const struct timespec *req, struct timespec *rem); - -static pthread_mutex_t g_mux = PTHREAD_MUTEX_INITIALIZER; -static volatile int g_testAtforkCount = 0; -static int g_testAtforkPrepare = 0; -static int g_testAtforkParent = 0; - -static void *Doit(void *arg) -{ - int err; - struct timespec ts = { 2, 0 }; // 2, set time 2s. - - ICUNIT_GOTO_EQUAL(g_testAtforkCount, 1, g_testAtforkCount, EXIT); - - err = pthread_mutex_lock(&g_mux); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - - (void)nanosleep(&ts, NULL); - err = pthread_mutex_unlock(&g_mux); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - -EXIT: - return NULL; -} - -static void *Doit1(void *arg) -{ - int err; - struct timespec ts = { 2, 0 }; // 2, set time 2s. - - ICUNIT_GOTO_EQUAL(g_testAtforkCount, 1, g_testAtforkCount, EXIT); - - err = pthread_mutex_lock(&g_mux); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - - (void)nanosleep(&ts, NULL); - err = pthread_mutex_unlock(&g_mux); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - -EXIT: - return NULL; -} - -static void Prepare(void) -{ - int err; - - err = pthread_mutex_unlock(&g_mux); - ICUNIT_ASSERT_EQUAL_VOID(err, 0, err); - g_testAtforkPrepare++; -} - -static void Parent(void) -{ - int err = pthread_mutex_lock(&g_mux); - ICUNIT_ASSERT_EQUAL_VOID(err, 0, err); - g_testAtforkParent++; -} - -static void *PthreadAtforkTest(void *arg) -{ - int err, ret; - int pid; - int status = 0; - struct timespec ts = { 1, 0 }; - pthread_t tid; - - g_testAtforkCount = 0; - g_testAtforkPrepare = 0; - g_testAtforkParent = 0; - - err = pthread_atfork(Prepare, Parent, NULL); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - g_testAtforkCount++; - err = pthread_create(&tid, NULL, Doit, NULL); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - - nanosleep(&ts, NULL); - pid = fork(); - ICUNIT_GOTO_EQUAL(g_testAtforkPrepare, 1, g_testAtforkPrepare, EXIT); - if (pid == 0) { - Doit1(NULL); - exit(10); // 10, set exit status. - } - - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT_WAIT); // 100000, The pid will never exceed 100000. - ICUNIT_GOTO_EQUAL(g_testAtforkParent, 1, g_testAtforkParent, EXIT_WAIT); - - err = pthread_join(tid, NULL); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT_WAIT); - - - err = waitpid(pid, &status, 0); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(err, pid, err, EXIT); - ICUNIT_GOTO_EQUAL(status, 10, status, EXIT); // 10, get exit status. - -EXIT: - return NULL; - -EXIT_WAIT: - (void)waitpid(pid, 0, 0); - return NULL; -} - -static int Testcase(void) -{ - int ret; - pthread_t newPthread; - int curThreadPri, curThreadPolicy; - pthread_attr_t a = { 0 }; - struct sched_param param = { 0 }; - - ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - curThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = curThreadPri + 2; // 2, adjust the priority. - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, PthreadAtforkTest, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadAtfork002(void) -{ - TEST_ADD_CASE("IT_PTHREAD_ATFORK_002", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_001.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_001.cpp deleted file mode 100644 index ed5debca..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_001.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static pthread_mutex_t g_pthreadMuxTest1; -static pthread_cond_t g_pthdCondTest1; - -static void *PthreadF01(void *t) -{ - int rc; - - rc = pthread_mutex_lock(&g_pthreadMuxTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - g_testCount++; - LosTaskDelay(100); - ICUNIT_GOTO_EQUAL(g_testCount, 2, g_testCount, EXIT); // 2, here assert the result. - g_testCount++; - - rc = pthread_cond_wait(&g_pthdCondTest1, &g_pthreadMuxTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); // 5, here assert the result. - rc = pthread_mutex_unlock(&g_pthreadMuxTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - -EXIT: - return NULL; -} - -static void *PthreadF02(void *t) -{ - int i; - int rc; - - ICUNIT_GOTO_EQUAL(g_testCount, 1, g_testCount, EXIT); - g_testCount++; - rc = pthread_mutex_lock(&g_pthreadMuxTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 3, g_testCount, EXIT); // 3, here assert the result. - g_testCount++; - rc = pthread_cond_signal(&g_pthdCondTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - ICUNIT_GOTO_EQUAL(g_testCount, 4, g_testCount, EXIT); // 4, here assert the result. - g_testCount++; - - rc = pthread_mutex_unlock(&g_pthreadMuxTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - LosTaskDelay(2); // 2, delay for Timing control. - -EXIT: - pthread_exit(NULL); -} - -static unsigned int TestCase(void) -{ - int i; - long t1 = 1; - long t2 = 2; - int rc; - pthread_t threads[3]; // 3, need 3 pthread for test. - pthread_attr_t attr; - const int loopNum = 2; - - g_testCount = 0; - pthread_mutex_init(&g_pthreadMuxTest1, NULL); - pthread_cond_init(&g_pthdCondTest1, NULL); - - rc = pthread_create(&threads[0], NULL, PthreadF01, (void *)t1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_create(&threads[1], NULL, PthreadF02, (void *)t2); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - for (i = 0; i < loopNum; i++) { - rc = pthread_join(threads[i], NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - rc = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_destroy(&g_pthreadMuxTest1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - rc = pthread_cond_destroy(&g_pthdCondTest1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - return 0; -} - -void ItTestPthreadCond001(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_COND_001", TestCase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_002.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_002.cpp deleted file mode 100644 index 70a2f02c..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_002.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static pthread_mutex_t g_pthreadMuxTest1; -static pthread_cond_t g_pthrdCondTest1; -static unsigned int g_pthreadExit = 0; - -static void *PthreadF01(void *t) -{ - int rc; - unsigned int count = 0; - const int testLoop = 2000; - while (count < testLoop) { - rc = pthread_mutex_lock(&g_pthreadMuxTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_cond_wait(&g_pthrdCondTest1, &g_pthreadMuxTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_mutex_unlock(&g_pthreadMuxTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - count++; - } - - g_pthreadExit = 1; -EXIT: - return NULL; -} - -static void *PthreadF02(void *t) -{ - int i; - int rc; - - while (g_pthreadExit != 1) { - rc = pthread_mutex_lock(&g_pthreadMuxTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_cond_signal(&g_pthrdCondTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - - rc = pthread_mutex_unlock(&g_pthreadMuxTest1); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - } - -EXIT: - pthread_exit(NULL); -} - -static unsigned int TestCase(void) -{ - int i; - long t1 = 1; - long t2 = 2; - int rc; - pthread_t threads[3]; - pthread_attr_t attr; - const int loopNum = 2; - - g_pthreadExit = 0; - g_testCount = 0; - pthread_mutex_init(&g_pthreadMuxTest1, NULL); - pthread_cond_init(&g_pthrdCondTest1, NULL); - - rc = pthread_create(&threads[0], NULL, PthreadF01, (void *)t1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_create(&threads[1], NULL, PthreadF02, (void *)t2); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - for (i = 0; i < loopNum; i++) { - rc = pthread_join(threads[i], NULL); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - } - - rc = pthread_attr_destroy(&attr); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - rc = pthread_mutex_destroy(&g_pthreadMuxTest1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - rc = pthread_cond_destroy(&g_pthrdCondTest1); - ICUNIT_ASSERT_EQUAL(rc, 0, rc); - - return 0; -} - -void ItTestPthreadCond002(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_COND_002", TestCase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_003.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_003.cpp deleted file mode 100644 index 736d7d5a..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_003.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static pthread_cond_t g_pthread_cond; -static pthread_mutex_t g_pthread_mutex; -#define TEST_THREAD_COUNT 5 -static void *pthread_cond_func001(void *arg) -{ - int ret; - struct timespec ts; - - g_testCount++; - - ret = pthread_mutex_lock(&g_pthread_mutex); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += 60; /* 60: wait 1 minute */ - - ret = pthread_cond_timedwait(&g_pthread_cond, &g_pthread_mutex, &ts); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_unlock(&g_pthread_mutex); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testCount++; -EXIT: - return NULL; -} - -static VOID *pthread_f06(void *argument) -{ - int policy; - int ret; - int i; - pthread_attr_t attr; - struct sched_param schedParam = { 0 }; - pthread_t thread[TEST_THREAD_COUNT]; - - g_testCount = 0; - - ret = pthread_attr_init(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_getschedparam(pthread_self(), &policy, &schedParam); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - schedParam.sched_priority -= 1; - ret = pthread_attr_setschedparam(&attr, &schedParam); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - for (i = 0; i < TEST_THREAD_COUNT; i++) { - ret = pthread_create(&thread[i], &attr, pthread_cond_func001, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - sleep(1); - - ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); /* 5: Five threads */ - - ret = pthread_mutex_lock(&g_pthread_mutex); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_cond_broadcast(&g_pthread_cond); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_mutex_unlock(&g_pthread_mutex); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - for (i = 0; i < TEST_THREAD_COUNT; i++) { - ret = pthread_join(thread[i], NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - ICUNIT_GOTO_EQUAL(g_testCount, 10, g_testCount, EXIT); /* 10: Twice per thread */ -EXIT: - return NULL; -} - -static int TestCase(void) -{ - int policy; - pthread_attr_t attr; - pthread_t newTh; - struct sched_param schedParam = { 0 }; - int ret; - - ret = pthread_mutex_init(&g_pthread_mutex, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_cond_init(&g_pthread_cond, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_getschedparam(pthread_self(), &policy, &schedParam); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - schedParam.sched_priority -= 1; - ret = pthread_attr_setschedparam(&attr, &schedParam); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, &attr, pthread_f06, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadCond003(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_COND_003", TestCase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_004.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_004.cpp deleted file mode 100644 index 65480312..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_cond_test_004.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" -static pthread_cond_t g_pthread_cond; -static pthread_mutex_t g_pthread_mutex; -#define TEST_THREAD_COUNT 5 - -static void *pthread_cond_func002(void *arg) -{ - int ret; - struct timespec ts; - - g_testCount++; - - ret = pthread_mutex_lock(&g_pthread_mutex); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += 2; /* 2: wait 2 seconds */ - - ret = pthread_cond_timedwait(&g_pthread_cond, &g_pthread_mutex, &ts); - ICUNIT_GOTO_EQUAL(ret, ETIMEDOUT, ret, EXIT); - - ret = pthread_mutex_unlock(&g_pthread_mutex); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_testCount++; -EXIT: - return NULL; -} - -static VOID *pthread_f07(void *argument) -{ - int policy; - int ret; - int i; - pthread_attr_t attr; - struct sched_param schedParam = { 0 }; - pthread_t thread[TEST_THREAD_COUNT]; - - g_testCount = 0; - - ret = pthread_attr_init(&attr); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_getschedparam(pthread_self(), &policy, &schedParam); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - schedParam.sched_priority -= 1; - ret = pthread_attr_setschedparam(&attr, &schedParam); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - for (i = 0; i < TEST_THREAD_COUNT; i++) { - ret = pthread_create(&thread[i], &attr, pthread_cond_func002, NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - sleep(1); - - ICUNIT_GOTO_EQUAL(g_testCount, 5, g_testCount, EXIT); /* 5: Five threads */ - - for (i = 0; i < TEST_THREAD_COUNT; i++) { - ret = pthread_join(thread[i], NULL); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - } - - ICUNIT_GOTO_EQUAL(g_testCount, 10, g_testCount, EXIT); /* 10: Twice per thread */ - -EXIT: - return NULL; -} - -static int TestCase(void) -{ - int policy; - pthread_attr_t attr; - pthread_t newTh; - struct sched_param schedParam = { 0 }; - int ret; - - ret = pthread_mutex_init(&g_pthread_mutex, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_cond_init(&g_pthread_cond, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_init(&attr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_getschedparam(pthread_self(), &policy, &schedParam); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - schedParam.sched_priority -= 1; - ret = pthread_attr_setschedparam(&attr, &schedParam); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newTh, &attr, pthread_f07, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newTh, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadCond004(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_COND_004", TestCase, TEST_POSIX, TEST_PTHREAD, TEST_LEVEL2, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_once_test_001.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_once_test_001.cpp deleted file mode 100644 index a39d99cd..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_once_test_001.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static int g_number = 0; -static int g_okStatus = 777; // 777, a special number indicate the status is ok. -static pthread_once_t g_onceCtrl = PTHREAD_ONCE_INIT; - -static void InitRoutine(void) -{ - g_number++; -} - -static void *Threadfunc(void *parm) -{ - int err; - err = pthread_once(&g_onceCtrl, InitRoutine); - ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); - return (void *)g_okStatus; -EXIT: - return NULL; -} - -static void *ThreadFuncTest(void *arg) -{ - pthread_t thread[3]; - int rc = 0; - int i = 3; - void *status; - const int threadsNum = 3; - - g_number = 0; - - for (i = 0; i < threadsNum; ++i) { - rc = pthread_create(&thread[i], NULL, Threadfunc, NULL); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - } - - for (i = 0; i < threadsNum; ++i) { - rc = pthread_join(thread[i], &status); - ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); - ICUNIT_GOTO_EQUAL((unsigned int)status, (unsigned int)g_okStatus, status, EXIT); - } - - ICUNIT_GOTO_EQUAL(g_number, 1, g_number, EXIT); - -EXIT: - return NULL; -} - -static int Testcase(void) -{ - int ret; - pthread_t newPthread; - int curThreadPri, curThreadPolicy; - pthread_attr_t a = { 0 }; - struct sched_param param = { 0 }; - - g_onceCtrl = PTHREAD_ONCE_INIT; - - ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - curThreadPri = param.sched_priority; - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = curThreadPri + 2; // 2, adjust the priority. - pthread_attr_setschedparam(&a, ¶m); - ret = pthread_create(&newPthread, &a, ThreadFuncTest, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthreadOnce001(void) -{ - TEST_ADD_CASE("IT_PTHREAD_ONCE_001", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_003.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_003.cpp deleted file mode 100644 index 5698c5bb..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_003.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -/* *************************************************************************** - * Public Functions - * ************************************************************************** */ - -static int g_currThreadPri, g_currThreadPolicy; -static int g_testPthredCount; -static void *ThreadFuncTest2(void *arg) -{ - (void)arg; - int ret; - int policy; - struct sched_param param = { 0 }; - pthread_t pthread = pthread_self(); - - g_testPthredCount++; - - ret = pthread_getschedparam(pthread, &policy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_currThreadPri, param.sched_priority, param.sched_priority, EXIT); - ICUNIT_GOTO_EQUAL(g_currThreadPolicy, policy, policy, EXIT); - ICUNIT_GOTO_EQUAL(g_testPthredCount, 2, g_testPthredCount, EXIT); // 2, here assert the result. -EXIT: - return NULL; -} - -static void *ThreadFuncTest3(void *arg) -{ - (void)arg; - int ret; - int policy; - struct sched_param param = { 0 }; - pthread_t pthread = pthread_self(); - - g_testPthredCount++; - - ret = pthread_getschedparam(pthread, &policy, ¶m); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ICUNIT_GOTO_EQUAL(g_currThreadPri, param.sched_priority, param.sched_priority, EXIT); - ICUNIT_GOTO_EQUAL(policy, SCHED_FIFO, policy, EXIT); - ICUNIT_GOTO_EQUAL(g_testPthredCount, 4, g_testPthredCount, EXIT); // 4, here assert the result. - -EXIT: - return NULL; -} - -static int Testcase() -{ - struct sched_param param = { 0 }; - int ret; - void *res = NULL; - pthread_attr_t a = { 0 }; - pthread_t newPthread, newPthread1; - - g_testPthredCount = 0; - - ret = pthread_getschedparam(pthread_self(), &g_currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - g_currThreadPri = param.sched_priority; - - g_testPthredCount++; - ret = pthread_create(&newPthread, NULL, ThreadFuncTest2, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testPthredCount, 2, g_testPthredCount); // 2, here assert the result. - g_testPthredCount++; - - param.sched_priority = g_currThreadPri; - ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&newPthread, NULL, ThreadFuncTest3, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(newPthread, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testPthredCount, 4, g_testPthredCount); // 4, here assert the result. - - param.sched_priority = g_currThreadPri; - ret = pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthread003(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_003", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_006.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_006.cpp deleted file mode 100644 index 3846c74f..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_006.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static pthread_barrier_t g_barrier; -static int g_testToCount001 = 0; -static int g_threadTest[10]; - -static void *ThreadFuncTest0(void *a) -{ - int ret; - int count = *((int *)a); - g_testToCount001++; - - ret = pthread_barrier_wait(&g_barrier); - ICUNIT_GOTO_EQUAL(ret, PTHREAD_BARRIER_SERIAL_THREAD, ret, EXIT); - - g_threadTest[count] = count; - -EXIT: - return NULL; -} - -static void *ThreadFuncTest2(void *a) -{ - int ret; - int count = *((int *)a); - g_testToCount001++; - - ret = pthread_barrier_wait(&g_barrier); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_threadTest[count] = count; - -EXIT: - return NULL; -} - -static void *ThreadFuncTest1(void *a) -{ - int ret; - int count = *((int *)a); - g_testToCount001++; - - ret = pthread_barrier_wait(&g_barrier); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_threadTest[count] = count; -EXIT: - return NULL; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = NULL; - pthread_attr_t a = { 0 }; - pthread_t thread; - pthread_t newPthread[10], newPthread1; - pthread_mutexattr_t mutex; - int index = 0; - int currThreadPri, currThreadPolicy; - int threadParam[10]; - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - currThreadPri = param.sched_priority; - const int testCount = 10; - - g_testToCount001 = 0; - - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = currThreadPri - 1; - pthread_attr_setschedparam(&a, ¶m); - - ret = pthread_barrier_init(&g_barrier, NULL, testCount); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - threadParam[0] = 0; - ret = pthread_create(&newPthread[index], &a, ThreadFuncTest0, &threadParam[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - g_threadTest[0] = 0; - - index = 1; - while (index < (testCount - 1)) { - threadParam[index] = index; - ret = pthread_create(&newPthread[index], &a, ThreadFuncTest1, &threadParam[index]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - g_threadTest[index] = 0; - index++; - } - - ICUNIT_ASSERT_EQUAL(g_testToCount001, testCount - 1, g_testToCount001); - - threadParam[index] = index; - ret = pthread_create(&newPthread[index], &a, ThreadFuncTest2, &threadParam[index]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - sleep(1); - - ICUNIT_ASSERT_EQUAL(g_testToCount001, testCount, g_testToCount001); - - index = 0; - while (index < testCount) { - threadParam[index] = index; - ret = pthread_join(newPthread[index], NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(g_threadTest[index], index, g_threadTest[index]); - index++; - } - - ret = pthread_barrier_destroy(&g_barrier); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItTestPthread006(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_006", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_007.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_007.cpp deleted file mode 100644 index 119de51d..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_007.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - - -static pthread_t g_th; -VOID *PthreadTest115(VOID *arg) -{ - g_testCount++; - sleep(1); - g_testCount++; - - return NULL; -} - -VOID *PthreadFunc1115(VOID *arg) -{ - int ret = 0; - g_testCount++; - usleep(1000 * 10 * 10); // 1000 * 10 * 10, delay for timimg control. - - ret = pthread_join(g_th, NULL); - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - g_testCount++; -EXIT: - return NULL; -} - -VOID *PthreadFunc2115(VOID *arg) -{ - int ret = 0; - g_testCount++; - usleep(1000 * 10 * 15); // 1000 * 10 * 15, delay for timimg control. - - ret = pthread_join(g_th, NULL); - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - g_testCount++; -EXIT: - return NULL; -} - -VOID *PthreadFunc3115(VOID *arg) -{ - int ret = 0; - g_testCount++; - usleep(1000 * 10 * 6); // 1000 * 10 * 6, delay for timimg control. - - ret = pthread_join(g_th, NULL); - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - g_testCount++; - ; - -EXIT: - return NULL; -} - -static UINT32 Testcase(VOID) -{ - int rc; - - int ret = 0; - pthread_t th1; - pthread_t th2; - pthread_t th3; - pthread_attr_t attr; - g_testCount = 0; - pthread_attr_init(&attr); - pthread_create(&g_th, &attr, PthreadTest115, NULL); - - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&th1, &attr, PthreadFunc1115, NULL); - pthread_create(&th2, &attr, PthreadFunc2115, NULL); - pthread_create(&th3, &attr, PthreadFunc3115, NULL); - ret = pthread_join(g_th, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - usleep(1000 * 10 * 50); // 1000 * 10 * 50, delay for timimg control. - ICUNIT_ASSERT_EQUAL(g_testCount, 8, g_testCount); // 8, assert the exit code. - return 0; -} - -void ItTestPthread007(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_007", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_008.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_008.cpp deleted file mode 100644 index 1dd20f38..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_008.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - - -static pthread_t g_th; -static VOID *PthreadTest115(VOID *arg) -{ - g_testCount++; - sleep(1); - g_testCount++; - - return NULL; -} - -static VOID *PthreadFunc1115(VOID *arg) -{ - int ret = 0; - g_testCount++; - usleep(1000 * 10 * 10); // 1000 * 10 * 10, delay for timimg control. - - ret = pthread_join(g_th, NULL); - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - g_testCount++; -EXIT: - return NULL; -} - -static VOID *PthreadFunc2115(VOID *arg) -{ - int ret = 0; - g_testCount++; - usleep(1000 * 10 * 15); // 1000 * 10 * 15, delay for timimg control. - - ret = pthread_join(g_th, NULL); - ICUNIT_GOTO_EQUAL(ret, EINVAL, ret, EXIT); - g_testCount++; -EXIT: - return NULL; -} - -static VOID *PthreadFunc3115(VOID *arg) -{ - int ret = 0; - g_testCount++; - usleep(1000 * 10 * 6); // 1000 * 10 * 6, delay for timimg control. - - ret = pthread_detach(g_th); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - g_testCount++; - ; - -EXIT: - return NULL; -} - -static UINT32 Testcase(VOID) -{ - int rc; - - int ret = 0; - pthread_t th1; - pthread_t th2; - pthread_t th3; - pthread_attr_t attr; - g_testCount = 0; - pthread_attr_init(&attr); - pthread_create(&g_th, &attr, PthreadTest115, NULL); - - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&th1, &attr, PthreadFunc1115, NULL); - pthread_create(&th2, &attr, PthreadFunc2115, NULL); - pthread_create(&th3, &attr, PthreadFunc3115, NULL); - ret = pthread_join(g_th, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - usleep(1000 * 10 * 50); // 1000 * 10 * 50, delay for timimg control. - ICUNIT_ASSERT_EQUAL(g_testCount, 8, g_testCount); // 8, assert the exit code. - return 0; -} - -void ItTestPthread008(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_008", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_009.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_009.cpp deleted file mode 100644 index bd1968b4..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_009.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static pthread_t g_th; -static VOID *PthreadTest115(VOID *arg) -{ - g_testCount++; - int ret = pthread_detach(g_th); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - g_testCount++; - -EXIT: - return NULL; -} - -static UINT32 Testcase(VOID) -{ - int ret; - pthread_attr_t attr; - g_testCount = 0; - pthread_attr_init(&attr); - pthread_create(&g_th, &attr, PthreadTest115, NULL); - -#ifdef LOSCFG_USER_TEST_SMP - sleep(1); -#endif - return 0; -} - -void ItTestPthread009(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_009", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_010.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_010.cpp deleted file mode 100644 index 45b3fc45..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_010.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static pthread_barrier_t g_barrier; -static int g_testToCount001 = 0; -static int g_threadTest[30]; - -static void *ThreadFuncTest0(void *a) -{ - struct sched_param param = { 0 }; - int ret; - int currThreadPolicy; - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, (void *)(uintptr_t)ret); - int currThreadPri = param.sched_priority; - - g_testToCount001++; - -EXIT: - return NULL; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - pthread_attr_t a = { 0 }; - pthread_t newPthread[30]; - int index = 0; - int currThreadPri, currThreadPolicy; - const int testCount = 30; - - ret = pthread_getschedparam(pthread_self(), &currThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - currThreadPri = param.sched_priority; - g_testToCount001 = 0; - ret = pthread_attr_init(&a); - pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = currThreadPri - 2; // 2, adjust the priority. - pthread_attr_setschedparam(&a, ¶m); - - while (index < testCount) { - ret = pthread_create(&newPthread[index], &a, ThreadFuncTest0, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - index++; - } - - ICUNIT_ASSERT_EQUAL(g_testToCount001, testCount, g_testToCount001); - - return 0; -} - -void ItTestPthread010(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_010", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_011.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_011.cpp deleted file mode 100644 index ac1ffd50..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_011.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" -#include "sys/syscall.h" - -void child1(void) -{ - int count = 0; - int policy, pri, newPolicy; - struct sched_param param = { 0 }; - pthread_t pthread = pthread_self(); - int tid = Syscall(SYS_gettid, 0, 0, 0, 0); - - int ret = pthread_getschedparam(pthread, &policy, ¶m); - - pri = param.sched_priority; - - while (1) { - ret = pthread_getschedparam(pthread, &newPolicy, ¶m); - if (ret != 0) { - printf("pthread_getschedparam failed ! %d erro: %d\n", __LINE__, errno); - exit(255); // 255, set a special exit code. - } - - if (newPolicy != policy || pri != param.sched_priority) { - printf("pthread_getschedparam failed ! %d policy %d newPolicy pri %d param.sched_priority :%d\n", __LINE__, - policy, newPolicy, pri, param.sched_priority); - exit(255); // 255, set a special exit code. - } - - count++; - }; - - exit(0); -} - -void child(void) -{ - int ret; - int loop = 0; - int status = 0; - const int loopNum = 50; - const int countNum = 128; - pid_t pid = fork(); - if (pid == 0) { - child1(); - } - - int tid = Syscall(SYS_gettid, 0, 0, 0, 0); - - for (int count = 0; count < countNum; count++) { - if (count == tid) { - continue; - } - - ret = Syscall(SYS_pthread_join, count, 0, 0, 0); - if (ret == 0) { - exit(1); - } - - ret = Syscall(SYS_pthread_set_detach, count, 0, 0, 0); - if (ret == 0) { - exit(1); - } - - ret = Syscall(SYS_pthread_deatch, count, 0, 0, 0); - if (ret == 0) { - exit(1); - } - - ret = Syscall(SYS_sched_setparam, count, 20, -1, 0); // 20, param test - if (ret == 0) { - exit(1); - } - - ret = Syscall(SYS_sched_getparam, count, -1, 0, 0); - if (ret == 0) { - exit(1); - } - - ret = Syscall(SYS_sched_setscheduler, count, SCHED_RR, 20, -1); // 20, param test - if (ret == 0) { - exit(1); - } - - ret = Syscall(SYS_sched_getscheduler, count, -1, 0, 0); - if (ret == 0) { - exit(1); - } - - ret = Syscall(SYS_tkill, count, SIGPWR, 0, 0); - if (ret == 0) { - exit(1); - } - - if (count == countNum - 1) { - loop++; - if (loop == loopNum) { - break; - } else { - count = 0; - } - } - } - - kill(pid, SIGKILL); - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - - exit(255); // 255, set a special exit code. -EXIT: - exit(0); -} - -static int Testcase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, The pid will never exceed 100000. - if (pid == 0) { - child(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(0); - } - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert exit code. - return 0; -EXIT: - return 1; -} - -void ItTestPthread011(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_011", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_012.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_012.cpp deleted file mode 100644 index f89b31d4..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_012.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static int Testcase(void) -{ - int ret; - ret = Syscall(SYS_set_thread_area, NULL, 0, 0, 0); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = Syscall(SYS_set_thread_area, 0x100, 0, 0, 0); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = Syscall(SYS_set_thread_area, 0x5000, 0, 0, 0); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = Syscall(SYS_set_thread_area, 0x5000, 0, 0, 0); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - -#ifndef LOSCFG_USER_TEST_SMP - ret = Syscall(SYS_set_thread_area, 0x40000000, 0, 0, 0); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = Syscall(SYS_set_thread_area, 0x40001000, 0, 0, 0); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); -#else - ret = Syscall(SYS_set_thread_area, 0x80000000, 0, 0, 0); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = Syscall(SYS_set_thread_area, 0x80001000, 0, 0, 0); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); -#endif - return 0; -} - -void ItTestPthread012(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_012", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_013.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_013.cpp deleted file mode 100644 index bf78c1aa..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_013.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static int Testcase(void) -{ - int ret; - pthread_attr_t attr = { 0 }; - int scope = 0; - - ret = pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); - ICUNIT_ASSERT_EQUAL(ret, ENOTSUP, ret); - - ret = pthread_attr_setscope(&attr, PTHREAD_SCOPE_PROCESS); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_getscope(&attr, &scope); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(scope, PTHREAD_SCOPE_PROCESS, scope); - - return 0; -} - -void ItTestPthread013(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_013", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_015.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_015.cpp deleted file mode 100644 index 84992367..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_015.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static VOID *PthreadTest115(VOID *arg) {} - -static int GroupProcess(void) -{ - int ret; - pthread_t th1; - pthread_attr_t attr; - pthread_attr_init(&attr); - int policy = 0; - struct sched_param param = { 0 }; - const int testThreadCount = 2000; - - ret = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - param.sched_priority += 2; // 2, adjust the priority. - ret = pthread_attr_setschedparam(&attr, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setschedpolicy(&attr, SCHED_FIFO); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - for (int i = 0; i < testThreadCount; i++) { - ret = pthread_create(&th1, &attr, PthreadTest115, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(th1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - - exit(255); // 255, set a special exit code. -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, The pid will never exceed 100000. - - if (pid == 0) { - prctl(PR_SET_NAME, "mainFork", 0UL, 0UL, 0UL); - GroupProcess(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert the special exit code. - - return 0; -EXIT: - return 1; -} - -void ItTestPthread015(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_015", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_016.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_016.cpp deleted file mode 100644 index 23f7962c..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_016.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static VOID *PthreadTest115(VOID *arg) -{ - int ret = pthread_detach(pthread_self()); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, (void *)(intptr_t)ret); - return NULL; -} - -static int GroupProcess(void) -{ - int ret; - pthread_t th1; - pthread_attr_t attr; - pthread_attr_init(&attr); - int policy = 0; - struct sched_param param = { 0 }; - const int testThreadCount = 2000; - - ret = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - param.sched_priority -= 2; // 2, adjust the priority. - ret = pthread_attr_setschedparam(&attr, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setschedpolicy(&attr, SCHED_FIFO); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - for (int i = 0; i < testThreadCount; i++) { - ret = pthread_create(&th1, &attr, PthreadTest115, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - - exit(255); // 255, set a special exit code. -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid; - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, The pid will never exceed 100000. - - if (pid == 0) { - prctl(PR_SET_NAME, "mainFork", 0UL, 0UL, 0UL); - GroupProcess(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert the special exit code. - - return 0; -EXIT: - return 1; -} - -void ItTestPthread016(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_016", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_017.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_017.cpp deleted file mode 100644 index edd54539..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_017.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" - -static VOID *PthreadTest115(VOID *arg) {} - -static int GroupProcess(void) -{ - int ret; - pthread_t th1; - pthread_attr_t attr; - pthread_attr_init(&attr); - int policy = 0; - struct sched_param param = { 0 }; - const int testThreadCount = 2000; - - ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_getschedparam(pthread_self(), &policy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - param.sched_priority -= 2; // 2, adjust the priority. - ret = pthread_attr_setschedparam(&attr, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_setschedpolicy(&attr, SCHED_FIFO); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - for (int i = 0; i < testThreadCount; i++) { - ret = pthread_create(&th1, &attr, PthreadTest115, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - } - - exit(255); // 255, set a special exit code. -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid, pid1; - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, The pid will never exceed 100000. - - if (pid == 0) { - prctl(PR_SET_NAME, "mainFork", 0UL, 0UL, 0UL); - GroupProcess(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert the special exit code. - - return 0; -EXIT: - return 1; -} - -void ItTestPthread017(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_017", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_018.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_018.cpp deleted file mode 100644 index 26aed44c..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_018.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" -#define TEST_THREAD_COUNT 2000 - -static int g_testCnt = 0; - -static void *PthreadTest116(VOID *arg) -{ - return NULL; -} - -static void *PthreadTest115(VOID *arg) -{ - pthread_t th1; - - int ret = pthread_create(&th1, NULL, PthreadTest116, 0); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, (void *)(intptr_t)ret); - - ret = pthread_join(th1, NULL); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, (void *)(intptr_t)ret); - - g_testCnt++; - - return NULL; -} - -static int GroupProcess(void) -{ - int ret; - pthread_t th1; - pthread_attr_t attr; - pthread_attr_init(&attr); - int policy = 0; - unsigned int *getStack = NULL; - size_t getSize; - struct sched_param param = { 0 }; - int stackSize = 0x3000; - - g_testCnt = 0; - - void *stack = malloc(stackSize); - ICUNIT_ASSERT_NOT_EQUAL((int)stack, 0, stack); - - ret = pthread_attr_setstack(&attr, stack, stackSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_getstack(&attr, (void **)&getStack, &getSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(getStack, stack, getStack); - ICUNIT_ASSERT_EQUAL(getSize, stackSize, getSize); - - ret = pthread_create(&th1, &attr, PthreadTest115, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(th1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testCnt, 1, g_testCnt); - - free(stack); - - stackSize = 3000; - - pthread_attr_init(&attr); - stack = malloc(stackSize); - ICUNIT_ASSERT_NOT_EQUAL((int)stack, 0, stack); - - ret = pthread_attr_setstack(&attr, stack, stackSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_getstack(&attr, (void **)&getStack, &getSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(getStack, stack, getStack); - ICUNIT_ASSERT_EQUAL(getSize, stackSize, getSize); - - ret = pthread_create(&th1, &attr, PthreadTest115, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(th1, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_testCnt, 2, g_testCnt); // 2, here, assert the result. - - free(stack); - - exit(255); // 255, set a special exit code. - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid; - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, The pid will never exceed 100000. - - if (pid == 0) { - prctl(PR_SET_NAME, "mainFork", 0UL, 0UL, 0UL); - GroupProcess(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); // 255, assert the special exit code. - - return 0; -EXIT: - return 1; -} - -void ItTestPthread018(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_018", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/pthread/smoke/pthread_test_019.cpp b/testsuites/unittest_old/process/pthread/smoke/pthread_test_019.cpp deleted file mode 100644 index e219eed4..00000000 --- a/testsuites/unittest_old/process/pthread/smoke/pthread_test_019.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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. - */ -#include "it_pthread_test.h" -#define TEST_THREAD_COUNT 2000 - -static int g_testCnt = 0; - -static void *PthreadTest116(VOID *arg) -{ - return NULL; -} - -static void *PthreadTest115(VOID *arg) -{ - pthread_t th1; - - int ret = pthread_create(&th1, NULL, PthreadTest116, 0); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, (void *)(intptr_t)ret); - - ret = pthread_join(th1, NULL); - ICUNIT_ASSERT_EQUAL_NULL(ret, 0, (void *)(intptr_t)ret); - - g_testCnt++; - - return NULL; -} - -static int GroupProcess(void) -{ - int ret; - pthread_t th1; - pthread_attr_t attr; - pthread_attr_init(&attr); - int policy = 0; - unsigned int *getStack = NULL; - size_t getSize; - struct sched_param param = { 0 }; - int stackSize = 2047; - void *stack = (void *)&getSize; - - g_testCnt = 0; - - ret = pthread_attr_setstack(&attr, stack, stackSize); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - ret = pthread_attr_getstack(&attr, (void **)&getStack, &getSize); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - stackSize = 3000; // 3000, change stackSize, test again. - - pthread_attr_init(&attr); - stack = (void *)0x1000; - - ret = pthread_attr_setstack(&attr, stack, stackSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_attr_getstack(&attr, (void **)&getStack, &getSize); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(getStack, stack, getStack); - ICUNIT_ASSERT_EQUAL(getSize, stackSize, getSize); - - ret = pthread_create(&th1, &attr, PthreadTest115, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - exit(255); // 255, set a special exit code. - return 0; -} - -static int TestCase(void) -{ - int ret; - int status = 0; - pid_t pid; - pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); // 100000, The pid will never exceed 100000. - - if (pid == 0) { - prctl(PR_SET_NAME, "mainFork", 0UL, 0UL, 0UL); - GroupProcess(); - printf("[Failed] - [Errline : %d RetCode : 0x%x\n", g_iCunitErrLineNo, g_iCunitErrCode); - exit(g_iCunitErrLineNo); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(WIFEXITED(status), 0, WIFEXITED(status)); - ICUNIT_ASSERT_EQUAL(WTERMSIG(status), SIGUSR2, WTERMSIG(status)); - -EXIT: - return 0; -} - -void ItTestPthread019(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_019", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/rwlock/BUILD.gn b/testsuites/unittest_old/process/rwlock/BUILD.gn deleted file mode 100644 index 292fe0e2..00000000 --- a/testsuites/unittest_old/process/rwlock/BUILD.gn +++ /dev/null @@ -1,73 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "process_rwlock_test.cpp", -] - -sources_smoke = [ "smoke/pthread_rwlock_test_001.cpp" ] - -sources_full = [ "full/pthread_rwlock_test_002.cpp" ] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_rwlock_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_rwlock_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_old/process/rwlock/full/pthread_rwlock_test_002.cpp b/testsuites/unittest_old/process/rwlock/full/pthread_rwlock_test_002.cpp deleted file mode 100644 index 075c2aa8..00000000 --- a/testsuites/unittest_old/process/rwlock/full/pthread_rwlock_test_002.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/* - * 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. - */ -#include "it_rwlock_test.h" -#include "string.h" - -static const int WRITE_THREAD_COUNT = 5; // 5, set w thread count. -static const int READ_THREAD_COUNT = 5; // 5, set read thread count. - -static const int READ_LOOP_COUNT = 10; // 10, set read loop count. -static pthread_rwlock_t g_rwlockLock; -static const int TEST_DATA_SIZE = 100000; // 100000, set test data size. -static int g_rwlockData[TEST_DATA_SIZE]; -static int g_rwlockMask; -static volatile int g_isWriting[WRITE_THREAD_COUNT]; -static volatile int g_isReading[READ_THREAD_COUNT]; -static volatile int g_isReadExit[READ_THREAD_COUNT]; -static volatile int g_isWriteExit[WRITE_THREAD_COUNT]; -static int g_writePar[WRITE_THREAD_COUNT]; -static int g_readPar[READ_THREAD_COUNT]; - -static void RwlockWait() -{ - int count; - int count1; - for (count = 0xFFFFFFF; count != 0; count--) { - } -} - -static int CheckReadThreadExit(void) -{ - int count = 0; - - for (int i = 0; i < READ_THREAD_COUNT; i++) { - if (g_isReadExit[i] == 5) { // 5, set read exit data. - count++; - } - } - - if (count == READ_THREAD_COUNT) { - return 0; - } - - return 1; -} - -static int CheckWriteThreadExit(void) -{ - int count = 0; - - for (int i = 1; i < WRITE_THREAD_COUNT; i++) { - if (g_isWriteExit[i] == 6) { // 6, The current possible value of the variable. - count++; - } - } - - if (count == (WRITE_THREAD_COUNT - 1)) { - return 0; - } - - return 1; -} - -static void *ThreadReadFunc(void *a) -{ - int ret; - int count = 0; - pthread_t thread = pthread_self(); - int loop = READ_LOOP_COUNT; - int threadCount = *((int *)a); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - while (loop > 0) { - SLEEP_AND_YIELD(1); - ret = pthread_rwlock_rdlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - g_isReading[threadCount] = 1; - - for (count = 0; count < TEST_DATA_SIZE; count++) { - ICUNIT_GOTO_EQUAL(g_rwlockData[count], g_rwlockMask, g_rwlockData[count], EXIT); - for (int index = 0; index < WRITE_THREAD_COUNT; index++) { - ICUNIT_GOTO_EQUAL(g_isWriting[index], 0, g_isWriting[index], EXIT); - } - } - - SLEEP_AND_YIELD(1); - g_isReading[threadCount] = 0; - - ret = pthread_rwlock_unlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - RwlockWait(); - loop--; - } - - g_isReadExit[threadCount] = 5; // 5, set read exit data. - -EXIT: - return nullptr; -} - -static void *ThreadWriteFunc1(void *a) -{ - int ret; - int count = 0; - int oldRwlockMask; - pthread_t thread = pthread_self(); - int threadCount = *((int *)a); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - while (CheckReadThreadExit()) { - SLEEP_AND_YIELD(1); - ret = pthread_rwlock_wrlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_isWriting[threadCount] = 1; - - oldRwlockMask = g_rwlockMask; - - g_rwlockMask++; - - for (count = 0; count < TEST_DATA_SIZE; count++) { - ICUNIT_GOTO_EQUAL(g_rwlockData[count], oldRwlockMask, g_rwlockData[count], EXIT); - for (int i = 0; i < READ_THREAD_COUNT; i++) { - ICUNIT_GOTO_EQUAL(g_isReading[i], 0, g_isReading[i], EXIT); - } - g_rwlockData[count] = g_rwlockMask; - } - - SLEEP_AND_YIELD(1); - - g_isWriting[threadCount] = 0; - - ret = pthread_rwlock_unlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - SLEEP_AND_YIELD(1); - } - - g_isWriteExit[threadCount] = 6; // 6, The current possible value of the variable. - -EXIT: - return nullptr; -} - -static void *ThreadWriteFunc(void *a) -{ - int ret; - int count = 0; - int oldRwlockMask; - pthread_t thread = pthread_self(); - int threadCount = *((int *)a); - - while (CheckReadThreadExit() || CheckWriteThreadExit()) { - SLEEP_AND_YIELD(1); - ret = pthread_rwlock_wrlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_isWriting[threadCount] = 1; - - oldRwlockMask = g_rwlockMask; - - g_rwlockMask++; - - for (count = 0; count < TEST_DATA_SIZE; count++) { - ICUNIT_GOTO_EQUAL(g_rwlockData[count], oldRwlockMask, g_rwlockData[count], EXIT); - for (int i = 0; i < READ_THREAD_COUNT; i++) { - ICUNIT_GOTO_EQUAL(g_isReading[i], 0, g_isReading[i], EXIT); - } - g_rwlockData[count] = g_rwlockMask; - } - - SLEEP_AND_YIELD(1); - - g_isWriting[threadCount] = 0; - - ret = pthread_rwlock_unlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - SLEEP_AND_YIELD(1); - } - -EXIT: - return nullptr; -} - -static int PthreadRwlockTest(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - int count = 0; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread, newPthread1; - pthread_rwlockattr_t rwlock; - int index = 0; - int curThreadPri, curThreadPolicy; - - (void)memset_s((void *)g_rwlockData, sizeof(int) * TEST_DATA_SIZE, 0, sizeof(int) * TEST_DATA_SIZE); - g_rwlockMask = 0; - - pthread_rwlock_init(&g_rwlockLock, NULL); - - ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - curThreadPri = param.sched_priority; - - while (index < 2) { // 2, Number of cycles. - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = curThreadPri + 1; - pthread_attr_setschedparam(&a, ¶m); - - g_writePar[0] = 0; - ret = pthread_create(&newPthread1, &a, ThreadWriteFunc, &g_writePar[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - count = 1; - while (count < WRITE_THREAD_COUNT) { - g_writePar[count] = count; - g_isWriting[count] = 0; - g_isWriteExit[count] = 0; - ret = pthread_create(&newPthread, &a, ThreadWriteFunc1, &g_writePar[count]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - count++; - } - - count = 0; - while (count < READ_THREAD_COUNT) { - g_readPar[count] = count; - g_isReading[count] = 0; - g_isReadExit[count] = 0; - ret = pthread_create(&newPthread, &a, ThreadReadFunc, &g_readPar[count]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - count++; - } - - ret = pthread_join(newPthread1, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - index++; - } - - pthread_rwlock_destroy(&g_rwlockLock); - return 0; -} - -static int PthreadRwlockTest1(void) -{ - PthreadRwlockTest(); - exit(255); // 255, exit args. -} - -static int Testcase(void) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(pid, 0, 100000, pid); // 100000, assert that function Result is equal to this. - if (pid == 0) { - PthreadRwlockTest1(); - exit(__LINE__); - } - - PthreadRwlockTest(); - - ret = wait(&status); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(status, 255, status); // 255, assert that function Result is equal to this. - return 0; -} - -void ItTestPthreadRwlock002(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_RWLOCK_002", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/rwlock/it_rwlock_test.h b/testsuites/unittest_old/process/rwlock/it_rwlock_test.h deleted file mode 100644 index a1c90151..00000000 --- a/testsuites/unittest_old/process/rwlock/it_rwlock_test.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -#ifndef IT_RWLOCK_TEST_H -#define IT_RWLOCK_TEST_H -#include "osTest.h" - -#define SLEEP_AND_YIELD(tick) usleep((tick)*10 * 1000) - -extern void ItTestPthreadRwlock001(void); -extern void ItTestPthreadRwlock002(void); -#endif diff --git a/testsuites/unittest_old/process/rwlock/process_rwlock_test.cpp b/testsuites/unittest_old/process/rwlock/process_rwlock_test.cpp deleted file mode 100644 index 2a0f5f7d..00000000 --- a/testsuites/unittest_old/process/rwlock/process_rwlock_test.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include -#include "it_rwlock_test.h" - -using namespace testing::ext; -namespace OHOS { -class ProcessRwlockTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: it_test_pthread_rwlock_001 - * @tc.desc: function for ProcessRwlockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessRwlockTest, ItTestPthreadRwlock001, TestSize.Level0) -{ - ItTestPthreadRwlock001(); -} -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: it_test_pthread_rwlock_002 - * @tc.desc: function for ProcessRwlockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessRwlockTest, ItTestPthreadRwlock002, TestSize.Level0) -{ - ItTestPthreadRwlock002(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/process/rwlock/smoke/pthread_rwlock_test_001.cpp b/testsuites/unittest_old/process/rwlock/smoke/pthread_rwlock_test_001.cpp deleted file mode 100644 index c50dda80..00000000 --- a/testsuites/unittest_old/process/rwlock/smoke/pthread_rwlock_test_001.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/* - * 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. - */ -#include "it_rwlock_test.h" -#include "string.h" - -static const int WRITE_THREAD_COUNT = 7; // 7, set w thread count. -static const int READ_THREAD_COUNT = 10; // 10, set read thread count. -static const int READ_LOOP_COUNT = 10; // 10, set read loop count. -static const int TEST_DATA_SIZE = 100000; // 100000, set test data size. - -static pthread_rwlock_t g_rwlockLock; - -static int g_rwlockData[TEST_DATA_SIZE]; -static int g_rwlockMask; -static volatile int g_isWriting[WRITE_THREAD_COUNT]; -static volatile int g_isReading[READ_THREAD_COUNT]; -static volatile int g_isReadExit[READ_THREAD_COUNT]; -static volatile int g_isWriteExit[WRITE_THREAD_COUNT]; -static int g_writePar[WRITE_THREAD_COUNT]; -static int g_readPar[READ_THREAD_COUNT]; - -static void RwlockWait() -{ - int count; - int count1; - for (count = 0xFFFFFFF; count != 0; count--) { - } -} - -static int CheckReadThreadExit(void) -{ - int count = 0; - - for (int i = 0; i < READ_THREAD_COUNT; i++) { - if (g_isReadExit[i] == 5) { // 5, set read exit data. - count++; - } - } - - if (count == READ_THREAD_COUNT) { - return 0; - } - - return 1; -} - -static int CheckWriteThreadExit(void) -{ - int count = 0; - - for (int i = 1; i < WRITE_THREAD_COUNT; i++) { - if (g_isWriteExit[i] == 6) { // 6, The current possible value of the variable. - count++; - } - } - - if (count == (WRITE_THREAD_COUNT - 1)) { - return 0; - } - - return 1; -} - -static void *ThreadReadFunc(void *a) -{ - int ret; - int count = 0; - pthread_t thread = pthread_self(); - int loop = READ_LOOP_COUNT; - int threadCount = *((int *)a); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - while (loop > 0) { - ret = pthread_rwlock_rdlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - g_isReading[threadCount] = 1; - - for (count = 0; count < TEST_DATA_SIZE; count++) { - ICUNIT_GOTO_EQUAL(g_rwlockData[count], g_rwlockMask, g_rwlockData[count], EXIT); - for (int index = 0; index < WRITE_THREAD_COUNT; index++) { - ICUNIT_GOTO_EQUAL(g_isWriting[index], 0, g_isWriting[index], EXIT); - } - } - - SLEEP_AND_YIELD(1); - - g_isReading[threadCount] = 0; - - ret = pthread_rwlock_unlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - RwlockWait(); - loop--; - } - - g_isReadExit[threadCount] = 5; // 5, set read exit data. - -EXIT: - return nullptr; -} - -static void *ThreadWriteFunc1(void *a) -{ - int ret; - int count = 0; - int oldRwlockMask; - pthread_t thread = pthread_self(); - int threadCount = *((int *)a); - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - while (CheckReadThreadExit()) { - ret = pthread_rwlock_wrlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_isWriting[threadCount] = 1; - - oldRwlockMask = g_rwlockMask; - - g_rwlockMask++; - - for (count = 0; count < TEST_DATA_SIZE; count++) { - ICUNIT_GOTO_EQUAL(g_rwlockData[count], oldRwlockMask, g_rwlockData[count], EXIT); - for (int i = 0; i < READ_THREAD_COUNT; i++) { - ICUNIT_GOTO_EQUAL(g_isReading[i], 0, g_isReading[i], EXIT); - } - g_rwlockData[count] = g_rwlockMask; - } - - SLEEP_AND_YIELD(1); - - g_isWriting[threadCount] = 0; - - ret = pthread_rwlock_unlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - SLEEP_AND_YIELD(1); - } - - g_isWriteExit[threadCount] = 6; // 6, The current possible value of the variable. - -EXIT: - return nullptr; -} - -static void *ThreadWriteFunc(void *a) -{ - int ret; - int count = 0; - int oldRwlockMask; - pthread_t thread = pthread_self(); - int threadCount = *((int *)a); - - while (CheckReadThreadExit() || CheckWriteThreadExit()) { - ret = pthread_rwlock_wrlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_isWriting[threadCount] = 1; - - oldRwlockMask = g_rwlockMask; - - g_rwlockMask++; - - for (count = 0; count < TEST_DATA_SIZE; count++) { - ICUNIT_GOTO_EQUAL(g_rwlockData[count], oldRwlockMask, g_rwlockData[count], EXIT); - for (int i = 0; i < READ_THREAD_COUNT; i++) { - ICUNIT_GOTO_EQUAL(g_isReading[i], 0, g_isReading[i], EXIT); - } - g_rwlockData[count] = g_rwlockMask; - } - - SLEEP_AND_YIELD(1); - - g_isWriting[threadCount] = 0; - - ret = pthread_rwlock_unlock(&g_rwlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - SLEEP_AND_YIELD(1); - } - -EXIT: - return nullptr; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - int count = 0; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread, newPthread1; - pthread_rwlockattr_t rwlock; - int index = 0; - int curThreadPri, curThreadPolicy; - - (void)memset_s((void *)g_rwlockData, sizeof(int) * TEST_DATA_SIZE, 0, sizeof(int) * TEST_DATA_SIZE); - g_rwlockMask = 0; - - pthread_rwlock_init(&g_rwlockLock, NULL); - - ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - curThreadPri = param.sched_priority; - - while (index < 2) { // 2, Set the cycle number. - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = curThreadPri + 1; - pthread_attr_setschedparam(&a, ¶m); - - g_writePar[0] = 0; - ret = pthread_create(&newPthread1, &a, ThreadWriteFunc, &g_writePar[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - count = 1; - while (count < WRITE_THREAD_COUNT) { - g_writePar[count] = count; - ret = pthread_create(&newPthread, &a, ThreadWriteFunc1, &g_writePar[count]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - g_isWriting[count] = 0; - g_isWriteExit[count] = 0; - count++; - } - - count = 0; - while (count < READ_THREAD_COUNT) { - g_readPar[count] = count; - ret = pthread_create(&newPthread, &a, ThreadReadFunc, &g_readPar[count]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - g_isReading[count] = 0; - g_isReadExit[count] = 0; - count++; - } - - ret = pthread_join(newPthread1, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - index++; - } - - pthread_rwlock_destroy(&g_rwlockLock); - return 0; -} - -void ItTestPthreadRwlock001(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_RWLOCK_001", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/process/spinlock/it_spinlock_test.h b/testsuites/unittest_old/process/spinlock/it_spinlock_test.h deleted file mode 100644 index 12e78126..00000000 --- a/testsuites/unittest_old/process/spinlock/it_spinlock_test.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -#ifndef IT_SPINLOCK_TEST_H -#define IT_SPINLOCK_TEST_H -#include "osTest.h" - -#define SLEEP_AND_YIELD(tick) usleep((tick)*10 * 1000) - -extern void ItTestPthreadSpinlock001(void); - -#endif diff --git a/testsuites/unittest_old/process/spinlock/process_spinlock_test.cpp b/testsuites/unittest_old/process/spinlock/process_spinlock_test.cpp deleted file mode 100644 index d9db0030..00000000 --- a/testsuites/unittest_old/process/spinlock/process_spinlock_test.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include -#include "it_spinlock_test.h" - -using namespace testing::ext; -namespace OHOS { -class ProcessSpinlockTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: it_test_pthread_spinlock_001 - * @tc.desc: function for ProcessSpinlockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(ProcessSpinlockTest, ItTestPthreadSpinlock001, TestSize.Level0) -{ - ItTestPthreadSpinlock001(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/process/spinlock/smoke/pthread_spinlock_test_001.cpp b/testsuites/unittest_old/process/spinlock/smoke/pthread_spinlock_test_001.cpp deleted file mode 100644 index 96c48729..00000000 --- a/testsuites/unittest_old/process/spinlock/smoke/pthread_spinlock_test_001.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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. - */ -#include "it_spinlock_test.h" -#include "string.h" - -static const int WRITE_THREAD_COUNT = 2; // 2, set test count. -static const int TEST_LOOP_COUNT = 1; -static const int TEST_COUNT = 2; // 2, set write thread count. -static pthread_spinlock_t g_spinlockLock; - -static const int TEST_DATA_SIZE = 100000; // 100000, set test data size. -static int g_spinlockData[TEST_DATA_SIZE]; -static int g_spinlockMask; -static volatile int g_isWriting[WRITE_THREAD_COUNT]; -static volatile int g_isWriteExit[WRITE_THREAD_COUNT]; -static int g_writePar[WRITE_THREAD_COUNT]; - -static void *ThreadWriteFunc1(void *a) -{ - int ret; - int testCount = TEST_LOOP_COUNT; - int oldRwlockMask; - pthread_t thread = pthread_self(); - int threadCount = *((int *)a); - int count; - - ret = pthread_detach(thread); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - while (testCount > 0) { - ret = pthread_spin_lock(&g_spinlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_isWriting[threadCount] = 1; - - oldRwlockMask = g_spinlockMask; - - g_spinlockMask++; - - for (count = 0; count < TEST_DATA_SIZE; count++) { - ICUNIT_GOTO_EQUAL(g_spinlockData[count], oldRwlockMask, g_spinlockData[count], EXIT); - g_spinlockData[count] = g_spinlockMask; - } - - g_isWriting[threadCount] = 0; - - ret = pthread_spin_unlock(&g_spinlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - SLEEP_AND_YIELD(1); - testCount--; - } - - g_isWriteExit[threadCount] = 6; // 6, The current possible value of the variable. - -EXIT: - return nullptr; -} - -static void *ThreadWriteFunc(void *a) -{ - int ret; - int testCount = TEST_LOOP_COUNT; - int oldRwlockMask; - pthread_t thread = pthread_self(); - int threadCount = *((int *)a); - int count; - - while (testCount > 0) { - ret = pthread_spin_lock(&g_spinlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - g_isWriting[threadCount] = 1; - - oldRwlockMask = g_spinlockMask; - - g_spinlockMask++; - - for (count = 0; count < TEST_DATA_SIZE; count++) { - ICUNIT_GOTO_EQUAL(g_spinlockData[count], oldRwlockMask, g_spinlockData[count], EXIT); - g_spinlockData[count] = g_spinlockMask; - } - - g_isWriting[threadCount] = 0; - - ret = pthread_spin_unlock(&g_spinlockLock); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - SLEEP_AND_YIELD(1); - testCount--; - } - -EXIT: - return nullptr; -} - -static int Testcase(void) -{ - struct sched_param param = { 0 }; - int ret; - void *res = nullptr; - pthread_attr_t a = { 0 }; - pthread_t thread = pthread_self(); - pthread_t newPthread, newPthread1; - pthread_rwlockattr_t rwlock; - int index = 0; - int curThreadPri, curThreadPolicy; - - (void)memset_s((void *)g_spinlockData, sizeof(int) * TEST_DATA_SIZE, 0, sizeof(int) * TEST_DATA_SIZE); - g_spinlockMask = 0; - - pthread_spin_init(&g_spinlockLock, 0); - - ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, -ret); - - curThreadPri = param.sched_priority; - - while (index < TEST_COUNT) { - ret = pthread_attr_init(&a); - pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); - param.sched_priority = curThreadPri + 1; - pthread_attr_setschedparam(&a, ¶m); - - g_writePar[0] = 0; - ret = pthread_create(&newPthread1, &a, ThreadWriteFunc, &g_writePar[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - g_writePar[1] = 1; - ret = pthread_create(&newPthread, &a, ThreadWriteFunc1, &g_writePar[1]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - g_isWriting[1] = 0; - g_isWriteExit[1] = 0; - - ret = pthread_join(newPthread1, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - index++; - } - - pthread_spin_destroy(&g_spinlockLock); - - return 0; -} - -void ItTestPthreadSpinlock001(void) -{ - TEST_ADD_CASE("IT_POSIX_PTHREAD_SPINLOCK_001", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/security/capability/BUILD.gn b/testsuites/unittest_old/security/capability/BUILD.gn deleted file mode 100644 index 031b03d6..00000000 --- a/testsuites/unittest_old/security/capability/BUILD.gn +++ /dev/null @@ -1,73 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "security_capability_test.cpp", -] - -sources_smoke = [ "smoke/cap_test_001.cpp" ] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_security_capability_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_security_capability_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_old/security/capability/it_test_capability.h b/testsuites/unittest_old/security/capability/it_test_capability.h deleted file mode 100644 index bd09554a..00000000 --- a/testsuites/unittest_old/security/capability/it_test_capability.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_SECURITY_CAPABILITY_H -#define _IT_TEST_SECURITY_CAPABILITY_H - -#include "osTest.h" - -VOID ItSuite_Security_Capbility(VOID); -extern void ItTestCap001(void); - -#endif diff --git a/testsuites/unittest_old/security/capability/security_capability_test.cpp b/testsuites/unittest_old/security/capability/security_capability_test.cpp deleted file mode 100644 index c00995f2..00000000 --- a/testsuites/unittest_old/security/capability/security_capability_test.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "it_test_capability.h" - -using namespace testing::ext; -namespace OHOS { -class SecurityCapabilityTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/** - * @tc.name: It_Test_Cap_001 - * @tc.desc: function for SecurityCapbilityTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SecurityCapabilityTest, ItTestCap001, TestSize.Level0) -{ - ItTestCap001(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/security/capability/smoke/cap_test_001.cpp b/testsuites/unittest_old/security/capability/smoke/cap_test_001.cpp deleted file mode 100644 index f8887989..00000000 --- a/testsuites/unittest_old/security/capability/smoke/cap_test_001.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * 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. - */ -#include "pthread.h" -#include "linux/capability.h" -#include -#include "it_test_capability.h" -#include -#include -#include - -#define CAP_NUM 2 -#define INVAILD_PID 65535 -#define CHANGE_CHILD_UID 1000 - -static void Sigac(int param) -{ - return; -} - -static void Child() -{ - int i = 10; - signal(25, Sigac); - - while (i--) { - sleep(1); - } - exit(0); -} - -static int TestChild(VOID) -{ - struct __user_cap_header_struct capheader; - struct __user_cap_data_struct capdata[CAP_NUM]; - struct __user_cap_data_struct capdatac[CAP_NUM]; - struct timespec tp; - int ret; - - (void)memset_s(&capheader, sizeof(struct __user_cap_header_struct), 0, sizeof(struct __user_cap_header_struct)); - (void)memset_s(capdata, CAP_NUM * sizeof(struct __user_cap_data_struct), 0, - CAP_NUM * sizeof(struct __user_cap_data_struct)); - capdata[0].permitted = 0xffffffff; - capdata[1].permitted = 0xffffffff; - capheader.version = _LINUX_CAPABILITY_VERSION_3; - capdata[CAP_TO_INDEX(CAP_SYS_NICE)].effective |= CAP_TO_MASK(CAP_SETPCAP); - capdata[CAP_TO_INDEX(CAP_SYS_NICE)].effective |= CAP_TO_MASK(CAP_SETUID); - capdata[CAP_TO_INDEX(CAP_SYS_NICE)].effective |= CAP_TO_MASK(CAP_KILL); - capdata[CAP_TO_INDEX(CAP_SYS_NICE)].effective |= CAP_TO_MASK(CAP_SYS_TIME); - capdata[CAP_TO_INDEX(CAP_SYS_NICE)].effective |= CAP_TO_MASK(CAP_SYS_NICE); - ret = capset(&capheader, &capdata[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = capget(&capheader, &capdatac[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - capheader.pid = INVAILD_PID; - ret = capget(&capheader, &capdatac[0]); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - errno = 0; - capheader.pid = 3; - kill(capheader.pid, 0); - if (errno != ESRCH) { - ret = capget(&capheader, &capdatac[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); - } - errno = 0; - capheader.pid = 4; - kill(capheader.pid, 0); - if (errno != ESRCH) { - ret = capget(&capheader, &capdatac[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); - } - errno = 0; - capheader.pid = 5; - kill(capheader.pid, 0); - if (errno != ESRCH) { - ret = capget(&capheader, &capdatac[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); - } - errno = 0; - capheader.pid = 6; - kill(capheader.pid, 0); - if (errno != ESRCH) { - ret = capget(&capheader, &capdatac[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("e %d,p %d\n", capdatac[0].effective, capdatac[0].permitted); - } - capheader.pid = 0; - - int pid = fork(); - if (pid == 0) { - ret = setuid(CHANGE_CHILD_UID); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - Child(); - } - sleep(1); - ret = kill(pid, SIGXFSZ); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - capdata[CAP_TO_INDEX(CAP_SYS_NICE)].effective &= ~CAP_TO_MASK(CAP_KILL); - ret = capset(&capheader, &capdata[0]); - ret = kill(pid, SIGXFSZ); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - tp.tv_sec = 0; - tp.tv_nsec = 0; - ret = clock_settime(CLOCK_REALTIME, &tp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - capdata[CAP_TO_INDEX(CAP_SYS_NICE)].effective &= ~CAP_TO_MASK(CAP_SYS_TIME); - ret = capset(&capheader, &capdata[0]); - ret = clock_settime(CLOCK_REALTIME, &tp); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - - struct sched_param param = { 0 }; - ret = sched_getparam(pid, ¶m); - param.sched_priority--; - ret = sched_setparam(pid, ¶m); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - capdata[CAP_TO_INDEX(CAP_SYS_NICE)].effective &= ~CAP_TO_MASK(CAP_SYS_NICE); - ret = capset(&capheader, &capdata[0]); - ret = sched_setparam(pid, ¶m); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - wait(nullptr); - exit(92); - - return 0; -} - -static int TestCase(VOID) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); - if (pid == 0) { - ret = TestChild(); - exit(__LINE__); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 92, status, EXIT); - - return 0; - -EXIT: - return 1; -} - -void ItTestCap001(void) -{ - TEST_ADD_CASE("IT_SEC_CAP_001", TestCase, TEST_POSIX, TEST_SEC, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/security/reugid/BUILD.gn b/testsuites/unittest_old/security/reugid/BUILD.gn deleted file mode 100644 index d0735590..00000000 --- a/testsuites/unittest_old/security/reugid/BUILD.gn +++ /dev/null @@ -1,73 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "security_reugid_test.cpp", -] - -sources_smoke = [ "smoke/reugid_test_001.cpp" ] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_security_reugid_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_security_reugid_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_old/security/reugid/it_test_reugid.h b/testsuites/unittest_old/security/reugid/it_test_reugid.h deleted file mode 100644 index 0acadc8f..00000000 --- a/testsuites/unittest_old/security/reugid/it_test_reugid.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_SECURITY_CAPABILITY_H -#define _IT_TEST_SECURITY_CAPABILITY_H - -#include "osTest.h" - -VOID ItSuiteSecurityReugid(VOID); -extern void ItTestReugid001(void); - -#endif diff --git a/testsuites/unittest_old/security/reugid/security_reugid_test.cpp b/testsuites/unittest_old/security/reugid/security_reugid_test.cpp deleted file mode 100644 index d58ab2b6..00000000 --- a/testsuites/unittest_old/security/reugid/security_reugid_test.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "it_test_reugid.h" - -using namespace testing::ext; -namespace OHOS { -class SecurityReugidTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/** - * @tc.name: ItTestReugid001 - * @tc.desc: function for SecurityReugidTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SecurityReugidTest, ItTestReugid001, TestSize.Level0) -{ - ItTestReugid001(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/security/reugid/smoke/reugid_test_001.cpp b/testsuites/unittest_old/security/reugid/smoke/reugid_test_001.cpp deleted file mode 100644 index 4dfa6141..00000000 --- a/testsuites/unittest_old/security/reugid/smoke/reugid_test_001.cpp +++ /dev/null @@ -1,434 +0,0 @@ -/* - * 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. - */ -#include "pthread.h" -#include "linux/capability.h" -#include "it_test_reugid.h" -#include -#include -#include - -static int Child1(int *list, int listSize) -{ - int getList[500]; - int ruid = 0; - int euid = 0; - int suid = 100; - int rgid = 0; - int egid = 0; - int sgid = 100; - int ret; - - rgid = getgid(); - ICUNIT_ASSERT_EQUAL(rgid, 300, rgid); - egid = getegid(); - ICUNIT_ASSERT_EQUAL(egid, 300, egid); - - ret = getresgid((gid_t *)&ruid, (gid_t *)&euid, (gid_t *)&suid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(ruid, 300, ruid); - ICUNIT_ASSERT_EQUAL(euid, 300, euid); - ICUNIT_ASSERT_EQUAL(suid, 300, suid); - - ruid = getuid(); - ICUNIT_ASSERT_EQUAL(ruid, 300, ruid); - euid = geteuid(); - ICUNIT_ASSERT_EQUAL(euid, 300, euid); - - ret = getresuid((gid_t *)&ruid, (gid_t *)&euid, (gid_t *)&suid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(ruid, 300, ruid); - ICUNIT_ASSERT_EQUAL(euid, 300, euid); - ICUNIT_ASSERT_EQUAL(suid, 300, suid); - - int size = getgroups(0, (gid_t *)getList); - ICUNIT_ASSERT_EQUAL(size, listSize, size); - - size = getgroups(size, (gid_t *)getList); - ICUNIT_ASSERT_EQUAL(size, listSize, size); - for (int i = 0; i < size - 1; i++) { - ICUNIT_ASSERT_EQUAL(getList[i], list[i], getList[i]); - } - - getList[size - 1] = 500; - ret = setgroups(0, (gid_t *)getList); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = getgroups(0, NULL); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - - ret = getgroups(ret, (gid_t *)getList); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - ICUNIT_ASSERT_EQUAL(getList[0], getgid(), getList[0]); - - exit(255); -} - -static int Child(void) -{ - int size; - int ret; - int list[500]; - int getList[500]; - int ruid = 0; - int euid = 0; - int suid = 100; - int rgid = 0; - int egid = 0; - int sgid = 100; - - ret = setgid(3000); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getgid(); - ICUNIT_ASSERT_EQUAL(ret, 3000, ret); - ret = getegid(); - ICUNIT_ASSERT_EQUAL(ret, 3000, ret); - - ret = setegid(3000); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getgid(); - ICUNIT_ASSERT_EQUAL(ret, 3000, ret); - ret = getegid(); - ICUNIT_ASSERT_EQUAL(ret, 3000, ret); - - ret = setgid(-1); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - ret = setegid(-2); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - list[0] = 1000; - list[1] = 2000; - list[2] = 3000; - list[3] = 4000; - list[4] = 5000; - ret = setgroups(5, (gid_t *)list); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - size = getgroups(0, (gid_t *)getList); - ICUNIT_ASSERT_EQUAL(size, 5, size); - - size = getgroups(size, (gid_t *)getList); - ICUNIT_ASSERT_EQUAL(size, 5, size); - - for (int i = 0; i < size; i++) { - ICUNIT_ASSERT_EQUAL(getList[i], list[i], getList[i]); - } - - list[0] = 1000; - list[1] = 2000; - list[2] = 6000; - list[3] = 4000; - list[4] = 5000; - list[5] = -1; - ret = setgroups(6, (gid_t *)list); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - list[0] = 1000; - list[1] = 2000; - list[2] = 6000; - list[3] = 4000; - list[4] = 5000; - list[5] = 7000; - ret = setgroups(6, (gid_t *)list); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - size = getgroups(0, (gid_t *)getList); - ICUNIT_ASSERT_EQUAL(size, 7, size); - - size = getgroups(0, NULL); - ICUNIT_ASSERT_EQUAL(size, 7, size); - - size = getgroups(size, (gid_t *)getList); - ICUNIT_ASSERT_EQUAL(size, 7, size); - for (int i = 0; i < size - 1; i++) { - ICUNIT_ASSERT_EQUAL(getList[i], list[i], getList[i]); - } - - ICUNIT_ASSERT_EQUAL(getList[size - 1], getgid(), getList[size - 1]); - - ret = seteuid(8000); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = geteuid(); - ICUNIT_ASSERT_EQUAL(ret, 8000, ret); - - ret = setuid(2000); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = geteuid(); - ICUNIT_ASSERT_EQUAL(ret, 2000, ret); - ret = getuid(); - ICUNIT_ASSERT_EQUAL(ret, 2000, ret); - - ret = setuid(-1); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - ret = seteuid(-2); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - ret = setregid(5000, 300); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EPERM, errno, errno); - - ret = setregid(5000, 5000); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getgid(); - ICUNIT_ASSERT_EQUAL(ret, 5000, ret); - egid = getegid(); - ICUNIT_ASSERT_EQUAL(egid, 5000, egid); - - ret = setregid(5000, -1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getgid(); - ICUNIT_ASSERT_EQUAL(ret, 5000, ret); - egid = getegid(); - ICUNIT_ASSERT_EQUAL(egid, 5000, egid); - - ret = setregid(3000, -2); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - ret = setregid(-5, -2); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - ret = setregid(3000, -1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getgid(); - ICUNIT_ASSERT_EQUAL(ret, 3000, ret); - egid = getegid(); - ICUNIT_ASSERT_EQUAL(egid, 3000, egid); - - ret = setreuid(1000, 3000); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EPERM, errno, errno); - - ret = setreuid(1000, -2); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - ret = setreuid(-2, -2); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - ret = setreuid(-1, 3000); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ruid = getuid(); - ICUNIT_ASSERT_EQUAL(ruid, 3000, ruid); - euid = geteuid(); - ICUNIT_ASSERT_EQUAL(euid, 3000, euid); - - ret = setreuid(1000, -1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ruid = getuid(); - ICUNIT_ASSERT_EQUAL(ruid, 1000, ruid); - euid = geteuid(); - ICUNIT_ASSERT_EQUAL(euid, 1000, euid); - - ret = setresuid(100, 100, 100); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getresuid((uid_t *)&ruid, (uid_t *)&euid, (uid_t *)&suid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(ruid, 100, ruid); - ICUNIT_ASSERT_EQUAL(euid, 100, euid); - ICUNIT_ASSERT_EQUAL(suid, 100, suid); - - ret = setresuid(200, 100, 100); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EPERM, errno, errno); - - ret = setresuid(100, 100, 200); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EPERM, errno, errno); - - ret = setresuid(100, 200, 200); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EPERM, errno, errno); - - ret = setresuid(-1, 200, 200); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getresuid((uid_t *)&ruid, (uid_t *)&euid, (uid_t *)&suid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(ruid, 200, ruid); - ICUNIT_ASSERT_EQUAL(euid, 200, euid); - ICUNIT_ASSERT_EQUAL(suid, 200, suid); - - ret = setresuid(-1, -1, 300); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getresuid((uid_t *)&ruid, (uid_t *)&euid, (uid_t *)&suid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(ruid, 300, ruid); - ICUNIT_ASSERT_EQUAL(euid, 300, euid); - ICUNIT_ASSERT_EQUAL(suid, 300, suid); - - ret = setresuid(-1, 200, 300); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ret = setresuid(-1, -2, 200); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - ret = setresuid(-2, 200, 200); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - ret = setresuid(200, -2, 200); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - ret = setresuid(200, 200, -3); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - ret = setresgid(100, 100, 100); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getresgid((gid_t *)&rgid, (gid_t *)&egid, (gid_t *)&sgid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(rgid, 100, rgid); - ICUNIT_ASSERT_EQUAL(egid, 100, egid); - ICUNIT_ASSERT_EQUAL(sgid, 100, sgid); - - ret = setresgid(200, 100, 100); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EPERM, errno, errno); - - ret = setresgid(100, 100, 200); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EPERM, errno, errno); - - ret = setresgid(100, 200, 200); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EPERM, errno, errno); - - ret = setresgid(-2, 100, 200); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - ret = setresgid(100, -2, 200); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - ret = setresgid(100, 100, -2); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - ret = setresgid(100, -1, -2); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - ret = setresgid(-1, 200, 200); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getresgid((gid_t *)&rgid, (gid_t *)&egid, (gid_t *)&sgid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(rgid, 200, rgid); - ICUNIT_ASSERT_EQUAL(egid, 200, egid); - ICUNIT_ASSERT_EQUAL(sgid, 200, sgid); - - ret = setresgid(-1, -1, 300); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getresgid((gid_t *)&rgid, (gid_t *)&egid, (gid_t *)&sgid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(rgid, 300, rgid); - ICUNIT_ASSERT_EQUAL(egid, 300, egid); - ICUNIT_ASSERT_EQUAL(sgid, 300, sgid); - - ret = setresgid(-1, 200, 300); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EPERM, errno, errno); - - size = getgroups(0, (gid_t *)getList); - size = getgroups(size, (gid_t *)getList); - pid_t pid = fork(); - if (pid == 0) { - Child1(getList, size); - exit(__LINE__); - } - - int status = 0; - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); - - ret = setgroups(0, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = getgroups(0, (gid_t *)getList); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - - ret = getgroups(1, (gid_t *)getList); - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - ICUNIT_ASSERT_EQUAL(getList[0], getgid(), getList[0]); - - ret = setreuid(-1, -1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setregid(-1, -1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setresuid(-1, -1, -1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setresuid(-1, -1, -1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = setegid(-1); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - ret = seteuid(-1); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(EINVAL, errno, errno); - - exit(255); - -EXIT: - return 1; -} - -static int TestCase(VOID) -{ - int ret; - int status = 0; - pid_t pid = fork(); - ICUNIT_GOTO_WITHIN_EQUAL(pid, 0, 100000, pid, EXIT); - if (pid == 0) { - ret = Child(); - exit(__LINE__); - } - - ret = waitpid(pid, &status, 0); - ICUNIT_GOTO_EQUAL(ret, pid, ret, EXIT); - status = WEXITSTATUS(status); - ICUNIT_GOTO_EQUAL(status, 255, status, EXIT); - - return 0; - -EXIT: - return 1; -} - -void ItTestReugid001(void) -{ - TEST_ADD_CASE("IT_SEC_UGID_001", TestCase, TEST_POSIX, TEST_SEC, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/security/vid/it_test_vid.h b/testsuites/unittest_old/security/vid/it_test_vid.h deleted file mode 100644 index 200fa201..00000000 --- a/testsuites/unittest_old/security/vid/it_test_vid.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_SECURITY_VID_H -#define _IT_TEST_SECURITY_VID_H - -#define _GNU_SOURCE -#include "osTest.h" -#include -#include "stdio.h" -#include -#include -#include "los_typedef.h" -#include "sched.h" -#include "signal.h" - -extern VOID ItSuite_Security_Vid(VOID); -extern VOID ItSecVid001(VOID); - -#endif diff --git a/testsuites/unittest_old/security/vid/security_vid_test.cpp b/testsuites/unittest_old/security/vid/security_vid_test.cpp deleted file mode 100644 index 2d66743f..00000000 --- a/testsuites/unittest_old/security/vid/security_vid_test.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "it_test_vid.h" - -using namespace testing::ext; -namespace OHOS { -class SecurityVidTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/** - * @tc.name: It_Sec_Vid_001 - * @tc.desc: function for SecurityVidTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SecurityVidTest, ItSecVid001, TestSize.Level0) -{ - ItSecVid001(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/security/vid/smoke/vid_test_001.cpp b/testsuites/unittest_old/security/vid/smoke/vid_test_001.cpp deleted file mode 100644 index d2dc6be0..00000000 --- a/testsuites/unittest_old/security/vid/smoke/vid_test_001.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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. - */ -#include "it_test_vid.h" -#include "stdio.h" -#include "unistd.h" -#include "sys/stat.h" -#include "time.h" -#include "stdlib.h" - -static VOID TimerFunc(int sig) -{ - return; -} - -static void ChildFunc() -{ - timer_t tid; - struct sigevent ent; - INT32 *ret1 = NULL; - int ret; - struct itimerspec its; - struct itimerspec its2; - timer_t *tid2 = nullptr; - int i = 0; - signal(SIGUSR1, TimerFunc); - ent.sigev_notify = SIGEV_SIGNAL; - ent.sigev_signo = SIGUSR1; - - tid2 = (timer_t *)malloc(sizeof(UINTPTR) * 1024); - ret1 = (int *)malloc(sizeof(int) * 1024); - (void)memset_s(tid2, sizeof(char *) * 1024, 0, sizeof(char *) * 1024); - (void)memset_s(ret1, sizeof(int) * 1024, 0xff, sizeof(int) * 1024); - while (i < 1024) { - *(ret1 + i) = timer_create(CLOCK_REALTIME, &ent, tid2 + i); - if (*(ret1 + i) == 0) { - ICUNIT_ASSERT_EQUAL_VOID(*(ret1 + i), 0, *(ret1 + i)); - ICUNIT_ASSERT_EQUAL_VOID(i, (int)(*(tid2 + i)), i); - } else { - ICUNIT_ASSERT_EQUAL_VOID(*(ret1 + i), -1, *(ret1 + i)); - } - i++; - } - - i = 0; - while (*(ret1 + i) == 0) { - ret = timer_delete(*(tid2 + i)); - ICUNIT_ASSERT_EQUAL_VOID(ret, 0, ret); - i++; - } - - i = 0; - while (i < 1024) { - *(ret1 + i) = timer_create(CLOCK_REALTIME, &ent, tid2 + i); - if (*(ret1 + i) == 0) { - ICUNIT_ASSERT_EQUAL_VOID(*(ret1 + i), 0, *(ret1 + i)); - ICUNIT_ASSERT_EQUAL_VOID(i, (int)(*(tid2 + i)), i); - } else { - ICUNIT_ASSERT_EQUAL_VOID(*(ret1 + i), -1, *(ret1 + i)); - } - i++; - } - - i = 0; - while (*(ret1 + i) == 0) { - ret = timer_delete(*(tid2 + i)); - ICUNIT_ASSERT_EQUAL_VOID(ret, 0, ret); - i++; - } - - free(tid2); - ret1 = (INT32 *)timer_create(CLOCK_REALTIME, &ent, &tid); - ICUNIT_ASSERT_EQUAL_VOID(ret1, 0, ret1); - - its.it_interval.tv_sec = 1; - its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = 1; - its.it_value.tv_nsec = 0; - ret1 = (INT32 *)timer_settime(tid, 0, &its, NULL); - ICUNIT_ASSERT_EQUAL_VOID(ret1, 0, ret1); - sleep(1); - ret1 = (INT32 *)timer_gettime(tid, &its2); - ICUNIT_ASSERT_EQUAL_VOID(ret1, 0, ret1); - ret1 = (INT32 *)timer_getoverrun(tid); - ret1 = (INT32 *)(((int)(intptr_t)ret1 >= 0) ? 0 : -1); - ICUNIT_ASSERT_EQUAL_VOID(ret1, 0, ret1); - - ret1 = (INT32 *)timer_delete(tid); - ICUNIT_ASSERT_EQUAL_VOID(ret1, 0, ret1); - - exit((int)(intptr_t)tid); -} - -static UINT32 TestCase(VOID) -{ - int pid; - int status = 0; - pid = fork(); - if (pid == 0) { - ChildFunc(); - } - - waitpid(pid, &status, 0); - return 0; -} - -VOID ItSecVid001(VOID) -{ - TEST_ADD_CASE("IT_SEC_VID_001", TestCase, TEST_POSIX, TEST_SEC, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/BUILD.gn b/testsuites/unittest_old/signal/BUILD.gn deleted file mode 100644 index 1bea9a96..00000000 --- a/testsuites/unittest_old/signal/BUILD.gn +++ /dev/null @@ -1,139 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../common/include", - "./", -] - -sources_entry = [ - "../common/osTest.cpp", - "signal_test.cpp", -] - -sources_smoke = [ - "smoke/It_ipc_fdisset_001.cpp", - "smoke/It_ipc_mkfifo_002.cpp", - "smoke/It_ipc_mkfifo_003.cpp", - "smoke/It_ipc_pipe_004.cpp", - "smoke/It_ipc_pipe_005.cpp", - "smoke/mkfifo_test_001.cpp", - "smoke/mkfifo_test_002.cpp", - "smoke/pipe_test_002.cpp", - "smoke/pipe_test_004.cpp", - - "smoke/signal_test_002.cpp", - "smoke/signal_test_009.cpp", - "smoke/signal_test_013.cpp", - "smoke/signal_test_014.cpp", - "smoke/signal_test_021.cpp", - "smoke/signal_test_022.cpp", - "smoke/signal_test_023.cpp", - "smoke/signal_test_024.cpp", - "smoke/signal_test_031.cpp", - "smoke/signal_test_032.cpp", - "smoke/signal_test_035.cpp", - "smoke/signal_test_036.cpp", - "smoke/signal_test_037.cpp", - "smoke/signal_test_039.cpp", - "smoke/signal_test_042.cpp", - "smoke/sigset_test_001.cpp", - "smoke/sigset_test_002.cpp", -] - -sources_full = [ - "full/It_ipc_fdclr_001.cpp", - "full/It_ipc_fdset_001.cpp", - "full/It_ipc_fdzero_001.cpp", - "full/It_ipc_sigaction_001.cpp", - "full/It_ipc_sigpause_001.cpp", - "full/It_ipc_sigprocmask_001.cpp", - "full/signal_test_001.cpp", - "full/signal_test_003.cpp", - "full/signal_test_004.cpp", - "full/signal_test_005.cpp", - "full/signal_test_006.cpp", - "full/signal_test_007.cpp", - "full/signal_test_008.cpp", - "full/signal_test_010.cpp", - "full/signal_test_011.cpp", - "full/signal_test_012.cpp", - "full/signal_test_015.cpp", - "full/signal_test_016.cpp", - "full/signal_test_017.cpp", - "full/signal_test_018.cpp", - "full/signal_test_019.cpp", - "full/signal_test_020.cpp", - "full/signal_test_025.cpp", - "full/signal_test_026.cpp", - "full/signal_test_028.cpp", - "full/signal_test_029.cpp", - "full/signal_test_030.cpp", - "full/signal_test_033.cpp", - "full/signal_test_038.cpp", - "full/signal_test_040.cpp", - "full/signal_test_041.cpp", - "full/It_ipc_pipe_002.cpp", - "full/It_ipc_pipe_003.cpp", - "full/pipe_test_001.cpp", - "full/pipe_test_003.cpp", - "full/pipe_test_005.cpp", - "full/pipe_test_006.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_signal_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_signal_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_old/signal/full/It_ipc_fdclr_001.cpp b/testsuites/unittest_old/signal/full/It_ipc_fdclr_001.cpp deleted file mode 100644 index 13fd61a4..00000000 --- a/testsuites/unittest_old/signal/full/It_ipc_fdclr_001.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" - -static const int TEST_LOOP_NUM = 4; -static const int TAR_STR_LEN = 12; - -static UINT32 Testcase(VOID) -{ - int pipeFd[TEST_LOOP_NUM][2], ret, i; // 2, pipe return 2 file descirpter - int fdmax = 0; - struct timeval tv; - fd_set reads; - FD_ZERO(&reads); - tv.tv_sec = 1; - tv.tv_usec = 50; // 50, overtime setting - for (i = 0; i < TEST_LOOP_NUM; i++) { - ret = pipe(pipeFd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - fdmax = pipeFd[i][1] > fdmax ? pipeFd[i][1] : fdmax; - ret = write(pipeFd[i][1], "aloha world", TAR_STR_LEN); - printf("write first status: %d\n", ret); - ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); - } - printf("next is select ...\n"); - ret = select(fdmax + 1, &reads, NULL, NULL, &tv); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - printf("select passed &&&&&&&&&&&&&&&&\n"); - FD_SET(pipeFd[0][0], &reads); - ret = select(fdmax + 1, &reads, NULL, NULL, &tv); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT1); - ret = FD_ISSET(pipeFd[0][0], &reads); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - FD_SET(pipeFd[1][0], &reads); - FD_SET(pipeFd[2][0], &reads); // 2, pipe return on the 2nd loop - FD_SET(pipeFd[3][0], &reads); // 3, pipe return on the 3rd loop - FD_CLR(pipeFd[3][0], &reads); // 3, pipe return on the 3rd loop - FD_CLR(pipeFd[2][0], &reads); // 2, pipe return on the 2nd loop - ret = select(fdmax + 1, &reads, NULL, NULL, &tv); - ICUNIT_GOTO_EQUAL(ret, 2, ret, EXIT1); // 2, expect selcet return value - ret = FD_ISSET(pipeFd[1][0], &reads); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ret = FD_ISSET(pipeFd[0][0], &reads); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - ret = FD_ISSET(pipeFd[2][0], &reads); // 2, pipe return on the 2nd loop - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - ret = FD_ISSET(pipeFd[3][0], &reads); // 3, pipe return on the 3rd loop - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - for (i = 0; i < TEST_LOOP_NUM; i++) { - close(pipeFd[i][0]); - close(pipeFd[i][1]); - } - - return LOS_OK; -EXIT1: - i = TEST_LOOP_NUM - 1; -EXIT: - for (i; i >= 0; i--) { - close(pipeFd[i][0]); - close(pipeFd[i][1]); - } - return LOS_NOK; -} - -VOID ItIpcFdClr001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/It_ipc_fdset_001.cpp b/testsuites/unittest_old/signal/full/It_ipc_fdset_001.cpp deleted file mode 100644 index dda0395b..00000000 --- a/testsuites/unittest_old/signal/full/It_ipc_fdset_001.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" - - -static const int TEST_LOOP_NUM = 4; -static const int TAR_STR_LEN = 12; - -static UINT32 Testcase(VOID) -{ - int pipeFd[TEST_LOOP_NUM][2], ret, i; // 2, pipe return 2 file descirpter - int fdmax = 0; - struct timeval tv; - fd_set reads; - FD_ZERO(&reads); - - tv.tv_sec = 1; - tv.tv_usec = 50; // 50, overtime setting - for (i = 0; i < TEST_LOOP_NUM; i++) { - ret = pipe(pipeFd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - fdmax = pipeFd[i][1] > fdmax ? pipeFd[i][1] : fdmax; - fdmax = pipeFd[i][0] > fdmax ? pipeFd[i][0] : fdmax; - ret = write(pipeFd[i][1], "Aloha World", TAR_STR_LEN); - printf("write first status: %d\n", ret); - ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); - } - - ret = select(fdmax + 1, &reads, NULL, NULL, &tv); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - FD_SET(pipeFd[0][0], &reads); - ret = select(fdmax + 1, &reads, NULL, NULL, &tv); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT1); - ret = FD_ISSET(pipeFd[0][0], &reads); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - FD_SET(pipeFd[1][0], &reads); - FD_SET(pipeFd[2][0], &reads); // 2, pipe return on the 2nd loop - FD_SET(pipeFd[3][0], &reads); // 3, pipe return on the 3rd loop - ret = select(fdmax + 1, &reads, NULL, NULL, &tv); - ICUNIT_GOTO_EQUAL(ret, TEST_LOOP_NUM, ret, EXIT1); - - for (i = 0; i < TEST_LOOP_NUM; i++) { - ret = FD_ISSET(pipeFd[i][0], &reads); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - } - - for (i = 0; i < TEST_LOOP_NUM; i++) { - close(pipeFd[i][0]); - close(pipeFd[i][1]); - } - printf("-----------FD_SET ok------------\n"); - return LOS_OK; -EXIT1: - i = TEST_LOOP_NUM - 1; -EXIT: - for (i; i >= 0; i--) { - close(pipeFd[i][0]); - close(pipeFd[i][1]); - } - return LOS_NOK; -} - -VOID ItIpcFdSet001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/It_ipc_fdzero_001.cpp b/testsuites/unittest_old/signal/full/It_ipc_fdzero_001.cpp deleted file mode 100644 index 33a45823..00000000 --- a/testsuites/unittest_old/signal/full/It_ipc_fdzero_001.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" - - -static const int TEST_LOOP_NUM = 4; -static const int TAR_STR_LEN = 12; - -static UINT32 Testcase(VOID) -{ - int pipeFd[TEST_LOOP_NUM][2], ret, i; // 2, pipe return 2 file descirpter - int fdmax = 0; - struct timeval tv; - fd_set reads; - FD_ZERO(&reads); - - tv.tv_sec = 1; - tv.tv_usec = 50; // 50, overtime setting - for (i = 0; i < TEST_LOOP_NUM; i++) { - ret = pipe(pipeFd[i]); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - fdmax = pipeFd[i][1] > fdmax ? pipeFd[i][1] : fdmax; - ret = write(pipeFd[i][1], "Aloha world", TAR_STR_LEN); - printf("write first status: %d\n", ret); - ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); - } - - ret = select(fdmax + 1, &reads, NULL, NULL, &tv); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - FD_SET(pipeFd[0][0], &reads); - ret = select(fdmax + 1, &reads, NULL, NULL, &tv); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT1); - ret = FD_ISSET(pipeFd[0][0], &reads); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT1); - - FD_SET(pipeFd[1][0], &reads); - FD_SET(pipeFd[2][0], &reads); // 2, pipe return on the 2nd loop - FD_SET(pipeFd[3][0], &reads); // 3, pipe return on the 3rd loop - FD_ZERO(&reads); - ret = select(fdmax + 1, &reads, NULL, NULL, &tv); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - - for (i = 0; i < TEST_LOOP_NUM; i++) { - ret = FD_ISSET(pipeFd[i][0], &reads); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - } - - for (i = 0; i < TEST_LOOP_NUM; i++) { - close(pipeFd[i][0]); - close(pipeFd[i][1]); - } - - return LOS_OK; -EXIT1: - i = TEST_LOOP_NUM - 1; -EXIT: - for (i; i >= 0; i--) { - close(pipeFd[i][0]); - close(pipeFd[i][1]); - } - return LOS_NOK; -} - -VOID ItIpcFdZero001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/It_ipc_pipe_002.cpp b/testsuites/unittest_old/signal/full/It_ipc_pipe_002.cpp deleted file mode 100644 index be0e2578..00000000 --- a/testsuites/unittest_old/signal/full/It_ipc_pipe_002.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "sys/shm.h" - -static UINT32 Testcase(VOID) -{ - int pipeFd[2], ret, spid; // 2, pipe return 2 file descripter - char buffer[20]; // 20, target buffer size - int *sharedflag = NULL; - int shmid; - - ret = pipe(pipeFd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - shmid = shmget((key_t)IPC_PRIVATE, sizeof(int), 0666 | IPC_CREAT); // 0666 the authority of the shm - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - sharedflag = (int *)shmat(shmid, NULL, 0); - *sharedflag = 0; - - spid = fork(); - ICUNIT_GOTO_NOT_EQUAL(spid, -1, spid, EXIT1); - if (spid == 0) { - sharedflag = (int *)shmat(shmid, NULL, 0); - close(pipeFd[0]); - ret = write(pipeFd[1], "hello world", 12); // 12, "hello world" length and '\0' - printf("write first status: %d\n", ret); - if (ret != 12) { // 12, "hello world" length and '\0' - exit(11); // 11, the value of son process unexpect exit, convenient to debug - } - *sharedflag = 1; - close(pipeFd[1]); - exit(RED_FLAG); - } - close(pipeFd[1]); - // waitting for the sub process has written the sentence - while (*sharedflag != 1) { - usleep(1); - } - ret = read(pipeFd[0], buffer, 12); // 12, "hello world" length and '\0' - ICUNIT_GOTO_EQUAL(ret, 12, ret, EXIT); // 12, "hello world" length and '\0' - ret = strcmp(buffer, "hello world"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - printf("read pipe success: %s\n", buffer); - wait(&ret); - printf("son return status: %d\n", WEXITSTATUS(ret)); - ICUNIT_GOTO_EQUAL(WEXITSTATUS(ret), RED_FLAG, WEXITSTATUS(ret), EXIT); - printf("pipe ok\n"); - close(pipeFd[0]); - return LOS_OK; -EXIT: - close(pipeFd[0]); -EXIT1: - return LOS_NOK; -} - -VOID ItIpcPipe002(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/It_ipc_pipe_003.cpp b/testsuites/unittest_old/signal/full/It_ipc_pipe_003.cpp deleted file mode 100644 index e19417f8..00000000 --- a/testsuites/unittest_old/signal/full/It_ipc_pipe_003.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "sys/shm.h" - -static const int TAR_STR_LEN = 12; - -static UINT32 Testcase(VOID) -{ - int pipeFd[2], ret, spid; // 2, pipe return 2 file descripter - char buffer[20]; // 20, target buffer size - int *sharedflag = NULL; - int shmid; - - ret = pipe(pipeFd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - shmid = shmget((key_t)IPC_PRIVATE, sizeof(int), 0666 | IPC_CREAT); // 0666 the authority of the shm - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - sharedflag = (int *)shmat(shmid, NULL, 0); - *sharedflag = 0; - - spid = fork(); - ICUNIT_GOTO_NOT_EQUAL(spid, -1, spid, EXIT1); - if (spid == 0) { - sharedflag = (int *)shmat(shmid, NULL, 0); - close(pipeFd[0]); - ret = write(pipeFd[1], "Hello world", TAR_STR_LEN); - printf("write first status: %d\n", ret); - if (ret != TAR_STR_LEN) { - exit(11); // 11, the value of son process unexpect exit, convenient to debug - } - *sharedflag = 1; - close(pipeFd[1]); - exit(RED_FLAG); - } - close(pipeFd[1]); - // waitting for the sub process has written the sentence - while (*sharedflag != 1) { - usleep(1); - } - ret = read(pipeFd[0], buffer, TAR_STR_LEN); - ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); - ret = strcmp(buffer, "Hello world"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - printf("read pipe success: %s\n", buffer); - wait(&ret); - printf("son return status: %d\n", WEXITSTATUS(ret)); - ICUNIT_GOTO_EQUAL(WEXITSTATUS(ret), RED_FLAG, WEXITSTATUS(ret), EXIT); - printf("pipe ok\n"); - close(pipeFd[0]); - return LOS_OK; -EXIT: - close(pipeFd[0]); -EXIT1: - return LOS_NOK; -} - -VOID ItIpcPipe003(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/It_ipc_sigaction_001.cpp b/testsuites/unittest_old/signal/full/It_ipc_sigaction_001.cpp deleted file mode 100644 index 14f33ef6..00000000 --- a/testsuites/unittest_old/signal/full/It_ipc_sigaction_001.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" - - -static int g_actionCnt1; -static void CatchAction1(int param) -{ - g_actionCnt1++; - printf("---------%d---signum-%d-----\n", g_actionCnt1, param); -} - -static UINT32 Testcase(VOID) -{ - int spid, ret; - struct sigaction act, oldact; - act.sa_handler = CatchAction1; - sigemptyset(&act.sa_mask); - act.sa_flags = 0; - spid = fork(); - ICUNIT_ASSERT_NOT_EQUAL(spid, -1, spid); - if (spid == 0) { - ret = sigaction(SIGCHLD, &act, &oldact); - if (ret == -1) { - exit(-1); - } - spid = fork(); - if (spid == 0) { - spid = getppid(); - kill(spid, SIGCHLD); - usleep(1000 * 10 * 10); // 1000, 10, 10, Used to calculate the delay time. - exit(0); - } - if (spid == -1) { - exit(-1); - } - ret = 0; - while (ret == 0) { - ret = waitpid(spid, NULL, WNOHANG); - } - - ret = sigaction(SIGCHLD, &oldact, NULL); - if (ret == -1) { - exit(6); // 6, the value of son process unexpect exit, convenient to debug - } - sleep(1); - printf("---son--cnt check----%d--------\n", g_actionCnt1); - exit(g_actionCnt1); - } - wait(&ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(ret), 2, WEXITSTATUS(ret)); // 2, assert that function Result is equal to this. - return LOS_OK; -} - -VOID ItIpcSigaction001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/It_ipc_sigpause_001.cpp b/testsuites/unittest_old/signal/full/It_ipc_sigpause_001.cpp deleted file mode 100644 index 69532df7..00000000 --- a/testsuites/unittest_old/signal/full/It_ipc_sigpause_001.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" - - -static void CatchAction3(int param) -{ - printf("son recv signal: SIGUSR1\n"); -} - -static UINT32 Testcase(VOID) -{ - int spid = 0; - int retval = 0; - - struct sigaction act; - act.sa_handler = CatchAction3; - act.sa_flags = 0; - spid = fork(); - ICUNIT_ASSERT_NOT_EQUAL(spid, -1, spid); - if (spid == 0) { - retval = sigemptyset(&act.sa_mask); - if (retval == -1) { - exit(-1); - } - retval = sigaction(SIGUSR1, &act, NULL); - if (retval == -1) { - exit(-1); - } - printf("enter sigpause...\n"); - retval = sigpause(SIGUSR1); - retval = RED_FLAG; - printf("son retval check %d\n", retval); - exit(retval); - } - sleep(2); // 2, sleep 2 second - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - printf("send signal to %d: SIGUSR1...\n", spid); - kill(spid, SIGUSR1); - wait(&retval); - printf("father retval check %d\n", WEXITSTATUS(retval)); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(retval), RED_FLAG, WEXITSTATUS(retval)); - return LOS_OK; -} - -VOID ItIpcSigpause001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/It_ipc_sigprocmask_001.cpp b/testsuites/unittest_old/signal/full/It_ipc_sigprocmask_001.cpp deleted file mode 100644 index 4ce04ff1..00000000 --- a/testsuites/unittest_old/signal/full/It_ipc_sigprocmask_001.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" - - -static UINT32 Testcase(VOID) -{ - int spid = 0; - int retval = 0; - - sigset_t set, oldset; - spid = fork(); - ICUNIT_ASSERT_NOT_EQUAL(spid, -1, spid); - if (spid == 0) { - retval = sigemptyset(&set); - if (retval == -1) { - exit(-1); - } - retval = sigemptyset(&oldset); - if (retval == -1) { - exit(-1); - } - retval = sigaddset(&set, SIGTERM); - if (retval == -1) { - exit(-1); - } - retval = sigprocmask(SIG_BLOCK, &set, &oldset); - if (retval == -1) { - exit(-1); - } - sleep(2); // 2, sleep 2 second - retval = RED_FLAG; - printf("son retval check %d\n", retval); - exit(retval); - } - sleep(1); - kill(spid, SIGTERM); - wait(&retval); - printf("father retval check %d\n", WEXITSTATUS(retval)); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(retval), RED_FLAG, WEXITSTATUS(retval)); - return LOS_OK; -} - -VOID ItIpcSigpromask001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/pipe_test_001.cpp b/testsuites/unittest_old/signal/full/pipe_test_001.cpp deleted file mode 100644 index 12332532..00000000 --- a/testsuites/unittest_old/signal/full/pipe_test_001.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "fcntl.h" - -int TestPipeSingleProcess() -{ - int pipefd[2]; // 2, array subscript - int retValue = -1; - pid_t pid; - retValue = pipe(pipefd); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - int *readFd = &pipefd[0]; - int *writeFd = &pipefd[1]; - - char readbuffer[100]; // 100, array subscript - int status, ret; - - int flag = fcntl(*readFd, F_GETFL); - fcntl(*readFd, F_SETFL, flag | O_NONBLOCK); - - pid = fork(); - if (pid == -1) { - printf("Fork Error!\n"); - return -1; - } else if (pid == 0) { - for (int i = 0; i < 3; i++) { // 3, Number of cycles - errno = 0; - char sentence1[15] = "Hello World"; - char a[4] = {0}; - sprintf(a, "%d", i); - strcat(sentence1, a); - int ret = write(*writeFd, sentence1, strlen(sentence1) + 1); - usleep(100000); // 100000, Used to calculate the delay time. - - printf("read\n"); - memset(readbuffer, 0, sizeof(readbuffer)); - retValue = read(*readFd, readbuffer, sizeof(readbuffer)); - printf("Receive %d bytes data : %s,%d\n", retValue, readbuffer, errno); - if (strncmp((readbuffer), (readbuffer), (strlen(sentence1))) != 0) { - exit(errno); - } - usleep(100000); // 100000, Used to calculate the delay time. - } - exit(0); - } - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - ret = unlink("/dev/pipe0"); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = close(pipefd[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = unlink("/dev/pipe0"); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = close(pipefd[1]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = unlink("/dev/pipe0"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - - -void ItPosixPipe001(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestPipeSingleProcess, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/pipe_test_003.cpp b/testsuites/unittest_old/signal/full/pipe_test_003.cpp deleted file mode 100644 index 09b90ab1..00000000 --- a/testsuites/unittest_old/signal/full/pipe_test_003.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "fcntl.h" - -int TestPipeSingleProcessFcntl() -{ - int pipefd[2]; // 2, array subscript - pid_t pid; - int retValue = -1; - retValue = pipe(pipefd); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - int *readFd = &pipefd[0]; - int *writeFd = &pipefd[1]; - - char readbuffer[100]; - int status, ret; - - int flag = fcntl(*readFd, F_GETFL); - fcntl(*readFd, F_SETFL, flag | O_NONBLOCK); - - pid = fork(); - if (pid == -1) { - printf("Fork Error!\n"); - return -1; - } else if (pid == 0) { - for (int i = 0; i < 3; i++) { // 3, Number of cycles - errno = 0; - char sentence1[15] = "Hello World"; - char a[4] = {0}; - sprintf(a, "%d", i); - strcat(sentence1, a); - int ret = write(*writeFd, sentence1, strlen(sentence1) + 1); - usleep(100000); // 100000, Used to calculate the delay time. - } - char sentence1[15] = "Hello World"; - char a[4] = {0}; - usleep(10000); // 10000, Used to calculate the delay time. - printf("read\n"); - memset(readbuffer, 0, sizeof(readbuffer)); - retValue = read(*readFd, readbuffer, sizeof(readbuffer)); - printf("Receive %d bytes data : %s,%d\n", retValue, readbuffer, errno); - printf("Receive %d bytes data : %s,%d\n", retValue, readbuffer + 13, errno); // 13, readbuffer offset. - printf("Receive %d bytes data : %s,%d\n", retValue, readbuffer + 26, errno); // 26, readbuffer offset. - ICUNIT_ASSERT_SIZE_STRING_EQUAL(readbuffer, "Hello World0", strlen(sentence1), errno); - ICUNIT_ASSERT_SIZE_STRING_EQUAL(readbuffer + 13, "Hello World1", strlen(sentence1), errno); // 13, readbuffer offset. - ICUNIT_ASSERT_SIZE_STRING_EQUAL(readbuffer + 26, "Hello World2", strlen(sentence1), errno); // 26, readbuffer offset. - usleep(100000); // 100000, Used to calculate the delay time. - - printf("read\n"); - memset(readbuffer, 0, sizeof(readbuffer)); - fcntl(*readFd, F_SETFL, O_NONBLOCK); - ret = fcntl(*readFd, F_GETFL, O_NONBLOCK); - printf("fctrl ret=%d,O_NONBLOCK=%d\n", ret, O_NONBLOCK); - retValue = read(*readFd, readbuffer, sizeof(readbuffer)); - printf("Receive %d bytes data : %s,%d\n", retValue, readbuffer, errno); - - ICUNIT_ASSERT_EQUAL(retValue, -1, retValue); - ICUNIT_ASSERT_EQUAL(errno, EAGAIN, errno); - ICUNIT_ASSERT_SIZE_STRING_EQUAL(readbuffer, readbuffer, strlen(sentence1), errno); - usleep(100000); // 100000, Used to calculate the delay time. - exit(0); - } - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ret = close(pipefd[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = close(pipefd[1]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -void ItPosixPipe003(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestPipeSingleProcessFcntl, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/pipe_test_005.cpp b/testsuites/unittest_old/signal/full/pipe_test_005.cpp deleted file mode 100644 index 9b490529..00000000 --- a/testsuites/unittest_old/signal/full/pipe_test_005.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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. - */ -#include "sys/shm.h" -#include "it_test_signal.h" -#include "signal.h" - -static void SigPrint(int signum) -{ - printf("Pipe break\n"); -} - -static int PipecommonWrite() -{ - int pipefd[2]; // 2, array subscript - pid_t pid; - int retValue = -1; - int *sharedflag = NULL; - int shmid; - int *readFd = &pipefd[0]; - int *writeFd = &pipefd[1]; - char sentence[] = "Hello World"; - char readbuffer[100]; - int status, ret; - - retValue = pipe(pipefd); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - if (signal(SIGPIPE, SigPrint) == SIG_ERR) { - printf("signal error\n"); - } - - shmid = shmget((key_t)IPC_PRIVATE, sizeof(int), 0666 | IPC_CREAT); // 0666 the authority of the shm - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - sharedflag = (int *)shmat(shmid, NULL, 0); - *sharedflag = 0; - - pid = fork(); - if (pid == -1) { - printf("Fork Error!\n"); - return -1; - } else if (pid == 0) { - sharedflag = (int *)shmat(shmid, NULL, 0); - close(*readFd); - retValue = write(*writeFd, sentence, strlen(sentence) + 1); - ICUNIT_ASSERT_EQUAL(retValue, strlen(sentence) + 1, retValue); - *sharedflag = 1; - // 2 waitting for the father process close the pipe's read port - while (*sharedflag != 2) { - usleep(1); - } - retValue = write(*writeFd, sentence, strlen(sentence) + 1); - ICUNIT_ASSERT_EQUAL(retValue, -1, retValue); - ICUNIT_ASSERT_EQUAL(errno, EPIPE, errno); - exit(0); - } else { - close(*writeFd); - // 1 waitting for the sub process has written the sentence first - while (*sharedflag != 1) { - usleep(1); - } - close(*readFd); - // 2 father process close the pipe's read port - *sharedflag = 2; - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - } - return 0; -} - -void ItPosixPipe005(void) -{ - TEST_ADD_CASE(__FUNCTION__, PipecommonWrite, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/pipe_test_006.cpp b/testsuites/unittest_old/signal/full/pipe_test_006.cpp deleted file mode 100644 index c0da9ea7..00000000 --- a/testsuites/unittest_old/signal/full/pipe_test_006.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static const int MAX_PIPES = 32; - -static int PipeUnlinkTest() -{ - int pipefd[MAX_PIPES][2]; // 2, array subscript - int tmpFd[2]; - pid_t pid; - int retValue = -1; - - int status, ret; - char devName[60]; // 60, array subscript - pid = fork(); - if (pid == -1) { - printf("Fork Error!\n"); - return -1; - } else if (pid == 0) { - for (int i = 0; i < MAX_PIPES; i++) { - retValue = pipe(pipefd[i]); - ICUNIT_ASSERT_EQUAL_EXIT(retValue, 0, __LINE__); - } - retValue = pipe(tmpFd); - ICUNIT_ASSERT_EQUAL_EXIT(retValue, -1, __LINE__); - for (int i = 0; i < MAX_PIPES; i++) { - snprintf(devName, 60, "/dev/pipe%d", i); // 60, len of max size - retValue = unlink(devName); - ICUNIT_ASSERT_EQUAL_EXIT(retValue, -1, __LINE__); - retValue = close(pipefd[i][0]); - ICUNIT_ASSERT_EQUAL_EXIT(retValue, 0, __LINE__); - retValue = unlink(devName); - ICUNIT_ASSERT_EQUAL_EXIT(retValue, -1, __LINE__); - retValue = close(pipefd[i][1]); - ICUNIT_ASSERT_EQUAL_EXIT(retValue, 0, __LINE__); - retValue = unlink(devName); - ICUNIT_ASSERT_EQUAL_EXIT(retValue, 0, __LINE__); - } - exit(0); - } - usleep(15000); // 15000, Used to calculate the delay time. - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - return 0; -} - - -void ItPosixPipe006(void) -{ - TEST_ADD_CASE(__FUNCTION__, PipeUnlinkTest, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_001.cpp b/testsuites/unittest_old/signal/full/signal_test_001.cpp deleted file mode 100644 index cc7d2510..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_001.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "sys/wait.h" - -static const int SIG_TEST_COUNT = 3; -static int g_sigCount = 0; -static void SigPrint(int sig) -{ - g_sigCount++; -} - -static int TestRaiseMuliti() -{ - int sig = SIGTERM; - int count = 0; - void (*ret)(int); - int retValue; - - g_sigCount = 0; - ret = signal(sig, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(ret, NULL, ret); - - while (1) { - retValue = raise(sig); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - usleep(10000); // 10000, Used to calculate the delay time. - count++; - if (count >= SIG_TEST_COUNT) { - break; - } - } - - return g_sigCount; -} - -static int TestCase(void) -{ - int count = TestRaiseMuliti(); - ICUNIT_ASSERT_EQUAL(count, SIG_TEST_COUNT, count); - - int pid = fork(); - if (pid == 0) { - int retValue; - printf("sigprocmask(1, NULL, NULL);\n"); - retValue = sigprocmask(1, NULL, NULL); - if (retValue != 0) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - printf("raise(SIGSTOP);\n"); - raise(SIGSTOP); - - int ret = kill(10, 0); // 10, kill process pid. - if (retValue != -1 || errno != ESRCH) { - exit(-1); - } - - ret = kill(99999, 0); // 99999, kill process pid. - if (retValue != -1 || errno != ESRCH) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - ret = kill(10, 31); // 10, kill process pid; 31, sigal. - if (retValue != -1 || errno != EINVAL) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - ret = kill(10, 32); // 10, kill process pid; 32, sigal. - if (retValue != -1 || errno != EINVAL) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - - ret = kill(2, 32); // 2, kill process pid; 32, sigal. - if (retValue != -1 || errno != EINVAL) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - - printf("test EPERM begin\n"); - ret = kill(2, 5); // 2, kill process pid; 5, sigal. - if (retValue != -1 || errno != EPERM) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - - ret = kill(3, 5); // 3, kill process pid; 5, sigal. - if (retValue != -1 || errno != EPERM) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - - ret = kill(0, 5); // 5, kill sigal num. - if (retValue != -1 || errno != EPERM) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - - ret = kill(1, 5); // 5, kill sigal num . - if (retValue != -1 || errno != EPERM) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - - printf("test kill ok\n"); - retValue = raise(SIGSTOP); - if (retValue != 0) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - int status, rt; - signal(SIGALRM, SigPrint); - sigset_t sigmask, oldmask, pending; - sigemptyset(&sigmask); - sigemptyset(&oldmask); - sigemptyset(&pending); - sigpending(&pending); - if (sigisemptyset(&pending) != 1) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - sigaddset(&sigmask, SIGALRM); - sigaddset(&sigmask, SIGUSR1); - sigprocmask(SIG_BLOCK, &sigmask, &oldmask); - sigpending(&pending); - if (sigisemptyset(&pending) != 1) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - if (sigisemptyset(&oldmask) != 1) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - - printf("1 pending=%d\n", pending.__bits[0]); - printf("1 oldmask=%d\n", oldmask.__bits[0]); - printf("before raise\n"); - raise(SIGALRM); - printf("after raise\n"); - sigpending(&pending); - if (sigismember(&pending, SIGALRM) != 1) { - printf("errline = %d\n", __LINE__); - exit(-1); - } - printf("pending=%d,sigismem = %d\n", pending.__bits[0], sigismember(&pending, SIGALRM)); - exit(0); - } - sleep(1); - int status; - signal(SIGALRM, SIG_DFL); - int retValue = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, pid, retValue); - return 0; -} - -void ItPosixSignal001(void) -{ - TEST_ADD_CASE("IT_POSIX_SIGNAL_001", TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_003.cpp b/testsuites/unittest_old/signal/full/signal_test_003.cpp deleted file mode 100644 index ce0c1727..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_003.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "sys/wait.h" - -static const int SIG_TEST_COUNT = 3; -static int g_sigCount = 0; -static void SigPrint(int sig) -{ - g_sigCount++; -} - -static int TestRaise() -{ - int count = 0; - int status = 0; - int fpid; - int fatherPid; - int sonPid; - void (*ret)(int) = NULL; - int retValue; - - g_sigCount = 0; - ret = signal(SIGTERM, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(ret, NULL, ret); - retValue = raise(SIGTERM); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - fatherPid = getpid(); - fpid = fork(); - // fpid check err - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - while (1) { - usleep(500000); // 500000, Used to calculate the delay time. - count++; - if (g_sigCount == SIG_TEST_COUNT) { - break; - } - // check child process num - // 0 means count should be positive and 2 controls the upper bound of count - if ((count) < (0) || (count) > (SIG_TEST_COUNT * 2)) { - exit(count); - } - } - exit(0); - } else { // parent threa - sonPid = fpid; - usleep(10); // 10, Used to calculate the delay time. - while (1) { - retValue = kill(sonPid, SIGTERM); - - sleep(1); - count++; - if (count == SIG_TEST_COUNT) { - break; - } - } - retValue = waitpid(sonPid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, sonPid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - } - return g_sigCount; -} - -static int TestCase(void) -{ - int count = TestRaise(); - // count should be 1, for global variables are not shared between different processors - ICUNIT_ASSERT_EQUAL(count, 1, count); - return 0; -} - -void ItPosixSignal003(void) -{ - TEST_ADD_CASE("IT_POSIX_SIGNAL_003", TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_004.cpp b/testsuites/unittest_old/signal/full/signal_test_004.cpp deleted file mode 100644 index 2e65400b..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_004.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "sys/wait.h" - -static const int SIG_TEST_COUNT = 3; -static int g_sigCount = 0; -static void SigPrint(int sig) -{ - g_sigCount++; -} - -/* child process kill msg to father , father receive msg and do func , wake up the pend thread */ -static int TestRaiseWake() -{ - int count = 0; - int fpid; - int fatherPid; - int status, retValue; - void (*retSig)(int); - - g_sigCount = 0; - retSig = signal(SIGTERM, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - fatherPid = getpid(); - fpid = fork(); - // fpid check err - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - while (1) { - retValue = kill(fatherPid, SIGTERM); - if (retValue != 0) { - exit(retValue); - } - usleep(100000); // 100000, Used to calculate the delay time. - count++; - if (count == SIG_TEST_COUNT) { - break; - } - } - exit(0); - } else { // parent threa - usleep(10); // 10, Used to calculate the delay time. - while (1) { - count++; - usleep(3000); // 3000, Used to calculate the delay time. - if (g_sigCount == SIG_TEST_COUNT) { - break; - } - // check child process num - ICUNIT_ASSERT_WITHIN_EQUAL(count, 0, SIG_TEST_COUNT * 30, count); // 30, assert that function Result is equal to this. - } - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - } - return g_sigCount; -} - -static int TestCase(void) -{ - int retValue, status; - - int fpid = fork(); - if (fpid == 0) { - retValue = TestRaiseWake(); - if (retValue != SIG_TEST_COUNT) { - exit(retValue); - } - exit(0); - } - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - return 0; -} - -void ItPosixSignal004(void) -{ - TEST_ADD_CASE("IT_POSIX_SIGNAL_004", TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_005.cpp b/testsuites/unittest_old/signal/full/signal_test_005.cpp deleted file mode 100644 index b70c58ab..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_005.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "sys/wait.h" - -static void SigPrint(int sig) -{ - printf("rase\n"); -} -static int TestSigDefAction() -{ - void (*ret)(int); - int retValue; - - ret = signal(SIGALRM, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(ret, NULL, ret); - retValue = raise(SIGALRM); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - sleep(1); - retValue = raise(SIGALRM); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - return 0; -} - -void ItPosixSignal005(void) -{ - TEST_ADD_CASE("IT_POSIX_SIGNAL_005", TestSigDefAction, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_006.cpp b/testsuites/unittest_old/signal/full/signal_test_006.cpp deleted file mode 100644 index b1644707..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_006.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "sys/wait.h" - -static void SigAlarm(int) -{ - printf("alert rings\n"); -} - -static int TestSigDefActionChild() -{ - int retValue, fpid, status; - void (*ret)(int) = NULL; - - ret = signal(SIGALRM, SigAlarm); - ICUNIT_ASSERT_NOT_EQUAL(ret, NULL, ret); - retValue = raise(SIGALRM); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - sleep(1); - fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - retValue = raise(SIGALRM); - if (retValue != 0) { - exit(retValue); - } - exit(0); - } - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - return 0; -} - -void ItPosixSignal006(void) -{ - TEST_ADD_CASE("IT_POSIX_SIGNAL_006", TestSigDefActionChild, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_007.cpp b/testsuites/unittest_old/signal/full/signal_test_007.cpp deleted file mode 100644 index 1fcb74ee..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_007.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "sys/wait.h" - -static int g_break = 0; -/* Sample : Father process want to free zombine child process */ -static void SigChildResponse(int signo) -{ - printf("Child Response\n"); - wait(nullptr); -} - -/* Register SIGCHLD, through signal to restore the child memery */ -static int TestSigKillResp() -{ - void (*ret)(int) = nullptr; - int fpid, fpids, status, retValue; - - signal(SIGCHLD, SigChildResponse); - fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - fpids = fork(); - if (fpids == 0) { - while (1) { - sleep(2); // 2, sleep 10 second. - } - } - usleep(10000); // 10000, Used to calculate the delay time. - retValue = kill(fpids, SIGKILL); - if (retValue != 0) { - exit(retValue); - } - retValue = waitpid(fpids, NULL, 0); - if (retValue != fpids) { - exit(retValue); - } - exit(0); - } - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - ret = signal(SIGCHLD, SIG_DFL); - - return 0; -} - -void ItPosixSignal007(void) -{ - TEST_ADD_CASE("IT_POSIX_SIGNAL_007", TestSigKillResp, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_008.cpp b/testsuites/unittest_old/signal/full/signal_test_008.cpp deleted file mode 100644 index dfac5669..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_008.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "sys/wait.h" - -/* Sample : Father process want to free zombine child process */ -void SigChildResponse(int signo) -{ - wait(nullptr); -} - -/* Register SIGCHLD, through signal to restore the child memery */ -static int TestSigKillWaitFromSigChild() -{ - void (*ret)(int); - int sig = SIGINT; - int fpid, fpids, status, retValue; - ret = signal(sig, SIG_IGN); - ICUNIT_ASSERT_NOT_EQUAL(ret, NULL, ret); - - ret = signal(sig, SigChildResponse); - ICUNIT_ASSERT_NOT_EQUAL(ret, NULL, ret); - fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - fpids = fork(); - if (fpids == 0) { - while (1) { - sleep(2); // 2, sleep 10 second. - } - } - usleep(10000); // 10000, Used to calculate the delay time. - retValue = kill(fpids, SIGKILL); - if (retValue != 0) { - exit(retValue); - } - retValue = waitpid(fpids, &status, 0); - if (retValue != fpids) { - exit(retValue); - } - exit(0); - } - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - ret = signal(sig, SIG_DFL); - ICUNIT_ASSERT_NOT_EQUAL(ret, NULL, ret); - - return 0; -} - -void ItPosixSignal008(void) -{ - TEST_ADD_CASE("IT_POSIX_SIGNAL_008", TestSigKillWaitFromSigChild, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, - TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_010.cpp b/testsuites/unittest_old/signal/full/signal_test_010.cpp deleted file mode 100644 index a8fa2800..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_010.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static int g_sigCount = 0; -static void SigPrint(int sig) -{ - g_sigCount++; -} - -static void SigPrint1(int sig) -{ - g_sigCount += 100; // 100, Used to calculate the progress of the program. -} - -static int TestSigWait() -{ - sigset_t set; - int sig, fpid, retValue, status; - void (*retSig)(int); - signal(SIGCHLD, SIG_DFL); - retSig = signal(SIGALRM, SigPrint1); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - - retSig = signal(SIGUSR1, SigPrint1); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - retValue = sigemptyset(&set); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGALRM); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - int count = 0; - fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - printf("sig wait begin\n"); - while (1) { - retValue = sigwait(&set, &sig); - if (retValue != 0) { - exit(retValue); - } - printf("sig wait end\n"); - count++; - if (count == 3) { // 3, Possible values for the current parameter - break; - } - } - exit(0); - } - sleep(1); - retValue = kill(fpid, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - sleep(1); - retValue = kill(fpid, SIGALRM); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - sleep(1); - retValue = kill(fpid, SIGALRM); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - signal(SIGALRM, SIG_DFL); - signal(SIGUSR1, SIG_DFL); - return 0; -} - -void ItPosixSignal010(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSigWait, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_011.cpp b/testsuites/unittest_old/signal/full/signal_test_011.cpp deleted file mode 100644 index 1e84c4da..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_011.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void SigPrint(int sig) -{ - return; -} - -static int TestSigTimeWait() -{ - sigset_t set; - int sig, fpid, retValue, status; - siginfo_t si; - struct timespec ts; - void (*retSig)(int); - ts.tv_sec = 2; // 2, set the sec of timeout. - ts.tv_nsec = 0; - retSig = signal(SIGALRM, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - - retSig = signal(SIGUSR1, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - retValue = sigemptyset(&set); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGALRM); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - int count = 0; - fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - printf("sig wait begin\n"); - while (1) { - retValue = sigtimedwait(&set, &si, &ts); - if (retValue == -1 && errno != EAGAIN) { - exit(errno); - } - printf("sig wait end\n"); - count++; - if (count == 3) { // 3, Possible values for the current parameter - break; - } - } - exit(0); - } - sleep(1); - retValue = kill(fpid, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - sleep(1); - retValue = kill(fpid, SIGALRM); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - signal(SIGALRM, SIG_DFL); - signal(SIGUSR1, SIG_DFL); - return 0; -} - -void ItPosixSignal011(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSigTimeWait, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_012.cpp b/testsuites/unittest_old/signal/full/signal_test_012.cpp deleted file mode 100644 index 1e14d2c2..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_012.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -void SigAlarm(int signum) -{ - printf("Alert Rings\n"); -} - -static int TestSigTimeWaitMultiPthread() -{ - int retValue; - int fpid, status; - - signal(SIGALRM, SigAlarm); - - fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - sigset_t waitSet; - retValue = sigemptyset(&waitSet); - if (retValue != 0) { - exit(retValue); - } - retValue = sigaddset(&waitSet, SIGALRM); - if (retValue != 0) { - exit(retValue); - } - - alarm(1); - int receivedSignal; - retValue = sigwait(&waitSet, &receivedSignal); - if (retValue != 0) { - exit(retValue); - } - if (receivedSignal != SIGALRM) { - exit(receivedSignal); - } - exit(0); - } - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - return 0; -} - -void ItPosixSignal012(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSigTimeWaitMultiPthread, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_015.cpp b/testsuites/unittest_old/signal/full/signal_test_015.cpp deleted file mode 100644 index 7e05440d..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_015.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static int g_sigCount = 0; -static void SigPrint(int sig) -{ - g_sigCount = 1; -} - -static int TestPauseNormal() -{ - void (*retSig)(int); - int retValue; - - int status; - errno = 0; - retSig = signal(SIGPWR, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - ICUNIT_ASSERT_EQUAL(errno, 0, errno); - - int fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - printf("child pause 1\n"); - sigset_t newset; - sigemptyset(&newset); - sigprocmask(SIG_SETMASK, &newset, nullptr); - sigaddset(&newset, SIGUSR1); - sigprocmask(SIG_BLOCK, &newset, nullptr); - int ret1 = pause(); - printf("child pause end 1 retSig = %d, errno=%d\n", ret1, errno); - exit(errno); - } - - sleep(1); - printf("father kill SIGUSR1 child not exec\n"); - retValue = kill(fpid, SIGUSR1); - sleep(1); - printf("father sleep then send signal to wake child\n"); - - retValue = kill(fpid, SIGPWR); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), EINTR, WEXITSTATUS(status)); - - /* Child pause, then father kill child */ - fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - printf("child pause 2\n"); - pause(); - if (g_sigCount != 1) { - exit(g_sigCount); - } - printf("child pause end 2\n"); - exit(0); - } - printf("father sleep 2 then send signal to wake child\n"); - sleep(1); - printf("father kill fpid = %d\n", fpid); - retValue = kill(fpid, SIGKILL); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WIFEXITED(status), 0, WIFEXITED(status)); - ICUNIT_ASSERT_EQUAL(WIFSIGNALED(status), 1, WIFSIGNALED(status)); - ICUNIT_ASSERT_EQUAL(WTERMSIG(status), SIGKILL, WTERMSIG(status)); - - return 0; -} - -void ItPosixSignal015(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestPauseNormal, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_016.cpp b/testsuites/unittest_old/signal/full/signal_test_016.cpp deleted file mode 100644 index e8bf1de3..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_016.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void SigPrint(int sig) -{ - printf("%s\n", __FUNCTION__, __LINE__); -} - -static void *ThreadSetFunc2(void *arg) -{ - int retValue; - - sigset_t set; - int sig; - retValue = sigemptyset(&set); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGALRM); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGUSR1); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - int count; - - retValue = sigwait(&set, &sig); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); -} - -static void *ThreadSetDfl(void *arg) -{ - int retValue; - - sigset_t set; - int sig; - retValue = sigemptyset(&set); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGALRM); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGUSR1); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - int count; - - retValue = sigwait(&set, &sig); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); -} - -static void *ThreadKill(void *arg) -{ - while (1) { - sleep(1); - } -} - -static int TestMultiPthreadKillPendNormal() -{ - int status, retValue, fpid; - pthread_t thread, thread1, thread2; - - fpid = fork(); - if (fpid == 0) { - retValue = pthread_create(&thread1, NULL, ThreadSetDfl, 0); - if (retValue != 0) { - exit(retValue); - } - retValue = pthread_create(&thread2, NULL, ThreadSetFunc2, 0); - if (retValue != 0) { - exit(retValue); - } - retValue = pthread_create(&thread, NULL, ThreadKill, 0); - if (retValue != 0) { - exit(retValue); - } - - pthread_join(thread, NULL); - pthread_join(thread1, NULL); - pthread_join(thread2, NULL); - - sigset_t set; - int sig; - retValue = sigemptyset(&set); - if (retValue != 0) { - exit(retValue); - } - retValue = sigaddset(&set, SIGALRM); - if (retValue != 0) { - exit(retValue); - } - retValue = sigaddset(&set, SIGUSR1); - if (retValue != 0) { - exit(retValue); - } - int count; - - retValue = sigwait(&set, &sig); - if (retValue != 0) { - exit(retValue); - } - printf("here exit\n"); - exit(0); - } - sleep(1); - /* Father kill child, then it will wake child */ - retValue = kill(fpid, SIGKILL); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - printf("father wait child dead\n"); - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - printf("status = %d\n", WEXITSTATUS(status)); - ICUNIT_ASSERT_EQUAL(WIFEXITED(status), 0, WIFEXITED(status)); - ICUNIT_ASSERT_EQUAL(WIFSIGNALED(status), 1, WIFSIGNALED(status)); - ICUNIT_ASSERT_EQUAL(WTERMSIG(status), SIGKILL, WTERMSIG(status)); - return 0; -} - -void ItPosixSignal016(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestMultiPthreadKillPendNormal, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_017.cpp b/testsuites/unittest_old/signal/full/signal_test_017.cpp deleted file mode 100644 index 91e50501..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_017.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void SigPrint(int sig) -{ - printf("%s\n", __FUNCTION__, __LINE__); -} - -static void *ThreadSetFunc2(void *arg) -{ - int retValue; - - sigset_t set; - int sig; - retValue = sigemptyset(&set); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGALRM); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGUSR1); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - int count; - - retValue = sigwait(&set, &sig); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); -} - -static void *ThreadSetDfl(void *arg) -{ - int retValue; - - sigset_t set; - int sig; - retValue = sigemptyset(&set); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGALRM); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGUSR1); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - int count; - - retValue = sigwait(&set, &sig); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); -} - -static void *ThreadKill(void *arg) -{ - int retValue; - - sigset_t set; - int sig; - retValue = sigemptyset(&set); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGALRM); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGUSR1); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); - int count; - - retValue = sigwait(&set, &sig); - ICUNIT_ASSERT_EQUAL_NULL(retValue, 0, retValue); -} - -static int TestMultiPthreadFatherProcessExit() -{ - int status = 0; - int retValue; - int fpid, fpids; - - pthread_t thread, thread1, thread2; - int father; - - fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - fpids = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpids, 0, UINT_MAX, fpids); - if (fpids == 0) { - retValue = pthread_create(&thread, NULL, ThreadKill, 0); - if (retValue != 0) { - exit(retValue); - } - retValue = pthread_create(&thread2, NULL, ThreadSetFunc2, 0); - if (retValue != 0) { - exit(retValue); - } - retValue = pthread_create(&thread1, NULL, ThreadSetDfl, 0); - if (retValue != 0) { - exit(retValue); - } - - father = getppid(); - printf("fatherPid = %d\n", father); - sleep(1); - printf("child kill father = %d\n", father); - retValue = kill(father, SIGKILL); - if (retValue != 0) { - exit(retValue); - } - } - sleep(1); - retValue = waitpid(fpids, &status, 0); - // grandchild process kill father process, so child process is recovered by init process - // child process doesn't receive termination singal from grandchild process - // so waitpid() returns -1 - ICUNIT_ASSERT_EQUAL(retValue, -1, retValue); - exit(1); - } - sleep(1); - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WIFEXITED(status), 0, WIFEXITED(status)); - ICUNIT_ASSERT_EQUAL(WIFSIGNALED(status), 1, WIFSIGNALED(status)); - ICUNIT_ASSERT_EQUAL(WTERMSIG(status), SIGKILL, WTERMSIG(status)); - return 0; -} - -void ItPosixSignal017(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestMultiPthreadFatherProcessExit, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_018.cpp b/testsuites/unittest_old/signal/full/signal_test_018.cpp deleted file mode 100644 index 7649e889..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_018.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void SigPrint(int sig) -{ - printf("%s\n", __FUNCTION__, __LINE__); -} - -static int TestSigTimeWaitKillProcess() -{ - sigset_t set; - int sig, fpid, retValue, status; - siginfo_t si; - struct timespec ts; - - ts.tv_sec = 2; // 2, set the sec of timeout. - ts.tv_nsec = 0; - void (*retSig)(int); - retSig = signal(SIGALRM, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - - retSig = signal(SIGUSR1, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - retValue = sigemptyset(&set); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGALRM); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - int count = 0; - fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - printf("sig wait begin\n"); - while (1) { - retValue = sigtimedwait(&set, &si, &ts); - if (retValue != SIGUSR1) { - exit(retValue); - } - printf("sig wait end\n"); - count++; - if (count == 3) { // 3, Possible values for the current parameter - break; - } - } - exit(0); - } - sleep(1); - retValue = kill(fpid, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - sleep(1); - retValue = kill(fpid, SIGKILL); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WIFEXITED(status), 0, WIFEXITED(status)); - ICUNIT_ASSERT_EQUAL(WIFSIGNALED(status), 1, WIFSIGNALED(status)); - ICUNIT_ASSERT_EQUAL(WTERMSIG(status), SIGKILL, WTERMSIG(status)); - - signal(SIGALRM, SIG_DFL); - signal(SIGUSR1, SIG_DFL); - return 0; -} - - -void ItPosixSignal018(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSigTimeWaitKillProcess, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_019.cpp b/testsuites/unittest_old/signal/full/signal_test_019.cpp deleted file mode 100644 index 22ed0ac0..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_019.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void SigPrint(int sig) -{ - printf("%s\n", __FUNCTION__, __LINE__); -} - -static int TestSigTimeWaitDirectKillChild() -{ - sigset_t set; - int sig, fpid, retValue, status; - siginfo_t si; - struct timespec ts; - - ts.tv_sec = 2; // 2, set the sec of timeout. - ts.tv_nsec = 0; - printf("1 sig wait begin\n"); - void (*retSig)(int); - retSig = signal(SIGALRM, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - retSig = signal(SIGUSR1, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(retSig, NULL, retSig); - retValue = sigemptyset(&set); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGALRM); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = sigaddset(&set, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - int count = 0; - fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - printf("sig wait begin\n"); - while (1) { - retValue = sigtimedwait(&set, &si, &ts); - if (retValue != 0) { - exit(retValue); - } - printf("sig wait end\n"); - count++; - if (count == 3) { // 3, Possible values for the current parameter - break; - } - } - exit(0); - } - sleep(1); - /* direct kill the child */ - retValue = kill(fpid, SIGKILL); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WIFEXITED(status), 0, WIFEXITED(status)); - ICUNIT_ASSERT_EQUAL(WIFSIGNALED(status), 1, WIFSIGNALED(status)); - ICUNIT_ASSERT_EQUAL(WTERMSIG(status), SIGKILL, WTERMSIG(status)); - signal(SIGALRM, SIG_DFL); - signal(SIGUSR1, SIG_DFL); - return 0; -} - -void ItPosixSignal019(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSigTimeWaitDirectKillChild, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_020.cpp b/testsuites/unittest_old/signal/full/signal_test_020.cpp deleted file mode 100644 index e65179a1..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_020.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void SigHandler(int sig) // ÐźŴ¦Àí³ÌÐò -{ - if (sig == SIGINT) { - printf("SIGINT sig\n"); - } else if (sig == SIGQUIT) { - printf("SIGQUIT sig\n"); - } else { - printf("SIGUSR1 sig\n"); - } -} - -static int TestSigSuspend() -{ - int status, retValue; - int fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - sigset_t newset, old, wait; - struct sigaction act; - printf("SIGUSR1 sig\n"); - act.sa_handler = SigHandler; - retValue = sigemptyset(&act.sa_mask); - if (retValue != 0) { - exit(retValue); - } - act.sa_flags = 0; - sigaction(SIGINT, &act, nullptr); - sigaction(SIGQUIT, &act, nullptr); - sigaction(SIGUSR1, &act, nullptr); - sigaction(SIGALRM, &act, nullptr); - - retValue = sigemptyset(&newset); - if (retValue != 0) { - exit(retValue); - } - retValue = sigaddset(&newset, SIGALRM); - if (retValue != 0) { - exit(retValue); - } - retValue = sigprocmask(SIG_BLOCK, &newset, &old); - if (retValue != 0) { - exit(retValue); - } - printf("newset 1 = %x\n", newset.__bits[0]); - printf("old 1 = %x\n", old.__bits[0]); - - retValue = sigemptyset(&newset); - if (retValue != 0) { - exit(retValue); - } - retValue = sigaddset(&newset, SIGQUIT); - if (retValue != 0) { - exit(retValue); - } - retValue = sigprocmask(SIG_BLOCK, &newset, &old); - if (retValue != 0) { - exit(retValue); - } - printf("newset 2 = %x\n", newset.__bits[0]); - printf("old 2 = %x\n", old.__bits[0]); - - retValue = sigemptyset(&newset); - if (retValue != 0) { - exit(retValue); - } - retValue = sigaddset(&newset, SIGINT); - if (retValue != 0) { - exit(retValue); - } - - retValue = sigprocmask(SIG_BLOCK, &newset, &old); - if (retValue != 0) { - exit(retValue); - } - printf("newset 1 = %x\n", newset.__bits[0]); - printf("old 1 = %x\n", old.__bits[0]); - - retValue = sigemptyset(&wait); - if (retValue != 0) { - exit(retValue); - } - retValue = sigaddset(&wait, SIGUSR1); - if (retValue != 0) { - exit(retValue); - } - printf("wait = %x\n", wait.__bits[0]); - - if (sigsuspend(&wait) != -1) { - printf("sigsuspend error\n"); - return -1; - } - printf("After sigsuspend\n"); - if (retValue != 0) { - exit(retValue); - } - printf("old 2= %x\n", old.__bits[0]); - - sigset_t pending; - retValue = sigemptyset(&pending); - if (retValue != 0) { - exit(retValue); - } - printf("pending 1= %x\n", pending.__bits[0]); - retValue = raise(SIGINT); - if (retValue != 0) { - exit(retValue); - } - retValue = sigpending(&pending); - if (retValue != 0) { - exit(retValue); - } - printf("pending 2= %x\n", pending.__bits[0]); - - retValue = raise(SIGALRM); - if (retValue != 0) { - exit(retValue); - } - retValue = sigpending(&pending); - if (retValue != 0) { - exit(retValue); - } - printf("pending 3= %x\n", pending.__bits[0]); - exit(0); - } - - sleep(1); - printf("kill SIGUSR1\n"); - retValue = kill(fpid, SIGUSR1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - sleep(1); - printf("kill SIGINT\n"); - retValue = kill(fpid, SIGINT); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - sigset_t new1, old1; - struct sigaction act; - - fpid = fork(); - if (fpid == 0) { - act.sa_handler = SigHandler; - retValue = sigemptyset(&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGINT, &act, nullptr); - sigaction(SIGQUIT, &act, nullptr); - sigaction(SIGUSR1, &act, nullptr); - - retValue = sigemptyset(&new1); - if (retValue != 0) { - exit(retValue); - } - retValue = sigaddset(&new1, SIGINT); - if (retValue != 0) { - exit(retValue); - } - retValue = sigprocmask(SIG_BLOCK, &new1, &old1); - if (retValue != 0) { - exit(retValue); - } - printf("new 1 = %x\n", new1.__bits[0]); - printf("old 1 = %x\n", old1.__bits[0]); - - retValue = kill(getpid(), SIGINT); - if (retValue != 0) { - exit(retValue); - } - retValue = raise(SIGUSR1); - if (retValue != 0) { - exit(retValue); - } - printf("raise 1 = %x\n", new1.__bits[0]); - - exit(0); - } - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - return 0; -} - -void ItPosixSignal020(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSigSuspend, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/full/signal_test_025.cpp b/testsuites/unittest_old/signal/full/signal_test_025.cpp deleted file mode 100644 index aef9dd8f..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_025.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void SigAlrm(int signum) -{ - printf("Alert rings.\n"); -} - -static int TestBlock() -{ - int sig = SIGALRM; - void *ret; - int retValue, status; - - int fpid = fork(); - if (fpid == 0) { - sigset(SIGALRM, SigAlrm); - int clock = 2; - printf("Alarm after %d seconds\n", clock); - alarm(clock); - for (int i = 0; i < 4; i++) { // 4, Number of cycles - printf("time = %d s\n", i); - sleep(1); - } - printf("\n\n"); - - printf("Hold the signal\n"); - retValue = sighold(sig); - if (retValue != 0) { - exit(retValue); - } - alarm(clock); - for (int i = 0; i < 4; i++) { // 4, Number of cycles - printf("time = %d s\n", i); - sleep(1); - } - printf("\n\n"); - - printf("Release the signal\n"); - retValue = sigrelse(sig); - if (retValue != 0) { - exit(retValue); - } - alarm(clock); - for (int i = 0; i < 4; i++) { // 4, Number of cycles - printf("time = %d s\n", i); - sleep(1); - } - printf("\n\n"); - - printf("Signal Pause(1)\n"); - printf("The process sleeps until alter rings (after 2 seconds)\n"); - alarm(clock); - retValue = sigpause(sig); - if (retValue != -1) { - exit(retValue); - } - printf("\n\n"); - - printf("Signal Pause(2)\n"); - printf("To test whether pause can relese the signal\n"); - alarm(clock); - retValue = sighold(sig); - if (retValue != 0) { - exit(retValue); - } - retValue = sigpause(sig); - if (retValue != -1) { - exit(retValue); - } - printf("\n\n"); - - printf("Ignore the signal\n"); - retValue = sigignore(sig); - if (retValue != 0) { - exit(retValue); - } - alarm(clock); - for (int i = 0; i < 4; i++) { // 4, Number of cycles - printf("time = %d s\n", i); - sleep(1); - } - printf("\n\n"); - printf("Test Ends\n"); - - exit(0); - } - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - return 0; -} - -void ItPosixSignal025(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestBlock, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/full/signal_test_026.cpp b/testsuites/unittest_old/signal/full/signal_test_026.cpp deleted file mode 100644 index f555f2fd..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_026.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#define INVALID_SIG 1000 - -static void SigPrint(int signum) -{ - printf("Signal Triggered\n"); -} - -static UINT32 TestCase(VOID) -{ - int ret, sig; - struct itimerval newValue, oldValue; - siginfo_t info; - sigset_t newset; - struct timespec timeout; - - timeout.tv_nsec = 0; - timeout.tv_sec = 1; - - int fpid, status; - fpid = fork(); - if (fpid == 0) { - (void)signal(SIGCHLD, SigPrint); - sigemptyset(&newset); - sigaddset(&newset, SIGCHLD); - ret = sigtimedwait(&newset, &info, &timeout); - if (ret != -1) { - exit(ret); - } - if (errno != EAGAIN) { - exit(errno); - } - printf("---------------\n"); - - sigemptyset(&newset); - sigaddset(&newset, SIGCHLD); - timeout.tv_nsec = 1; - timeout.tv_sec = -1; - ret = sigtimedwait(&newset, &info, &timeout); - printf("ret = %d errno = %d EINVAL = %d\n", ret, errno, EINVAL); - if (ret != -1) { - exit(ret); - } - if (errno != EINVAL) { - exit(errno); - } - - sigemptyset(&newset); - sigaddset(&newset, SIGCHLD); - timeout.tv_nsec = 1; - timeout.tv_sec = 3; // 3, set the sec of timeout. - ret = sigtimedwait(&newset, (siginfo_t *)2, &timeout); // 2, wait for signal num - printf("ret = %d errno = %d EFAULT = %d\n", ret, errno, EFAULT); - if (ret != -1) { - exit(ret); - } - if (errno != EFAULT) { - exit(errno); - } - exit(0); - } - - sleep(2); // 2, sleep 10 second. - kill(fpid, SIGCHLD); - ret = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, fpid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - return LOS_OK; -} - -void ItPosixSignal026(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/full/signal_test_028.cpp b/testsuites/unittest_old/signal/full/signal_test_028.cpp deleted file mode 100644 index ba48ed17..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_028.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -// print the sigset bit by biy -static void PrintSigset(sigset_t *set) -{ - for (int i = 0; i < 32; ++i) { // 32, Number of cycles - if (sigismember(set, i)) { - putchar('1'); - } else { - putchar('0'); - } - } - puts(""); -} - -static int TestSigset() -{ - // record mask words - sigset_t sigset; - - void *ret; - int retValue, status; - - int fpid = fork(); - if (fpid == 0) { - // clean the signal set - printf("EmptySet\n"); - retValue = sigemptyset(&sigset); - if (retValue != 0) { - exit(retValue); - } - printf("Current set is: \n"); - PrintSigset(&sigset); - printf("EmptySet End\n\n"); - - printf("IsEmptySet\n"); - retValue = sigisemptyset(&sigset); - if (retValue != 1) { - exit(retValue); - } - if (retValue == 1) { - printf("The set is empty\n"); - } else { - printf("The set is not empty\n"); - } - printf("IsEmptySet End\n\n"); - - printf("AddSet\n"); - retValue = sigaddset(&sigset, SIGINT); - if (retValue != 0) { - exit(retValue); - } - printf("Add SIGINT\n"); - printf("Current set is: \n"); - PrintSigset(&sigset); - printf("AddSet End\n\n"); - - printf("IsMember\n"); - retValue = sigismember(&sigset, SIGINT); - if (retValue != 1) { - exit(retValue); - } - if (retValue == 1) { - printf("The SIGINT is a member of set\n"); - } else { - printf("The SIGINT is not a member of set\n"); - } - printf("IsMember End\n\n"); - - printf("DelSet\n"); - retValue = sigdelset(&sigset, SIGINT); - if (retValue != 0) { - exit(retValue); - } - printf("Delete signal SIGINT\n"); - printf("Current set is: \n"); - PrintSigset(&sigset); - printf("DelSet End\n\n"); - - printf("FillSet\n"); - retValue = sigfillset(&sigset); - if (retValue != 0) { - exit(retValue); - } - printf("Current set is: \n"); - PrintSigset(&sigset); - printf("FillSet End\n\n"); - - sigset_t sigsetTmp; - sigemptyset(&sigsetTmp); - sigset_t sigsetTarget; - sigfillset(&sigset); - printf("AndSet\n"); - retValue = sigandset(&sigsetTarget, &sigset, &sigsetTmp); - if (retValue != 0) { - exit(retValue); - } - printf("And fullset with emptyset\n"); - printf("Current set is: \n"); - PrintSigset(&sigset); - if (sigisemptyset(&sigsetTarget)) { - printf("AndSet Succeed\n"); - } else { - printf("AndSet Fail\n"); - } - printf("AndSet End\n\n"); - - sigemptyset(&sigsetTarget); - printf("OrSet\n"); - retValue = sigorset(&sigsetTarget, &sigset, &sigsetTmp); - if (retValue != 0) { - exit(retValue); - } - printf("Or fullset with emptyset\n"); - printf("Current set is: \n"); - PrintSigset(&sigset); - if (!sigisemptyset(&sigsetTarget)) { - printf("OrSet Succeed\n"); - } else { - printf("OrSet Fail\n"); - } - printf("OrSet End\n\n"); - - exit(0); - } - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - return 0; -} - -void ItPosixSignal028(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSigset, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/full/signal_test_029.cpp b/testsuites/unittest_old/signal/full/signal_test_029.cpp deleted file mode 100644 index 22379f75..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_029.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static int g_sigCount = 0; -static void SigPrint(int signum) -{ - g_sigCount++; - printf("signal receive sucess\n"); -} - -static UINT32 TestCase(VOID) -{ - int pid; - int ret, status; - sigset_t newset; - struct sigaction act; - - act.sa_handler = SigPrint; - sigemptyset(&act.sa_mask); - act.sa_flags = 0; - pid = fork(); - if (pid < 0) { - printf("Fork error\n"); - return LOS_NOK; - } else if (pid == 0) { - ret = sigaction(SIGUSR1, &act, nullptr); - if (ret != 0) { - exit(LOS_NOK); - } - sigemptyset(&newset); - sigaddset(&newset, SIGCHLD); - ret = sigsuspend(&newset); - printf("ret = %d errno = %d EINTR = %d\n", ret, errno, EINTR); - if (ret != -1 || errno != EINTR) { - exit(LOS_NOK); - } - - ret = sigsuspend(NULL); - if (ret != -1) { - exit(ret); - } - if (errno != EFAULT) { - exit(errno); - } - - ret = sigsuspend((sigset_t *)2); // 2, suspend signal num. - if (ret != -1) { - exit(ret); - } - if (errno != EFAULT) { - exit(errno); - } - - ret = sigpending(NULL); - if (ret != -1) { - exit(ret); - } - if (errno != EFAULT) { - exit(errno); - } - - ret = sigpending((sigset_t *)2); // 2, pending signal num. - if (ret != -1) { - exit(ret); - } - if (errno != EFAULT) { - exit(errno); - } - exit(LOS_OK); - } - sleep(1); - ret = kill(pid, SIGUSR1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("kill sucess\n"); - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), LOS_OK, WEXITSTATUS(status)); - - return LOS_OK; -} - -void ItPosixSignal029(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/full/signal_test_030.cpp b/testsuites/unittest_old/signal/full/signal_test_030.cpp deleted file mode 100644 index 05fe5691..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_030.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static int g_sigCount = 0; -static void SigPrint(int sig) -{ - g_sigCount++; - printf("signal receive sucess\n"); -} - -static UINT32 TestCase(VOID) -{ - int pid; - int ret = 0; - struct sigaction act; - - act.sa_handler = SigPrint; - sigemptyset(&act.sa_mask); - act.sa_flags = 0; - pid = fork(); - if (pid < 0) { - printf("Fork error\n"); - return LOS_NOK; - } else if (pid == 0) { - ret = sigaction(SIGUSR1, &act, nullptr); - if (ret != 0) { - printf("ret = %d\n", ret); - exit(LOS_NOK); - } - ret = sigpause(SIGUSR1); - printf("ret = %d errno = %d EINTR = %d\n", ret, errno, EINTR); - if (ret == -1 && errno == EINTR) { - exit(LOS_OK); - } - sleep(10); // 10, sleep 10 second. - exit(LOS_NOK); - } - sleep(1); - ret = kill(pid, SIGUSR1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("kill sucess\n"); - wait(&ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(ret), LOS_OK, WEXITSTATUS(ret)); - return LOS_OK; -} - -void ItPosixSignal030(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/full/signal_test_033.cpp b/testsuites/unittest_old/signal/full/signal_test_033.cpp deleted file mode 100644 index dc290704..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_033.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static int g_sigCount = 0; -static int g_sigCount1 = 0; -static void SigPrint(int sig) -{ - g_sigCount++; - printf("signal receive sucess\n"); -} - -static void SigPrint1(int sig) -{ - g_sigCount1++; - printf("signal receive sucess\n"); -} - -static UINT32 TestCase(VOID) -{ - int pid = 0; - int ret = 0; - void (*retptr)(int); - sigset_t newset, oldset; - - pid = fork(); - if (pid < 0) { - printf("Fork error\n"); - return LOS_NOK; - } else if (pid == 0) { - printf("test032 raise before\n"); - sigemptyset(&newset); - sigaddset(&newset, SIGUSR1); - sigaddset(&newset, SIGUSR2); - ret = sigprocmask(SIG_BLOCK, &newset, &oldset); - if (ret != 0) { - printf("error:sigprocmask\n"); - exit(LOS_NOK); - } - retptr = signal(SIGUSR1, SigPrint); - if (retptr == SIG_ERR) { - printf("error:signal\n"); - exit(LOS_NOK); - } - retptr = signal(SIGUSR2, SigPrint1); - if (retptr == SIG_ERR) { - printf("error:signal\n"); - exit(LOS_NOK); - } - raise(SIGUSR1); - raise(SIGUSR2); - sigdelset(&newset, SIGUSR2); - ret = sigprocmask(SIG_UNBLOCK, &newset, &oldset); - if (ret != 0) { - printf("error:sigprocmask\n"); - exit(LOS_NOK); - } - sleep(1); - if (!(g_sigCount == 1 && g_sigCount1 == 0)) { - printf("Assert failed in line %d\n", __LINE__); - printf("g_sigCount = %d, g_sigCount1 = %d\n", g_sigCount, g_sigCount1); - exit(LOS_NOK); - } - sigdelset(&newset, SIGUSR1); - sigaddset(&newset, SIGUSR2); - ret = sigprocmask(SIG_UNBLOCK, &newset, &oldset); - if (ret != 0) { - printf("error:sigprocmask\n"); - exit(LOS_NOK); - } - sleep(1); - if (!(g_sigCount == 1 && g_sigCount1 == 1)) { - printf("Assert failed in line %d\n", __LINE__); - printf("g_sigCount = %d, g_sigCount1 = %d\n", g_sigCount, g_sigCount1); - exit(LOS_NOK); - } - printf("test032 raise after\n"); - exit(LOS_OK); - } - - wait(&ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(ret), LOS_OK, WEXITSTATUS(ret)); - return LOS_OK; -} - -void ItPosixSignal033(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/full/signal_test_038.cpp b/testsuites/unittest_old/signal/full/signal_test_038.cpp deleted file mode 100644 index 3e924deb..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_038.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static const int INVAILD_SIG = 1000; -static void *ThreadKillTest(void *arg) -{ - printf("Enter ThreadKillTest...\n"); - sleep(2); // 2, sleep 10 second. - printf("ThreadKillTest finished...\n"); - return NULL; -} -static UINT32 TestCase(VOID) -{ - int ret, status; - - int fpid = fork(); - if (fpid == 0) { - pthread_t thread1; - ret = pthread_create(&thread1, NULL, ThreadKillTest, 0); - if (ret != 0) { - exit(ret); - } - sleep(1); - ret = pthread_kill(thread1, INVAILD_SIG); - printf("ret = %d errno = %d EINVAL = %d\n", ret, errno, EINVAL); - if (ret != EINVAL) { - exit(ret); - } - // sleep 2 seconds - sleep(2); // 2, sleep 10 second. - pthread_join(thread1, NULL); - - exit(0); - } - - ret = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, fpid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - return LOS_OK; -} - -void ItPosixSignal038(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/full/signal_test_040.cpp b/testsuites/unittest_old/signal/full/signal_test_040.cpp deleted file mode 100644 index bdf2eb6a..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_040.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static int g_sigCount = 0; -static int g_sigCount1 = 0; -static void SigPrint(int sig) -{ - g_sigCount++; - printf("signal receive sucess\n"); -} - -static UINT32 TestCase(VOID) -{ - int pid = 0; - int ret = 0; - void *retptr = NULL; - sigset_t newset, oldset; - - sigemptyset(&newset); - sigprocmask(SIG_SETMASK, &newset, NULL); - - signal(SIGURG, SIG_IGN); - raise(SIGURG); - signal(SIGURG, SigPrint); - raise(SIGURG); - printf("g_sigCount=%d\n", g_sigCount); - sleep(1); - ICUNIT_ASSERT_EQUAL(g_sigCount, 1, g_sigCount); - - signal(SIGHUP, SigPrint); - signal(SIGUSR1, SigPrint); - pid = fork(); - if (pid == 0) { - signal(SIGHUP, SigPrint); - signal(SIGUSR1, SigPrint); - sigset_t set, set1; - sigemptyset(&set); - sigemptyset(&set1); - sigaddset(&set, SIGHUP); - sigaddset(&set1, SIGUSR1); - sigaddset(&set1, SIGHUP); - sigprocmask(SIG_BLOCK, &set1, NULL); - raise(SIGHUP); - raise(SIGUSR1); - printf("child\n"); - int rt = sigsuspend(&set); - printf("sigsuspend rt = %d, errno=%d\n", rt, errno); - exit(2); // 2, exit args - } else { - sleep(1); - kill(pid, SIGHUP); - printf("sighug\n"); - kill(pid, SIGUSR1); - wait(&ret); - printf("ret1 = %d,%d\n", ret, WEXITSTATUS(ret)); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(ret), 2, WEXITSTATUS(ret)); // 2, assert that function Result is equal to this. - } - return LOS_OK; -} - -void ItPosixSignal040(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/full/signal_test_041.cpp b/testsuites/unittest_old/signal/full/signal_test_041.cpp deleted file mode 100644 index 33e057a8..00000000 --- a/testsuites/unittest_old/signal/full/signal_test_041.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -#include "pthread.h" - -static void Sigprint(int sig) -{ - printf("enter sighandle : -------------------------\n"); -} -static void Sigprint111(int sig) -{ - printf("enter sighandle : ---111----------------------\n"); -} - -static void *ThreadFunc7(void *arg) -{ - int retval; - sigset_t set, oldset; - sighandler_t sigret; - printf("-----------------------------\n"); - sleep(1); - raise(SIGUSR2); - sleep(1); - sigret = signal(SIGUSR2, Sigprint); - - sleep(1); - raise(SIGUSR2); - retval = sigemptyset(&set); - if (retval == -1) { - exit(-1); - } - printf("line = %d\n", __LINE__); - retval = sigemptyset(&oldset); - if (retval == -1) { - exit(-1); - } - printf("line = %d\n", __LINE__); - retval = sigprocmask(SIG_SETMASK, &set, &oldset); - if (retval == -1) { - exit(-1); - } - retval = sigismember(&oldset, SIGTERM); - printf("th SIGTERM is in oldset:%d\n", retval); - if (retval != 1) { - exit(-1); - } - retval = sigismember(&oldset, SIGUSR1); - printf("th SIGUSR1 is in oldset:%d\n", retval); - if (retval != 1) { - exit(-1); - } - retval = sigismember(&oldset, SIGUSR2); - printf("th SIGUSR2 is in oldset:%d\n", retval); - if (retval != 0) { - exit(-1); - } - retval = sigprocmask(SIG_SETMASK, &oldset, &set); - if (retval == -1) { - exit(-1); - } - sleep(1); - printf("-----------------------------\n"); - retval = sigemptyset(&set); - if (retval == -1) { - exit(-1); - } - retval = sigemptyset(&oldset); - if (retval == -1) { - exit(-1); - } - retval = sigprocmask(SIG_SETMASK, &set, &oldset); - if (retval == -1) { - exit(-1); - } - retval = sigismember(&oldset, SIGTERM); - printf("SIGTERM is in oldset:%d\n", retval); - if (retval != 1) { - exit(-1); - } - retval = sigismember(&oldset, SIGUSR1); - printf("SIGUSR1 is in oldset:%d\n", retval); - if (retval != 1) { - exit(-1); - } - retval = sigismember(&oldset, SIGUSR2); - printf("SIGUSR2 is in oldset:%d\n", retval); - if (retval != 0) { - exit(-1); - } - - printf("-----------------newthread7 is finished------------\n"); - return nullptr; -} - -static UINT32 TestCase(VOID) -{ - int ret, retval; - void *res = nullptr; - pthread_t newPthread, newPthread1; - sigset_t set, oldset; - sighandler_t sigret; - sigret = signal(SIGUSR2, Sigprint111); - retval = sigemptyset(&set); - if (retval == -1) { - printf("error: sigemptyset \n"); - return -1; - } - retval = sigemptyset(&oldset); - if (retval == -1) { - printf("error: sigemptyset \n"); - return -1; - } - retval = sigaddset(&set, SIGTERM); - if (retval == -1) { - printf("error: sigemptyset \n"); - return -1; - } - retval = sigismember(&set, SIGTERM); - printf("SIGTERM is in set:%d\n", retval); - ICUNIT_ASSERT_EQUAL(retval, 1, retval); - retval = sigaddset(&set, SIGUSR1); - if (retval == -1) { - printf("error: sigemptyset \n"); - return -1; - } - retval = sigismember(&set, SIGUSR1); - printf("SIGUSR1 is in set:%d\n", retval); - ICUNIT_ASSERT_EQUAL(retval, 1, retval); - retval = sigismember(&set, SIGUSR2); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - printf("SIGUSR2 is in set:%d\n", retval); - retval = sigprocmask(SIG_SETMASK, &set, &oldset); - printf("line = %d\n", __LINE__); - if (retval == -1) { - printf("error: sigemptyset \n"); - return -1; - } - printf("line = %d\n", __LINE__); - raise(SIGUSR2); - printf("line = %d\n", __LINE__); - sleep(1); - ret = pthread_create(&newPthread1, nullptr, ThreadFunc7, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("line = %d\n", __LINE__); - sleep(1); - raise(SIGUSR2); - retval = sigaddset(&set, SIGUSR2); - if (retval == -1) { - printf("error: sigemptyset \n"); - return -1; - } - printf("line = %d\n", __LINE__); - retval = sigdelset(&set, SIGUSR1); - if (retval == -1) { - printf("error: sigemptyset \n"); - return -1; - } - printf("line = %d\n", __LINE__); - retval = sigismember(&set, SIGTERM); - printf("f SIGTERM is in set:%d\n", retval); - ICUNIT_ASSERT_EQUAL(retval, 1, retval); - retval = sigismember(&set, SIGUSR1); - printf("f SIGUSR1 is in set:%d\n", retval); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - retval = sigismember(&set, SIGUSR2); - printf("f SIGUSR2 is in set:%d\n", retval); - ICUNIT_ASSERT_EQUAL(retval, 1, retval); - retval = sigprocmask(SIG_SETMASK, &set, nullptr); - if (retval == -1) { - printf("error: sigemptyset \n"); - return -1; - } - ret = pthread_join(newPthread1, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - retval = sigprocmask(SIG_SETMASK, &oldset, &set); - if (retval == -1) { - printf("error: sigemptyset \n"); - return -1; - } - - printf("-----------------main is finished------------\n"); - - return 0; -} - -void ItPosixSignal041(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/it_test_signal.h b/testsuites/unittest_old/signal/it_test_signal.h deleted file mode 100644 index a6913d12..00000000 --- a/testsuites/unittest_old/signal/it_test_signal.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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. - */ -#ifndef IT_TEST_SIGNAL_H -#define IT_TEST_SIGNAL_H - -#include "osTest.h" -#include "sys/resource.h" -#include - -#define RED_FLAG 6 - -extern void ItPosixSignal001(void); -extern void ItPosixSignal002(void); -extern void ItPosixSignal003(void); -extern void ItPosixSignal004(void); -extern void ItPosixSignal005(void); -extern void ItPosixSignal006(void); -extern void ItPosixSignal007(void); -extern void ItPosixSignal008(void); -extern void ItPosixSignal009(void); -extern void ItPosixSignal010(void); -extern void ItPosixSignal011(void); -extern void ItPosixSignal012(void); -extern void ItPosixSignal013(void); -extern void ItPosixSignal014(void); -extern void ItPosixSignal015(void); -extern void ItPosixSignal016(void); -extern void ItPosixSignal017(void); -extern void ItPosixSignal018(void); -extern void ItPosixSignal019(void); -extern void ItPosixSignal020(void); -extern void ItPosixSignal021(void); -extern void ItPosixSignal022(void); -extern void ItPosixSignal023(void); -extern void ItPosixSignal024(void); -extern void ItPosixSignal025(void); - -extern void ItPosixSignal026(void); -extern void ItPosixSignal027(void); -extern void ItPosixSignal028(void); -extern void ItPosixSignal029(void); -extern void ItPosixSignal030(void); -extern void ItPosixSignal031(void); -extern void ItPosixSignal032(void); -extern void ItPosixSignal033(void); -extern void ItPosixSignal034(void); -extern void ItPosixSignal035(void); -extern void ItPosixSignal036(void); -extern void ItPosixSignal037(void); -extern void ItPosixSignal038(void); -extern void ItPosixSignal039(void); -extern void ItPosixSignal040(void); -extern void ItPosixSignal041(void); -extern void ItPosixSignal042(void); - -extern void ItPosixSigset001(void); -extern void ItPosixSigset002(void); -extern void ItPosixPipe001(void); -extern void ItPosixPipe002(void); -extern void ItPosixPipe003(void); -extern void ItPosixPipe004(void); -extern void ItPosixPipe005(void); -extern void ItPosixPipe006(void); -extern void ItPosixMkfifo001(void); -extern void ItPosixMkfifo002(void); -extern void ItIpcFdClr001(void); -extern void ItIpcFdIsset001(void); -extern void ItIpcFdSet001(void); -extern void ItIpcFdZero001(void); -extern void ItIpcMkfifo002(void); -extern void ItIpcMkfifo003(void); -extern void ItIpcPipe002(void); -extern void ItIpcPipe003(void); -extern void ItIpcPipe004(void); -extern void ItIpcPipe005(void); -extern void ItIpcSigaction001(void); -extern void ItIpcSigpause001(void); -extern void ItIpcSigpromask001(void); -extern int kill(pid_t pid, int sig); - -#endif diff --git a/testsuites/unittest_old/signal/signal_test.cpp b/testsuites/unittest_old/signal/signal_test.cpp deleted file mode 100644 index 7ddd1a97..00000000 --- a/testsuites/unittest_old/signal/signal_test.cpp +++ /dev/null @@ -1,664 +0,0 @@ -/* - * 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. - */ -#include -#include -#include "it_test_signal.h" - -using namespace testing::ext; -namespace OHOS { -class SignalTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: IT_POSIX_SIGNAL_002 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal002, TestSize.Level0) -{ - ItPosixSignal002(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_009 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal009, TestSize.Level0) -{ - ItPosixSignal009(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_013 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal013, TestSize.Level0) -{ - ItPosixSignal013(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_014 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal014, TestSize.Level0) -{ - ItPosixSignal014(); -} - - -/* * - * @tc.name: IT_POSIX_SIGNAL_021 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal021, TestSize.Level0) -{ - ItPosixSignal021(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_022 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal022, TestSize.Level0) -{ - ItPosixSignal022(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_023 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal023, TestSize.Level0) -{ - ItPosixSignal023(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_024 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal024, TestSize.Level0) -{ - ItPosixSignal024(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_031 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal031, TestSize.Level0) -{ - ItPosixSignal031(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_032 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal032, TestSize.Level0) -{ - ItPosixSignal032(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_035 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal035, TestSize.Level0) -{ - ItPosixSignal035(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_036 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal036, TestSize.Level0) -{ - ItPosixSignal036(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_037 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal037, TestSize.Level0) -{ - ItPosixSignal037(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_039 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal039, TestSize.Level0) -{ - ItPosixSignal039(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_042 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal042, TestSize.Level0) -{ - ItPosixSignal042(); -} - -/* * - * @tc.name: ItPosixPipe002 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixPipe002, TestSize.Level0) -{ - ItPosixPipe002(); -} - -/* * - * @tc.name: ItPosixMkfifo002 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixMkfifo002, TestSize.Level0) -{ - ItPosixMkfifo002(); -} - -/* * - * @tc.name: IT_IPC_FD_ISSET_001 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItIpcFdIsset001, TestSize.Level0) -{ - ItIpcFdIsset001(); -} -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: IT_IPC_FD_CLR_001 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItIpcFdClr001, TestSize.Level0) -{ - ItIpcFdClr001(); -} - -/* * - * @tc.name: IT_IPC_FD_SET_001 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItIpcFdSet001, TestSize.Level0) -{ - ItIpcFdSet001(); -} - -/* * - * @tc.name: IT_IPC_FD_ZERO_001 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItIpcFdZero001, TestSize.Level0) -{ - ItIpcFdZero001(); -} - -/* - * @tc.name: IT_IPC_SIGACTION_001^M - * @tc.desc: function for SignalTest^M - * @tc.type: FUNC^M - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItIpcSigaction001, TestSize.Level0) -{ - ItIpcSigaction001(); -} - -/* * - * @tc.name: IT_IPC_SIGPAUSE_001 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItIpcSigpause001, TestSize.Level0) -{ - ItIpcSigpause001(); -} - -/* * - * @tc.name: IT_IPC_SIGPROMASK_001 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItIpcSigpromask001, TestSize.Level0) -{ - ItIpcSigpromask001(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_001 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal001, TestSize.Level0) -{ - ItPosixSignal001(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_003 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal003, TestSize.Level0) -{ - ItPosixSignal003(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_004 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal004, TestSize.Level0) -{ - ItPosixSignal004(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_005 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal005, TestSize.Level0) -{ - ItPosixSignal005(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_006 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal006, TestSize.Level0) -{ - ItPosixSignal006(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_007 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal007, TestSize.Level0) -{ - ItPosixSignal007(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_008 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal008, TestSize.Level0) -{ - ItPosixSignal008(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_010 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal010, TestSize.Level0) -{ - ItPosixSignal010(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_011 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal011, TestSize.Level0) -{ - ItPosixSignal011(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_012 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal012, TestSize.Level0) -{ - ItPosixSignal012(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_015 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal015, TestSize.Level0) -{ - ItPosixSignal015(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_016 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal016, TestSize.Level0) -{ - ItPosixSignal016(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_017 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal017, TestSize.Level0) -{ - ItPosixSignal017(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_018 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal018, TestSize.Level0) -{ - ItPosixSignal018(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_019 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal019, TestSize.Level0) -{ - ItPosixSignal019(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_020 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal020, TestSize.Level0) -{ - ItPosixSignal020(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_025 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal025, TestSize.Level0) -{ - ItPosixSignal025(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_026 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal026, TestSize.Level0) -{ - ItPosixSignal026(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_028 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal028, TestSize.Level0) -{ - ItPosixSignal028(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_029 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal029, TestSize.Level0) -{ - ItPosixSignal029(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_030 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal030, TestSize.Level0) -{ - ItPosixSignal030(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_033 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal033, TestSize.Level0) -{ - ItPosixSignal033(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_038 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal038, TestSize.Level0) -{ - ItPosixSignal038(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_040 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal040, TestSize.Level0) -{ - ItPosixSignal040(); -} - -/* * - * @tc.name: IT_POSIX_SIGNAL_041 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixSignal041, TestSize.Level0) -{ - ItPosixSignal041(); -} - -/* * - * @tc.name: IT_IPC_PIPE_002 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItIpcPipe002, TestSize.Level0) -{ - ItIpcPipe002(); -} - -/* * - * @tc.name: IT_IPC_PIPE_003 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItIpcPipe003, TestSize.Level0) -{ - ItIpcPipe003(); -} - -/* * - * @tc.name: ItPosixPipe001 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixPipe001, TestSize.Level0) -{ - ItPosixPipe001(); -} - -/* * - * @tc.name: ItPosixPipe003 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixPipe003, TestSize.Level0) -{ - ItPosixPipe003(); -} - -/* * - * @tc.name: ItPosixPipe004 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixPipe004, TestSize.Level0) -{ - ItPosixPipe004(); -} - -/* * - * @tc.name: ItPosixPipe005 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixPipe005, TestSize.Level0) -{ - ItPosixPipe005(); -} - -/* * - * @tc.name: ItPosixPipe006 - * @tc.desc: function for SignalTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SignalTest, ItPosixPipe006, TestSize.Level0) -{ - ItPosixPipe006(); -} - -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/signal/smoke/It_ipc_fdisset_001.cpp b/testsuites/unittest_old/signal/smoke/It_ipc_fdisset_001.cpp deleted file mode 100644 index 806f38d0..00000000 --- a/testsuites/unittest_old/signal/smoke/It_ipc_fdisset_001.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" - - -static const int TAR_STR_LEN = 12; - -static UINT32 Testcase(VOID) -{ - int pipeFd[2], ret; // 2, pipe return 2 file descirpter - fd_set reads; - ret = pipe(pipeFd); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ret = write(pipeFd[1], "Hello World", TAR_STR_LEN); - printf("write first status: %d\n", ret); - ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); - FD_ZERO(&reads); - FD_SET(pipeFd[0], &reads); - ret = select(pipeFd[0] + 1, &reads, NULL, NULL, NULL); - ICUNIT_GOTO_EQUAL(ret, 1, ret, EXIT); - ret = FD_ISSET(pipeFd[0], &reads); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); - close(pipeFd[0]); - close(pipeFd[1]); - printf("-------------------FD_ISSET ok------------\n"); - return LOS_OK; -EXIT: - close(pipeFd[0]); - close(pipeFd[1]); - return LOS_NOK; -} - -VOID ItIpcFdIsset001(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/It_ipc_mkfifo_002.cpp b/testsuites/unittest_old/signal/smoke/It_ipc_mkfifo_002.cpp deleted file mode 100644 index b1a9815a..00000000 --- a/testsuites/unittest_old/signal/smoke/It_ipc_mkfifo_002.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" - - -static const int NAME_BUF_SIZE = 50; -static const int TAR_STR_LEN = 12; - -static UINT32 Testcase(VOID) -{ - int tarFd, ret, spid; - char buffer[20]; // 20, target buffer size - char pathname[NAME_BUF_SIZE]; - char *filename = "/mkfifotest2"; - strncpy(pathname, "/dev", NAME_BUF_SIZE); - strcat(pathname, filename); - ret = mkfifo(pathname, 0777); // 0777, file athurioty - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - spid = fork(); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - if (spid == 0) { - sleep(1); - tarFd = open(pathname, O_WRONLY, 0777); // 0777, file athurioty - if (tarFd == -1) { - exit(12); // 12, the value of son process unexpect exit, convenient to debug - } - printf("son tarfd = %d\n", tarFd); - ret = write(tarFd, "hello world", TAR_STR_LEN); - if (ret != TAR_STR_LEN) { - exit(11); // 11, the value of son process unexpect exit, convenient to debug - } - printf("write first status: %d\n", ret); - close(tarFd); - exit(RED_FLAG); - } - - tarFd = open(pathname, O_RDONLY, 0777); // 0777, file athurioty - printf("son tarfd = %d\n", tarFd); - ICUNIT_GOTO_NOT_EQUAL(tarFd, -1, tarFd, EXIT); - ret = read(tarFd, buffer, TAR_STR_LEN); - ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); - ret = strcmp(buffer, "hello world"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - printf("read fifo success: %s\n", buffer); - wait(&ret); - ICUNIT_GOTO_EQUAL(WEXITSTATUS(ret), RED_FLAG, WEXITSTATUS(ret), EXIT); - - close(tarFd); - remove(pathname); - printf("mkfifo ok\n"); - return LOS_OK; -EXIT: - close(tarFd); -EXIT1: - remove(pathname); - return LOS_NOK; -} - -VOID ItIpcMkfifo002(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/It_ipc_mkfifo_003.cpp b/testsuites/unittest_old/signal/smoke/It_ipc_mkfifo_003.cpp deleted file mode 100644 index 3b6b89d0..00000000 --- a/testsuites/unittest_old/signal/smoke/It_ipc_mkfifo_003.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" - - -static const int NAME_BUF_SIZE = 50; -static const int TAR_STR_LEN = 12; - -static UINT32 Testcase(VOID) -{ - int tarFd, ret, spid; - char buffer[20]; // 20, target buffer size - char pathname[NAME_BUF_SIZE]; - char *filename = "/mkfifotest3"; - strncpy(pathname, "/dev", NAME_BUF_SIZE); - strcat(pathname, filename); - ret = mkfifo(pathname, 0777); // 0777, file athurioty - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT1); - spid = fork(); - ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, EXIT1); - if (spid == 0) { - tarFd = open(pathname, O_WRONLY, 0777); // 0777, file athurioty - if (tarFd == -1) { - exit(12); // 12, the value of son process unexpect exit, convenient to debug - } - printf("son tarfd = %d\n", tarFd); - ret = write(tarFd, "hello world", TAR_STR_LEN); - if (ret != TAR_STR_LEN) { - exit(11); // 11, the value of son process unexpect exit, convenient to debug - } - printf("write first status: %d\n", ret); - close(tarFd); - exit(RED_FLAG); - } - - tarFd = open(pathname, O_RDONLY, 0777); // 0777, file athurioty - printf("son tarfd = %d\n", tarFd); - ICUNIT_GOTO_NOT_EQUAL(tarFd, -1, tarFd, EXIT); - sleep(1); - ret = read(tarFd, buffer, TAR_STR_LEN); - ICUNIT_GOTO_EQUAL(ret, TAR_STR_LEN, ret, EXIT); - ret = strcmp(buffer, "hello world"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - printf("read fifo success: %s\n", buffer); - wait(&ret); - ICUNIT_GOTO_EQUAL(WEXITSTATUS(ret), RED_FLAG, WEXITSTATUS(ret), EXIT); - - close(tarFd); - remove(pathname); - printf("mkfifo ok\n"); - return LOS_OK; -EXIT: - close(tarFd); -EXIT1: - remove(pathname); - return LOS_NOK; -} - -VOID ItIpcMkfifo003(void) -{ - TEST_ADD_CASE(__FUNCTION__, Testcase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/It_ipc_pipe_004.cpp b/testsuites/unittest_old/signal/smoke/It_ipc_pipe_004.cpp deleted file mode 100644 index 7dd997cb..00000000 --- a/testsuites/unittest_old/signal/smoke/It_ipc_pipe_004.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2021-2021, 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 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "it_test_signal.h" - -#define TAR_STR_LEN 12 - -static UINT32 TestCase(VOID) -{ - int pipefd[2]; // 2, array subscript - int retValue = pipe2(pipefd, O_CLOEXEC); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - int *readFd = &pipefd[0]; - int *writeFd = &pipefd[1]; - char readbuffer[100]; - int status, ret; - - pid_t pid = fork(); - if (pid == -1) { - printf("Fork Error!\n"); - return -1; - } else if (pid == 0) { - for (int i = 0; i < 3; i++) { // 3, Number of cycles - errno = 0; - char sentence1[15] = "Hello World"; - char a[4] = {0}; - retValue = sprintf_s(a, sizeof(a), "%d", i); - ICUNIT_ASSERT_NOT_EQUAL(retValue, NULL, retValue); - retValue = strcat_s(sentence1, sizeof(sentence1), a); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - ret = write(*writeFd, sentence1, strlen(sentence1) + 1); - ICUNIT_ASSERT_EQUAL(ret, 13, ret); // 13, assert that function Result is equal to this. - usleep(100000); // 100000, Used to calculate the delay time. - - retValue = memset_s(readbuffer, sizeof(readbuffer), 0, sizeof(readbuffer)); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = read(*readFd, readbuffer, sizeof(readbuffer)); - ICUNIT_ASSERT_EQUAL(retValue, 13, retValue); // 13, assert that function Result is equal to this. - ret = strncmp((readbuffer), (sentence1), (strlen(sentence1))); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - usleep(100000); // 100000, Used to calculate the delay time. - } - exit(0); - } - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - ret = unlink("/dev/pipe0"); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = close(pipefd[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = unlink("/dev/pipe0"); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ret = close(pipefd[1]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = unlink("/dev/pipe0"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -void ItIpcPipe004(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/It_ipc_pipe_005.cpp b/testsuites/unittest_old/signal/smoke/It_ipc_pipe_005.cpp deleted file mode 100644 index 03e9e655..00000000 --- a/testsuites/unittest_old/signal/smoke/It_ipc_pipe_005.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2021-2021, 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 - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "it_test_signal.h" - -static UINT32 TestCase(VOID) -{ - int pipefd[2]; // 2, array subscript - errno = 0; - int ret = pipe2(pipefd, -1); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - pipefd[0] = 2; // 2, set pipe fd - pipefd[1] = 3; // 3, set pipe fd - - errno = 0; - ret = pipe2((int *)-1, O_CLOEXEC); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - return 0; -} - -void ItIpcPipe005(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_LIB, TEST_LIBC, TEST_LEVEL1, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/signal/smoke/mkfifo_test_001.cpp b/testsuites/unittest_old/signal/smoke/mkfifo_test_001.cpp deleted file mode 100644 index a0832bb5..00000000 --- a/testsuites/unittest_old/signal/smoke/mkfifo_test_001.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include -#include -#include -#include -#include -#include - -static int TestMkfifo() -{ - char buffer[80]; - int fd; - int retValue; - pid_t pid; - - unlink("/dev/fifo"); - - retValue = mkfifo("/dev/fifo", 0777); // 0777, mkfifo config. - printf("mkfifo begin,retValue=%d\n", retValue); - - char sentence[] = "Hello World"; - - pid = fork(); - if (pid < 0) { - printf("Fork error\n"); - return -1; - } else if (pid == 0) { - fd = open("/dev/fifo", O_WRONLY); - write(fd, sentence, sizeof(sentence) + 1); - close(fd); - exit(0); - } else { - fd = open("/dev/fifo", O_RDONLY); - read(fd, buffer, sizeof(buffer)); - printf("Receive data: %s\n", buffer); - close(fd); - } - return 0; -} - - -void ItPosixMkfifo001(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestMkfifo, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/mkfifo_test_002.cpp b/testsuites/unittest_old/signal/smoke/mkfifo_test_002.cpp deleted file mode 100644 index ecdd1062..00000000 --- a/testsuites/unittest_old/signal/smoke/mkfifo_test_002.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include -#include -#include -#include -#include -#include - -static const int NAME_BUF_SIZE = 500; -static const int FAULT1 = 6; -static const int FAULT2 = 7; - -static int TestMkfifoReturn() -{ - int retValue, i; - int status = 0; - pid_t pid; - char pathname[NAME_BUF_SIZE]; - - retValue = mkfifo("/dev/fifo0", 0777); // 0777, mkfifo config. - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = mkfifo("/dev/fifo0", 0777); // 0777, mkfifo config. - ICUNIT_GOTO_EQUAL(retValue, -1, retValue, EXIT); - ICUNIT_GOTO_EQUAL(errno, EEXIST, errno, EXIT); - - /* // no support errno EDQUOT ENOENT EROFS ENAMETOOLONG - retValue = mkfifo("/dev/fifo0/fifo1", 0777); - ICUNIT_GOTO_EQUAL(retValue, -1, retValue, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENOENT, errno, EXIT); - - mkdir("/dev/usr", 0444); - ICUNIT_GOTO_EQUAL(retValue, 0, retValue,EXIT); - retValue = mkfifo("/dev/usr/fifo0", 0777); - ICUNIT_GOTO_EQUAL(retValue, -1, retValue, EXIT); - ICUNIT_GOTO_EQUAL(errno, EROFS, errno, EXIT); - - sprintf(pathname, "/dev/"); - for (i = 5; i < NAME_BUF_SIZE - 4; i = i + 4) { - sprintf(&pathname[i], "fifo"); - } - printf("pathname : %s\n", pathname); - retValue = mkfifo(pathname, 0777); - ICUNIT_GOTO_EQUAL(retValue, -1, retValue, EXIT); - ICUNIT_GOTO_EQUAL(errno, ENAMETOOLONG, errno, EXIT); - - retValue = mkfifo("/usr/fifo0", 0777); - ICUNIT_GOTO_EQUAL(retValue, -1, retValue, EXIT); - - pid = fork(); - if (pid < 0) { - printf("Fork error\n"); - return LOS_NOK; - } else if (pid == 0) { - for (i = 1; i <= 100024; i++) { - sprintf(pathname, "/dev/fifo%d", i); - mkfifo(pathname, 0777); - } - retValue = mkfifo("/dev/fifo100025", 0777); - if (retValue != -1) { - printf("error: unexpect return mkfifo\n"); - exit(FAULT1); - } - if (errno != EDQUOT) { - printf("error: unexpect errno mkfifo\n"); - exit(FAULT2); - } - exit(LOS_OK); - } - wait(&status); - ICUNIT_GOTO_EQUAL(WEXITSTATUS(status),LOS_OK,WEXITSTATUS(status), EXIT); - - for (i = 0; i <= 100025; i++) { - sprintf(pathname, "/dev/fifo%d", i); - unlink(pathname); - } */ - unlink("/usr/fifo0"); - unlink("/dev/fifo0/fifo1"); - unlink("/dev/usr/fifo0"); - rmdir("/dev/usr"); - unlink(pathname); - unlink("/dev/fifo0"); - return LOS_OK; - -EXIT: - unlink("/usr/fifo0"); - unlink("/dev/fifo0/fifo1"); - unlink("/dev/usr/fifo0"); - rmdir("/dev/usr"); - unlink(pathname); - unlink("/dev/fifo0"); - return LOS_NOK; -} - -void ItPosixMkfifo002(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestMkfifoReturn, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/pipe_test_002.cpp b/testsuites/unittest_old/signal/smoke/pipe_test_002.cpp deleted file mode 100644 index fafa5f3b..00000000 --- a/testsuites/unittest_old/signal/smoke/pipe_test_002.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "fcntl.h" -#include "sys/shm.h" - -static int TestPipeMultiProcess() -{ - int pipefd[2]; // 2, array subscript - pid_t pid; - int retValue = -1; - retValue = pipe(pipefd); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - int *readFd = &pipefd[0]; - int *writeFd = &pipefd[1]; - char readbuffer[100] = {0}; - int status, ret; - int totalNum = 3; - int *sharedflag = NULL; - int shmid; - - int flag = fcntl(*readFd, F_GETFL); - fcntl(*readFd, F_SETFL, flag | O_NONBLOCK); - shmid = shmget((key_t)IPC_PRIVATE, sizeof(int), 0666 | IPC_CREAT); // 0666 the authority of the shm - ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); - sharedflag = (int *)shmat(shmid, NULL, 0); - *sharedflag = 0; - - pid = fork(); - if (pid == -1) { - printf("Fork Error!\n"); - return -1; - } else if (pid == 0) { - sharedflag = (int *)shmat(shmid, NULL, 0); - close(pipefd[0]); - for (int i = 0; i < totalNum; i++) { - errno = 0; - char sentence1[15] = "Hello World"; - char a[2] = {0}; - sprintf(a, "%d", i); - strcat(sentence1, a); - int ret = write(*writeFd, sentence1, strlen(sentence1) + 1); - ICUNIT_ASSERT_EQUAL(ret, strlen(sentence1) + 1, ret); - usleep(10000); // 10000, Used to calculate the delay time. - } - *sharedflag = 1; - ret = close(pipefd[1]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - exit(0); - } else { - close(pipefd[1]); - // waitting for the sub process has written the sentence first - while (*sharedflag != 1) { - usleep(1); - } - for (int i = 0; i < totalNum; i++) { - printf("read\n"); - char sentence1[15] = "Hello World"; - char a[2] = {0}; - sprintf(a, "%d", i); - strcat(sentence1, a); - memset(readbuffer, 0, sizeof(readbuffer)); - retValue = read(*readFd, readbuffer, strlen(sentence1) + 1); - printf("Receive %d bytes data : %s, errno : %d\n", retValue, readbuffer, errno); - ICUNIT_ASSERT_SIZE_STRING_EQUAL(readbuffer, sentence1, strlen(sentence1), errno); - } - } - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - ret = close(pipefd[0]); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - - -void ItPosixPipe002(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestPipeMultiProcess, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/pipe_test_004.cpp b/testsuites/unittest_old/signal/smoke/pipe_test_004.cpp deleted file mode 100644 index 87e8243f..00000000 --- a/testsuites/unittest_old/signal/smoke/pipe_test_004.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "fcntl.h" - -#define FAULT1 11 -#define FAULT2 22 -int TestPipeReturn() -{ - int pipefd[2]; // 2, array subscript - int retValue, i, status; - retValue = pipe(NULL); - ICUNIT_ASSERT_EQUAL(retValue, -1, retValue); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - printf("***************1\n"); - - return LOS_OK; -} - -void ItPosixPipe004(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestPipeReturn, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/signal_test_002.cpp b/testsuites/unittest_old/signal/smoke/signal_test_002.cpp deleted file mode 100644 index 17d430de..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_002.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "sys/wait.h" - -static int g_sigCount = 0; -static void SigPrint(int sig) -{ - g_sigCount++; -} - -static int TestRaiseIgnore() -{ - int sig = SIGPWR; - void *ret; - int retValue; - - g_sigCount = 0; - // trigger one - ret = (void *)signal(sig, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(ret, NULL, ret); - - retValue = raise(sig); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - usleep(1000); // 1000, Used to calculate the delay time. - // trigger ignore - ret = (void *)signal(sig, SIG_IGN); - ICUNIT_ASSERT_NOT_EQUAL(ret, NULL, ret); - - retValue = raise(sig); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - // trigger one - ret = (void *)signal(sig, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(ret, NULL, ret); - retValue = raise(sig); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - return g_sigCount; -} - -static int TestCase(void) -{ - int count; - - count = TestRaiseIgnore(); - // the signal should be triggered twice - ICUNIT_ASSERT_EQUAL(count, 2, count); // 2, assert that function Result is equal to this. - return 0; -} - -void ItPosixSignal002(void) -{ - TEST_ADD_CASE("IT_POSIX_SIGNAL_002", TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/signal_test_009.cpp b/testsuites/unittest_old/signal/smoke/signal_test_009.cpp deleted file mode 100644 index 775fb542..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_009.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static int g_sigCount = 0; -static void SigPrint(int sig) -{ - g_sigCount++; -} - -static void SigPrint1(int sig) -{ - g_sigCount += 100; // 100, Used to calculate the progress of the program. -} - -static int TestSigSet() -{ - sigset_t set = { 0 }; - sigset_t set1 = { 0 }; - sigset_t left = { 0 }; - sigset_t right = { 0 }; - - void (*ret)(int); - int retValue; - - left.__bits[0] = 0x1; - right.__bits[0] = 0x2; - - retValue = sigandset(&set, &left, &right); - ICUNIT_ASSERT_EQUAL(set.__bits[0], 0, set.__bits[0]); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - left.__bits[0] = 0x11; - right.__bits[0] = 0x1; - - retValue = sigandset(&set, &left, &right); - ICUNIT_ASSERT_EQUAL(set.__bits[0], 1, set.__bits[0]); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - left.__bits[0] = 0x11; - right.__bits[0] = 0x11; - - retValue = sigandset(&set, &left, &right); - ICUNIT_ASSERT_EQUAL(set.__bits[0], 0x11, set.__bits[0]); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - retValue = sigorset(&set, &left, &right); - ICUNIT_ASSERT_EQUAL(set.__bits[0], 0x11, set.__bits[0]); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - retValue = sigdelset(&set, 1); - ICUNIT_ASSERT_EQUAL(set.__bits[0], 0x10, set.__bits[0]); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - int sigs; - sigset(1, SigPrint1); - - retValue = raise(1); - ICUNIT_ASSERT_EQUAL(g_sigCount, 100, g_sigCount); // 100, assert that function Result is equal to this. - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - retValue = sigfillset(&set); - ICUNIT_ASSERT_EQUAL(set.__bits[0], 0x7fffffff, set.__bits[0]); - ICUNIT_ASSERT_EQUAL(set.__bits[1], 0xfffffffc, set.__bits[1]); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - retValue = sigaddset(&set1, 1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - ret = signal(1, SigPrint); - ICUNIT_ASSERT_NOT_EQUAL(ret, NULL, ret); - retValue = sighold(1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - retValue = raise(1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - retValue = sigrelse(1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - retValue = raise(1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - ICUNIT_ASSERT_EQUAL(g_sigCount, 102, g_sigCount); // 102, assert that function Result is equal to this. - - retValue = sigisemptyset(&set1); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - - retValue = siginterrupt(1, 0); - ICUNIT_ASSERT_EQUAL(retValue, 0, retValue); - return 0; -} - - -void ItPosixSignal009(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSigSet, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/signal_test_013.cpp b/testsuites/unittest_old/signal/smoke/signal_test_013.cpp deleted file mode 100644 index f715a27e..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_013.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void SigPrint(int sig) -{ - printf("%s\n", __FUNCTION__, __LINE__); - return; -} - -static void SigPrint1(int sig) -{ - printf("%s\n", __FUNCTION__, __LINE__); - return; -} - -static int g_sigCount = 0; -static void SigPrint2(int sig) -{ - g_sigCount = 1; - printf("%s, count = %d\n", __FUNCTION__, g_sigCount); - return; -} - -static void *ThreadSetFunc2(void *arg) -{ - void (*retSig)(int); - retSig = signal(SIGALRM, SigPrint2); - ICUNIT_GOTO_NOT_EQUAL(retSig, SIG_ERR, retSig, EXIT); - pthread_exit((void *)NULL); - return NULL; -EXIT: - pthread_exit((void *)-1); - return (void *)-1; -} - -static void *ThreadSetDfl(void *arg) -{ - void (*retSig)(int); - retSig = signal(SIGALRM, SIG_DFL); - ICUNIT_GOTO_NOT_EQUAL(retSig, SIG_ERR, retSig, EXIT); - pthread_exit((void *)NULL); - return NULL; -EXIT: - pthread_exit((void *)-1); - return (void *)-1; -} - -static void *ThreadKill(void *arg) -{ - int retValue; - - retValue = raise(SIGALRM); - ICUNIT_GOTO_EQUAL(retValue, 0, retValue, EXIT); - pthread_exit((void *)NULL); - return NULL; -EXIT: - pthread_exit((void *)-1); - return (void *)-1; -} - -static int TestSigMultiPthread() -{ - int fpid; - int status; - int *status1 = nullptr; - int ret; - int count; - pthread_t thread, thread1, thread2; - - fpid = fork(); - ICUNIT_ASSERT_WITHIN_EQUAL(fpid, 0, UINT_MAX, fpid); - if (fpid == 0) { - ret = pthread_create(&thread1, NULL, ThreadSetDfl, 0); - if (ret != 0) { - exit(ret); - } - ret = pthread_create(&thread2, NULL, ThreadSetFunc2, 0); - if (ret != 0) { - exit(ret); - } - ret = pthread_create(&thread, NULL, ThreadKill, 0); - if (ret != 0) { - exit(ret); - } - - pthread_join(thread, (void **)&status1); - if ((int)(intptr_t)status1 != 0) { - exit(-1); - } - pthread_join(thread1, (void **)&status1); - if ((int)(intptr_t)status1 != 0) { - exit(-1); - } - pthread_join(thread2, (void **)&status1); - if ((int)(intptr_t)status1 != 0) { - exit(-1); - } - if (g_sigCount != 1) { - exit(g_sigCount); - } - exit(0); - } - - ret = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, fpid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - return 0; -} - -void ItPosixSignal013(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSigMultiPthread, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/signal_test_014.cpp b/testsuites/unittest_old/signal/smoke/signal_test_014.cpp deleted file mode 100644 index 36180e20..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_014.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void SigPrint(int sig) -{ - printf("%s,%d\n", __FUNCTION__, __LINE__); -} - -static int TestSigErrno() -{ - void (*ret)(int); - ret = signal(100, SigPrint); // 100, signal num. - ICUNIT_ASSERT_EQUAL((int)ret, -1, (int)ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = signal(0, SigPrint); - ICUNIT_ASSERT_EQUAL((int)ret, -1, (int)ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - errno = 0; - ret = signal(30, SigPrint); // 30, signal num. - ICUNIT_ASSERT_EQUAL(errno, 0, errno); - - ret = signal(-1, SigPrint); - ICUNIT_ASSERT_EQUAL((int)ret, -1, (int)ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = signal(32, SigPrint); // 32, signal num. - ICUNIT_ASSERT_EQUAL((int)ret, -1, (int)ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = signal(31, SigPrint); // 31, signal num. - ICUNIT_ASSERT_EQUAL((int)ret, -1, (int)ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - return 0; -} - -void ItPosixSignal014(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSigErrno, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/signal_test_021.cpp b/testsuites/unittest_old/signal/smoke/signal_test_021.cpp deleted file mode 100644 index 7b1ca818..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_021.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "stdio.h" -#include "unistd.h" -#include "signal.h" - -static void SigPrint(int signum) -{ - printf("Catch signal %d\n", signum); -} - -static void SigQuit(int signum) -{ - printf("QUIT\n"); -} - -static int TestSignal() -{ - int sigI = SIGINT; - int sigQ = SIGQUIT; - void (*ret)(int); - int retValue, status; - - int fpid = fork(); - if (fpid == 0) { - ret = signal(sigI, SigPrint); - if (ret == nullptr) { - exit((int)ret); - } - printf("SIGINT to trigger the signal\n"); - printf("SIGQUIT to quit\n\n"); - - retValue = raise(sigI); - if (retValue != 0) { - exit(retValue); - } - - ret = signal(sigQ, SigQuit); - if (ret == nullptr) { - exit((int)ret); - } - - retValue = raise(sigQ); - if (retValue != 0) { - exit(retValue); - } - exit(0); - } - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - return 0; -} - -void ItPosixSignal021(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSignal, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/smoke/signal_test_022.cpp b/testsuites/unittest_old/signal/smoke/signal_test_022.cpp deleted file mode 100644 index f3ed53b5..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_022.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void SigPrint(int) -{ - printf("Receive signal. Raise successes\n\n"); -} - -static int TestRaise() -{ - int sig = SIGINT; - void (*ret)(int) = nullptr; - int retValue, status; - - int fpid = fork(); - if (fpid == 0) { - printf("Set signal\n"); - ret = signal(sig, SigPrint); - if (ret == nullptr) { - exit((int)ret); - } - retValue = raise(sig); - if (retValue != 0) { - exit(retValue); - } - - usleep(1000); // 1000, Used to calculate the delay time. - printf("Set ignore\n"); - ret = signal(sig, SIG_IGN); - if (ret == NULL) { - exit((int)ret); - } - retValue = raise(sig); - if (retValue != 0) { - exit(retValue); - } - - printf("\nReset signal\n"); - ret = signal(sig, SigPrint); - if (ret == NULL) { - exit((int)ret); - } - retValue = raise(sig); - if (retValue != 0) { - exit(retValue); - } - exit(0); - } - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - return 0; -} - -void ItPosixSignal022(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestRaise, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/smoke/signal_test_023.cpp b/testsuites/unittest_old/signal/smoke/signal_test_023.cpp deleted file mode 100644 index 9b96715b..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_023.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void SigPrint(int signum) -{ - printf("Receive signal. Kill succeeds\n\n"); -} - -static int TestKill() -{ - int sig = SIGALRM; - - void (*retSig)(int); - int retValue, status; - - printf("new code \n"); - - int fpid = fork(); - if (fpid == 0) { - printf("Set Signal\n\n"); - retSig = signal(sig, SigPrint); - if (retSig == NULL) { - printf("retSig = null\n"); - exit((int)retSig); - } - - printf("Test Kill\n"); - usleep(1000); // 1000, Used to calculate the delay time. - retValue = kill(getpid(), sig); - if (retValue != 0) { - printf("value != 0 \n"); - exit(retValue); - } - exit(0); - } - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - return 0; -} - -void ItPosixSignal023(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestKill, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/smoke/signal_test_024.cpp b/testsuites/unittest_old/signal/smoke/signal_test_024.cpp deleted file mode 100644 index c5b49729..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_024.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static void OldAction(int signum) -{ - printf("Here is the old action\n"); -} - -static void NewAction(int signum) -{ - printf("Here is the new action\n"); -} - -static int TestSigaction() -{ - int retValue, status; - int fpid = fork(); - if (fpid == 0) { - struct sigaction curAction, oldAction; - curAction.sa_handler = OldAction; - retValue = sigemptyset(&curAction.sa_mask); - if (retValue != 0) { - exit(retValue); - } - curAction.sa_flags = 0; - - printf("Execute Signal\n"); - retValue = sigaction(SIGINT, &curAction, NULL); - if (retValue != 0) { - exit(retValue); - } - retValue = raise(SIGINT); - if (retValue != 0) { - exit(retValue); - } - printf("\n\n"); - - printf("Test backup\n"); - retValue = sigaction(SIGINT, &curAction, &oldAction); - if (retValue != 0) { - exit(retValue); - } - curAction.sa_handler = NewAction; - retValue = sigaction(SIGINT, &curAction, NULL); - if (retValue != 0) { - exit(retValue); - } - retValue = sigaction(SIGALRM, &oldAction, NULL); - if (retValue != 0) { - exit(retValue); - } - retValue = raise(SIGINT); - if (retValue != 0) { - exit(retValue); - } - retValue = raise(SIGALRM); - if (retValue != 0) { - exit(retValue); - } - printf("\n\n"); - - exit(0); - } - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - return 0; -} - -void ItPosixSignal024(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestSigaction, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/smoke/signal_test_031.cpp b/testsuites/unittest_old/signal/smoke/signal_test_031.cpp deleted file mode 100644 index abd8c999..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_031.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static const int INVALID_SIG = 1000; - -static UINT32 TestCase(VOID) -{ - int ret = 0; - sigset_t set; - - /* // EINVAL no support - ret = sigemptyset(NULL); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - ret = sigfillset(NULL); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - */ - int status; - int fpid = fork(); - if (fpid == 0) { - sigemptyset(&set); - ret = sigaddset(&set, INVALID_SIG); - if (ret != -1) { - exit(ret); - } - if (errno != EINVAL) { - exit(errno); - } - printf("----------------------------------\n"); - - ret = sigdelset(&set, INVALID_SIG); - if (ret != -1) { - exit(ret); - } - if (errno != EINVAL) { - exit(errno); - } - printf("----------------------------------\n"); - - ret = sigignore(INVALID_SIG); - if (ret != -1) { - exit(ret); - } - if (errno != EINVAL) { - exit(errno); - } - printf("----------------------------------\n"); - - ret = sigignore(SIGKILL); - if (ret != -1) { - exit(ret); - } - if (errno != EINVAL) { - exit(errno); - } - printf("----------------------------------\n"); - - ret = sigrelse(INVALID_SIG); - if (ret != -1) { - exit(ret); - } - if (errno != EINVAL) { - exit(errno); - } - printf("----------------------------------\n"); - - ret = sighold(INVALID_SIG); - if (ret != -1) { - exit(ret); - } - if (errno != EINVAL) { - exit(errno); - } - printf("----------------------------------\n"); - - exit(0); - } - - ret = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, fpid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - return LOS_OK; -} - -void ItPosixSignal031(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/smoke/signal_test_032.cpp b/testsuites/unittest_old/signal/smoke/signal_test_032.cpp deleted file mode 100644 index 32b7c79d..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_032.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static int g_sigCount = 0; -static void SigPrint(int sig) -{ - g_sigCount++; - printf("signal receive sucess\n"); -} - -static UINT32 TestCase(VOID) -{ - int pid = 0; - int ret = 0; - void (*retptr)(int) = NULL; - sigset_t newset, oldset; - pid = fork(); - if (pid < 0) { - printf("Fork error\n"); - return LOS_NOK; - } else if (pid == 0) { - printf("test032 raise before\n"); - sigemptyset(&newset); - sigaddset(&newset, SIGUSR1); - ret = sigprocmask(SIG_BLOCK, &newset, &oldset); - if (ret != 0) { - printf("error:sigprocmask\n"); - exit(LOS_NOK); - } - retptr = signal(SIGUSR1, SigPrint); - if (retptr == SIG_ERR) { - printf("error:signal\n"); - exit(LOS_NOK); - } - raise(SIGUSR1); - printf("test032 raise after\n"); - exit(g_sigCount); - } - - wait(&ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(ret), 0, WEXITSTATUS(ret)); - return LOS_OK; -} - -void ItPosixSignal032(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/smoke/signal_test_035.cpp b/testsuites/unittest_old/signal/smoke/signal_test_035.cpp deleted file mode 100644 index b98dbbd0..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_035.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static int g_sigCount = 0; -static void SigPrint(int sig) -{ - g_sigCount++; -} - -static int TestCase() -{ - int sig = 100; - int count = 0; - int retValue, status; - void (*ret)(int); - - printf("new 2\n"); - - int fpid = fork(); - if (fpid == 0) { - ret = signal(sig, SigPrint); - if (ret != SIG_ERR) { - exit((int)ret); - } - if (errno != EINVAL) { - exit(errno); - } - - sig = SIGTERM; - ret = signal(sig, SigPrint); - ret = signal(sig, SIG_DFL); - if (ret != SigPrint) { - exit((int)ret); - } - exit(0); - } - - retValue = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retValue, fpid, retValue); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - return LOS_OK; -} - -void ItPosixSignal035(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/signal_test_036.cpp b/testsuites/unittest_old/signal/smoke/signal_test_036.cpp deleted file mode 100644 index 8cb97a67..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_036.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static int g_sigCount = 0; -static void SigPrint(int sig) -{ - g_sigCount++; -} - -static int TestCase() -{ - int sig = SIGKILL; - int ret, status; - - int fpid = fork(); - if (fpid == 0) { - struct sigaction sigAct, oldAct; - sigAct.sa_handler = SigPrint; - sigemptyset(&sigAct.sa_mask); - sigAct.sa_flags = 0; - - ret = sigaction(sig, &sigAct, &oldAct); - printf("ret = %d\n", ret); - if (ret != -1) { - exit(ret); - } - if (errno != EINVAL) { - exit(errno); - } - exit(0); - } - - /* sig = SIGTERM; - ret = sigaction(sig, (struct sigaction *)1, &oldAct); - printf("ret == %d\n", ret); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - - ret = sigaction(sig, &sigAct, (struct sigaction *)1); - printf("ret === %d\n", ret); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); */ - - ret = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, fpid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - return LOS_OK; -} - -void ItPosixSignal036(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/smoke/signal_test_037.cpp b/testsuites/unittest_old/signal/smoke/signal_test_037.cpp deleted file mode 100644 index e2605476..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_037.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -static UINT32 TestCase(VOID) -{ - int retval, status; - sigset_t set, oldset; - - int fpid = fork(); - if (fpid == 0) { - retval = sigemptyset(&set); - ICUNIT_ASSERT_NOT_EQUAL(retval, -1, retval); - retval = sigemptyset(&oldset); - ICUNIT_ASSERT_NOT_EQUAL(retval, -1, retval); - retval = sigaddset(&set, SIGTERM); - ICUNIT_ASSERT_NOT_EQUAL(retval, -1, retval); - printf("----------------------------------\n"); - retval = sigprocmask(666, &set, &oldset); // 666, invalid param - ICUNIT_ASSERT_EQUAL(retval, -1, retval); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - printf("----------------------------------\n"); - retval = sigprocmask(SIG_BLOCK, (sigset_t *)1, &oldset); - ICUNIT_ASSERT_EQUAL(retval, -1, retval); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); - printf("----------------------------------\n"); - retval = sigprocmask(SIG_BLOCK, &set, &oldset); - ICUNIT_ASSERT_EQUAL(retval, 0, retval); - - exit(0); - } - - retval = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(retval, fpid, retval); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - - return LOS_OK; -} - -void ItPosixSignal037(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/signal/smoke/signal_test_039.cpp b/testsuites/unittest_old/signal/smoke/signal_test_039.cpp deleted file mode 100644 index 3c51a1ce..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_039.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" -#include "time.h" -static const int INVALID_WHICH = 666; -#define IS32BIT(x) !((x) + 0x80000000ULL >> 32) - -static UINT32 TestCase(VOID) -{ - int ret, status; - struct itimerval newValue = { 0 }; - struct itimerval oldValue = { 0 }; - struct itimerval test; - - int fpid = fork(); - if (fpid == 0) { - bool flag = IS32BIT(test.it_interval.tv_sec); - ret = setitimer(INVALID_WHICH, &newValue, &oldValue); - printf("ret=%x--flag=%d-----\n", ret, flag); - if (ret != -1) { - exit(ret); - } - if (errno != EINVAL) { - exit(errno); - } - printf("---------------\n"); - - exit(0); - } - - /* // EFAULT no support - ret = setitimer(ITIMER_VIRTUAL, NULL, &oldValue); - printf("ret = %d errno = %d EFAULT = %d\n", ret, errno, EFAULT); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); */ - - ret = waitpid(fpid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, fpid, ret); - ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status)); - return LOS_OK; -} - -void ItPosixSignal039(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/signal_test_042.cpp b/testsuites/unittest_old/signal/smoke/signal_test_042.cpp deleted file mode 100644 index 408900d3..00000000 --- a/testsuites/unittest_old/signal/smoke/signal_test_042.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - */ -#include "it_test_signal.h" -#include "signal.h" - -#include "pthread.h" - -static int SigtimedwaitFailTest(const sigset_t *set, siginfo_t *info, const struct timespec *timeout, - unsigned int expectErrno) -{ - int ret; - errno = 0; - if (expectErrno == 0) { - ret = sigtimedwait(set, info, timeout); - if (ret != 0) { - printf("err: line %d, errno %d\n", __LINE__, errno); - return errno; - } - return 0; - } - ret = sigtimedwait(set, info, timeout); - if (ret == 0) { - printf("err: line %d\n", __LINE__); - return -1; - } - if (errno != expectErrno) { - printf("err: line %d\n", __LINE__); - return errno; - } - return 0; -} - -static UINT32 TestCase() -{ - int ret; - struct timespec time1 = { 0, 50 }; - sigset_t set; - - sigemptyset(&set); - sigprocmask(SIG_SETMASK, &set, NULL); - - printf("check invlid sigset ...\n"); - int rt = sigaddset(&set, 0); - ICUNIT_ASSERT_EQUAL(rt, -1, rt); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - rt = sigaddset(&set, 100); // 100, set signal num - ICUNIT_ASSERT_EQUAL(rt, -1, rt); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - rt = sigaddset(&set, SIGALRM); - ICUNIT_ASSERT_EQUAL(rt, 0, rt); - - siginfo_t si; - time1.tv_sec = -1; - printf("check invlid timespec: tv_sec=-1 ...\n"); - ret = SigtimedwaitFailTest(&set, &si, &time1, EINVAL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - time1.tv_sec = 1; - time1.tv_nsec = -1; - printf("check invlid timespec: tv_nsec=-1 ...\n"); - ret = SigtimedwaitFailTest(&set, &si, &time1, EINVAL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - time1.tv_sec = 1; - time1.tv_nsec = 1000 * 1000 * 1000 + 1; // 1000, set the nsec of time. - printf("check invlid timespec: tv_nsec overflow ...\n"); - ret = SigtimedwaitFailTest(&set, &si, &time1, EINVAL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ItPosixSignal042(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/sigset_test_001.cpp b/testsuites/unittest_old/signal/smoke/sigset_test_001.cpp deleted file mode 100644 index 257e552f..00000000 --- a/testsuites/unittest_old/signal/smoke/sigset_test_001.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -#include "it_test_signal.h" -#include "signal.h" -#include "pthread.h" -#include "errno.h" -static int g_signum; - -static void SigUsr(int sigNum) -{ - g_signum = sigNum; - ICUNIT_ASSERT_EQUAL_VOID(g_signum, SIGUSR2, g_signum); -} - -static void *PthreadSigsetSigHold(void *arg) -{ - void (*ret)(int); - ret = sigset(SIGUSR1, SIG_HOLD); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, NULL, ret); - ICUNIT_ASSERT_EQUAL_NULL(errno, EINVAL, errno); - return nullptr; -} - -static void *PthreadSigsetSigUsr(void *arg) -{ - void (*ret)(int); - ret = sigset(SIGUSR2, SigUsr); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, NULL, ret); - return nullptr; -} - -static UINT32 TestCase() -{ - pthread_t tid = -1; - - int ret = pthread_create(&tid, nullptr, PthreadSigsetSigHold, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_kill(tid, SIGUSR1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = pthread_join(tid, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_create(&tid, nullptr, PthreadSigsetSigUsr, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_kill(tid, SIGUSR2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = pthread_join(tid, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -void ItPosixSigset001(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/signal/smoke/sigset_test_002.cpp b/testsuites/unittest_old/signal/smoke/sigset_test_002.cpp deleted file mode 100644 index d9be9437..00000000 --- a/testsuites/unittest_old/signal/smoke/sigset_test_002.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ - -#include "it_test_signal.h" -#include "signal.h" -#include "pthread.h" -#include "errno.h" -static int g_signum; - -static void SigUsr(int sigNum) -{ - g_signum = sigNum; -} - -static void *PthreadSigsetSigSetError(void *arg) -{ - void (*ret)(int); - ret = sigset(0, SigUsr); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, NULL, ret); - ICUNIT_ASSERT_EQUAL_NULL(errno, EINVAL, errno); - errno = 0; - - ret = sigset(_NSIG, SigUsr); - ICUNIT_ASSERT_NOT_EQUAL_NULL(ret, NULL, ret); - ICUNIT_ASSERT_EQUAL_NULL(errno, EINVAL, errno); - errno = 0; - - return nullptr; -} - -static UINT32 TestCase() -{ - pthread_t tid; - - int ret = pthread_create(&tid, nullptr, PthreadSigsetSigSetError, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = pthread_kill(tid, SIGUSR1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = pthread_join(tid, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -void ItPosixSigset002(void) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_SIGNAL, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/BUILD.gn b/testsuites/unittest_old/sys/BUILD.gn deleted file mode 100644 index d59e4d18..00000000 --- a/testsuites/unittest_old/sys/BUILD.gn +++ /dev/null @@ -1,103 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../common/include", - "./", -] - -sources_entry = [ - "../common/osTest.cpp", - "sys_unit_test.cpp", -] - -sources_smoke = [ - "smoke/sys_test_004.cpp", - "smoke/sys_test_005.cpp", - "smoke/sys_test_006.cpp", - "smoke/sys_test_007.cpp", - "smoke/sys_test_008.cpp", - "smoke/sys_test_009.cpp", - "smoke/sys_test_010.cpp", - "smoke/sys_test_012.cpp", - "smoke/sys_test_013.cpp", - "smoke/sys_test_014.cpp", - "smoke/sys_test_015.cpp", - "smoke/sys_test_016.cpp", - "smoke/sys_test_017.cpp", - "smoke/sys_test_029.cpp", - "smoke/sys_test_030.cpp", - "smoke/sys_test_031.cpp", -] - -sources_full = [ - "full/sys_test_001.cpp", - "full/sys_test_018.cpp", - "full/sys_test_019.cpp", - "full/sys_test_020.cpp", - "full/sys_test_021.cpp", - "full/sys_test_022.cpp", - "full/sys_test_023.cpp", - "full/sys_test_024.cpp", - "full/sys_test_025.cpp", - "full/sys_test_026.cpp", - "full/sys_test_027.cpp", - "full/sys_test_028.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_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" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_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" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} diff --git a/testsuites/unittest_old/sys/It_test_sys.h b/testsuites/unittest_old/sys/It_test_sys.h deleted file mode 100644 index 4bc6ad5d..00000000 --- a/testsuites/unittest_old/sys/It_test_sys.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_SYS_H -#define _IT_TEST_SYS_H - -#include "libgen.h" -#include "setjmp.h" -#include "fenv.h" -#include "float.h" -#include "math.h" -#include "regex.h" -#include "locale.h" -#include "pwd.h" -#include "osTest.h" -#define FE_INVALID 1 -#define FE_DIVBYZERO 4 -#define FE_OVERFLOW 8 -#define FE_UNDERFLOW 16 -#define FE_INEXACT 32 -#define FE_ALL_EXCEPT 0 -#define FE_TONEAREST 0 -#define FE_DOWNWARD 0x400 -#define FE_UPWARD 0x800 -#define FE_TOWARDZERO 0xc00 - -extern CHAR *g_groupFileStream; -extern CHAR *g_passwdFileStream; -extern VOID ItTestSys001(VOID); -extern VOID IT_TEST_SYS_002(VOID); -extern VOID IT_TEST_SYS_003(VOID); -extern VOID ItTestSys004(VOID); -extern VOID ItTestSys005(VOID); -extern VOID ItTestSys006(VOID); -extern VOID ItTestSys007(VOID); -extern VOID ItTestSys008(VOID); -extern VOID ItTestSys009(VOID); -extern VOID ItTestSys010(VOID); -extern VOID IT_TEST_SYS_011(VOID); -extern VOID ItTestSys012(VOID); -extern VOID ItTestSys013(VOID); -extern VOID ItTestSys014(VOID); -extern VOID ItTestSys015(VOID); -extern VOID ItTestSys016(VOID); -extern VOID ItTestSys017(VOID); -extern VOID ItTestSys018(VOID); -extern VOID ItTestSys019(VOID); -extern VOID ItTestSys020(VOID); -extern VOID ItTestSys021(VOID); -extern VOID ItTestSys022(VOID); -extern VOID ItTestSys023(VOID); -extern VOID ItTestSys024(VOID); -extern VOID ItTestSys025(VOID); -extern VOID ItTestSys026(VOID); -extern VOID ItTestSys027(VOID); -extern VOID ItTestSys028(VOID); -extern VOID ItTestSys029(VOID); -extern VOID IT_TEST_SYS_030(VOID); -extern VOID IT_TEST_SYS_031(VOID); -#endif diff --git a/testsuites/unittest_old/sys/full/sys_test_001.cpp b/testsuites/unittest_old/sys/full/sys_test_001.cpp deleted file mode 100644 index 1ff8db62..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_001.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -#include "It_test_sys.h" - -static jmp_buf g_buf; -static UINT32 First(VOID) -{ - int val = 2; - int ret = setjmp(g_buf); - if (ret) { - ICUNIT_ASSERT_EQUAL(ret, val, ret); - goto OUT1; - } - - longjmp(g_buf, val); -OUT1: - return 0; -} - -static UINT32 Sencond(VOID) -{ - int ret = setjmp(g_buf); - if (ret) { - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - goto OUT2; - } - - longjmp(g_buf, 0); - -OUT2: - return 0; -} - -static UINT32 TestCase(VOID) -{ - int ret = First(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = Sencond(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -VOID ItTestSys001(VOID) -{ - TEST_ADD_CASE("IT_TEST_SYS_024", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/full/sys_test_018.cpp b/testsuites/unittest_old/sys/full/sys_test_018.cpp deleted file mode 100644 index f6490a59..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_018.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -STATIC UINT32 TestCase(VOID) -{ - struct passwd *user1 = nullptr; - struct passwd *user2 = nullptr; - struct passwd *user3 = nullptr; - struct passwd *user4 = nullptr; - INT32 ret; - CHAR *pathList[] = {"/etc/group", "/etc/passwd"}; - CHAR *streamList[] = {g_groupFileStream, g_passwdFileStream}; - INT32 streamLen[] = {strlen(g_groupFileStream), strlen(g_passwdFileStream)}; - - ret = PrepareFileEnv(pathList, streamList, streamLen, 2); /* 2, group & passwd */ - if (ret != 0) { - printf("error: need some env file, but prepare is not ok"); - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return -1; - } - - user1 = getpwnam("root"); - ICUNIT_GOTO_NOT_EQUAL(user1, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_name, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_uid, 0, -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_gid, 0, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_gecos, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_dir, "/root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_shell, "/bin/bash", -1, ERROUT); - - user2 = getpwnam("daemon"); - ICUNIT_GOTO_NOT_EQUAL(user2, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_name, "daemon", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user2->pw_uid, 1, -1, ERROUT); - ICUNIT_GOTO_EQUAL(user2->pw_gid, 1, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_gecos, "daemon", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_dir, "/usr/sbin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_shell, "/usr/sbin/nologin", -1, ERROUT); - - - user3 = getpwnam("bin"); - ICUNIT_GOTO_NOT_EQUAL(user3, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_name, "bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user3->pw_uid, 2, -1, ERROUT); /* 2, from etc/group */ - ICUNIT_GOTO_EQUAL(user3->pw_gid, 2, -1, ERROUT); /* 2, from etc/group */ - ICUNIT_GOTO_STRING_EQUAL(user3->pw_gecos, "bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_dir, "/bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_shell, "/usr/sbin/nologin", -1, ERROUT); - - user4 = getpwnam("lyw"); - ICUNIT_GOTO_EQUAL(user4, nullptr, -1, ERROUT); - - user4 = getpwnam(""); - ICUNIT_GOTO_EQUAL(user4, nullptr, -1, ERROUT); - - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return 0; -ERROUT: - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return -1; -} - -VOID ItTestSys018(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/full/sys_test_019.cpp b/testsuites/unittest_old/sys/full/sys_test_019.cpp deleted file mode 100644 index 2460ccda..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_019.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -STATIC UINT32 TestCase(VOID) -{ - struct passwd pwd; - struct passwd *user1 = nullptr; - struct passwd *user2 = nullptr; - struct passwd *user3 = nullptr; - struct passwd *user4 = nullptr; - struct passwd *user5 = nullptr; - CHAR buf1[1024] = { 0 }; /* 1024, buffer for test */ - CHAR buf2[2] = { 0 }; /* 2, for test,this buffer is not enough large to save data */ - INT32 ret; - CHAR *pathList[] = {"/etc/group", "/etc/passwd"}; - CHAR *streamList[] = {g_groupFileStream, g_passwdFileStream}; - INT32 streamLen[] = {strlen(g_groupFileStream), strlen(g_passwdFileStream)}; - - ret = PrepareFileEnv(pathList, streamList, streamLen, 2); /* 2, group & passwd */ - if (ret != 0) { - printf("error: need some env file, but prepare is not ok"); - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return -1; - } - - ret = getpwnam_r("root", &pwd, buf1, sizeof(buf1), &user1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROUT); - ICUNIT_GOTO_NOT_EQUAL(user1, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_name, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_uid, 0, -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_gid, 0, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_gecos, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_dir, "/root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_shell, "/bin/bash", -1, ERROUT); - - ICUNIT_GOTO_STRING_EQUAL(pwd.pw_name, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(pwd.pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(pwd.pw_uid, 0, -1, ERROUT); - ICUNIT_GOTO_EQUAL(pwd.pw_gid, 0, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(pwd.pw_gecos, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(pwd.pw_dir, "/root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(pwd.pw_shell, "/bin/bash", -1, ERROUT); - - ret = getpwnam_r("daemon", &pwd, buf1, sizeof(buf1), &user2); - ICUNIT_GOTO_NOT_EQUAL(user2, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_name, "daemon", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user2->pw_uid, 1, -1, ERROUT); - ICUNIT_GOTO_EQUAL(user2->pw_gid, 1, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_gecos, "daemon", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_dir, "/usr/sbin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_shell, "/usr/sbin/nologin", -1, ERROUT); - - ret = getpwnam_r("bin", &pwd, buf1, sizeof(buf1), &user3); - ICUNIT_GOTO_NOT_EQUAL(user3, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_name, "bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user3->pw_uid, 2, -1, ERROUT); /* 2, from etc/group */ - ICUNIT_GOTO_EQUAL(user3->pw_gid, 2, -1, ERROUT); /* 2, from etc/group */ - ICUNIT_GOTO_STRING_EQUAL(user3->pw_gecos, "bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_dir, "/bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_shell, "/usr/sbin/nologin", -1, ERROUT); - - ret = getpwnam_r("root", &pwd, buf2, sizeof(buf2), &user4); - ICUNIT_GOTO_EQUAL(ret, ERANGE, ret, ERROUT); - ICUNIT_GOTO_EQUAL(user4, nullptr, -1, ERROUT); - - ret = getpwnam_r(nullptr, &pwd, buf1, sizeof(buf1), &user5); - ICUNIT_GOTO_EQUAL(ret, 0, -1, ERROUT); - ret = getpwnam_r("", &pwd, buf1, sizeof(buf1), &user5); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, -1, ERROUT); - ret = getpwnam_r("sssssss", &pwd, buf1, sizeof(buf1), &user5); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, -1, ERROUT); - - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return 0; -ERROUT: - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return -1; -} - -VOID ItTestSys019(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/full/sys_test_020.cpp b/testsuites/unittest_old/sys/full/sys_test_020.cpp deleted file mode 100644 index 89438972..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_020.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -STATIC UINT32 TestCase(VOID) -{ - struct passwd *user1 = nullptr; - struct passwd *user2 = nullptr; - struct passwd *user3 = nullptr; - struct passwd *user4 = nullptr; - INT32 ret; - CHAR *pathList[] = {"/etc/group", "/etc/passwd"}; - CHAR *streamList[] = {g_groupFileStream, g_passwdFileStream}; - INT32 streamLen[] = {strlen(g_groupFileStream), strlen(g_passwdFileStream)}; - - ret = PrepareFileEnv(pathList, streamList, streamLen, 2); /* 2, group & passwd */ - if (ret != 0) { - printf("error: need some env file, but prepare is not ok"); - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return -1; - } - - user1 = getpwuid(0); - ICUNIT_GOTO_NOT_EQUAL(user1, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_name, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_uid, 0, -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_gid, 0, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_gecos, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_dir, "/root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_shell, "/bin/bash", -1, ERROUT); - - user2 = getpwuid(1); - ICUNIT_GOTO_NOT_EQUAL(user2, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_name, "daemon", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user2->pw_uid, 1, -1, ERROUT); - ICUNIT_GOTO_EQUAL(user2->pw_gid, 1, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_gecos, "daemon", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_dir, "/usr/sbin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_shell, "/usr/sbin/nologin", -1, ERROUT); - - user3 = getpwuid(2); /* 2, from etc/group */ - ICUNIT_GOTO_NOT_EQUAL(user3, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_name, "bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user3->pw_uid, 2, -1, ERROUT); /* 2, from etc/group */ - ICUNIT_GOTO_EQUAL(user3->pw_gid, 2, -1, ERROUT); /* 2, from etc/group */ - ICUNIT_GOTO_STRING_EQUAL(user3->pw_gecos, "bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_dir, "/bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_shell, "/usr/sbin/nologin", -1, ERROUT); - - user4 = getpwuid(200); - ICUNIT_GOTO_EQUAL(user4, nullptr, -1, ERROUT); - - user4 = getpwuid(-100); - ICUNIT_GOTO_EQUAL(user4, nullptr, -1, ERROUT); - - user4 = getpwuid(100000); - ICUNIT_GOTO_EQUAL(user4, nullptr, -1, ERROUT); - - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return 0; -ERROUT: - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return -1; -} - -VOID ItTestSys020(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/full/sys_test_021.cpp b/testsuites/unittest_old/sys/full/sys_test_021.cpp deleted file mode 100644 index 03e07091..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_021.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -STATIC UINT32 TestCase(VOID) -{ - struct passwd pwd; - struct passwd *user1 = nullptr; - struct passwd *user2 = nullptr; - struct passwd *user3 = nullptr; - struct passwd *user4 = nullptr; - struct passwd *user5 = nullptr; - CHAR buf1[1024] = { 0 }; /* 1024, buffer for test */ - CHAR buf2[2] = { 0 }; /* 2, for test,this buffer is not enough large to save data */ - INT32 ret; - CHAR *pathList[] = {"/etc/group", "/etc/passwd"}; - CHAR *streamList[] = {g_groupFileStream, g_passwdFileStream}; - INT32 streamLen[] = {strlen(g_groupFileStream), strlen(g_passwdFileStream)}; - - ret = PrepareFileEnv(pathList, streamList, streamLen, 2); /* 2, group & passwd */ - if (ret != 0) { - printf("error: need some env file, but prepare is not ok"); - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return -1; - } - - ret = getpwuid_r(0, &pwd, buf1, sizeof(buf1), &user1); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROUT); - ICUNIT_GOTO_NOT_EQUAL(user1, NULL, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_name, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_uid, 0, -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_gid, 0, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_gecos, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_dir, "/root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_shell, "/bin/bash", -1, ERROUT); - - ICUNIT_GOTO_STRING_EQUAL(pwd.pw_name, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(pwd.pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(pwd.pw_uid, 0, -1, ERROUT); - ICUNIT_GOTO_EQUAL(pwd.pw_gid, 0, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(pwd.pw_gecos, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(pwd.pw_dir, "/root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(pwd.pw_shell, "/bin/bash", -1, ERROUT); - - ret = getpwuid_r(1, &pwd, buf1, sizeof(buf1), &user2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROUT); - ICUNIT_GOTO_NOT_EQUAL(user2, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_name, "daemon", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user2->pw_uid, 1, -1, ERROUT); - ICUNIT_GOTO_EQUAL(user2->pw_gid, 1, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_gecos, "daemon", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_dir, "/usr/sbin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_shell, "/usr/sbin/nologin", -1, ERROUT); - - ret = getpwuid_r(2, &pwd, buf1, sizeof(buf1), &user3); /* 2, from etc/group */ - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROUT); - ICUNIT_GOTO_NOT_EQUAL(user3, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_name, "bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user3->pw_uid, 2, -1, ERROUT); /* 2, from etc/group */ - ICUNIT_GOTO_EQUAL(user3->pw_gid, 2, -1, ERROUT); /* 2, from etc/group */ - ICUNIT_GOTO_STRING_EQUAL(user3->pw_gecos, "bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_dir, "/bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user3->pw_shell, "/usr/sbin/nologin", -1, ERROUT); - - ret = getpwuid_r(0, &pwd, buf2, sizeof(buf2), &user4); - ICUNIT_GOTO_EQUAL(ret, ERANGE, ret, ERROUT); - ICUNIT_GOTO_EQUAL(user4, nullptr, -1, ERROUT); - - - ret = getpwuid_r(200, &pwd, buf1, sizeof(buf1), &user5); /* 200, invalid param for test */ - ICUNIT_GOTO_EQUAL(user5, nullptr, -1, ERROUT); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, -1, ERROUT); - - ret = getpwuid_r(100000, &pwd, buf1, sizeof(buf1), &user5); /* 100000, invalid param for test */ - ICUNIT_GOTO_EQUAL(user5, nullptr, -1, ERROUT); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, -1, ERROUT); - - ret = getpwuid_r(-100, &pwd, buf1, sizeof(buf1), &user5); /* -100, invalid param for test */ - ICUNIT_GOTO_EQUAL(user5, nullptr, -1, ERROUT); - ICUNIT_GOTO_NOT_EQUAL(ret, 0, -1, ERROUT); - - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return 0; -ERROUT: - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return -1; -} - -VOID ItTestSys021(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/full/sys_test_022.cpp b/testsuites/unittest_old/sys/full/sys_test_022.cpp deleted file mode 100644 index fc9814ce..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_022.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -STATIC UINT32 TestCase(VOID) -{ - struct passwd *user1 = nullptr; - struct passwd *user2 = nullptr; - INT32 ret; - CHAR *pathList[] = {"/etc/group", "/etc/passwd"}; - CHAR *streamList[] = {g_groupFileStream, g_passwdFileStream}; - INT32 streamLen[] = {strlen(g_groupFileStream), strlen(g_passwdFileStream)}; - - ret = PrepareFileEnv(pathList, streamList, streamLen, 2); /* 2, group & passwd */ - if (ret != 0) { - printf("error: need some env file, but prepare is not ok"); - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return -1; - } - - user1 = getpwent(); - ICUNIT_GOTO_NOT_EQUAL(user1, NULL, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_name, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_uid, 0, -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_gid, 0, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_gecos, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_dir, "/root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_shell, "/bin/bash", -1, ERROUT); - - user1 = getpwent(); - ICUNIT_GOTO_NOT_EQUAL(user1, NULL, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_name, "daemon", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_uid, 1, -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_gid, 1, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_gecos, "daemon", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_dir, "/usr/sbin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_shell, "/usr/sbin/nologin", -1, ERROUT); - - user1 = getpwent(); - ICUNIT_GOTO_NOT_EQUAL(user1, NULL, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_name, "bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(user1->pw_uid, 2, -1, ERROUT); /* 2, from etc/group */ - ICUNIT_GOTO_EQUAL(user1->pw_gid, 2, -1, ERROUT); /* 2, from etc/group */ - ICUNIT_GOTO_STRING_EQUAL(user1->pw_gecos, "bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_dir, "/bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user1->pw_shell, "/usr/sbin/nologin", -1, ERROUT); - - setpwent(); - user2 = getpwent(); - ICUNIT_GOTO_NOT_EQUAL(user2, NULL, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(user2->pw_name, user1->pw_name, -1, ERROUT); - - setpwent(); - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return 0; -ERROUT: - setpwent(); - (VOID)RecoveryFileEnv(pathList, 2); /* 2, group & passwd */ - return -1; -} - -VOID ItTestSys022(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/full/sys_test_023.cpp b/testsuites/unittest_old/sys/full/sys_test_023.cpp deleted file mode 100644 index 4972e261..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_023.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" -#include "grp.h" - -STATIC UINT32 TestCase(VOID) -{ - struct group *grp1 = nullptr; - struct group *grp2 = nullptr; - struct group *grp3 = nullptr; - struct group *grp4 = nullptr; - INT32 ret; - CHAR *pathList[] = {"/etc/group"}; - CHAR *streamList[] = {g_groupFileStream}; - INT32 streamLen[] = {strlen(g_groupFileStream)}; - - ret = PrepareFileEnv(pathList, streamList, streamLen, 1); - if (ret != 0) { - printf("error: need some env file, but prepare is not ok"); - (VOID)RecoveryFileEnv(pathList, 1); - return -1; - } - - grp1 = getgrent(); - ICUNIT_GOTO_NOT_EQUAL(grp1, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(grp1->gr_name, "root", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(grp1->gr_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(grp1->gr_gid, 0, -1, ERROUT); - - grp2 = getgrent(); - ICUNIT_GOTO_NOT_EQUAL(grp2, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(grp2->gr_name, "daemon", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(grp2->gr_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(grp2->gr_gid, 1, -1, ERROUT); - - grp3 = getgrent(); - ICUNIT_GOTO_NOT_EQUAL(grp3, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(grp3->gr_name, "bin", -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(grp3->gr_passwd, "x", -1, ERROUT); - ICUNIT_GOTO_EQUAL(grp3->gr_gid, 2, -1, ERROUT); /* 2, from etc/group */ - - setgrent(); - - grp4 = getgrent(); - ICUNIT_GOTO_NOT_EQUAL(grp4, nullptr, -1, ERROUT); - ICUNIT_GOTO_STRING_EQUAL(grp1->gr_name, grp4->gr_name, -1, ERROUT); - - setgrent(); - (VOID)RecoveryFileEnv(pathList, 1); - return 0; -ERROUT: - setgrent(); - (VOID)RecoveryFileEnv(pathList, 1); - return -1; -} - -VOID ItTestSys023(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/full/sys_test_024.cpp b/testsuites/unittest_old/sys/full/sys_test_024.cpp deleted file mode 100644 index 442b648c..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_024.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -static jmp_buf g_buf; - -static UINT32 First(VOID) -{ - int ret = _setjmp(g_buf); - if (ret) { - ICUNIT_ASSERT_EQUAL(ret, 2, ret); - goto OUT1; - } - _longjmp(g_buf, 2); -OUT1: - return 0; -} - -static UINT32 Sencond(VOID) -{ - int ret = _setjmp(g_buf); - if (ret) { - ICUNIT_ASSERT_EQUAL(ret, 1, ret); - goto OUT2; - } - _longjmp(g_buf, 0); - -OUT2: - return 0; -} - -static UINT32 TestCase(VOID) -{ - int ret = First(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = Sencond(); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - return 0; -} - -VOID ItTestSys024(VOID) -{ - TEST_ADD_CASE("IT_TEST_SYS_024", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/full/sys_test_025.cpp b/testsuites/unittest_old/sys/full/sys_test_025.cpp deleted file mode 100644 index 95ea0554..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_025.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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. - */ - -#include "It_test_sys.h" -#include - -#define GROUPFILE "/etc/group" - -STATIC INT32 TestCase0(void) -{ - struct group getNam1 = { nullptr }; - struct group *getNam2 = nullptr; - struct group getData1 = { nullptr }; - struct group *getData2 = nullptr; - struct group *groupRet = nullptr; - CHAR buf[1000]; /* 1000, buffer for test */ - size_t len = sizeof(buf); - - INT32 ret = getgrgid_r(0, &getNam1, buf, len, &getNam2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_NOT_EQUAL(getNam2, nullptr, getNam2); - ICUNIT_ASSERT_STRING_EQUAL(getNam2->gr_name, "root", getNam2->gr_name); - ICUNIT_ASSERT_STRING_EQUAL(getNam2->gr_passwd, "x", getNam2->gr_passwd); - ICUNIT_ASSERT_EQUAL(getNam2->gr_gid, 0, getNam2->gr_gid); - - groupRet = getgrgid(0); - ICUNIT_ASSERT_NOT_EQUAL(groupRet, nullptr, groupRet); - ICUNIT_ASSERT_STRING_EQUAL(groupRet->gr_name, "root", groupRet->gr_name); - ICUNIT_ASSERT_STRING_EQUAL(groupRet->gr_passwd, "x", groupRet->gr_passwd); - ICUNIT_ASSERT_EQUAL(groupRet->gr_gid, 0, groupRet->gr_gid); - - groupRet = getgrnam("root"); - ICUNIT_ASSERT_NOT_EQUAL(groupRet, nullptr, groupRet); - ICUNIT_ASSERT_STRING_EQUAL(groupRet->gr_name, "root", groupRet->gr_name); - ICUNIT_ASSERT_STRING_EQUAL(groupRet->gr_passwd, "x", groupRet->gr_passwd); - ICUNIT_ASSERT_EQUAL(groupRet->gr_gid, 0, groupRet->gr_gid); - - ret = getgrnam_r("root", &getData1, buf, len, &getData2); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_NOT_EQUAL(getData2, nullptr, getData2); - ICUNIT_ASSERT_STRING_EQUAL(getData2->gr_name, "root", getData2->gr_name); - ICUNIT_ASSERT_STRING_EQUAL(getData2->gr_passwd, "x", getData2->gr_passwd); - ICUNIT_ASSERT_EQUAL(getData2->gr_gid, 0, getData2->gr_gid); - return 0; -} - -STATIC INT32 TestCase1(void) -{ - INT32 len = 1000; - CHAR buf[1000]; - struct group getNam1 = { nullptr }; - struct group *getNam2 = nullptr; - struct group getData1 = { nullptr }; - struct group *getData2 = nullptr; - struct group *groupRet = nullptr; - - INT32 ret = getgrgid_r(-1, &getNam1, buf, len, &getNam2); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(errno, EAFNOSUPPORT, errno); - errno = 0; - - groupRet = getgrgid(-1); - ICUNIT_ASSERT_EQUAL(groupRet, 0, groupRet); - ICUNIT_ASSERT_EQUAL(errno, EAFNOSUPPORT, errno); - errno = 0; - - groupRet = getgrnam("null"); - ICUNIT_ASSERT_EQUAL(groupRet, nullptr, groupRet); - ICUNIT_ASSERT_EQUAL(errno, EAFNOSUPPORT, errno); - errno = 0; - - ret = getgrnam_r("null", &getData1, buf, len, &getData2); - ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(errno, EAFNOSUPPORT, errno); - errno = 0; - - return 0; -} - -STATIC INT32 TestCase(void) -{ - CHAR *pathList[] = {"/etc/group"}; - CHAR *streamList[] = {g_groupFileStream}; - INT32 streamLen[] = {strlen(g_groupFileStream)}; - - INT32 ret = PrepareFileEnv(pathList, streamList, streamLen, 1); - if (ret != 0) { - printf("error: need some env file, but prepare is not ok"); - (VOID)RecoveryFileEnv(pathList, 1); - return -1; - } - - ret = TestCase0(); - ICUNIT_GOTO_EQUAL(ret, 0, ret, ERROUT); - - ret = TestCase1(); - ICUNIT_GOTO_EQUAL(ret, 0, re, ERROUT); - - (VOID)RecoveryFileEnv(pathList, 1); - return 0; -ERROUT: - (VOID)RecoveryFileEnv(pathList, 1); - return -1; -} - -VOID ItTestSys025(VOID) -{ - TEST_ADD_CASE("IT_TEST_SYS_025", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/sys/full/sys_test_026.cpp b/testsuites/unittest_old/sys/full/sys_test_026.cpp deleted file mode 100644 index 80b9244b..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_026.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ - -#include "It_test_sys.h" -static int TestCase(void) -{ - char *name = getlogin(); - ICUNIT_ASSERT_NOT_EQUAL(name, "USER1", NULL); - int ret = getlogin_r(name, sizeof(name)); - ICUNIT_ASSERT_EQUAL(ret, 6, ret); - ret = setenv("LOGNAME", "USER1", 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - name = getlogin(); - ICUNIT_ASSERT_STRING_EQUAL(name, "USER1", name); - ret = getlogin_r(name, strlen(name) + 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = getlogin_r(name, 1); - ICUNIT_ASSERT_EQUAL(ret, 34, ret); - - ret = unsetenv("LOGNAME"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - name = getlogin(); - ICUNIT_ASSERT_EQUAL(name, nullptr, name); - return 0; -} - -VOID ItTestSys026(VOID) -{ - TEST_ADD_CASE("IT_TEST_SYS_026", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} \ No newline at end of file diff --git a/testsuites/unittest_old/sys/full/sys_test_027.cpp b/testsuites/unittest_old/sys/full/sys_test_027.cpp deleted file mode 100644 index 6ebe8f73..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_027.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "It_test_sys.h" -#include "fcntl.h" -#include - -static UINT32 TestCase(VOID) -{ - int fd; - int ret1; - int ret2; - int id1 = 1; - int id2 = 2; - char *str1 = "/storage/1.txt"; - char *str2 = "/etc/2.txt"; - - fd = open(str1, O_CREAT); - if (fd < 0) { - return -1; - } - fd = open(str2, O_CREAT); - if (fd < 0) { - return -1; - } - ret1 = ftok(str1, id1); - ICUNIT_ASSERT_NOT_EQUAL(ret1, -1, ret1); - ret2 = ftok(str1, id2); - ICUNIT_ASSERT_NOT_EQUAL(ret1, -1, ret2); - ICUNIT_ASSERT_NOT_EQUAL(ret1, ret2, -1); - ret2 = ftok(str1, id1); - ICUNIT_ASSERT_EQUAL(ret1, ret2, -1); - ret2 = ftok(str2, id1); - ICUNIT_ASSERT_NOT_EQUAL(ret2, -1, ret2); - ICUNIT_ASSERT_NOT_EQUAL(ret1, ret2, -1); - return 0; -} - -VOID ItTestSys027(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/full/sys_test_028.cpp b/testsuites/unittest_old/sys/full/sys_test_028.cpp deleted file mode 100644 index 9a3a243d..00000000 --- a/testsuites/unittest_old/sys/full/sys_test_028.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* 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. - */ -#include "It_test_sys.h" - -static UINT32 TestCase(VOID) -{ - int ret, status; - - pid_t pid = fork(); - if (pid == 0) { - ret = setpriority(PRIO_PROCESS, 0, 15); /* 15, set priority for test */ - if (ret != 0) { - exit(0); - } - ret = nice(0); - exit(ret); - } else { - ret = waitpid(pid, &status, 0); - ICUNIT_ASSERT_EQUAL(ret, pid, ret); - status = WEXITSTATUS(status); - ICUNIT_ASSERT_EQUAL(status, 15, status); /* 15, set priority for test */ - - ret = nice(-40); /* -40, set invalid priority for test */ - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - } - return 0; -} - -VOID ItTestSys028(VOID) -{ - TEST_ADD_CASE(ItTestSys028, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_004.cpp b/testsuites/unittest_old/sys/smoke/sys_test_004.cpp deleted file mode 100644 index a3586444..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_004.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -#define MAX_NRAND48 0x80000000 - -static UINT32 TestCase(VOID) -{ - long x; - short unsigned int seed[3] = {1, 2, 3}; - - x = nrand48(seed); - if ((x < 0) || (x > MAX_NRAND48)) { - printf("[IN %s][line %d] x = %d\n", __FUNCTION__, __LINE__, x); - goto EXIT; - } - - return 0; -EXIT: - return -1; -} - -VOID ItTestSys004(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_005.cpp b/testsuites/unittest_old/sys/smoke/sys_test_005.cpp deleted file mode 100644 index ae47e8b4..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_005.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -#define MAX_RANDOM 0x80000000 - -static UINT32 TestCase(VOID) -{ - long x; - - x = random(); - if (x > labs(MAX_RANDOM - 1)) { - printf("[IN %s][line %d] x = %d\n", __FUNCTION__, __LINE__, x); - goto EXIT; - } - - return 0; -EXIT: - return -1; -} - -VOID ItTestSys005(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_006.cpp b/testsuites/unittest_old/sys/smoke/sys_test_006.cpp deleted file mode 100644 index c923415f..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_006.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -#define MAX_RANDOM 0x80000000 -static unsigned int g_seed = 123; - -static UINT32 TestCase(VOID) -{ - int x; - unsigned *pseed = &g_seed; - - x = rand_r(pseed); - printf("x= %d\n", x); - - if (x > abs(int(MAX_RANDOM - 1))) { - printf("[IN %s][line %d] x = %d\n", __FUNCTION__, __LINE__, x); - goto EXIT; - } - - return 0; -EXIT: - return -1; -} - -VOID ItTestSys006(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_007.cpp b/testsuites/unittest_old/sys/smoke/sys_test_007.cpp deleted file mode 100644 index 46a2e04d..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_007.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -#define MAX_RANDOM 0x80000000 -static unsigned short g_seed = 123; - -static UINT32 TestCase(VOID) -{ - double x; - unsigned short *pseed = &g_seed; - unsigned short *p = NULL; - - p = seed48(pseed); - ICUNIT_GOTO_NOT_EQUAL(p, NULL, p, EXIT); - - x = drand48(); - printf("x= %d\n", x); - - return 0; -EXIT: - return -1; -} - -VOID ItTestSys007(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_008.cpp b/testsuites/unittest_old/sys/smoke/sys_test_008.cpp deleted file mode 100644 index a3ec1724..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_008.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -#define BUF_SIZE 256 - -static UINT32 TestCase(VOID) -{ - char ebuff[BUF_SIZE]; - int ret; - int cflags; - regex_t reg; - char *a = NULL; - char *b = (char *)"No error"; - char *testStr = (char *)"Hello World"; - char *regStr = (char *)"H.*"; - - cflags = REG_EXTENDED | REG_ICASE | REG_NOSUB; - - ret = regcomp(®, regStr, cflags); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = regexec(®, testStr, 0, NULL, 0); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - regerror(ret, ®, ebuff, BUF_SIZE); - a = ebuff; - ret = strcmp(a, b); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - regfree(®); - - return 0; -EXIT: - regerror(ret, ®, ebuff, BUF_SIZE); - fprintf(stderr, "%s\n", ebuff); - regfree(®); - - return -1; -} - - -VOID ItTestSys008(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_009.cpp b/testsuites/unittest_old/sys/smoke/sys_test_009.cpp deleted file mode 100644 index b19f3f23..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_009.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -static UINT32 TestCase(VOID) -{ - char *val = NULL; - const char *name = (char *)"ABC"; - char *env = (char *)"test-test"; - int ret; - - val = getenv(name); - ICUNIT_GOTO_EQUAL(val, NULL, val, EXIT); - - setenv(name, env, 1); - - val = getenv(name); - ret = strcmp(val, env); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unsetenv("ABC"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - val = getenv(name); - ICUNIT_GOTO_EQUAL(val, NULL, val, EXIT); - - return 0; -EXIT: - return -1; -} - -VOID ItTestSys009(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_010.cpp b/testsuites/unittest_old/sys/smoke/sys_test_010.cpp deleted file mode 100644 index 60415c50..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_010.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -static UINT32 TestCase(VOID) -{ - char *plocale = NULL; - char *buffer = (char *)"C"; - int ret; - - plocale = setlocale(LC_ALL, NULL); - ret = strcmp(plocale, buffer); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return -1; -} - -VOID ItTestSys010(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_012.cpp b/testsuites/unittest_old/sys/smoke/sys_test_012.cpp deleted file mode 100644 index 352839a8..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_012.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -static UINT32 TestCase(VOID) -{ - char *val = NULL; - char *val2 = NULL; - const char *name = (char *)"ABC"; - char *env = (char *)"test-test"; - int ret; - - val = getenv(name); - ICUNIT_GOTO_EQUAL(val, NULL, val, EXIT); - - setenv(name, env, 1); - - val = getenv(name); - val2 = secure_getenv(name); - ret = strcmp(val2, env); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - ret = strcmp(val, env); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ret = unsetenv("ABC"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - val = getenv(name); - ICUNIT_GOTO_EQUAL(val, NULL, val, EXIT); - - return 0; -EXIT: - return -1; -} - -VOID ItTestSys012(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_013.cpp b/testsuites/unittest_old/sys/smoke/sys_test_013.cpp deleted file mode 100644 index 43402cab..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_013.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -struct q { - struct q *n; - struct q *p; - int i; -}; - -static struct q *New(int i) -{ - struct q *q = (struct q *)malloc(sizeof *q); - q->i = i; - return q; -} - -static UINT32 TestCase(VOID) -{ - struct q *q = New(0); - struct q *p = NULL; - int i; - - insque(q, 0); - for (i = 1; i < 10; i++) { - insque(New(i), q); - q = q->n; - } - p = q; - while (q) { - if (q->i != --i) { - printf("[IN %s][line %d]walking queue: got %d, wanted %d\n", __FUNCTION__, __LINE__, q->i, i); - goto EXIT; - } - q = q->p; - } - remque(p->p); - if (p->p->i != p->i - 2) { - printf("[IN %s][line %d]remque: got %d, wanted %d\n", __FUNCTION__, __LINE__, p->p->i, p->i - 2); - goto EXIT; - } - if (p->p->n->i != p->i) { - printf("[IN %s][line %d]remque: got %d, wanted %d\n", __FUNCTION__, __LINE__, p->p->n->i, p->i); - goto EXIT; - } - - return 0; -EXIT: - return -1; -} - -VOID ItTestSys013(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_014.cpp b/testsuites/unittest_old/sys/smoke/sys_test_014.cpp deleted file mode 100644 index 9c224ae9..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_014.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -static void ShowFeExceptions(void) -{ - printf("current exceptions raised: "); - if (fetestexcept(FE_DIVBYZERO)) { - printf(" FE_DIVBYZERO"); - } - if (fetestexcept(FE_INEXACT)) { - printf(" FE_INEXACT"); - } - if (fetestexcept(FE_INVALID)) { - printf(" FE_INVALID"); - } - if (fetestexcept(FE_OVERFLOW)) { - printf(" FE_OVERFLOW"); - } - if (fetestexcept(FE_UNDERFLOW)) { - printf(" FE_UNDERFLOW"); - } - if (fetestexcept(FE_ALL_EXCEPT) == 0) { - printf(" none"); - } - printf("\n"); -} - -static double X2(double x) /* times two */ -{ - fenv_t currExcepts; - - /* Save and clear current f-p environment. */ - feholdexcept(&currExcepts); - - /* Raise inexact and overflow exceptions. */ - printf("In x2(): x = %f\n", x = x * 2.0); - ShowFeExceptions(); - feclearexcept(FE_INEXACT); /* hide inexact exception from caller */ - - /* Merge caller's exceptions (FE_INVALID) */ - /* with remaining x2's exceptions (FE_OVERFLOW). */ - feupdateenv(&currExcepts); - return x; -} - -static UINT32 TestCase(VOID) -{ - feclearexcept(FE_ALL_EXCEPT); - feraiseexcept(FE_INVALID); /* some computation with invalid argument */ - ShowFeExceptions(); - printf("x2(DBL_MAX) = %f\n", X2(DBL_MAX)); - ShowFeExceptions(); - - return 0; -EXIT: - return -1; -} - - -VOID ItTestSys014(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_015.cpp b/testsuites/unittest_old/sys/smoke/sys_test_015.cpp deleted file mode 100644 index d31254cc..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_015.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -#define TEST_NUM 123 - -static UINT32 TestCase(VOID) -{ - long a = TEST_NUM; - long b = 0; - char *pstr = NULL; - - pstr = l64a(a); - ICUNIT_GOTO_NOT_EQUAL(pstr, NULL, pstr, EXIT); - - b = a64l(pstr); - ICUNIT_GOTO_EQUAL(b, a, b, EXIT); - - return 0; -EXIT: - return -1; -} - -VOID ItTestSys015(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_016.cpp b/testsuites/unittest_old/sys/smoke/sys_test_016.cpp deleted file mode 100644 index c53c9dda..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_016.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -static UINT32 TestCase(VOID) -{ - char *ptr = NULL; - int ret; - - ptr = basename((char *)"."); - ret = strcmp(ptr, "."); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ptr = basename(".."); - ret = strcmp(ptr, ".."); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ptr = basename("/"); - ret = strcmp(ptr, "/"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ptr = basename("test1"); - ret = strcmp(ptr, "test1"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - ptr = basename("/test1/test2"); - ret = strcmp(ptr, "test2"); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return -1; -} - -VOID ItTestSys016(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_017.cpp b/testsuites/unittest_old/sys/smoke/sys_test_017.cpp deleted file mode 100644 index 28c0d173..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_017.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ -#include "It_test_sys.h" - -#define TEST_PASSWORD (char *)"test1234" - -static UINT32 TestCase(VOID) -{ - char *passwd1 = NULL; - char *passwd2 = NULL; - char *key = NULL; - char slat[2]; - int ret; - - key = TEST_PASSWORD; - slat[0] = key[0]; - slat[1] = key[1]; - passwd1 = crypt(key, slat); - ICUNIT_GOTO_NOT_EQUAL(passwd1, NULL, passwd1, EXIT); - - key = TEST_PASSWORD; - slat[0] = passwd1[0]; - slat[1] = passwd1[1]; - passwd2 = crypt(key, slat); - ICUNIT_GOTO_NOT_EQUAL(passwd2, NULL, passwd2, EXIT); - - ret = strcmp(passwd1, passwd2); - ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT); - - return 0; -EXIT: - return -1; -} - -VOID ItTestSys017(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_029.cpp b/testsuites/unittest_old/sys/smoke/sys_test_029.cpp deleted file mode 100644 index d270433e..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_029.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -#include "It_test_sys.h" -#include - -static UINT32 TestCase(VOID) -{ - int ret1; - int id = 1; - char *str1 = "/storage/1"; - char str2[] = { 0 }; - - errno = 0; - ret1 = ftok(str1, id); - ICUNIT_ASSERT_EQUAL(ret1, -1, ret1); - ICUNIT_ASSERT_EQUAL(errno, ENOENT, errno); - - errno = 0; - ret1 = ftok(str2, id); - ICUNIT_ASSERT_EQUAL(ret1, -1, ret1); - ICUNIT_ASSERT_EQUAL(errno, ENOENT, errno); - - return 0; -} - -VOID ItTestSys029(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_030.cpp b/testsuites/unittest_old/sys/smoke/sys_test_030.cpp deleted file mode 100644 index 59384fa4..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_030.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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. - */ - -#include "It_test_sys.h" - - -sigjmp_buf jmp_env; -int val = 2; - -static void sig_alarm(int signum) -{ - siglongjmp(jmp_env, val); -} - -static UINT32 TestCase(VOID) -{ -#if 0 - int alarm_time = 1; - int ret; - - signal(SIGALRM, sig_alarm); - alarm(alarm_time); - ret = sigsetjmp(jmp_env, 1); - if (ret) { - ICUNIT_ASSERT_EQUAL(ret, val, ret); - } - sleep(3); -#endif - return 0; -} - -VOID IT_TEST_SYS_030(VOID) -{ - TEST_ADD_CASE("IT_TEST_SYS_030", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/smoke/sys_test_031.cpp b/testsuites/unittest_old/sys/smoke/sys_test_031.cpp deleted file mode 100644 index a68858c0..00000000 --- a/testsuites/unittest_old/sys/smoke/sys_test_031.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ - -#include "It_test_sys.h" - -static UINT32 TestCase(VOID) -{ - char buf1[100] = { 0 }; - char *str = nullptr; - - ctermid(buf1); - ICUNIT_ASSERT_STRING_EQUAL(buf1, "/dev/tty", -1); - str = ctermid(nullptr); - ICUNIT_ASSERT_STRING_EQUAL(str, "/dev/tty", -1); - - return 0; -} - -VOID IT_TEST_SYS_031(VOID) -{ - TEST_ADD_CASE("IT_TEST_SYS_031", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/sys/sys_unit_test.cpp b/testsuites/unittest_old/sys/sys_unit_test.cpp deleted file mode 100644 index 48ee0b9c..00000000 --- a/testsuites/unittest_old/sys/sys_unit_test.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "It_test_sys.h" - -CHAR *g_groupFileStream = "root:x:0:\ndaemon:x:1:\nbin:x:2:\n"; -CHAR *g_passwdFileStream = "root:x:0:0:root:/root:/bin/bash\n" \ - "daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin\nbin:x:2:2:bin:/bin:/usr/sbin/nologin\n"; - -using namespace testing::ext; -namespace OHOS { -class SysTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: IT_TEST_SYS_004 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys004, TestSize.Level0) -{ - ItTestSys004(); -} - -/* * - * @tc.name: IT_TEST_SYS_005 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys005, TestSize.Level0) -{ - ItTestSys005(); -} - -/* * - * @tc.name: IT_TEST_SYS_006 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys006, TestSize.Level0) -{ - ItTestSys006(); -} - -/* * - * @tc.name: IT_TEST_SYS_007 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys007, TestSize.Level0) -{ - ItTestSys007(); -} - -/* * - * @tc.name: IT_TEST_SYS_008 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys008, TestSize.Level0) -{ - ItTestSys008(); -} - -/* * - * @tc.name: IT_TEST_SYS_009 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys009, TestSize.Level0) -{ - ItTestSys009(); -} - -/* * - * @tc.name: IT_TEST_SYS_010 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys010, TestSize.Level0) -{ - ItTestSys010(); -} - -/* * - * @tc.name: IT_TEST_SYS_012 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys012, TestSize.Level0) -{ - ItTestSys012(); -} - -/* * - * @tc.name: IT_TEST_SYS_013 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys013, TestSize.Level0) -{ - ItTestSys013(); -} - -/* * - * @tc.name: IT_TEST_SYS_014 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys014, TestSize.Level0) -{ - ItTestSys014(); -} - -/* * - * @tc.name: IT_TEST_SYS_015 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys015, TestSize.Level0) -{ - ItTestSys015(); -} - -/* * - * @tc.name: IT_TEST_SYS_016 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys016, TestSize.Level0) -{ - ItTestSys016(); -} - -/* * - * @tc.name: IT_TEST_SYS_017 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys017, TestSize.Level0) -{ - ItTestSys017(); -} - -/* * - * @tc.name: IT_TEST_SYS_029 - * @tc.desc: function for ftok exception test - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys029, TestSize.Level0) -{ - ItTestSys029(); -} - -/* * - * @tc.name: IT_TEST_SYS_030 - * @tc.desc: function for sigsetjmp siglongjmp test - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, IT_TEST_SYS_030, TestSize.Level0) -{ - IT_TEST_SYS_030(); -} - -/* * - * @tc.name: IT_TEST_SYS_031 - * @tc.desc: function for ctermid test - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, IT_TEST_SYS_031, TestSize.Level0) -{ - IT_TEST_SYS_031(); -} -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: IT_TEST_SYS_001 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys001, TestSize.Level0) -{ - ItTestSys001(); -} - -/* * - * @tc.name: IT_TEST_SYS_018 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys018, TestSize.Level0) -{ - ItTestSys018(); -} - -/* * - * @tc.name: IT_TEST_SYS_019 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys019, TestSize.Level0) -{ - ItTestSys019(); -} - -/* * - * @tc.name: IT_TEST_SYS_020 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys020, TestSize.Level0) -{ - ItTestSys020(); -} - -/* * - * @tc.name: IT_TEST_SYS_021 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys021, TestSize.Level0) -{ - ItTestSys021(); -} - -/* * - * @tc.name: IT_TEST_SYS_022 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys022, TestSize.Level0) -{ - ItTestSys022(); -} - -/* * - * @tc.name: IT_TEST_SYS_023 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys023, TestSize.Level0) -{ - ItTestSys023(); -} - -/* * - * @tc.name: IT_TEST_SYS_024 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys024, TestSize.Level0) -{ - ItTestSys024(); -} - -/* * - * @tc.name: IT_TEST_SYS_025 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys025, TestSize.Level0) -{ - ItTestSys025(); -} - -/* * - * @tc.name: IT_TEST_SYS_025 - * @tc.desc: function for SysTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys026, TestSize.Level0) -{ - ItTestSys026(); -} - -/* * - * @tc.name: IT_TEST_SYS_027 - * @tc.desc: function for ftok normal test - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys027, TestSize.Level0) -{ - ItTestSys027(); -} - -/* * - * @tc.name: ItTestSys028 - * @tc.desc: function for nice:set pthread priority - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(SysTest, ItTestSys028, TestSize.Level0) -{ - ItTestSys028(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/time/clock/BUILD.gn b/testsuites/unittest_old/time/clock/BUILD.gn deleted file mode 100644 index c4526665..00000000 --- a/testsuites/unittest_old/time/clock/BUILD.gn +++ /dev/null @@ -1,84 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "time_clock_test.cpp", -] - -sources_smoke = [ "smoke/clock_test_smoke.cpp" ] - -sources_full = [ - "full/clock_test_001.cpp", - "full/clock_test_002.cpp", - "full/clock_test_003.cpp", - "full/clock_test_004.cpp", - "full/clock_test_005.cpp", - "full/clock_test_006.cpp", - "full/clock_test_007.cpp", - "full/clock_test_008.cpp", - "full/clock_test_009.cpp", - "full/clock_test_010.cpp", -] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_time_clock_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_time_clock_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_old/time/clock/full/clock_test_001.cpp b/testsuites/unittest_old/time/clock/full/clock_test_001.cpp deleted file mode 100644 index de8e2a4a..00000000 --- a/testsuites/unittest_old/time/clock/full/clock_test_001.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include -#include -#include "lt_clock_test.h" -#include - -/* When clock time is changed, timers for a relative interval are unaffected, - * but timers for an absolute point in time are affected. - */ -static int ClockTest(void) -{ - clockid_t clk = CLOCK_REALTIME; - struct timespec res, tp, oldtp; - int ret; - int passflag = 0; - - /* get clock resolution */ - ret = clock_getres(clk, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(res.tv_sec, CLOCK_RES_SEC, res.tv_sec); - ICUNIT_ASSERT_EQUAL(res.tv_nsec, CLOCK_RES_NSEC, res.tv_nsec); - - /* get current real time */ - ret = clock_gettime(clk, &oldtp); - printf("The current real time: sec is %lld, nsec is %ld\n", oldtp.tv_sec, oldtp.tv_nsec); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - printf("sleep 2 seconds\n"); - sleep(2); // 2, seconds. - - tp.tv_sec = oldtp.tv_sec + 2; // 2, use for testing clock setting - tp.tv_nsec = oldtp.tv_nsec; - - /* set real time */ - ret = clock_settime(clk, &tp); - printf("Setting time: sec is %lld, nsec is %ld\n", tp.tv_sec, tp.tv_nsec); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - printf("get real time clock again\n"); - - /* get current real time again */ - ret = clock_gettime(clk, &tp); - printf("Obtaining the current time after setting: sec = %lld, nsec = %ld\n", tp.tv_sec, tp.tv_nsec); - passflag = (tp.tv_sec >= 2 + oldtp.tv_sec) && (tp.tv_sec <= 2 + oldtp.tv_sec + 1); // 2, use for testing clock setting - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(passflag, true, passflag); - - return 0; -} - -void ClockTest001(void) -{ - TEST_ADD_CASE(__FUNCTION__, ClockTest, TEST_POSIX, TEST_TIMES, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/clock/full/clock_test_002.cpp b/testsuites/unittest_old/time/clock/full/clock_test_002.cpp deleted file mode 100644 index de50492f..00000000 --- a/testsuites/unittest_old/time/clock/full/clock_test_002.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ -#include "lt_clock_test.h" - -static void *ThreadFuncTest(void *arg) -{ - printf("Subthread starting infinite loop\n"); - while (1) { - } -} - -static int ThreadClock(const char *msg, clockid_t cid) -{ - struct timespec ts; - int ret; - - printf("%s", msg); - ret = clock_gettime(cid, &ts); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - printf("%lld.%03ld s\n", ts.tv_sec, ts.tv_nsec / 1000000); // 1000000, 1ms. - return 0; -} - -static int ClockTest(void) -{ - pthread_t thread; - clockid_t clockid; - int ret; - struct timespec ts; - - ret = pthread_create(&thread, NULL, ThreadFuncTest, 0); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - printf("Main thread sleeping\n"); - sleep(1); - - printf("Main thread consuming some CPU time...\n"); - usleep(400000); // 400000 delay for test - - /* get current pthread clockid */ - ret = pthread_getcpuclockid(pthread_self(), &clockid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = ThreadClock("Main thread CPU time: ", clockid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* get create pthread clockid */ - ret = pthread_getcpuclockid(thread, &clockid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = ThreadClock("Subthread CPU time: ", clockid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void ClockTest002(void) -{ - TEST_ADD_CASE(__FUNCTION__, ClockTest, TEST_POSIX, TEST_TIMES, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/clock/full/clock_test_003.cpp b/testsuites/unittest_old/time/clock/full/clock_test_003.cpp deleted file mode 100644 index d37ae98b..00000000 --- a/testsuites/unittest_old/time/clock/full/clock_test_003.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ -#include "lt_clock_test.h" - -static int ClockTest(void) -{ - clockid_t clockid; - struct timespec ts; - int ret; - pid_t pid = 0; - int passflag = 0; - - /* get kernel process 1 clockid */ - pid = 1; - ret = clock_getcpuclockid(1, &clockid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(clockid, CLOCK_GET_CPU_CLOCKID(pid), clockid); - - /* get clockid time */ - ret = clock_gettime(clockid, &ts); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("Obtaining the process running time: %lld second, %ld nanosecond\n", ts.tv_sec, ts.tv_nsec); - - /* get user process 2 clockid */ - pid = 2; // 2, test the process 2 (An existent pid) - ret = clock_getcpuclockid(2, &clockid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(clockid, CLOCK_GET_CPU_CLOCKID(pid), clockid); - - /* get clockid time */ - ret = clock_gettime(clockid, &ts); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("Obtaining the process running time: %lld second, %ld nanosecond\n", ts.tv_sec, ts.tv_nsec); - - /* get current process clockid */ - pid = getpid(); - ret = clock_getcpuclockid(getpid(), &clockid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(clockid, CLOCK_GET_CPU_CLOCKID(pid), clockid); - - /* get clockid time */ - ret = clock_gettime(clockid, &ts); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("Obtaining the process running time: %lld second, %ld nanosecond\n", ts.tv_sec, ts.tv_nsec); - - return 0; -} - -void ClockTest003(void) -{ - TEST_ADD_CASE(__FUNCTION__, ClockTest, TEST_POSIX, TEST_TIMES, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/clock/full/clock_test_004.cpp b/testsuites/unittest_old/time/clock/full/clock_test_004.cpp deleted file mode 100644 index 5add0e14..00000000 --- a/testsuites/unittest_old/time/clock/full/clock_test_004.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ -#include "lt_clock_test.h" - -static int ClockTest(void) -{ - pthread_t thread; - clockid_t clockid; - int ret; - struct timespec ts; - - /* check param invalid */ - ret = clock_gettime(-2050, &ts); // 2050, clock id. - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - return 0; -} - -void ClockTest004(void) -{ - TEST_ADD_CASE(__FUNCTION__, ClockTest, TEST_POSIX, TEST_TIMES, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/clock/full/clock_test_005.cpp b/testsuites/unittest_old/time/clock/full/clock_test_005.cpp deleted file mode 100644 index 8db361ac..00000000 --- a/testsuites/unittest_old/time/clock/full/clock_test_005.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -#include "lt_clock_test.h" - -static int ClockTest(void) -{ - clockid_t clockid; - struct timespec ts; - int ret; - pid_t pid = 0; - - /* check param invalid */ - ret = clock_getcpuclockid(pid, &clockid); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - pid = 65; // 65, non existent process id. - ret = clock_getcpuclockid(pid, &clockid); - ICUNIT_ASSERT_EQUAL(ret, EINVAL, ret); - - return 0; -} - -void ClockTest005(void) -{ - TEST_ADD_CASE(__FUNCTION__, ClockTest, TEST_POSIX, TEST_TIMES, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/clock/full/clock_test_006.cpp b/testsuites/unittest_old/time/clock/full/clock_test_006.cpp deleted file mode 100644 index 1585f406..00000000 --- a/testsuites/unittest_old/time/clock/full/clock_test_006.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include -#include -#include "lt_clock_test.h" -#include - -/* When clock time is changed, timers for a relative interval are unaffected, - * but timers for an absolute point in time are affected. - */ -static int ClockTest(void) -{ - clockid_t clk = CLOCK_REALTIME_COARSE; - struct timespec res, tp, oldtp; - int ret; - int passflag = 0; - - /* get clock resolution */ - ret = clock_getres(clk, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(res.tv_sec, CLOCK_COARSE_RES_SEC, res.tv_sec); - ICUNIT_ASSERT_EQUAL(res.tv_nsec, CLOCK_COARSE_RES_NSEC, res.tv_nsec); - - /* get current real coarse time */ - ret = clock_gettime(clk, &oldtp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("The current coarse real time: sec is %lld, nsec is %ld\n", oldtp.tv_sec, oldtp.tv_nsec); - - tp.tv_sec = 5 * oldtp.tv_sec; // 5, times the number of seconds. - tp.tv_nsec = oldtp.tv_nsec; // 5, times the number of nseconds. - - /* set real coarse time */ - ret = clock_settime(clk, &tp); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EOPNOTSUPP, errno); - - printf("get coarse real time clock again\n"); - - /* get current real coarse time again */ - ret = clock_gettime(clk, &tp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("The current coarse real time again: sec is %lld, nsec is %ld\n", tp.tv_sec, tp.tv_nsec); - passflag = (tp.tv_sec >= oldtp.tv_sec) && (tp.tv_sec <= oldtp.tv_sec + 1); - ICUNIT_ASSERT_EQUAL(passflag, 1, passflag); - - return 0; -} - -void ClockTest006(void) -{ - TEST_ADD_CASE(__FUNCTION__, ClockTest, TEST_POSIX, TEST_TIMES, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/clock/full/clock_test_007.cpp b/testsuites/unittest_old/time/clock/full/clock_test_007.cpp deleted file mode 100644 index ae574345..00000000 --- a/testsuites/unittest_old/time/clock/full/clock_test_007.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include -#include -#include "lt_clock_test.h" -#include - -/* When clock time is changed, timers for a relative interval are unaffected, - * but timers for an absolute point in time are affected. - */ -static int ClockTest(void) -{ - clockid_t clk = CLOCK_MONOTONIC_COARSE; - struct timespec res, tp, oldtp; - int ret; - int passflag = 0; - /* get clock resolution */ - ret = clock_getres(clk, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(res.tv_sec, CLOCK_COARSE_RES_SEC, res.tv_sec); - ICUNIT_ASSERT_EQUAL(res.tv_nsec, CLOCK_COARSE_RES_NSEC, res.tv_nsec); - - /* get current monotonic coarse time */ - ret = clock_gettime(clk, &oldtp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("The current monotonic coarse time: sec is %lld, nsec is %ld\n", oldtp.tv_sec, oldtp.tv_nsec); - - tp.tv_sec = 5 * res.tv_sec; // 5, times the number of seconds. - tp.tv_nsec = res.tv_nsec; - - /* set monotonic coarse time */ - ret = clock_settime(clk, &tp); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EOPNOTSUPP, errno); - - printf("get coarse monotonic time clock again\n"); - - /* get current monotonic coarse time again */ - ret = clock_gettime(clk, &tp); - passflag = (tp.tv_sec >= oldtp.tv_sec) && (tp.tv_sec <= oldtp.tv_sec + 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(passflag, 1, passflag); - printf("The current monotonic coarse time again: sec is %lld, nsec is %ld\n", tp.tv_sec, tp.tv_nsec); - - return 0; -} - -void ClockTest007(void) -{ - TEST_ADD_CASE(__FUNCTION__, ClockTest, TEST_POSIX, TEST_TIMES, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/clock/full/clock_test_008.cpp b/testsuites/unittest_old/time/clock/full/clock_test_008.cpp deleted file mode 100644 index 436123af..00000000 --- a/testsuites/unittest_old/time/clock/full/clock_test_008.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include -#include -#include -#include "lt_clock_test.h" - -/* When clock time is changed, timers for a relative interval are unaffected, - * but timers for an absolute point in time are affected. - */ -static int ClockTest(void) -{ - clockid_t clk = CLOCK_MONOTONIC; - struct timespec res, tp, oldtp; - int ret; - int passflag = 0; - - /* get clock resolution */ - ret = clock_getres(clk, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(res.tv_sec, CLOCK_RES_SEC, res.tv_sec); - ICUNIT_ASSERT_EQUAL(res.tv_nsec, CLOCK_RES_NSEC, res.tv_nsec); - - /* get current monotonic time */ - ret = clock_gettime(clk, &oldtp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("The current monotonic time: sec is %lld, nsec is %ld\n", oldtp.tv_sec, oldtp.tv_nsec); - - tp.tv_sec = 5 * oldtp.tv_sec; // 5, times the number of seconds. - tp.tv_nsec = oldtp.tv_nsec; - - /* set real time */ - ret = clock_settime(clk, &tp); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EINVAL, errno); - - LogPrintln("get monotonic time clock again\n"); - - /* get current monotonic time again */ - ret = clock_gettime(clk, &tp); - passflag = (tp.tv_sec >= oldtp.tv_sec) && (tp.tv_sec <= oldtp.tv_sec + 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(passflag, 1, passflag); - printf("The current monotonic time: sec is %lld, nsec is %ld\n", tp.tv_sec, tp.tv_nsec); - - return 0; -} - -void ClockTest008(void) -{ - TEST_ADD_CASE(__FUNCTION__, ClockTest, TEST_POSIX, TEST_TIMES, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/clock/full/clock_test_009.cpp b/testsuites/unittest_old/time/clock/full/clock_test_009.cpp deleted file mode 100644 index c6296625..00000000 --- a/testsuites/unittest_old/time/clock/full/clock_test_009.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include -#include -#include "lt_clock_test.h" -#include - -/* When clock time is changed, timers for a relative interval are unaffected, - * but timers for an absolute point in time are affected. - */ -static int ClockTest(void) -{ - clockid_t clk = CLOCK_MONOTONIC_RAW; - struct timespec res, tp, oldtp; - int ret; - int passflag = 0; - - /* get clock resolution */ - ret = clock_getres(clk, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(res.tv_sec, CLOCK_RES_SEC, res.tv_sec); - ICUNIT_ASSERT_EQUAL(res.tv_nsec, CLOCK_RES_NSEC, res.tv_nsec); - - /* get current monotonic raw time */ - ret = clock_gettime(clk, &oldtp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - printf("The current monotonic raw time: sec is %lld, nsec is %ld\n", oldtp.tv_sec, oldtp.tv_nsec); - - tp.tv_sec = 5 * res.tv_sec; // 5, times the number of seconds. - tp.tv_nsec = res.tv_nsec; - - /* set monotonic raw time */ - ret = clock_settime(clk, &tp); - ICUNIT_ASSERT_EQUAL(ret, -1, ret); - ICUNIT_ASSERT_EQUAL(errno, EOPNOTSUPP, errno); - - printf("get monotonic raw time clock again\n"); - - /* get current monotonic raw time again */ - ret = clock_gettime(clk, &tp); - passflag = (tp.tv_sec >= oldtp.tv_sec) && (tp.tv_sec <= oldtp.tv_sec + 1); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(passflag, 1, passflag); - printf("The current monotonic raw time again: sec is %lld, nsec is %ld\n", tp.tv_sec, tp.tv_nsec); - - return 0; -} - -void ClockTest009(void) -{ - TEST_ADD_CASE(__FUNCTION__, ClockTest, TEST_POSIX, TEST_TIMES, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/clock/full/clock_test_010.cpp b/testsuites/unittest_old/time/clock/full/clock_test_010.cpp deleted file mode 100644 index 2b14879b..00000000 --- a/testsuites/unittest_old/time/clock/full/clock_test_010.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include -#include -#include -#include "lt_clock_test.h" -#include - -static int g_failCnt = 0; - -static int SleepTest(int64_t expectTime) -{ - clockid_t clk = CLOCK_REALTIME; - struct timespec tp, oldtp; - int ret; - int64_t escapeTime; - - /* get current real time */ - ret = clock_gettime(clk, &oldtp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - tp.tv_sec = expectTime / (long)1e9; - tp.tv_nsec = expectTime % (long)1e9; - ret = clock_nanosleep(clk, 0, &tp, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* get current real time again */ - ret = clock_gettime(clk, &tp); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - escapeTime = (tp.tv_sec - oldtp.tv_sec) * (int64_t)1e9 + (tp.tv_nsec - oldtp.tv_nsec); - LogPrintln("slept time (expected --> actual): %" PRId64 "ns --> %" PRId64 "ns, delta: %" PRId64 "ns\n", expectTime, - escapeTime, escapeTime - expectTime); - - g_failCnt += (escapeTime < expectTime); - - return 0; -} - -static void *ClockTestThread(void *arg) -{ - (void)SleepTest(0); - (void)SleepTest(2); // 2, ns. - (void)SleepTest(3); // 3, ns. - (void)SleepTest(40e3); // 40us - (void)SleepTest(50e3); // 50us - (void)SleepTest(50e3 + 1); // 50us+1ns - (void)SleepTest(60e3); // 60us - (void)SleepTest(65e3); // 65us - (void)SleepTest(5e6); // 5ms - (void)SleepTest(10e6); // 10ms - (void)SleepTest(10e6 + 1); // 10ms+1ns - (void)SleepTest(25e6); // 25ms - (void)SleepTest(1e9); // 1s - - return NULL; -} - -static int ClockTest(void) -{ - int ret; - pthread_t thread; - struct sched_param param = { 0 }; - pthread_attr_t attr; - pthread_attr_init(&attr); - - pthread_attr_setschedpolicy(&attr, SCHED_FIFO); - pthread_attr_setschedparam(&attr, ¶m); - - ret = pthread_create(&thread, &attr, ClockTestThread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = pthread_join(thread, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(g_failCnt, 0, g_failCnt); - return 0; -} - -void ClockTest010(void) -{ - TEST_ADD_CASE(__FUNCTION__, ClockTest, TEST_POSIX, TEST_TIMES, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/clock/lt_clock_test.h b/testsuites/unittest_old/time/clock/lt_clock_test.h deleted file mode 100644 index ac34a0dd..00000000 --- a/testsuites/unittest_old/time/clock/lt_clock_test.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ -#ifndef TIME_CLOCK_LT_CLOCK_TEST_H_ -#define TIME_CLOCK_LT_CLOCK_TEST_H_ -#include -#include -#include -#include -#include -#include "osTest.h" - -#define CLOCK_RES_SEC 0 -#define CLOCK_RES_NSEC 1000 -#define CLOCK_COARSE_RES_SEC 0 -#define CLOCK_COARSE_RES_NSEC 1000000 -#define CLOCK_GET_CPU_CLOCKID(pid) ((-pid - 1) * 8U + 2) - -void ClockTestSmoke(void); -void ClockTest001(void); -void ClockTest002(void); -void ClockTest003(void); -void ClockTest004(void); -void ClockTest005(void); -void ClockTest006(void); -void ClockTest007(void); -void ClockTest008(void); -void ClockTest009(void); -void ClockTest010(void); - -#endif /* TIME_CLOCK_LT_CLOCK_TEST_H_ */ diff --git a/testsuites/unittest_old/time/clock/smoke/clock_test_smoke.cpp b/testsuites/unittest_old/time/clock/smoke/clock_test_smoke.cpp deleted file mode 100644 index bde8e6ef..00000000 --- a/testsuites/unittest_old/time/clock/smoke/clock_test_smoke.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ -#include "lt_clock_test.h" - -static int ClockSmokeTest(void) -{ - clockid_t clk = CLOCK_REALTIME; - struct timespec res = {0,0}, setts = {0,0}, oldtp = {0,0}, ts = {0,0}; - int ret; - int passflag = 0; - - /* get clock resolution */ - ret = clock_getres(clk, &res); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(res.tv_sec, CLOCK_RES_SEC, res.tv_sec); - ICUNIT_ASSERT_EQUAL(res.tv_nsec, CLOCK_RES_NSEC, res.tv_nsec); - - /* get clock realtime */ - ret = clock_gettime(clk, &oldtp); - printf("the clock current time: %lld second, %ld nanosecond\n", oldtp.tv_sec, oldtp.tv_nsec); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* set clock realtime */ - setts.tv_sec = oldtp.tv_sec + 1; - setts.tv_nsec = oldtp.tv_nsec; - printf("the clock setting time: %lld second, %ld nanosecond\n", setts.tv_sec, setts.tv_nsec); - ret = clock_settime(CLOCK_REALTIME, &setts); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ret = clock_gettime(clk, &ts); - printf("obtaining the current time after setting: %lld second, %ld nanosecond\n", ts.tv_sec, ts.tv_nsec); - passflag = (ts.tv_sec >= setts.tv_sec) && (ts.tv_sec <= setts.tv_sec + 1); // 1, means obtaining time's errno is 1 second. - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - ICUNIT_ASSERT_EQUAL(passflag, true, passflag); - return 0; -} - -void ClockTestSmoke(void) -{ - TEST_ADD_CASE(__FUNCTION__, ClockSmokeTest, TEST_POSIX, TEST_TIMES, TEST_LEVEL0, TEST_FUNCTION); -} - diff --git a/testsuites/unittest_old/time/clock/time_clock_test.cpp b/testsuites/unittest_old/time/clock/time_clock_test.cpp deleted file mode 100644 index 6a4bd7b6..00000000 --- a/testsuites/unittest_old/time/clock/time_clock_test.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "lt_clock_test.h" - -using namespace testing::ext; -namespace OHOS { -class TimeClockTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: ClockTestSmoke - * @tc.desc: function for TimeClockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeClockTest, ClockTestSmoke, TestSize.Level0) -{ - ClockTestSmoke(); -} -#endif - -#if defined(LOSCFG_USER_TEST_FULL) -/* * - * @tc.name: ClockTest001 - * @tc.desc: function for TimeClockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeClockTest, ClockTest001, TestSize.Level0) -{ - ClockTest001(); -} - -/* * - * @tc.name: ClockTest002 - * @tc.desc: function for TimeClockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeClockTest, ClockTest002, TestSize.Level0) -{ - ClockTest002(); -} - -/* * - * @tc.name: ClockTest003 - * @tc.desc: function for TimeClockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeClockTest, ClockTest003, TestSize.Level0) -{ - ClockTest003(); -} - -/* * - * @tc.name: ClockTest004 - * @tc.desc: function for TimeClockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeClockTest, ClockTest004, TestSize.Level0) -{ - ClockTest004(); // clock_getcpuclockid not supported on HMOS currently -} - -/* * - * @tc.name: ClockTest005 - * @tc.desc: function for TimeClockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeClockTest, ClockTest005, TestSize.Level0) -{ - ClockTest005(); -} - -/* * - * @tc.name: ClockTest006 - * @tc.desc: function for TimeClockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeClockTest, ClockTest006, TestSize.Level0) -{ - ClockTest006(); -} - -/* * - * @tc.name: ClockTest007 - * @tc.desc: function for TimeClockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeClockTest, ClockTest007, TestSize.Level0) -{ - ClockTest007(); -} - -/* * - * @tc.name: ClockTest008 - * @tc.desc: function for TimeClockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeClockTest, ClockTest008, TestSize.Level0) -{ - ClockTest008(); -} - -/* * - * @tc.name: ClockTest009 - * @tc.desc: function for TimeClockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeClockTest, ClockTest009, TestSize.Level0) -{ - ClockTest009(); -} - -/* * - * @tc.name: ClockTest010 - * @tc.desc: function for TimeClockTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeClockTest, ClockTest010, TestSize.Level0) -{ - ClockTest010(); -} - -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/time/timer/BUILD.gn b/testsuites/unittest_old/time/timer/BUILD.gn deleted file mode 100644 index e046cd47..00000000 --- a/testsuites/unittest_old/time/timer/BUILD.gn +++ /dev/null @@ -1,81 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../../common/include", - "./", -] - -sources_entry = [ - "../../common/osTest.cpp", - "time_timer_test.cpp", -] - -sources_smoke = [ - "smoke/timer_test_001.cpp", - "smoke/timer_test_002.cpp", - "smoke/timer_test_003.cpp", - "smoke/timer_test_004.cpp", - "smoke/timer_test_005.cpp", - "smoke/timer_test_tzset_001.cpp", - "smoke/timer_test_tzset_002.cpp", -] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_time_timer_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_time_timer_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_old/time/timer/lt_timer_test.h b/testsuites/unittest_old/time/timer/lt_timer_test.h deleted file mode 100644 index 1c5ab9a0..00000000 --- a/testsuites/unittest_old/time/timer/lt_timer_test.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ -#ifndef TIME_TIMER_LT_TIMER_TEST_H -#define TIME_TIMER_LT_TIMER_TEST_H - -#include -#include -#include -#include -#include "osTest.h" - -void TimerTest001(void); -void TimerTest002(void); -void TimerTest003(void); -void TimerTest004(void); -void TimerTest005(void); -void TIME_TEST_TZSET_001(void); -void TIME_TEST_TZSET_002(void); - -#endif /* TIME_TIMER_LT_TIMER_TEST_H */ diff --git a/testsuites/unittest_old/time/timer/smoke/timer_test_001.cpp b/testsuites/unittest_old/time/timer/smoke/timer_test_001.cpp deleted file mode 100644 index f888c497..00000000 --- a/testsuites/unittest_old/time/timer/smoke/timer_test_001.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include -#include "lt_timer_test.h" - -#define SIG SIGALRM -#define CLOCKID CLOCK_REALTIME - -static int g_sigHdlCnt; -static int g_overRunCnt; -static timer_t g_timerID; - -static void SigHandler01(int sig) -{ - g_sigHdlCnt++; - g_overRunCnt += timer_getoverrun(g_timerID); - LogPrintln("signo %d g_sigHdlCnt %d, overrun %d,%d\n", sig, g_sigHdlCnt, g_overRunCnt, timer_getoverrun(g_timerID)); -} - -static int TimerTest(void) -{ - int interval = 3; // 3, seconds - timer_t timerid01, timerid02; - struct sigevent sev; - struct itimerspec its; - sigset_t mask; - struct sigaction sa; - int ret; - - sa.sa_flags = 0; - sa.sa_handler = SigHandler01; - sigemptyset(&sa.sa_mask); - ret = sigaction(SIG, &sa, nullptr); - LogPrintln("sigaction %d: %d", SIG, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Block timer signal */ - sigemptyset(&mask); - sigaddset(&mask, SIG); - ret = sigprocmask(SIG_BLOCK, &mask, nullptr); - LogPrintln("sigprocmask setmask %d: %d", SIG, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Create the timer */ - sev.sigev_notify = SIGEV_SIGNAL; - sev.sigev_signo = SIG; - sev.sigev_value.sival_ptr = &timerid01; - ret = timer_create(CLOCKID, &sev, &timerid01); - LogPrintln("timer_create %p: %d", timerid01, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - g_timerID = timerid01; - - /* Start the timer */ - its.it_value.tv_sec = 0; - its.it_value.tv_nsec = 900000000; // 900000000, 0.9s - its.it_interval.tv_sec = its.it_value.tv_sec; - its.it_interval.tv_nsec = its.it_value.tv_nsec; - - ret = timer_settime(timerid01, 0, &its, nullptr); - LogPrintln("timer_settime %p: %d", timerid01, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - - /* Test of evp is NULL */ - ret = timer_create(CLOCKID, NULL, &timerid02); - LogPrintln("timer_settime %p: %d", timerid02, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - its.it_value.tv_sec = 1; - its.it_value.tv_nsec = 0; - its.it_interval.tv_sec = its.it_value.tv_sec; - its.it_interval.tv_nsec = its.it_value.tv_nsec; - - ret = timer_settime(timerid02, 0, &its, nullptr); - LogPrintln("timer_settime %p: %d", timerid02, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - sleep(6); - /* Sleep for a while */ - LogPrintln("sleep %ds", interval); - sleep(interval); // timer signal is blocked, this sleep should not be interrupted - ICUNIT_ASSERT_EQUAL(g_sigHdlCnt, 0, g_sigHdlCnt); - - /* Get the timer's time */ - ret = timer_gettime(timerid01, &its); - LogPrintln("timer_gettime %p: %d", timerid01, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Get the timer's overruns */ - ret = timer_getoverrun(timerid01); - LogPrintln("timer_getoverrun %p: %d", timerid01, ret); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); // before timer deliver, return value of timer_getoverrun is unspecified - - LogPrintln("unblock signal %d", SIG); - - /* Unlock the timer signal */ - ret = sigprocmask(SIG_UNBLOCK, &mask, nullptr); - LogPrintln("sigprocmask unblock %d: %d", SIG, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - interval = 1; - LogPrintln("sleep another %ds", interval); - sleep(interval); // this sleep may be interrupted by the timer - LogPrintln("sleep time over, g_sigHdlCnt = %d", g_sigHdlCnt); - - LogPrintln("sleep another %ds", interval); - sleep(interval); // this sleep may be interrupted by the timer - LogPrintln("sleep time over, g_sigHdlCnt = %d", g_sigHdlCnt); - - ret = timer_delete(timerid01); - LogPrintln("timer_delete %p %d", timerid01, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = timer_delete(timerid02); - LogPrintln("timer_delete %p %d", timerid02, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_NOT_EQUAL(g_sigHdlCnt, 0, g_sigHdlCnt); - ICUNIT_ASSERT_NOT_EQUAL(g_overRunCnt, 0, g_overRunCnt); - - return 0; -} - -void TimerTest001(void) -{ - TEST_ADD_CASE(__FUNCTION__, TimerTest, TEST_POSIX, TEST_SWTMR, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/timer/smoke/timer_test_002.cpp b/testsuites/unittest_old/time/timer/smoke/timer_test_002.cpp deleted file mode 100644 index f758eaa2..00000000 --- a/testsuites/unittest_old/time/timer/smoke/timer_test_002.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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. - */ -#include "lt_timer_test.h" - -static int g_almHandlerFlag; -static void SigAlmHandler(int sig) -{ - g_almHandlerFlag++; -} - -static int TimerTest(void) -{ - struct itimerval itv; - int ret; - - ret = getitimer(ITIMER_REAL, &itv); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - itv.it_value.tv_sec = 2; // 2, seconds. - itv.it_value.tv_usec = 500000; // 500000, 500ms. - itv.it_interval.tv_sec = 1; - itv.it_interval.tv_usec = 500000; // 500000, 500ms. - (void)signal(SIGALRM, SigAlmHandler); - - ret = setitimer(ITIMER_REAL, &itv, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LogPrintln("sleep %ds", 3); // 3, this sleep may be interrupted by the timer - sleep(3); // 3, this sleep may be interrupted by the timer - LogPrintln("sleep end, almHandlerFlag %d\n", g_almHandlerFlag); - ICUNIT_ASSERT_EQUAL(g_almHandlerFlag, 1, g_almHandlerFlag); - - LogPrintln("sleep %ds", 2); // 2, this sleep may be interrupted by the timer - sleep(2); // 2, this sleep may be interrupted by the timer - LogPrintln("sleep end, almHandlerFlag %d\n", g_almHandlerFlag); - ICUNIT_ASSERT_EQUAL(g_almHandlerFlag, 2, g_almHandlerFlag); // 2, assert the g_almHandlerFlag. - - LogPrintln("sleep %ds", 2); // 2, this sleep may be interrupted by the timer - sleep(2); // 2, this sleep may be interrupted by the timer - LogPrintln("sleep end, almHandlerFlag %d\n", g_almHandlerFlag); - ICUNIT_ASSERT_EQUAL(g_almHandlerFlag, 3, g_almHandlerFlag); // 3, assert the g_almHandlerFlag. - - ret = getitimer(ITIMER_REAL, &itv); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(itv.it_interval.tv_sec, 1, itv.it_interval.tv_sec); - ICUNIT_ASSERT_EQUAL(itv.it_interval.tv_usec, 500000, itv.it_interval.tv_usec); // 500000, assert the tv_usec. - - /* stop this timer */ - itv.it_value.tv_sec = 0; - itv.it_value.tv_usec = 0; - itv.it_interval.tv_sec = 0; - itv.it_interval.tv_usec = 0; - ret = setitimer(ITIMER_REAL, &itv, NULL); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - return 0; -} - -void TimerTest002(void) -{ - TEST_ADD_CASE(__FUNCTION__, TimerTest, TEST_POSIX, TEST_SWTMR, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/timer/smoke/timer_test_003.cpp b/testsuites/unittest_old/time/timer/smoke/timer_test_003.cpp deleted file mode 100644 index f6cfab91..00000000 --- a/testsuites/unittest_old/time/timer/smoke/timer_test_003.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include -#include -#include "lt_timer_test.h" - -#define SIG SIGALRM -#define CLOCKID CLOCK_REALTIME - -static int SetTimerTest(void) -{ - int ret = 0; - int sig = 0; - int failed = 0; - timer_t timerid; - sigset_t set, oldSet; - struct sigevent sev; - - ret = sigemptyset(&set); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = sigaddset(&set, SIG); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = sigprocmask(SIG_BLOCK, &set, &oldSet); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Create the timer */ - sev.sigev_notify = SIGEV_SIGNAL; - sev.sigev_signo = SIG; - sev.sigev_value.sival_ptr = &timerid; - ret = timer_create(CLOCKID, &sev, &timerid); - LogPrintln("timer_create %p: %d", timerid, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - struct timespec testcases[] = { - {0, 30000000}, - {1, 0}, - {1, 5}, - {1, 5000}, - {1, 30000000}, - {2, 0}, - }, zero = {0, 0}; - - for (int i = 0; i < sizeof(testcases) / sizeof(testcases[0]); ++i) { - struct timespec start, end; - struct itimerspec its; - int64_t expected, escaped; - - its.it_interval = zero; - its.it_value = testcases[i]; - - ret = clock_gettime(CLOCKID, &start); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = timer_settime(timerid, 0, &its, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = sigwait(&set, &sig); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = clock_gettime(CLOCKID, &end); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - expected = its.it_value.tv_sec * (int64_t)1e9 + its.it_value.tv_nsec; - escaped = end.tv_sec * (int64_t)1e9 + end.tv_nsec - start.tv_sec * (int64_t)1e9 - start.tv_nsec; - - failed += (escaped < expected || (escaped - expected) >= 20000000); // 20000000, 2 ticks. - } - - ret = timer_delete(timerid); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = sigprocmask(SIG_SETMASK, &oldSet, nullptr); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_EQUAL(failed, 0, failed); - - return 0; -} - -void TimerTest003(void) -{ - TEST_ADD_CASE(__FUNCTION__, SetTimerTest, TEST_POSIX, TEST_SWTMR, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/timer/smoke/timer_test_004.cpp b/testsuites/unittest_old/time/timer/smoke/timer_test_004.cpp deleted file mode 100644 index e28ec8d4..00000000 --- a/testsuites/unittest_old/time/timer/smoke/timer_test_004.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include -#include "lt_timer_test.h" - -/* signo should be in the range SIGRTMIN to SIGRTMAX when SA_SIGINFO flag is set. */ -#define SIG SIGRTMIN -#define CLOCKID CLOCK_REALTIME - -static int g_handlerFlag; -static int g_tmrOverrun; - -static void SigHandler(int sig, siginfo_t *si, void *uc) -{ - if (si == nullptr) { - LogPrintln("[ERROR]sig %d, si %p, uc %p\n", sig, si, uc); - return; - } - -#ifdef TEST_ON_LINUX - timer_t timerid = *(timer_t *)si->si_value.sival_ptr; -#else // SA_SIGINFO not compatible with POSIX on HMOS - timer_t timerid = *(timer_t *)si; -#endif - - g_tmrOverrun += timer_getoverrun(timerid); - LogPrintln("signo %d handlerFlag %d timer %p overrun %d\n", sig, ++g_handlerFlag, timerid, g_tmrOverrun); -} - -static int SigInfoTimerTest(void) -{ - int interval = 3; // 3 seconds - timer_t timerid; - struct sigevent sev; - struct itimerspec its; - sigset_t mask; - struct sigaction sa; - int ret; - - /* Install handler for timer signal. */ - sa.sa_flags = SA_SIGINFO; - sa.sa_sigaction = SigHandler; - sigemptyset(&sa.sa_mask); - ret = sigaction(SIG, &sa, nullptr); - LogPrintln("sigaction %d: %d", SIG, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Block timer signal */ - sigemptyset(&mask); - sigaddset(&mask, SIG); - ret = sigprocmask(SIG_BLOCK, &mask, nullptr); - LogPrintln("sigprocmask setmask %d: %d", SIG, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Create the timer */ - sev.sigev_notify = SIGEV_SIGNAL; - sev.sigev_signo = SIG; - sev.sigev_value.sival_ptr = &timerid; - ret = timer_create(CLOCKID, &sev, &timerid); - LogPrintln("timer_create %p: %d", timerid, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Start the timer */ - its.it_value.tv_sec = 0; - its.it_value.tv_nsec = 990000000; // 990000000, 0.99s - its.it_interval.tv_sec = its.it_value.tv_sec; - its.it_interval.tv_nsec = its.it_value.tv_nsec; - - ret = timer_settime(timerid, 0, &its, nullptr); - LogPrintln("timer_settime %p: %d", timerid, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Sleep for a while */ - LogPrintln("sleep %ds", interval); - sleep(interval); // should not be interrupted - - /* Get the timer's time */ - ret = timer_gettime(timerid, &its); - LogPrintln("timer_gettime %p: %d", timerid, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - /* Get the timer's overruns */ - ret = timer_getoverrun(timerid); - LogPrintln("timer_getoverrun %p: %d", timerid, ret); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - - /* Unlock the timer signal */ - ret = sigprocmask(SIG_UNBLOCK, &mask, nullptr); - LogPrintln("sigprocmask unblock %d: %d", SIG, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - LogPrintln("sleep another %ds", interval); - sleep(interval); // should be interrupted - LogPrintln("sleep time over, g_handlerFlag = %d", g_handlerFlag); - - ret = timer_delete(timerid); - LogPrintln("timer_delete %p %d", timerid, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_NOT_EQUAL(g_handlerFlag, 0, g_handlerFlag); - ICUNIT_ASSERT_NOT_EQUAL(g_tmrOverrun, 0, g_tmrOverrun); - - return 0; -} - -void TimerTest004(void) -{ - TEST_ADD_CASE(__FUNCTION__, SigInfoTimerTest, TEST_POSIX, TEST_SWTMR, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/timer/smoke/timer_test_005.cpp b/testsuites/unittest_old/time/timer/smoke/timer_test_005.cpp deleted file mode 100644 index 4c739f74..00000000 --- a/testsuites/unittest_old/time/timer/smoke/timer_test_005.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include "osTest.h" -#include -#include -#include "lt_timer_test.h" - -static int g_sigHdlCnt01; -static int g_sigHdlCnt02; -static int g_sigHdlCnt03; - -static void TempSigHandler(union sigval v) -{ - LogPrintln("This is TempSigHandler ...\r\n"); - (*(void(*)(void))(v.sival_ptr))(); -} - -static void TempSigHandler01(void) -{ - g_sigHdlCnt01++; -} - -static void TempSigHandler02(void) -{ - g_sigHdlCnt02++; -} - -static int TimerTest(void) -{ - timer_t timerid01, timerid02, timerid03; - struct sigevent sev; - struct itimerspec its; - int ret; - int i; - - (void)memset(&sev, 0, sizeof(struct sigevent)); - sev.sigev_notify = SIGEV_THREAD; - sev.sigev_notify_function = TempSigHandler; - sev.sigev_value.sival_ptr = (void *)TempSigHandler01; - - /* Start the timer */ - its.it_value.tv_sec = 3; // 3, timer time 3 seconds. - its.it_value.tv_nsec = 0; - its.it_interval.tv_sec = its.it_value.tv_sec; - its.it_interval.tv_nsec = its.it_value.tv_nsec; - ret = timer_create(CLOCK_REALTIME, &sev, &timerid01); - LogPrintln("timer_settime %p: %d", timerid01, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = timer_settime(timerid01, 0, &its, nullptr); - LogPrintln("timer_create %p: %d", timerid01, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - its.it_value.tv_sec = 4; // 4, timer time 4 seconds. - its.it_value.tv_nsec = 0; - its.it_interval.tv_sec = its.it_value.tv_sec; - its.it_interval.tv_nsec = its.it_value.tv_nsec; - - sev.sigev_value.sival_ptr = (void *)TempSigHandler02; - ret = timer_create(CLOCK_REALTIME, &sev, &timerid02); - LogPrintln("timer_settime %p: %d", timerid02, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = timer_settime(timerid02, 0, &its, nullptr); - LogPrintln("timer_settime %p: %d", timerid02, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - its.it_value.tv_sec = 5; // 5, timer time 5 seconds. - its.it_value.tv_nsec = 0; - its.it_interval.tv_sec = its.it_value.tv_sec; - its.it_interval.tv_nsec = its.it_value.tv_nsec; - - sleep(20); // 20, sleep seconds for timer. - ret = timer_delete(timerid01); - LogPrintln("timer_delete %p %d", timerid01, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ret = timer_delete(timerid02); - LogPrintln("timer_delete %p %d", timerid02, ret); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - - ICUNIT_ASSERT_NOT_EQUAL(g_sigHdlCnt01, 0, g_sigHdlCnt01); - ICUNIT_ASSERT_NOT_EQUAL(g_sigHdlCnt02, 0, g_sigHdlCnt02); - return 0; - -} - -void TimerTest005(void) -{ - TEST_ADD_CASE(__FUNCTION__, TimerTest, TEST_POSIX, TEST_SWTMR, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/timer/smoke/timer_test_tzset_001.cpp b/testsuites/unittest_old/time/timer/smoke/timer_test_tzset_001.cpp deleted file mode 100644 index 8cc51b4b..00000000 --- a/testsuites/unittest_old/time/timer/smoke/timer_test_tzset_001.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include -#include "lt_timer_test.h" -#include - -static UINT32 testcase(VOID) -{ - time_t td; - int ret = 0; - - errno = 0; - ret = putenv("TZ=GMT-3"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - tzset(); - - errno = 0; - ret = time(&td); - TEST_PRINT("[INFO]%s:%d,%s,Current time = %s\n", __FILE__, __LINE__, __func__, asctime(localtime(&td))); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -void TIME_TEST_TZSET_001(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_POSIX, TEST_SWTMR, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/timer/smoke/timer_test_tzset_002.cpp b/testsuites/unittest_old/time/timer/smoke/timer_test_tzset_002.cpp deleted file mode 100644 index 311def89..00000000 --- a/testsuites/unittest_old/time/timer/smoke/timer_test_tzset_002.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ -#include -#include -#include -#include -#include -#include "lt_timer_test.h" -#include - -static UINT32 testcase(VOID) -{ - time_t td; - int ret = 0; - - errno = 0; - ret = putenv((char *) "TZ=GMT-100"); - ICUNIT_ASSERT_EQUAL(ret, 0, ret); - tzset(); - - errno = 0; - ret = time(&td); - TEST_PRINT("[INFO]%s:%d,%s,Current time = %s\n", __FILE__, __LINE__, __func__, asctime(localtime(&td))); - ICUNIT_ASSERT_NOT_EQUAL(ret, -1, ret); - TEST_PRINT("[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s\n", __FILE__, __LINE__, __func__, ret, errno, strerror(errno)); - ICUNIT_GOTO_EQUAL(errno, 0, errno, OUT); - - return LOS_OK; -OUT: - return LOS_NOK; -} - -void TIME_TEST_TZSET_002(void) -{ - TEST_ADD_CASE(__FUNCTION__, testcase, TEST_POSIX, TEST_SWTMR, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/time/timer/time_timer_test.cpp b/testsuites/unittest_old/time/timer/time_timer_test.cpp deleted file mode 100644 index dc2d9648..00000000 --- a/testsuites/unittest_old/time/timer/time_timer_test.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "lt_timer_test.h" - -using namespace testing::ext; -namespace OHOS { -class TimeTimerTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: TimerTest001 - * @tc.desc: function for TimeTimerTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeTimerTest, TimerTest001, TestSize.Level0) -{ - TimerTest001(); -} - -/* * - * @tc.name: TimerTest002 - * @tc.desc: function for TimeTimerTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeTimerTest, TimerTest002, TestSize.Level0) -{ - TimerTest002(); -} - -/* * - * @tc.name: TimerTest003 - * @tc.desc: function for TimeTimerTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeTimerTest, TimerTest003, TestSize.Level0) -{ - TimerTest003(); -} - -/* * - * @tc.name: TimerTest004 - * @tc.desc: function for TimeTimerTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -/*HWTEST_F(TimeTimerTest, TimerTest004, TestSize.Level0) -{ - TimerTest004(); // TODO: musl sigaction handler have only one param. -}*/ - -/* * - * @tc.name: TimerTest005 - * @tc.desc: function for timer_create SIGEV_THREAD. - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeTimerTest, TimerTest005, TestSize.Level0) -{ - TimerTest005(); -} - -/* * - * @tc.name: TIME_TEST_TZSET_001 - * @tc.desc: function for TIME_TEST_TZSET_001 - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeTimerTest, TIME_TEST_TZSET_001, TestSize.Level0) -{ - TIME_TEST_TZSET_001(); -} - -/* * - * @tc.name: TIME_TEST_TZSET_002 - * @tc.desc: function for TimeTimerTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TimeTimerTest, TIME_TEST_TZSET_002, TestSize.Level0) -{ - TIME_TEST_TZSET_002(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/trace/BUILD.gn b/testsuites/unittest_old/trace/BUILD.gn deleted file mode 100644 index aecccb3b..00000000 --- a/testsuites/unittest_old/trace/BUILD.gn +++ /dev/null @@ -1,78 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../common/include", - "./", -] - -sources_entry = [ - "../common/osTest.cpp", - "trace_unit_test.cpp", -] - -sources_smoke = [ - "smoke/trace_test_001.cpp", - "smoke/trace_test_002.cpp", - "smoke/trace_test_003.cpp", - "smoke/trace_test_004.cpp", -] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_trace_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_trace_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_old/trace/It_test_trace.h b/testsuites/unittest_old/trace/It_test_trace.h deleted file mode 100644 index aa183311..00000000 --- a/testsuites/unittest_old/trace/It_test_trace.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_SYS_H -#define _IT_TEST_SYS_H - -#include "osTest.h" -#include -#include -#include -#include -#include - -#define TRACE_IOC_MAGIC 'T' -#define TRACE_START _IO(TRACE_IOC_MAGIC, 1) -#define TRACE_STOP _IO(TRACE_IOC_MAGIC, 2) -#define TRACE_RESET _IO(TRACE_IOC_MAGIC, 3) -#define TRACE_DUMP _IO(TRACE_IOC_MAGIC, 4) -#define TRACE_SET_MASK _IO(TRACE_IOC_MAGIC, 5) -#define TRACE_USR_MAX_PARAMS 3 - -typedef struct { - unsigned int eventType; - uintptr_t identity; - uintptr_t params[TRACE_USR_MAX_PARAMS]; -} UsrEventInfo; - -VOID ItTestTrace001(VOID); -VOID ItTestTrace002(VOID); -VOID ItTestTrace003(VOID); -VOID ItTestTrace004(VOID); -#endif diff --git a/testsuites/unittest_old/trace/smoke/trace_test_001.cpp b/testsuites/unittest_old/trace/smoke/trace_test_001.cpp deleted file mode 100644 index 65694ec2..00000000 --- a/testsuites/unittest_old/trace/smoke/trace_test_001.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ - -#include "It_test_trace.h" - -static UINT32 TestCase(VOID) -{ - int fd = open("/dev/trace", O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, errno, EXIT); - - ioctl(fd, TRACE_START, NULL); - sleep(1); - ioctl(fd, TRACE_STOP, NULL); - ioctl(fd, TRACE_DUMP, false); -EXIT: - close(fd); - return 0; -} - -VOID ItTestTrace001(VOID) -{ - TEST_ADD_CASE("IT_TEST_TRACE_001", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/trace/smoke/trace_test_002.cpp b/testsuites/unittest_old/trace/smoke/trace_test_002.cpp deleted file mode 100644 index 71ec72cf..00000000 --- a/testsuites/unittest_old/trace/smoke/trace_test_002.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -#include "It_test_trace.h" - -static UINT32 TestCase(VOID) -{ - size_t mask; - int fd = open("/dev/trace", O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, errno, EXIT); - - ioctl(fd, TRACE_STOP, NULL); - ioctl(fd, TRACE_RESET, NULL); /* clear all events */ - - mask = 0x10000; /* filter kernel events */ - ioctl(fd, TRACE_SET_MASK, mask); - - ioctl(fd, TRACE_START, NULL); /* start trace */ - sleep(1); - ioctl(fd, TRACE_STOP, NULL); - ioctl(fd, TRACE_DUMP, false); -EXIT: - close(fd); - return 0; -} - -VOID ItTestTrace002(VOID) -{ - TEST_ADD_CASE("IT_TEST_TRACE_002", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/trace/smoke/trace_test_003.cpp b/testsuites/unittest_old/trace/smoke/trace_test_003.cpp deleted file mode 100644 index 3feeb3b9..00000000 --- a/testsuites/unittest_old/trace/smoke/trace_test_003.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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. - */ - -#include "It_test_trace.h" - -static UINT32 TestCase(VOID) -{ - UsrEventInfo info = { - .eventType = 0x1, - .identity = 0x0001, - .params = {1, 2, 3}, - }; - - int fd = open("/dev/trace", O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, errno, EXIT); - - ioctl(fd, TRACE_START, NULL); /* start trace */ - (void)write(fd, &info, sizeof(UsrEventInfo)); - info.eventType = 0x2; - info.identity = 0x0002; - (void)write(fd, &info, sizeof(UsrEventInfo)); - - ioctl(fd, TRACE_STOP, NULL); - ioctl(fd, TRACE_DUMP, false); -EXIT: - close(fd); - return 0; -} - -VOID ItTestTrace003(VOID) -{ - TEST_ADD_CASE("IT_TEST_TRACE_003", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/trace/smoke/trace_test_004.cpp b/testsuites/unittest_old/trace/smoke/trace_test_004.cpp deleted file mode 100644 index 2ec18090..00000000 --- a/testsuites/unittest_old/trace/smoke/trace_test_004.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#include "It_test_trace.h" - -static UINT32 TestCase(VOID) -{ - int i; - int size = 0x100; - int len; - char *buffer = NULL; - - int fd = open("/dev/trace", O_RDWR); - ICUNIT_GOTO_NOT_EQUAL(fd, -1, errno, EXIT); - - ioctl(fd, TRACE_STOP, NULL); - - buffer= (char *)malloc(size); - if (buffer == NULL) { - printf("Read buffer malloc failed!\n"); - goto EXIT; - } - - len = read(fd, buffer, size); - for (i = 0; i < len; i++) { - printf("%02x ", buffer[i] & 0xFF); - } - printf("\n"); - free(buffer); -EXIT: - close(fd); - return 0; -} - -VOID ItTestTrace004(VOID) -{ - TEST_ADD_CASE("IT_TEST_TRACE_004", TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/trace/trace_unit_test.cpp b/testsuites/unittest_old/trace/trace_unit_test.cpp deleted file mode 100644 index 78f3702e..00000000 --- a/testsuites/unittest_old/trace/trace_unit_test.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include - -#include "It_test_trace.h" - -using namespace testing::ext; -namespace OHOS { -class TraceTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: IT_TEST_TRACE_001 - * @tc.desc: function for TraceTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TraceTest, ItTestTrace001, TestSize.Level0) -{ - ItTestTrace001(); -} - -/* * - * @tc.name: IT_TEST_TRACE_002 - * @tc.desc: function for TraceTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TraceTest, ItTestTrace002, TestSize.Level0) -{ - ItTestTrace002(); -} - -/* * - * @tc.name: IT_TEST_TRACE_003 - * @tc.desc: function for TraceTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TraceTest, ItTestTrace003, TestSize.Level0) -{ - ItTestTrace003(); -} - -/* * - * @tc.name: IT_TEST_TRACE_004 - * @tc.desc: function for TraceTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(TraceTest, ItTestTrace004, TestSize.Level0) -{ - ItTestTrace004(); -} -#endif -} // namespace OHOS diff --git a/testsuites/unittest_old/util/BUILD.gn b/testsuites/unittest_old/util/BUILD.gn deleted file mode 100644 index 0f99dc27..00000000 --- a/testsuites/unittest_old/util/BUILD.gn +++ /dev/null @@ -1,84 +0,0 @@ -# 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") - -common_include_dirs = [ - "//third_party/googletest/googletest/include", - "../common/include", - "../misc", - "./", -] - -sources_entry = [ - "../common/osTest.cpp", - "util_test.cpp", -] - -sources_smoke = [ - "smoke/it_test_util_100.cpp", - "smoke/it_test_util_101.cpp", - "smoke/util_test_001.cpp", - "smoke/util_test_002.cpp", - "smoke/util_test_003.cpp", - "smoke/util_test_004.cpp", - "smoke/util_test_005.cpp", - "smoke/util_test_006.cpp", - "smoke/util_test_007.cpp", -] - -sources_full = [] - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { - unittest("liteos_a_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" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} - -if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { - unittest("liteos_a_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" ] - deps = [ "//third_party/bounds_checking_function:libsec_shared" ] - } -} diff --git a/testsuites/unittest_old/util/It_test_util.h b/testsuites/unittest_old/util/It_test_util.h deleted file mode 100644 index d7adfcc9..00000000 --- a/testsuites/unittest_old/util/It_test_util.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -#ifndef _IT_TEST_UTIL_H -#define _IT_TEST_UTIL_H - -#include "osTest.h" -#include "getopt.h" -#include "stdio.h" -#include "stdlib.h" -#include "unistd.h" -#include "crypt.h" -#include "time.h" -#include "search.h" - -extern VOID ItTestUtil001(VOID); -extern VOID ItTestUtil002(VOID); -extern VOID ItTestUtil003(VOID); -extern VOID ItTestUtil004(VOID); -extern VOID ItTestUtil005(VOID); -extern VOID ItTestUtil006(VOID); -extern VOID ItTestUtil007(VOID); -extern VOID ItTestUtil100(VOID); -extern VOID ItTestUtil101(VOID); - -#endif diff --git a/testsuites/unittest_old/util/smoke/it_test_util_100.cpp b/testsuites/unittest_old/util/smoke/it_test_util_100.cpp deleted file mode 100644 index 7e984ef0..00000000 --- a/testsuites/unittest_old/util/smoke/it_test_util_100.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ -#include "It_test_util.h" - -static int TestCase(void) -{ - wchar_t value[] = L"12"; - wchar_t value1[] = L"abcdefg"; - int len; - - len = wcswidth(value, 2); - ICUNIT_ASSERT_EQUAL(len, 2, len); - - len = wcswidth(value1, 7); - ICUNIT_ASSERT_EQUAL(len, 7, len); - - return 0; -} -void ItTestUtil100(void) - -{ - TEST_ADD_CASE("It_Test_Util_100", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/util/smoke/it_test_util_101.cpp b/testsuites/unittest_old/util/smoke/it_test_util_101.cpp deleted file mode 100644 index 9c879a9f..00000000 --- a/testsuites/unittest_old/util/smoke/it_test_util_101.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ -#include "It_test_util.h" - -static int TestCase(void) -{ - wchar_t value[] = L"2"; - wchar_t value1[] = L"a"; - int len; - - len = wcwidth(*value); - ICUNIT_ASSERT_EQUAL(len, 1, len); - - len = wcwidth(*value1); - ICUNIT_ASSERT_EQUAL(len, 1, len); - - return 0; -} - -void ItTestUtil101(void) -{ - TEST_ADD_CASE("It_Test_Util_101", TestCase, TEST_VFS, TEST_JFFS, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/util/smoke/util_test_001.cpp b/testsuites/unittest_old/util/smoke/util_test_001.cpp deleted file mode 100644 index 06a54451..00000000 --- a/testsuites/unittest_old/util/smoke/util_test_001.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_test_util.h" - -static struct option g_longOptions[] = { - {"test1", 0, NULL, 'a'}, - {"test2", 0, NULL, 'b'}, - {"test3", 0, NULL, 'c'}, - {0, 0, 0, 0}, -}; - -#define ARGC_NUM 5 - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - INT32 argc = ARGC_NUM; - CHAR *argv[] = {"test", "-b", "-a", "-c", NULL}; - CHAR *ptr = NULL; - CHAR * const shortOptions = "abc"; - - for (i = 0; (ret = getopt_long(argc, argv, shortOptions, g_longOptions, NULL)) != -1; i++) { - switch (ret) { - case 'a': - ICUNIT_GOTO_EQUAL(i, 1, i, EXIT); - break; - case 'b': - ICUNIT_GOTO_EQUAL(i, 0, i, EXIT); - break; - case 'c': - ICUNIT_GOTO_EQUAL(i, 2, i, EXIT); - break; - default: - break; - } - } - - return 0; -EXIT: - return -1; -} - -VOID ItTestUtil001(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/util/smoke/util_test_002.cpp b/testsuites/unittest_old/util/smoke/util_test_002.cpp deleted file mode 100644 index fee8059b..00000000 --- a/testsuites/unittest_old/util/smoke/util_test_002.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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. - */ -#include "It_test_util.h" - -static struct option g_longOptions[] = { - {"test1", 0, NULL, 'a'}, - {"test2", 0, NULL, 'b'}, - {"test3", 0, NULL, 'c'}, - {0, 0, 0, 0}, -}; - -#define ARGC_NUM 5 - -static UINT32 TestCase(VOID) -{ - INT32 ret, i; - INT32 argc = ARGC_NUM; - CHAR *argv[] = {"test", "-b", "-a", "-c", NULL}; - CHAR *ptr = NULL; - CHAR * const shortOptions = "abc"; - - for (i = 0; (ret = getopt_long_only(argc, argv, shortOptions, g_longOptions, NULL)) != -1; i++) { - switch (ret) { - case 'a': - ICUNIT_GOTO_EQUAL(i, 1, i, EXIT); - break; - case 'b': - ICUNIT_GOTO_EQUAL(i, 0, i, EXIT); - break; - case 'c': - ICUNIT_GOTO_EQUAL(i, 2, i, EXIT); - break; - default: - break; - } - } - - return 0; -EXIT: - return -1; -} - -VOID ItTestUtil002(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/util/smoke/util_test_003.cpp b/testsuites/unittest_old/util/smoke/util_test_003.cpp deleted file mode 100644 index 38c9d4a4..00000000 --- a/testsuites/unittest_old/util/smoke/util_test_003.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -#define TEST_BUF_SIZE 20 -#define TEST_STR "rw,ro=test" - -static UINT32 TestCase(VOID) -{ - enum { - RO_OPT = 0, - RW_OPT, - NAME_OPT - }; - - CHAR *const token[] = { - [RO_OPT] = "ro", - [RW_OPT] = "rw", - [NAME_OPT] = "name", - NULL - }; - CHAR *buf = (char *)malloc(TEST_BUF_SIZE); - CHAR *a = TEST_STR; - CHAR *value = NULL; - CHAR *subopts = NULL; - INT32 err = 0; - INT32 countRight = 0; - INT32 countErr = 0; - - strcpy_s(buf, TEST_BUF_SIZE, a); - subopts = buf; - - while (*subopts != '\0' && !err) { - switch (getsubopt(&subopts, token, &value)) { - case RO_OPT: - if (value) { - countRight++; - } else { - countErr++; - } - break; - case RW_OPT: - if (value) { - countErr++; - } else { - countRight++; - } - break; - case NAME_OPT: - if (value) { - countErr++; - } else { - countErr++; - } - break; - default: - err = 1; - break; - } - } - - ICUNIT_GOTO_EQUAL(countRight, 2, countRight, EXIT); - ICUNIT_GOTO_EQUAL(countErr, 0, countErr, EXIT); - - free(buf); - return 0; -EXIT: - free(buf); - return -1; -} - -VOID ItTestUtil003(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/util/smoke/util_test_004.cpp b/testsuites/unittest_old/util/smoke/util_test_004.cpp deleted file mode 100644 index b9874ee3..00000000 --- a/testsuites/unittest_old/util/smoke/util_test_004.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -#define JRAND48_NUM 0x100000000 - -static UINT32 TestCase(VOID) -{ - long int x; - unsigned short seed[3] = {1, 2, 3}; - - x = jrand48(seed); - if ((x < -JRAND48_NUM) || (x > JRAND48_NUM)) { - printf("[IN %s][line %d] x = %d\n", __FUNCTION__, __LINE__, x); - goto EXIT; - } - - return 0; -EXIT: - return -1; -} - -VOID ItTestUtil004(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/util/smoke/util_test_005.cpp b/testsuites/unittest_old/util/smoke/util_test_005.cpp deleted file mode 100644 index 332f6251..00000000 --- a/testsuites/unittest_old/util/smoke/util_test_005.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -#define MRAND48_NUM 0x100000000 - -static UINT32 TestCase(VOID) -{ - long int x; - unsigned short seed[7] = {1, 2, 3, 4, 5, 6, 7}; - - lcong48(seed); - x = mrand48(); - if ((x < -MRAND48_NUM) || (x > MRAND48_NUM)) { - printf("[IN %s][line %d] x = %d\n", __FUNCTION__, __LINE__, x); - goto EXIT; - } - - return 0; -EXIT: - return -1; -} - -VOID ItTestUtil005(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/util/smoke/util_test_006.cpp b/testsuites/unittest_old/util/smoke/util_test_006.cpp deleted file mode 100644 index a5b7be34..00000000 --- a/testsuites/unittest_old/util/smoke/util_test_006.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -static UINT32 TestCase(VOID) -{ - char key[64]; - char orig[9] = "eggplant"; - char buf[64]; - char txt[9]; - int i, j; - - for (i = 0; i < 64; i++) { - key[i] = rand() & 1; - } - - for (i = 0; i < 8; i++) { - for (j = 0; j < 8; j++) { - buf[i * 8 + j] = orig[i] >> j & 1; - } - setkey(key); - } - printf("Before encrypting: %s\n", orig); - - encrypt(buf, 0); - for (i = 0; i < 8; i++) { - for (j = 0, txt[i] = '\0'; j < 8; j++) { - txt[i] |= buf[i * 8 + j] << j; - } - txt[8] = '\0'; - } - ICUNIT_GOTO_STRING_NOT_EQUAL(txt, orig, txt, EXIT); - - encrypt(buf, 1); - for (i = 0; i < 8; i++) { - for (j = 0, txt[i] = '\0'; j < 8; j++) { - txt[i] |= buf[i * 8 + j] << j; - } - txt[8] = '\0'; - } - ICUNIT_GOTO_STRING_EQUAL(txt, orig, txt, EXIT); - - return 0; -EXIT: - return -1; -} - - -VOID ItTestUtil006(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/util/smoke/util_test_007.cpp b/testsuites/unittest_old/util/smoke/util_test_007.cpp deleted file mode 100644 index cacdae8d..00000000 --- a/testsuites/unittest_old/util/smoke/util_test_007.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - */ -#include "It_test_misc.h" - -static void *g_root = NULL; - -static void *Xmalloc(unsigned n) -{ - void *p = NULL; - if (n <= 0) { - printf("err: malloc size invalid\n"); - exit(EXIT_FAILURE); - } - p = malloc(n); - if (p) { - return p; - } - fprintf(stderr, "insufficient memory\n"); - exit(EXIT_FAILURE); -} - -static int Compare(const void *pa, const void *pb) -{ - if (*(int *)pa < *(int *)pb) { - return -1; - } - if (*(int *)pa > *(int *)pb) { - return 1; - } - return 0; -} - -static void Action(const void *nodep, VISIT which, int depth) -{ - int *datap = NULL; - - switch (which) { - case preorder: - break; - case postorder: - datap = *(int **)nodep; - break; - case endorder: - break; - case leaf: - datap = *(int **)nodep; - break; - } -} - -static UINT32 TestCase(VOID) -{ - int i; - int *ptr = NULL; - void *val = NULL; - - srand(time(NULL)); - for (i = 0; i < 12; i++) { - ptr = (int *)Xmalloc(sizeof(int)); - *ptr = rand() & 0xff; - val = tsearch((void *)ptr, &g_root, Compare); - if (val == NULL) - exit(EXIT_FAILURE); - else if ((*(int **)val) != ptr) - free(ptr); - } - twalk(g_root, Action); - tdestroy(g_root, free); - - return 0; -} - -VOID ItTestUtil007(VOID) -{ - TEST_ADD_CASE(__FUNCTION__, TestCase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); -} diff --git a/testsuites/unittest_old/util/util_test.cpp b/testsuites/unittest_old/util/util_test.cpp deleted file mode 100644 index 3a21c281..00000000 --- a/testsuites/unittest_old/util/util_test.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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. - */ -#include "stdio.h" -#include -#include -#include "It_test_util.h" - -using namespace testing::ext; -namespace OHOS { -class UtilTest : public testing::Test { -public: - static void SetUpTestCase(void) {} - static void TearDownTestCase(void) {} -}; - -#if defined(LOSCFG_USER_TEST_SMOKE) -/* * - * @tc.name: IT_TEST_UTIL_001 - * @tc.desc: function for UtilTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(UtilTest, ItTestUtil001, TestSize.Level0) -{ - ItTestUtil001(); -} - -/* * - * @tc.name: IT_TEST_UTIL_002 - * @tc.desc: function for UtilTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(UtilTest, ItTestUtil002, TestSize.Level0) -{ - ItTestUtil002(); -} - -/* * - * @tc.name: IT_TEST_UTIL_003 - * @tc.desc: function for UtilTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(UtilTest, ItTestUtil003, TestSize.Level0) -{ - ItTestUtil003(); -} - -/* * - * @tc.name: IT_TEST_UTIL_004 - * @tc.desc: function for UtilTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(UtilTest, ItTestUtil004, TestSize.Level0) -{ - ItTestUtil004(); -} - -/* * - * @tc.name: IT_TEST_UTIL_005 - * @tc.desc: function for UtilTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(UtilTest, ItTestUtil005, TestSize.Level0) -{ - ItTestUtil005(); -} - -/* * - * @tc.name: IT_TEST_UTIL_006 - * @tc.desc: function for UtilTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(UtilTest, ItTestUtil006, TestSize.Level0) -{ - ItTestUtil006(); -} - -/* * - * @tc.name: IT_TEST_UTIL_007 - * @tc.desc: function for UtilTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(UtilTest, ItTestUtil007, TestSize.Level0) -{ - ItTestUtil007(); -} - -/* * - * @tc.name: IT_TEST_UTIL_101 - * @tc.desc: function for UtilTest - * @tc.type: FUNC - * @tc.require: AR000EEMQ9 - */ -HWTEST_F(UtilTest, ItTestUtil101, TestSize.Level0) -{ - ItTestUtil101(); -} - -#endif -} // namespace OHOS