[LTP] [PATCH 2/7] Add lsm_get_self_attr01 test
Andrea Cervesato
andrea.cervesato@suse.com
Tue Jan 7 09:50:54 CET 2025
Hi Petr,
On 12/18/24 19:55, Petr Vorel wrote:
> Also, kselftest test tools/testing/selftests/lsm/lsm_get_self_attr_test.c is
> testing also for ctx being NULL. Then it would make sense to use it.
Now I remember why I skipped this part. The kselftest is checking in
this way (that's how library works apparently):
TEST(ctx_null_lsm_get_self_attr)
{
const long page_size = sysconf(_SC_PAGESIZE);
__u32 size = page_size;
int rc;
rc = lsm_get_self_attr(LSM_ATTR_CURRENT, NULL, &size, 0);
if (attr_lsm_count()) {
ASSERT_NE(-1, rc);
ASSERT_NE(1, size);
} else {
ASSERT_EQ(-1, rc);
}
}
If there are LSM implementations in the system, "lsm_get_self_attr"
won't return any error code but 0.
If there are NOT implementations, the syscall will return -1.
Andrea
More information about the ltp
mailing list