Compare commits
67 Commits
panjiayan_
...
main
Author | SHA1 | Date |
---|---|---|
|
f55906dee6 | 7 months ago |
|
222949d5be | 7 months ago |
|
fe05466eeb | 7 months ago |
|
796b79839f | 7 months ago |
|
4e9288d1c6 | 7 months ago |
|
40412da54b | 7 months ago |
|
dde2f171f7 | 7 months ago |
|
35cc8978c2 | 7 months ago |
|
52267d6c61 | 7 months ago |
|
5fa1e6d8be | 7 months ago |
|
9680a495c8 | 7 months ago |
|
369c13a976 | 7 months ago |
|
8c28fae73b | 7 months ago |
|
d5998e8235 | 7 months ago |
|
aa49188067 | 7 months ago |
|
353e570ea1 | 7 months ago |
|
4040f795c5 | 7 months ago |
|
766693aac5 | 7 months ago |
|
7bb2fdb46c | 7 months ago |
|
8bd6b59974 | 7 months ago |
|
453b244b67 | 7 months ago |
|
6f209d8726 | 7 months ago |
|
54f82cd61c | 7 months ago |
|
e32b938549 | 7 months ago |
|
768b870f5b | 7 months ago |
|
10228b14b6 | 7 months ago |
|
6e424ad722 | 7 months ago |
|
b04c0c9f54 | 7 months ago |
|
77f2c2e021 | 7 months ago |
|
feebadef06 | 7 months ago |
|
30c5b2fb9c | 7 months ago |
|
2d46693239 | 7 months ago |
|
1e81313cb2 | 7 months ago |
|
749ba92144 | 7 months ago |
|
2b84597fad | 7 months ago |
|
8db0d6c6e1 | 7 months ago |
|
82512f98ec | 7 months ago |
|
ba78f4af13 | 7 months ago |
|
2bbd81e1bb | 7 months ago |
|
1e2e1722f8 | 7 months ago |
|
7a03be035e | 7 months ago |
|
c42d4c8f9c | 7 months ago |
|
e89676cded | 7 months ago |
|
dafc1c8a0a | 7 months ago |
|
fa052b7a28 | 7 months ago |
|
d38443f8c2 | 7 months ago |
|
e885d4d491 | 7 months ago |
|
cc2f7154e9 | 7 months ago |
|
5c9daabe2a | 7 months ago |
|
faf14db68b | 7 months ago |
|
8b314ac8fb | 7 months ago |
|
a835bb28b1 | 7 months ago |
|
e4b3839750 | 8 months ago |
|
0fad9f57a6 | 8 months ago |
|
ad862c087c | 8 months ago |
|
e40ef14308 | 8 months ago |
|
5ae7b2f1a6 | 8 months ago |
|
8367e625c7 | 8 months ago |
|
2c6af109bd | 8 months ago |
|
fd0ab82e14 | 8 months ago |
|
7b80ec07b2 | 8 months ago |
|
1b8e680a1b | 8 months ago |
|
cd4901a844 | 8 months ago |
|
5492542b81 | 8 months ago |
|
a8b379bf08 | 8 months ago |
|
5bc821ea65 | 8 months ago |
|
2ebbcd66d3 | 8 months ago |
@ -0,0 +1,60 @@
|
||||
# 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")
|
||||
|
||||
netdb_include_dirs = [ "$TEST_UNITTEST_DIR/net/netdb" ]
|
||||
|
||||
netdb_sources_entry = [ "$TEST_UNITTEST_DIR/net/netdb/net_netdb_test.cpp" ]
|
||||
|
||||
netdb_sources_smoke = [
|
||||
"$TEST_UNITTEST_DIR/net/netdb/smoke/net_netdb_test_001.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/smoke/net_netdb_test_013.cpp",
|
||||
]
|
||||
|
||||
netdb_sources_full = [
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_002.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_003.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_004.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_005.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_006.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_007.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_008.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_009.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_010.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_011.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_012.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_015.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_016.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_017.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_018.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_019.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_020.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_021.cpp",
|
||||
"$TEST_UNITTEST_DIR/net/netdb/full/net_netdb_test_022.cpp",
|
||||
]
|
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 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; // 用于记录 InitRoutine 被调用的次数
|
||||
static int g_okStatus = 777; // 定义一个特殊的状态值,表示状态正常
|
||||
static pthread_once_t g_onceCtrl = PTHREAD_ONCE_INIT; // pthread_once 的控制变量,初始化为未执行状态
|
||||
|
||||
// 初始化函数,每次调用都会增加 g_number 的值
|
||||
static void InitRoutine(void)
|
||||
{
|
||||
g_number++;
|
||||
}
|
||||
|
||||
// 线程函数,测试 pthread_once 的行为
|
||||
static void *Threadfunc(void *parm)
|
||||
{
|
||||
int err;
|
||||
// 确保 InitRoutine 只被调用一次
|
||||
err = pthread_once(&g_onceCtrl, InitRoutine);
|
||||
ICUNIT_GOTO_EQUAL(err, 0, err, EXIT); // 使用测试框架的宏检查 pthread_once 的返回值是否为 0
|
||||
return reinterpret_cast<void *>(g_okStatus); // 返回状态值
|
||||
EXIT:
|
||||
return NULL; // 出错时返回 NULL
|
||||
}
|
||||
|
||||
// 测试函数,创建多个线程并检查 pthread_once 的行为
|
||||
static void *ThreadFuncTest(void *arg)
|
||||
{
|
||||
pthread_t thread[3]; // 定义线程数组,用于存储线程 ID
|
||||
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); // 检查 pthread_create 的返回值
|
||||
}
|
||||
|
||||
// 等待所有线程结束
|
||||
for (i = 0; i < threadsNum; ++i) {
|
||||
rc = pthread_join(thread[i], &status);
|
||||
ICUNIT_GOTO_EQUAL(rc, 0, rc, EXIT); // 检查 pthread_join 的返回值
|
||||
ICUNIT_GOTO_EQUAL((unsigned int)status, (unsigned int)g_okStatus, status, EXIT); // 检查线程函数的返回值
|
||||
}
|
||||
|
||||
// 检查 InitRoutine 是否只被调用了一次
|
||||
ICUNIT_GOTO_EQUAL(g_number, 1, g_number, EXIT);
|
||||
|
||||
EXIT:
|
||||
return NULL; // 出错时返回 NULL
|
||||
}
|
||||
|
||||
// 测试用例函数,设置线程属性并启动测试线程
|
||||
static int Testcase(void)
|
||||
{
|
||||
int ret; // 用于存储函数调用的返回值
|
||||
pthread_t newPthread; // 定义新线程的 ID
|
||||
int curThreadPri, curThreadPolicy; // 用于存储当前线程的调度策略和优先级
|
||||
pthread_attr_t a = { 0 }; // 定义线程属性对象并初始化
|
||||
struct sched_param param = { 0 }; // 定义调度参数对象并初始化
|
||||
|
||||
g_onceCtrl = PTHREAD_ONCE_INIT; // 重置 pthread_once 的控制变量
|
||||
|
||||
// 获取当前线程的调度策略和优先级
|
||||
ret = pthread_getschedparam(pthread_self(), &curThreadPolicy, ¶m);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, -ret); // 检查 pthread_getschedparam 的返回值
|
||||
|
||||
curThreadPri = param.sched_priority; // 获取当前线程的优先级
|
||||
|
||||
// 设置新线程的属性
|
||||
ret = pthread_attr_init(&a); // 初始化线程属性
|
||||
pthread_attr_setinheritsched(&a, PTHREAD_EXPLICIT_SCHED); // 设置线程继承调度策略为显式
|
||||
param.sched_priority = curThreadPri + 2; // 设置新线程的优先级为当前线程优先级加 2
|
||||
pthread_attr_setschedparam(&a, ¶m); // 设置线程调度参数
|
||||
ret = pthread_create(&newPthread, &a, ThreadFuncTest, 0); // 创建新线程并运行测试函数
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret); // 检查 pthread_create 的返回值
|
||||
|
||||
// 等待新线程结束
|
||||
ret = pthread_join(newPthread, NULL);
|
||||
ICUNIT_ASSERT_EQUAL(ret, 0, ret); // 检查 pthread_join 的返回值
|
||||
|
||||
return 0; // 测试成功结束
|
||||
}
|
||||
|
||||
// 注册测试用例
|
||||
void ItTestPthreadOnce001(void)
|
||||
{
|
||||
TEST_ADD_CASE("IT_PTHREAD_ONCE_001", Testcase, TEST_POSIX, TEST_MEM, TEST_LEVEL0, TEST_FUNCTION); // 使用测试框架的宏注册测试用例
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <climits>
|
||||
#include <sys/types.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
#include "It_process_plimits.h"
|
||||
|
||||
//write function to get process file mode
|
||||
static std::string GetFileMode(const char* filePath)
|
||||
{
|
||||
const int MODE_COUNT = 11;
|
||||
char fileProperty[MODE_COUNT] = "----------";
|
||||
char fileMode[MODE_COUNT] = "-rwxrwxrwx";
|
||||
struct stat buf;
|
||||
stat(filePath, &buf);//get state of the file
|
||||
unsigned int off = 256;
|
||||
const int LOOP_VARY = 10;
|
||||
for (int i = 1; i < LOOP_VARY; i++) {
|
||||
if (buf.st_mode & (off >> (i - 1))) {
|
||||
fileProperty[i] = fileMode[i];
|
||||
}
|
||||
}
|
||||
return fileProperty;
|
||||
}
|
||||
|
||||
//check the Property
|
||||
static int IsFilePropertyR1(const char* filePath)
|
||||
{
|
||||
std::string fileOrg = "-r--r--r--";
|
||||
std::string fileProperty = GetFileMode(filePath);
|
||||
return strcmp(fileProperty.c_str(), fileOrg.c_str());
|
||||
}
|
||||
|
||||
void ItProcessPlimits008(void)
|
||||
{
|
||||
//define process function ID
|
||||
std::string filePath = "/proc/plimits/";
|
||||
std::vector<std::string> fileName;
|
||||
fileName.push_back("plimits.procs");
|
||||
fileName.push_back("plimits.limiters");
|
||||
fileName.push_back("pids.max");
|
||||
fileName.push_back("sched.period");
|
||||
fileName.push_back("sched.quota");
|
||||
fileName.push_back("sched.stat");
|
||||
fileName.push_back("memory.failcnt");
|
||||
fileName.push_back("memory.limit");
|
||||
fileName.push_back("memory.peak");
|
||||
fileName.push_back("memory.usage");
|
||||
fileName.push_back("memory.stat");
|
||||
|
||||
for (auto iter = fileName.begin(); iter != fileName.end(); ++iter) {
|
||||
std::string fileFullPath = filePath + *iter;
|
||||
int ret = IsFilePropertyR1(fileFullPath.c_str());
|
||||
ASSERT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*It is used primarily to verify access to specific files in
|
||||
the /proc/plimit/directory, ensuring that these files are read-only
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <cstring>
|
||||
#include <gtest/gtest.h>
|
||||
#include "It_process_plimits.h"
|
||||
|
||||
void ItProcessPlimitsIpc002(void)
|
||||
{
|
||||
mode_t mode;
|
||||
int ret;
|
||||
int fd;
|
||||
std::string plimitsRootPath = "/proc/plimits/";
|
||||
std::vector<std::string> ipcConfFileName;
|
||||
ipcConfFileName.push_back("ipc.mq_limit");
|
||||
ipcConfFileName.push_back("ipc.shm_limit");
|
||||
ipcConfFileName.push_back("ipc.stat");
|
||||
|
||||
for (auto iter = ipcConfFileName.begin(); iter != ipcConfFileName.end(); ++iter) {
|
||||
std::string fullPath = plimitsRootPath + *iter;
|
||||
fd = access(fullPath.c_str(), W_OK | X_OK);
|
||||
ASSERT_EQ(fd, -1);
|
||||
fd = access(fullPath.c_str(), F_OK | R_OK);
|
||||
ASSERT_EQ(fd, 0);
|
||||
}
|
||||
return;
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <cstring>
|
||||
#include <gtest/gtest.h>
|
||||
#include "It_process_plimits.h"
|
||||
|
||||
void ItProcessPlimitsIpc003(void)
|
||||
{
|
||||
mode_t mode;
|
||||
int ret;
|
||||
std::string plimitsPath = "/proc/plimits/test";
|
||||
std::string configFileMqCount = "/proc/plimits/test/ipc.mq_limit";
|
||||
std::string configFileShmSize = "/proc/plimits/test/ipc.shm_limit";
|
||||
std::string configFileStat = "/proc/plimits/test/ipc.stat";
|
||||
|
||||
ret = mkdir(plimitsPath.c_str(), S_IFDIR | mode);
|
||||
ASSERT_EQ(ret, 0);
|
||||
|
||||
int fd = access(configFileMqCount.c_str(), F_OK | W_OK | R_OK);
|
||||
ASSERT_EQ(fd, 0);
|
||||
|
||||
fd = access(configFileShmSize.c_str(), F_OK | W_OK | R_OK);
|
||||
ASSERT_EQ(fd, 0);
|
||||
|
||||
fd = access(configFileStat.c_str(), F_OK | R_OK);
|
||||
ASSERT_EQ(fd, 0);
|
||||
|
||||
fd = access(configFileStat.c_str(), W_OK | X_OK);
|
||||
ASSERT_EQ(fd, -1);
|
||||
|
||||
ret = rmdir(plimitsPath.c_str());
|
||||
ASSERT_EQ(ret, 0);
|
||||
return;
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <cstring>
|
||||
#include <gtest/gtest.h>
|
||||
#include "It_process_plimits.h"
|
||||
|
||||
void ItProcessPlimitsIpc004(void)
|
||||
{
|
||||
mode_t mode;
|
||||
mode_t chmodMode = 0777;
|
||||
int ret;
|
||||
int fd;
|
||||
std::string rootplimitsPath = "/proc/plimits";
|
||||
std::string subPlimitsPath = "/proc/plimits/test";
|
||||
|
||||
std::vector<std::string> ipcConfFileName;
|
||||
ipcConfFileName.push_back("ipc.mq_limit");
|
||||
ipcConfFileName.push_back("ipc.shm_limit");
|
||||
ipcConfFileName.push_back("ipc.stat");
|
||||
|
||||
ret = mkdir(subPlimitsPath.c_str(), S_IFDIR | mode);
|
||||
ASSERT_EQ(ret, 0);
|
||||
|
||||
for (auto iter = ipcConfFileName.begin(); iter != ipcConfFileName.end(); ++iter) {
|
||||
std::string fullPath = rootplimitsPath + "/" + *iter;
|
||||
ret = chmod(fullPath.c_str(), mode);
|
||||
ASSERT_EQ(ret, -1);
|
||||
}
|
||||
|
||||
for (auto iter = ipcConfFileName.begin(); iter != ipcConfFileName.end(); ++iter) {
|
||||
std::string fullPath = subPlimitsPath + "/" + *iter;
|
||||
ret = chmod(fullPath.c_str(), mode);
|
||||
ASSERT_EQ(ret, -1);
|
||||
}
|
||||
|
||||
ret = rmdir(subPlimitsPath.c_str());
|
||||
ASSERT_EQ(ret, 0);
|
||||
return;
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <cstring>
|
||||
#include <mqueue.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "It_process_plimits.h"
|
||||
|
||||
static const int g_buffSize = 512;
|
||||
static const int g_arryLen = 4;
|
||||
static const int MQ_MAX_PER_PROCESS_COUNT = 255;
|
||||
static const int MQUEUE_STANDARD_NAME_LENGTH = 50;
|
||||
|
||||
void ItProcessPlimitsIpc005(void)
|
||||
{
|
||||
INT32 ret;
|
||||
mode_t mode;
|
||||
char buf[g_buffSize] = { 0 };
|
||||
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = "";
|
||||
mqd_t mqueue[MQ_MAX_PER_PROCESS_COUNT];
|
||||
struct mq_attr attr = { 0 };
|
||||
int index = 0;
|
||||
attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH;
|
||||
attr.mq_maxmsg = 1;
|
||||
|
||||
std::string plimitsPath = "/proc/plimits/test";
|
||||
|
||||
ret = mkdir(plimitsPath.c_str(), S_IFDIR | mode);
|
||||
ASSERT_EQ(ret, 0);
|
||||
|
||||
ret = ReadFile("/proc/plimits/test/ipc.mq_limit", buf);
|
||||
ASSERT_STREQ(buf, "1024\n");
|
||||
|
||||
for (index = 0; index < MQ_MAX_PER_PROCESS_COUNT; ++index) {
|
||||
ret = snprintf_s(mqname, sizeof(mqname), MQUEUE_STANDARD_NAME_LENGTH, "/mq_005_%d_%d",
|
||||
index, LosCurTaskIDGet());
|
||||
ASSERT_NE(ret, -1);
|
||||
mqueue[index] = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr);
|
||||
ASSERT_NE(mqueue[index], (mqd_t)-1);
|
||||
}
|
||||
for (int k = 0; k < MQ_MAX_PER_PROCESS_COUNT; ++k) {
|
||||
ret = mq_close(mqueue[k]);
|
||||
ASSERT_NE(ret, -1);
|
||||
ret = snprintf_s(mqname, sizeof(mqname), MQUEUE_STANDARD_NAME_LENGTH, "/mq_005_%d_%d", k, LosCurTaskIDGet());
|
||||
ASSERT_NE(ret, -1);
|
||||
ret = mq_unlink(mqname);
|
||||
ASSERT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
ret = rmdir(plimitsPath.c_str());
|
||||
ASSERT_EQ(ret, 0);
|
||||
return;
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <cstring>
|
||||
#include <mqueue.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "It_process_plimits.h"
|
||||
|
||||
static const int MQUEUE_STANDARD_NAME_LENGTH = 50;
|
||||
static const int g_buffSize = 512;
|
||||
static const int g_arryLen = 4;
|
||||
static const int g_readLen = 254;
|
||||
static const int MQ_MAX_LIMIT_COUNT = 10;
|
||||
|
||||
static int FreeResource(mqd_t *mqueue, int index, char *mqname)
|
||||
{
|
||||
int ret = -1;
|
||||
for (int k = 0; k < index; ++k) {
|
||||
if (snprintf_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, MQUEUE_STANDARD_NAME_LENGTH, "/mq_006_%d_%d",
|
||||
k, LosCurTaskIDGet()) < 0) {
|
||||
return -1;
|
||||
}
|
||||
ret = mq_close(mqueue[k]);
|
||||
if (ret != 0) {
|
||||
return -2; /* 2: errno */
|
||||
}
|
||||
ret = mq_unlink(mqname);
|
||||
if (ret != 0) {
|
||||
return -3; /* 3: errno */
|
||||
}
|
||||
(void)memset_s(mqname, MQUEUE_STANDARD_NAME_LENGTH, 0, MQUEUE_STANDARD_NAME_LENGTH);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// plimits_ipc_07, plimits_ipc_14, plimits_ipc_17
|
||||
void ItProcessPlimitsIpc006(void)
|
||||
{
|
||||
INT32 ret;
|
||||
mode_t mode;
|
||||
char buf[g_buffSize] = { 0 };
|
||||
char *array[g_arryLen] = { nullptr };
|
||||
int mqSuccessCount = -1, mqFailedCount = -1;
|
||||
CHAR mqname[MQUEUE_STANDARD_NAME_LENGTH] = "";
|
||||
mqd_t mqueue[g_readLen];
|
||||
std::string subPlimitsPath = "/proc/plimits/test";
|
||||
std::string configFileMqCount = "/proc/plimits/test/ipc.mq_limit";
|
||||
std::string limitMqCount = "10";
|
||||
struct mq_attr attr = { 0 };
|
||||
attr.mq_msgsize = MQUEUE_STANDARD_NAME_LENGTH;
|
||||
attr.mq_maxmsg = 1;
|
||||
int index = 0;
|
||||
|
||||
ret = mkdir(subPlimitsPath.c_str(), S_IFDIR | mode);
|
||||
ASSERT_EQ(ret, 0);
|
||||
|
||||
ret = WriteFile(configFileMqCount.c_str(), limitMqCount.c_str());
|
||||
ASSERT_NE(ret, -1);
|
||||
|
||||
for (index = 0; index < MQ_MAX_LIMIT_COUNT; ++index) {
|
||||
ret = snprintf_s(mqname, sizeof(mqname), MQUEUE_STANDARD_NAME_LENGTH, "/mq_006_%d_%d",
|
||||
index, LosCurTaskIDGet());
|
||||
ASSERT_NE(ret, -1);
|
||||
mqueue[index] = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr);
|
||||
ASSERT_NE(mqueue[index], (mqd_t)-1);
|
||||
(void)memset_s(mqname, sizeof(mqname), 0, sizeof(mqname));
|
||||
}
|
||||
ret = snprintf_s(mqname, sizeof(mqname), MQUEUE_STANDARD_NAME_LENGTH, "/mq_006_%d_%d", index, LosCurTaskIDGet());
|
||||
ASSERT_NE(ret, -1);
|
||||
mqueue[index] = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr);
|
||||
ASSERT_EQ(mqueue[index], (mqd_t)-1);
|
||||
(void)memset_s(mqname, sizeof(mqname), 0, sizeof(mqname));
|
||||
|
||||
ret = ReadFile("/proc/plimits/test/ipc.stat", buf);
|
||||
printf("/proc/plimits/test/ipc.stat: %s\n", buf);
|
||||
GetLine(buf, g_arryLen, g_readLen, array);
|
||||
mqSuccessCount = atoi(array[0] + strlen("mq count: "));
|
||||
mqFailedCount = atoi((array[1] + strlen("mq failed count: ")));
|
||||
ASSERT_EQ(mqSuccessCount, MQ_MAX_LIMIT_COUNT);
|
||||
ASSERT_EQ(mqFailedCount, 1);
|
||||
ret = FreeResource(mqueue, index, mqname);
|
||||
ASSERT_EQ(ret, 0);
|
||||
|
||||
ret = rmdir(subPlimitsPath.c_str());
|
||||
ASSERT_EQ(ret, 0);
|
||||
return;
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <cstring>
|
||||
#include <gtest/gtest.h>
|
||||
#include "It_process_plimits.h"
|
||||
|
||||
void ItProcessPlimitsIpc007(void)
|
||||
{
|
||||
mode_t mode;
|
||||
int ret;
|
||||
std::string plimitsPath = "/proc/plimits/test";
|
||||
std::string configFileMqCount = "/proc/plimits/test/ipc.mq_limit";
|
||||
std::string mqLimitCount = "0123";
|
||||
|
||||
ret = mkdir(plimitsPath.c_str(), S_IFDIR | mode);
|
||||
ASSERT_EQ(ret, 0);
|
||||
|
||||
ret = WriteFile(configFileMqCount.c_str(), mqLimitCount.c_str());
|
||||
ASSERT_NE(ret, -1);
|
||||
|
||||
ret = rmdir(plimitsPath.c_str());
|
||||
ASSERT_EQ(ret, 0);
|
||||
return;
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 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 <climits>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#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
|
||||
*/
|
||||
HWTEST_F(SecurityCapabilityTest, ItTestCap001, TestSize.Level0)
|
||||
{
|
||||
ItTestCap001();
|
||||
}
|
||||
#endif
|
||||
} // namespace OHOS
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue