mirror of
https://github.com/systemd/systemd.git
synced 2025-03-09 12:58:26 +03:00
test: do not fail if mknod() fails in a build system
mknod fails in a Salsa container when building Debian packages, skip the check Follow-up for 6a57d86bf9d7f8d6f5d339f57665dfb2e1d191c5
This commit is contained in:
parent
cb091faeca
commit
7d967aacce
@ -136,7 +136,11 @@ TEST (test_dirent_is_file_with_suffix) {
|
||||
assert_se(touch(name) >= 0);
|
||||
assert_se(touch(dotfile) >= 0);
|
||||
assert_se(touch(dotdot) >= 0);
|
||||
assert_se(mknod(chr, 0775 | S_IFCHR, makedev(0, 0)) >= 0);
|
||||
/* This can fail in containers/build systems */
|
||||
if (mknod(chr, 0775 | S_IFCHR, makedev(0, 0)) < 0) {
|
||||
assert(ERRNO_IS_PRIVILEGE(errno));
|
||||
chr = NULL;
|
||||
}
|
||||
|
||||
if (symlink(name, name_alias) < 0) {
|
||||
assert_se(IN_SET(errno, EINVAL, ENOSYS, ENOTTY, EPERM));
|
||||
@ -169,13 +173,16 @@ TEST (test_dirent_is_file_with_suffix) {
|
||||
if (strcmp(de_dotdot->d_name, "..dotdot") == 0)
|
||||
break;
|
||||
|
||||
rewinddir(dir);
|
||||
while ((de_chr = readdir(dir)) != NULL)
|
||||
if (strcmp(de_chr->d_name, "test_chr") == 0)
|
||||
break;
|
||||
if (chr) {
|
||||
rewinddir(dir);
|
||||
while ((de_chr = readdir(dir)) != NULL)
|
||||
if (strcmp(de_chr->d_name, "test_chr") == 0)
|
||||
break;
|
||||
|
||||
/* Test when d_type is not DT_REG, DT_LNK, or DT_UNKNOWN */
|
||||
assert_se(!dirent_is_file_with_suffix(de_chr, NULL));
|
||||
/* Test when d_type is not DT_REG, DT_LNK, or DT_UNKNOWN */
|
||||
assert(de_chr);
|
||||
assert_se(!dirent_is_file_with_suffix(de_chr, NULL));
|
||||
}
|
||||
|
||||
/* Test when suffix is NULL */
|
||||
assert_se(dirent_is_file_with_suffix(de_reg, NULL) == true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user