Re: [LTP] [PATCH 2/2 v2] mount/mount03.c: Test feature MS_NOATIME of mount(2)

chrubis
2013-07-09T14:56:16Z

Hi!
> Additional test for features MS_NOATIME.
>
> Signed-off-by: DAN LI <li.dan@cn.fujitsu.com>
> ---
> + case 6:
> + /* Validate MS_NOATIME flag of mount call */
> +
> + snprintf(file, PATH_MAX, "%satime", path_name);
> + fd = open(file, O_CREAT | O_RDWR, S_IRWXU);
> + if (fd == -1) {
> + tst_resm(TWARN | TERRNO, "opening %s failed", file);
> + return 1;
> + }
> +
> + if (write(fd, "TEST_MS_NOATIME", 15) != 15) {
> + tst_resm(TWARN | TERRNO, "write %s failed", file);
> + return 1;
> + }
> +
> + if (fstat(fd, &file_stat) == -1) {
> + tst_resm(TWARN | TERRNO, "stat %s failed #1", file);
> + return 1;
> + }
> +
> + atime = file_stat.st_atime;
> +
> + sleep(1);
> +
> + if (read(fd, NULL, 20) == -1) {
> + tst_resm(TWARN | TERRNO, "read %s failed", file);
> + return 1;
> + }
> +
> + if (fstat(fd, &file_stat) == -1) {
> + tst_resm(TWARN | TERRNO, "stat %s failed #2", file);
> + return 1;
> + }
> + close(fd);
> +
> + if (file_stat.st_atime != atime) {
> + tst_resm(TWARN, "access time is updated");
> + return 1;
> + }
> + return 0;
> }

This version looks fine.

--
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!