public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V8 1/2] syscalls/utimensat: Migrate to new test framework
Date: Thu, 6 Aug 2020 14:56:03 +0200	[thread overview]
Message-ID: <20200806125603.GC3315@yuki.lan> (raw)
In-Reply-To: <ebc888947b095fd6a359ad749e50217d0b38954e.1596637728.git.viresh.kumar@linaro.org>

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

  parent reply	other threads:[~2020-08-06 12:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-05 14:31 [LTP] [PATCH V8 1/2] syscalls/utimensat: Migrate to new test framework Viresh Kumar
2020-08-05 14:31 ` [LTP] [PATCH V8 2/2] syscalls/utimensat: Add support for time64 tests Viresh Kumar
2020-08-06 12:56 ` Cyril Hrubis [this message]
2020-08-07  4:42   ` [LTP] [PATCH V8 1/2] syscalls/utimensat: Migrate to new test framework Viresh Kumar
2020-08-07  8:45     ` Cyril Hrubis
2020-08-07 11:24       ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200806125603.GC3315@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox