[CRIU] [PATCH] test: zdtm -- Fix fanotify00 test

Andrew Vagin avagin at parallels.com
Sat Apr 6 14:42:06 EDT 2013


Tested-by: Andrew Vagin <avagin at parallels.com>

On Sat, Apr 06, 2013 at 05:45:30PM +0400, Cyrill Gorcunov wrote:
> @mnt_id do change on remount so exclude it from
> compare.
> 
> Reported-by: Andrew Vagin <avagin at parallels.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  test/zdtm/live/static/fanotify00.c | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/test/zdtm/live/static/fanotify00.c b/test/zdtm/live/static/fanotify00.c
> index 376287f..42c8af5 100644
> --- a/test/zdtm/live/static/fanotify00.c
> +++ b/test/zdtm/live/static/fanotify00.c
> @@ -109,6 +109,30 @@ static void copy_fhandle(char *tok, struct fanotify_mark_inode *inode)
>  	inode->fhandle[off] = '\0';
>  }
>  
> +static int cmp_fanotify_obj(struct fanotify_obj *old, struct fanotify_obj *new)
> +{
> +	if ((old->glob.faflags != new->glob.faflags)			||
> +	    (old->glob.evflags != new->glob.evflags)			||
> +	    (old->inode.i_ino != new->inode.i_ino)			||
> +	    (old->inode.s_dev != new->inode.s_dev)			||
> +	    (old->inode.mflags != new->inode.mflags)			||
> +	    (old->inode.mask != new->inode.mask)			||
> +	    (old->inode.ignored_mask != new->inode.ignored_mask))
> +		return -1;
> +
> +	if (memcmp(old->inode.fhandle, new->inode.fhandle,
> +		   sizeof(new->inode.fhandle)))
> +		return -2;
> +
> +	/* mnt_id may change, exclude it */
> +	if ((old->mount.mflags != new->mount.mflags)			||
> +	    (old->mount.mask != new->mount.mask)			||
> +	    (old->mount.ignored_mask != new->mount.ignored_mask))
> +		return -3;
> +
> +	return 0;
> +}
> +
>  int parse_fanotify_fdinfo(int fd, struct fanotify_obj *obj, unsigned int expected_to_meet)
>  {
>  	unsigned int met = 0;
> @@ -246,7 +270,7 @@ int main (int argc, char *argv[])
>  
>  	show_fanotify_obj(&new);
>  
> -	if (memcmp(&old, &new, sizeof(old))) {
> +	if (cmp_fanotify_obj(&old, &new)) {
>  		fail("fanotify mismatch on fdinfo level\n");
>  		exit(1);
>  	}
> -- 
> 1.8.1.4
> 


More information about the CRIU mailing list