From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
Shuah Khan <shuah@kernel.org>,
Linux API <linux-api@vger.kernel.org>,
Linux FS Devel <linux-fsdevel@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-man@vger.kernel.org,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH 3/3] selftests: add readfile(2) selftests
Date: Sat, 4 Jul 2020 20:38:26 +0200 [thread overview]
Message-ID: <CAMuHMdXck1u+Djv1xOvRA7riMN4m3qp8o4zmXVvqrC1S+0fifA@mail.gmail.com> (raw)
In-Reply-To: <20200704140250.423345-4-gregkh@linuxfoundation.org>
Hi Greg,
On Sat, Jul 4, 2020 at 4:05 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> Test the functionality of readfile(2) in various ways.
>
> Also provide a simple speed test program to benchmark using readfile()
> instead of using open()/read()/close().
>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Any benchmark results to share?
> --- /dev/null
> +++ b/tools/testing/selftests/readfile/readfile.c
> +static void readfile(const char *filename)
> +{
> +// int root_fd;
???
> + unsigned char buffer[16000];
> + int retval;
> +
> + memset(buffer, 0x00, sizeof(buffer));
> +
> +// root_fd = open("/", O_DIRECTORY);
> +// if (root_fd == -1)
> +// ksft_exit_fail_msg("error with root_fd\n");
???
> +
> + retval = sys_readfile(root_fd, filename, &buffer[0], sizeof(buffer), 0);
> +
> +// close(root_fd);
> +
> + if (retval <= 0)
> + ksft_test_result_fail("readfile() test of filename=%s failed with retval %d\n",
> + filename, retval);
> + else
> + ksft_test_result_pass("readfile() test of filename=%s succeeded with retval=%d\n",
> + filename, retval);
> +// buffer='%s'\n",
> +// filename, retval, &buffer[0]);
> +
> +}
> +
> +
> +int main(int argc, char *argv[])
> +{
> + ksft_print_header();
> + ksft_set_plan(10);
> +
> + test_readfile_supported(); // 1 test
> +
> + test_sysfs_files(); // 1 test
> +
> + test_filesizes(); // 6 tests
> +
> + setup_tmpdir();
> +
> + readfile(TEST_FILE1);
> + readfile(TEST_FILE2);
> +// readfile(TEST_FILE4);
???
> +
> + teardown_tmpdir();
> +
> + if (ksft_get_fail_cnt())
> + return ksft_exit_fail();
> +
> + return ksft_exit_pass();
> +}
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2020-07-04 18:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-04 14:02 [PATCH 0/3] readfile(2): a new syscall to make open/read/close faster Greg Kroah-Hartman
2020-07-04 14:02 ` [PATCH 1/3] readfile: implement readfile syscall Greg Kroah-Hartman
2020-07-04 18:35 ` Geert Uytterhoeven
2020-07-04 19:14 ` Matthew Wilcox
2020-07-04 19:41 ` Miklos Szeredi
2020-07-04 20:12 ` Al Viro
2020-07-04 20:16 ` Al Viro
2020-07-04 14:02 ` [PATCH 2/3] arch: wire up the " Greg Kroah-Hartman
2020-07-04 18:36 ` Geert Uytterhoeven
2020-07-04 14:02 ` [PATCH 3/3] selftests: add readfile(2) selftests Greg Kroah-Hartman
2020-07-04 18:38 ` Geert Uytterhoeven [this message]
2020-07-05 6:55 ` Greg Kroah-Hartman
2020-07-05 11:24 ` Geert Uytterhoeven
2020-07-05 11:36 ` Greg Kroah-Hartman
2020-07-05 1:41 ` Heinrich Schuchardt
2020-07-05 7:34 ` Greg Kroah-Hartman
2020-07-05 9:46 ` Heinrich Schuchardt
2020-07-04 14:02 ` [PATCH] readfile.2: new page describing readfile(2) Greg Kroah-Hartman
2020-07-05 2:54 ` Heinrich Schuchardt
2020-07-04 19:30 ` [PATCH 0/3] readfile(2): a new syscall to make open/read/close faster Al Viro
2020-07-05 11:47 ` Greg Kroah-Hartman
2020-07-06 17:25 ` Dave Martin
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=CAMuHMdXck1u+Djv1xOvRA7riMN4m3qp8o4zmXVvqrC1S+0fifA@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=shuah@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).