diff --git a/test/unittest/seccomp/seccomp_unittest.cpp b/test/unittest/seccomp/seccomp_unittest.cpp index b1e79fd77d0ad6870a5ecd1fd558ab19ab9e305c..33668bbb16c35b00243704d24f0dd2b5f0dbd0f1 100644 --- a/test/unittest/seccomp/seccomp_unittest.cpp +++ b/test/unittest/seccomp/seccomp_unittest.cpp @@ -32,6 +32,8 @@ #include #include "seccomp_policy.h" +#include "parameter.h" +#include "param_utils.h" using SyscallFunc = bool (*)(void); constexpr int SLEEP_TIME_100MS = 100000; // 100ms @@ -1315,6 +1317,28 @@ public: } }; +/** + * @tc.name: IsEnableSeccomp + * @tc.desc: Verify the system seccomp policy. + * @tc.type: FUNC + * @tc.require: issueI5IUWJ + */ +HWTEST_F(SeccompUnitTest, Init_IsEnableSeccomp001, TestSize.Level1) +{ + bool res = true; +#ifdef WITH_SECCOMP_DEBUG + char value[PARAM_BUFFER_SIZE] = { 0 }; + u_int32_t len = sizeof(value); + if (SystemReadParam("persist.init.debug.seccomp.enabel", value, &len) == 0) { + if (strncmp(value, "0", len) == 0) { + res = false; + } + } +#endif + bool isEnable = IsEnableSeccomp(); + EXPECT_EQ(res, isEnable); +} + /** * @tc.name: TestSystemSycall * @tc.desc: Verify the system seccomp policy.