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 v2] syscalls: add syscall syncfs test
Date: Fri, 15 Feb 2019 14:03:51 +0100	[thread overview]
Message-ID: <20190215130350.GA26339@rei> (raw)
In-Reply-To: <CAOQ4uxj-=5J2809-11_X4-zXPWOyrmLyFZd+acz692mB9YM3gw@mail.gmail.com>

Hi!
> > +
> > +       fd =  SAFE_OPEN(TST_FILE, O_RDWR|O_CREAT, MODE);
> > +
> > +       /* Filling the test file */
> > +       for (counter = 0; counter < TST_FILE_SIZE_MB; counter++)
> > +               SAFE_WRITE(1, fd, buffer, SIZE_MB);
> > +
> > +       TEST(syncfs(fd));
> > +       if (TST_RET != 0)
> > +               tst_brk(TFAIL | TTERRNO, "syncfs(fd) failed");
> > +
> > +       SAFE_FILE_SCANF(dev_stat_path, "%*s %*s %*s %*s %*s %*s %s",
> > +                       nwrite_sec_val);
> > +
> > +       write_sec = SAFE_STRTOUL(nwrite_sec_val, 0, ULONG_MAX);
> > +
> > +       if ((write_sec - prev_write_sec) * 512 >=
> > +           (TST_FILE_SIZE_MB * SIZE_MB))
> > +               tst_res(TPASS, "Test filesystem synced to device");
> > +       else
> > +               tst_res(TFAIL, "Failed to sync test filesystem to device");
> > +
> > +       SAFE_CLOSE(fd);
> > +}
> > +
> 
> It's good to have a tests that verified syncfs() actually does what it
> is meant to do.
> It's awkward that none of the tests for fsync() fdatasync() sync()
> sync_file_range()
> check that.
> 
> It would be very low hanging to have the exact same test that you wrote
> iterate on several test cases where the only difference is the op called on
> fd. (fsync,fdatasync,syncfs) should all have the same consequence wrt
> minimal written sectors.
> With a little more effort, sync() and sync_file_range() could also be
> added to test cases.
> 
> I realize that LTP usually puts syscalls tests under the specific
> kernel/syscalls directory, but in this case, I believe code reuse calls
> for a single test that exercises all three syscalls.

We can always put the common code into a header/library and still have a
test for each of the syscalls as we usually do in LTP.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2019-02-15 13:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15  7:17 [LTP] [PATCH v2] syscalls: add syscall syncfs test Sumit Garg
2019-02-15  7:55 ` Xiao Yang
2019-02-15 11:58   ` Sumit Garg
2019-02-15 12:16     ` Cyril Hrubis
2019-02-15 13:18       ` Sumit Garg
2019-02-15 13:22         ` Cyril Hrubis
2019-02-15 13:25           ` Cyril Hrubis
2019-02-15 13:51             ` Sumit Garg
2019-02-16  0:17           ` Steve Muckle
2019-02-18  7:52             ` Sumit Garg
2019-02-18 12:24               ` Cyril Hrubis
2019-02-18 11:57             ` Cyril Hrubis
2019-02-19 23:15               ` Steve Muckle
2019-02-20 13:14                 ` Cyril Hrubis
2019-02-20 15:12                   ` Cyril Hrubis
2019-02-22 19:58                     ` Steve Muckle
2019-02-19  6:44   ` Sumit Garg
2019-02-21  7:08     ` Sumit Garg
2019-02-15  8:42 ` Amir Goldstein
2019-02-15 13:03   ` Cyril Hrubis [this message]
2019-02-15 13:38   ` Sumit Garg

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=20190215130350.GA26339@rei \
    --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