mirror of
https://github.com/systemd/systemd.git
synced 2025-02-27 01:57:35 +03:00
test: use IN_SET()/ERRNO_IS_NEG_*() more
This commit is contained in:
parent
c83f4220a1
commit
6f8b3838c9
@ -328,23 +328,23 @@ TEST(mount_option_supported) {
|
||||
|
||||
r = mount_option_supported("tmpfs", "size", "64M");
|
||||
log_info("tmpfs supports size=64M: %s (%i)", r < 0 ? "don't know" : yes_no(r), r);
|
||||
assert_se(r > 0 || r == -EAGAIN || (r < 0 && ERRNO_IS_PRIVILEGE(r)));
|
||||
assert_se(r > 0 || r == -EAGAIN || ERRNO_IS_NEG_PRIVILEGE(r));
|
||||
|
||||
r = mount_option_supported("ext4", "discard", NULL);
|
||||
log_info("ext4 supports discard: %s (%i)", r < 0 ? "don't know" : yes_no(r), r);
|
||||
assert_se(r > 0 || r == -EAGAIN || (r < 0 && ERRNO_IS_PRIVILEGE(r)));
|
||||
assert_se(r > 0 || r == -EAGAIN || ERRNO_IS_NEG_PRIVILEGE(r));
|
||||
|
||||
r = mount_option_supported("tmpfs", "idontexist", "64M");
|
||||
log_info("tmpfs supports idontexist: %s (%i)", r < 0 ? "don't know" : yes_no(r), r);
|
||||
assert_se(r == 0 || r == -EAGAIN || (r < 0 && ERRNO_IS_PRIVILEGE(r)));
|
||||
assert_se(IN_SET(r, 0, -EAGAIN) || ERRNO_IS_NEG_PRIVILEGE(r));
|
||||
|
||||
r = mount_option_supported("tmpfs", "ialsodontexist", NULL);
|
||||
log_info("tmpfs supports ialsodontexist: %s (%i)", r < 0 ? "don't know" : yes_no(r), r);
|
||||
assert_se(r == 0 || r == -EAGAIN || (r < 0 && ERRNO_IS_PRIVILEGE(r)));
|
||||
assert_se(IN_SET(r, 0, -EAGAIN) || ERRNO_IS_NEG_PRIVILEGE(r));
|
||||
|
||||
r = mount_option_supported("proc", "hidepid", "1");
|
||||
log_info("proc supports hidepid=1: %s (%i)", r < 0 ? "don't know" : yes_no(r), r);
|
||||
assert_se(r >= 0 || r == -EAGAIN || (r < 0 && ERRNO_IS_PRIVILEGE(r)));
|
||||
assert_se(r >= 0 || r == -EAGAIN || ERRNO_IS_NEG_PRIVILEGE(r));
|
||||
}
|
||||
|
||||
TEST(fstype_can_discard) {
|
||||
|
@ -45,7 +45,7 @@ TEST(getxattr_at_malloc) {
|
||||
fd = open("/", O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_NOCTTY);
|
||||
assert_se(fd >= 0);
|
||||
r = getxattr_at_malloc(fd, "usr", "user.idontexist", 0, &value);
|
||||
assert_se(r < 0 && ERRNO_IS_XATTR_ABSENT(r));
|
||||
assert_se(ERRNO_IS_NEG_XATTR_ABSENT(r));
|
||||
|
||||
safe_close(fd);
|
||||
fd = open(x, O_PATH|O_CLOEXEC);
|
||||
@ -99,7 +99,7 @@ TEST(xsetxattr) {
|
||||
|
||||
/* by full path */
|
||||
r = xsetxattr(AT_FDCWD, x, "user.foo", "fullpath", SIZE_MAX, 0);
|
||||
if (r < 0 && ERRNO_IS_NOT_SUPPORTED(r))
|
||||
if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
|
||||
return (void) log_tests_skipped_errno(r, "no xattrs supported on /var/tmp");
|
||||
assert_se(r >= 0);
|
||||
verify_xattr(dfd, "fullpath");
|
||||
|
Loading…
x
Reference in New Issue
Block a user