[LTP] [PATCH v2 02/10] syscalls/ioctl:add common c file for loop ioctl

Cyril Hrubis chrubis@suse.cz
Mon Apr 20 15:01:40 CEST 2020

> +void tst_assert_file_str(const char *file, const int lineno, const char 
> *path, const char *buf, const char *val)
> +{
> +       char sys_val[1024];
> +
> +       SAFE_FILE_LINES_SCANF(path, buf, sys_val);

We should call the file_lines_scanf() here and pass the filename and
lineno that this functions takes as parameter instead.

Also I'm not sure that it's a good idea to pass the fmt to this
function. I guess that it would be better to pass a prefix string such
as "foo=" and to append the "%s" in this function. That way we could
also encode the buffer length to the fmt string as well, in that case we
would append "%1024s".

> +       if (!strcmp(val, sys_val)) {
> +               tst_res_(file, lineno, TPASS, "%s %s field = %s", path, 
> buf, sys_val);
> +               return;
> +       }
> +
> +       tst_res_(file, lineno, TFAIL, "%s %s field != %s got %s", path, 
> buf, val, sys_val);
> +}

Cyril Hrubis

More information about the ltp mailing list