[LTP] [PATCH V8 1/2] syscalls/utimensat: Migrate to new test framework

Cyril Hrubis chrubis@suse.cz
Thu Aug 6 14:56:03 CEST 2020


Hi!
> +static void reset_time(char *pathname, int dfd, int flags)
> +{
> +	struct timespec ts[2];
> +	struct stat sb;
>  
> -		ts[1].tv_sec = atoi(argv[optind + 3]);
> -		if (argv[optind + 4][0] == 'n') {
> -			ts[1].tv_nsec = UTIME_NOW;
> -		} else if (argv[optind + 4][0] == 'o') {
> -			ts[1].tv_nsec = UTIME_OMIT;
> -		} else {
> -			ts[1].tv_nsec = atoi(argv[optind + 4]);
> -		}
> +	ts[0].tv_sec = 0;
> +	ts[0].tv_nsec = 0;
> +	ts[1].tv_sec = 0;
> +	ts[1].tv_nsec = 0;
>  
> -		tsp = ts;
> +	TEST(sys_utimensat(dfd, pathname, ts, flags));
> +	TEST(stat(pathname, &sb));

Wrapping the calls to TEST() macro here is useless.

Also we do pass libc timespec to a syscall that is supposed to take the
old kernel type, right?

I guess that the options are:

* Use the glibc function here instead

* Change the type in the follow up patch

> +	if (sb.st_atime || sb.st_mtime) {
> +		tst_res(TFAIL, "Failed to reset access and modification time (%lu: %lu)",
> +			sb.st_atime, sb.st_mtime);
>  	}
> +}

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list