diff --git a/ohos.build b/ohos.build index fb8100a24d44db60bc0dadaf7fd98dda65cc529a..72dada8b7e8396e1d767195a2ac44e57bcfc74d7 100755 --- a/ohos.build +++ b/ohos.build @@ -32,6 +32,8 @@ } ], "test_list": [ + "//base/security/dataclassification/test/unittest/fbe_iudf_xattr:fbe_iudf_xattr_test", + "//base/security/dataclassification/test/unittest/hwdevsl:hwdevsl_test" ] } } diff --git a/test/unittest/fbe_iudf_xattr/BUILD.gn b/test/unittest/fbe_iudf_xattr/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..4c9fe2f289d877ca4f0f0c135e152437efe51305 --- /dev/null +++ b/test/unittest/fbe_iudf_xattr/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/test.gni") +module_output_path = "dataclassification/fbe_iudf_xattr" + +config("fbe_iudf_xattr_test_config") { + visibility = [ ":*" ] + include_dirs = [ + "//base/security/dataclassification/test/unittest/fbe_iudf_xattr", + "//base/security/dataclassification/interfaces/innerkits/fbe_iudf_xattr/include", + "//third_party/googletest/googletest/include", + ] + cflags = [ "-DHILOG_ENABLE" ] +} + +ohos_unittest("IudfXattrTest") { + part_name = "dataclassification" + subsystem_name = "security" + module_out_path = module_output_path + + sources = [ "fbe_iudf_xattr_test.cpp" ] + + configs = [ ":fbe_iudf_xattr_test_config" ] + + deps = [ "//base/security/dataclassification/interfaces/innerkits/fbe_iudf_xattr:fbe_iudf_xattr" ] + + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] +} + +group("fbe_iudf_xattr_test") { + testonly = true + deps = [ ":IudfXattrTest" ] +} diff --git a/test/unittest/fbe_iudf_xattr/fbe_iudf_xattr_test.cpp b/test/unittest/fbe_iudf_xattr/fbe_iudf_xattr_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b878b9f3e3f6049e18b1d013cc5360f912ec0c2f --- /dev/null +++ b/test/unittest/fbe_iudf_xattr/fbe_iudf_xattr_test.cpp @@ -0,0 +1,54 @@ + +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" + +#include "fbe_iudf_xattr_test.h" +#include "fbe_sdp_policy.h" + +using namespace testing::ext; + +class IudfXattrTest : public testing::Test { +protected: + IudfXattrTest(); + ~IudfXattrTest(); + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; + +private: +}; + +IudfXattrTest::IudfXattrTest() {} +IudfXattrTest::~IudfXattrTest() {} +void IudfXattrTest::SetUpTestCase() {} +void IudfXattrTest::TearDownTestCase() {} +void IudfXattrTest::SetUp() {} +void IudfXattrTest::TearDown() {} + +/** + * @tc.name: TestIsSupportIudf + * @tc.desc: Verify IsSupportIudf function + * @tc.type: FUN + */ +HWTEST_F(IudfXattrTest, TestIsSupportIudf, TestSize.Level0) +{ + bool ret; + + ret = IsSupportIudf(); + EXPECT_EQ(false, ret); +} \ No newline at end of file diff --git a/test/unittest/fbe_iudf_xattr/fbe_iudf_xattr_test.h b/test/unittest/fbe_iudf_xattr/fbe_iudf_xattr_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c07f158014071a7b16c21b4f234311f8497e5923 --- /dev/null +++ b/test/unittest/fbe_iudf_xattr/fbe_iudf_xattr_test.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FBE_IUDF_XATTR_TEST_H +#define FBE_IUDF_XATTR_TEST_H + +int TestIsSupportIudf(void); + +#endif \ No newline at end of file diff --git a/test/unittest/hwdevsl/BUILD.gn b/test/unittest/hwdevsl/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..821e7c54c9fe28ec02c3ca8eba4d33375e810e52 --- /dev/null +++ b/test/unittest/hwdevsl/BUILD.gn @@ -0,0 +1,49 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/test.gni") +module_output_path = "dataclassification/hwdevsl" + +config("hwdevsl_private_config") { + visibility = [ ":*" ] + include_dirs = [ + "//base/security/dataclassification/test/unittest/hwdevsl", + "//base/security/dataclassification/interfaces/innerkits/hwdevsl/include/1.0", + "//third_party/googletest/googletest/include", + "utils/native/base/include", + ] + + cflags = [ "-DHILOG_ENABLE" ] +} + +ohos_unittest("HwDslTest") { + part_name = "dataclassification" + subsystem_name = "security" + module_out_path = module_output_path + + sources = [ "hwdevsl_test.cpp" ] + + configs = [ ":hwdevsl_private_config" ] + + deps = [ + "//base/security/dataclassification/interfaces/innerkits/hwdevsl:hwdsl", + "//utils/native/base:utils", + ] + + external_deps = [ "hiviewdfx_hilog_native:libhilog" ] +} + +group("hwdevsl_test") { + testonly = true + deps = [ ":HwDslTest" ] +} diff --git a/test/unittest/hwdevsl/hwdevsl_test.cpp b/test/unittest/hwdevsl/hwdevsl_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dee67e26d42687024b77336d6f6e6735c6ba8c5c --- /dev/null +++ b/test/unittest/hwdevsl/hwdevsl_test.cpp @@ -0,0 +1,55 @@ + +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" + +#include "hwdevsl_test.h" +#include "dev_slinfo_mgr.h" + +using namespace testing::ext; + +class DeviceSecurityLevelTest : public testing::Test { +protected: + DeviceSecurityLevelTest(); + ~DeviceSecurityLevelTest(); + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; + +private: +}; + +DeviceSecurityLevelTest::DeviceSecurityLevelTest() {} +DeviceSecurityLevelTest::~DeviceSecurityLevelTest() {} +void DeviceSecurityLevelTest::SetUpTestCase() {} +void DeviceSecurityLevelTest::TearDownTestCase() {} +void DeviceSecurityLevelTest::SetUp() {} +void DeviceSecurityLevelTest::TearDown() {} + +/** + * @tc.name: TestOnStart + * @tc.desc: Verify DEVSL_OnStart function + * @tc.type: FUN + */ +HWTEST_F(DeviceSecurityLevelTest, TestOnStart, TestSize.Level0) +{ + int32_t ret; + + ret = DEVSL_OnStart(1); + EXPECT_EQ(DEVSL_SUCCESS, ret); + DEVSL_ToFinish(); +} \ No newline at end of file diff --git a/test/unittest/hwdevsl/hwdevsl_test.h b/test/unittest/hwdevsl/hwdevsl_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d4ec4baaede73d701eba60d1255c016465739d80 --- /dev/null +++ b/test/unittest/hwdevsl/hwdevsl_test.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef Device_SEC_LEVEL_TEST_H +#define Device_SEC_LEVEL_TEST_H + +int TestOnStart(void); + +#endif \ No newline at end of file