Re: [PATCH] vircgroupmock: Mock access("/sys/devices/system/cpu/present")

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2016-02-25 at 09:08 +0100, Michal Privoznik wrote:
> There's been a report on the upstream list [1] describing we

You forgot the link. Then again, I'm not sure this information
is even useful to have in the commit message.

> 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
> open("libvirt.git/tests/fakerootdir-DmE8Z9/not/really/sys/fs/cgroup//devices_system_cpu_present", O_RDONLY) = 4

This is a really long line that's not strictly relevant to the
issue your commit is fixing, so I think you can just skip it.
The only line we're interested about is the access() call.

> read(4, "8-23,48-159\n", 5121)          = 12
> read(4, "", 5109)                       = 0
> close(4)                                = 0
> ...
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  tests/vircgroupmock.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c
> index 9ce7d41..756ac51 100644
> --- a/tests/vircgroupmock.c
> +++ b/tests/vircgroupmock.c
> @@ -541,7 +541,8 @@ int access(const char *path, int mode)
>          ret = realaccess(newpath, mode);
>          free(newpath);
>      } 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. */
>          ret = (mode == F_OK || mode == R_OK) ? 0 : -1;
>      } else if (STREQ(path, "/proc/mounts")) {

ACK once the commit message has been polished up.

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]