public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/3] syscalls/sendfile: Convert sendfile02 to the new API
Date: Wed, 16 Jun 2021 16:15:27 +0200	[thread overview]
Message-ID: <YMoHf/mwjDXkCdJH@pevik> (raw)
In-Reply-To: <20210603033611.15619-2-xieziyao@huawei.com>

> 1. Convert sendfile02 to the new API with file descriptors instead
> of socket descriptors.
> 2. Remove the support for UCLINUX.
> 3. Remove redundant testcases {4, 22, 26} and {6, 20, 26}.

Thanks, merged with diff below (fix docparse formatting, add OFFSET_DESC()
macro, fix checkpatch.pl warning on comparison order).

Kind regards,
Petr

diff --git testcases/kernel/syscalls/sendfile/sendfile02.c testcases/kernel/syscalls/sendfile/sendfile02.c
index 820063681..ffd654885 100644
--- testcases/kernel/syscalls/sendfile/sendfile02.c
+++ testcases/kernel/syscalls/sendfile/sendfile02.c
@@ -9,7 +9,8 @@
 /*\
  * [Description]
  *
- * Test the basic functionality of the sendfile() system call,
+ * Test the basic functionality of the sendfile() system call:
+ *
  * 1. Call sendfile() with offset = 0.
  * 2. Call sendfile() with offset in the middle of the file.
  */
@@ -23,6 +24,8 @@
 #define IN_FILE "in_file"
 #define OUT_FILE "out_file"
 
+#define OFFSET_DESC(x) .desc = "with offset = "#x, .offset = x
+
 struct test_case_t {
 	char *desc;
 	off_t offset;
@@ -30,8 +33,8 @@ struct test_case_t {
 	int64_t exp_retval;
 	int64_t exp_updated_offset;
 } tc[] = {
-	{ "with offset = 0", 0, 26, 26, 26 },
-	{ "with offset = 2", 2, 24, 24, 26 },
+	{ OFFSET_DESC(0), 26, 26, 26 },
+	{ OFFSET_DESC(2), 24, 24, 26 },
 };
 
 static void setup(void)
@@ -60,7 +63,7 @@ static void run(unsigned int i)
 	TEST(sendfile(out_fd, in_fd, &offset, tc[i].count));
 	after_pos = SAFE_LSEEK(in_fd, 0, SEEK_CUR);
 
-	if (TST_RET != tc[i].exp_retval)
+	if (tc[i].exp_retval != TST_RET)
 		tst_res(TFAIL, "sendfile() failed to return expected value, "
 			       "expected: %" PRId64 ", got: %ld",
 			tc[i].exp_retval, TST_RET);

  reply	other threads:[~2021-06-16 14:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03  3:36 [LTP] [PATCH 0/3] Fix and convert sendfile{02, 06} to the new API Xie Ziyao
2021-06-03  3:36 ` [LTP] [PATCH 1/3] syscalls/sendfile: Convert sendfile02 " Xie Ziyao
2021-06-16 14:15   ` Petr Vorel [this message]
2021-06-03  3:36 ` [LTP] [PATCH 2/3] syscalls/sendfile: Convert sendfile06 " Xie Ziyao
2021-06-17 20:06   ` Petr Vorel
2021-06-18  3:37     ` Xie Ziyao
2021-06-18  8:14       ` Petr Vorel
2021-06-18  8:03     ` Cyril Hrubis
2021-06-21 12:12       ` Petr Vorel
2021-06-03  3:36 ` [LTP] [PATCH 3/3] syscalls/sendfile: Remove unnecessary header files Xie Ziyao
2021-06-17 20:08   ` Petr Vorel

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=YMoHf/mwjDXkCdJH@pevik \
    --to=pvorel@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