提交 50129dcc 编写于 作者: M Michal Privoznik

vircgroupmock: Mock access("/sys/devices/system/cpu/present")

There's been a report on the upstream list [1] describing we
access /sys/devices/system/cpu/present directly on the host from
within our test suite. This may end up in unpredictable results
as no all linux systems are required to have that file. Mock
access to the file.

libvirt.git/tests $ ../run strace vircgrouptest
...
access("/sys/devices/system/cpu/present", F_OK) = 0
...
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 c92547c3
...@@ -541,7 +541,8 @@ int access(const char *path, int mode) ...@@ -541,7 +541,8 @@ int access(const char *path, int mode)
ret = realaccess(newpath, mode); ret = realaccess(newpath, mode);
free(newpath); free(newpath);
} else if (STREQ(path, "/proc/cgroups") || } else if (STREQ(path, "/proc/cgroups") ||
STREQ(path, "/proc/self/cgroup")) { STREQ(path, "/proc/self/cgroup") ||
STREQ(path, SYSFS_CPU_PRESENT)) {
/* These files are readable for all. */ /* These files are readable for all. */
ret = (mode == F_OK || mode == R_OK) ? 0 : -1; ret = (mode == F_OK || mode == R_OK) ? 0 : -1;
} else if (STREQ(path, "/proc/mounts")) { } else if (STREQ(path, "/proc/mounts")) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册