public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jason Xing <kerneljasonxing@linux.alibaba.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3] syscalls/cma: fix the failure of compiling with O2 option
Date: Tue, 26 Feb 2019 10:22:40 +0800	[thread overview]
Message-ID: <1551147760-52601-1-git-send-email-kerneljasonxing@linux.alibaba.com> (raw)
In-Reply-To: <1551145346-34128-1-git-send-email-kerneljasonxing@linux.alibaba.com>

This issue is triggered by the commit 9b02cd465f70 which I wrote. If
compile the process_vm_readv03.c with O2 option and run, it will return
TFAIL. By casting the int type to unsigned long type in the ltp_syscall
calling functions can we avoid this failure. Thus I modify all the
testcases which might be affected by the previous commit.

Signed-off-by: Jason Xing <kerneljasonxing@linux.alibaba.com>
---
 testcases/kernel/syscalls/cma/process_vm_readv02.c  | 4 ++--
 testcases/kernel/syscalls/cma/process_vm_readv03.c  | 9 +++++----
 testcases/kernel/syscalls/cma/process_vm_writev02.c | 4 ++--
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/testcases/kernel/syscalls/cma/process_vm_readv02.c b/testcases/kernel/syscalls/cma/process_vm_readv02.c
index e1fc32a..68e1bea 100644
--- a/testcases/kernel/syscalls/cma/process_vm_readv02.c
+++ b/testcases/kernel/syscalls/cma/process_vm_readv02.c
@@ -135,7 +135,7 @@ static void child_invoke(void)
 
 	tst_resm(TINFO, "child 1: reading string from same memory location.");
 	TEST(ltp_syscall(__NR_process_vm_readv, pids[0],
-			 &local, 1, &remote, 1, 0));
+			 &local, 1UL, &remote, 1UL, 0UL));
 	if (TEST_RETURN != len)
 		tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");
 	if (strncmp(lp, tst_string, len) != 0)
@@ -150,7 +150,7 @@ static void setup(void)
 	tst_require_root();
 
 	/* Just a sanity check of the existence of syscall */
-	ltp_syscall(__NR_process_vm_readv, getpid(), NULL, 0, NULL, 0, 0);
+	ltp_syscall(__NR_process_vm_readv, getpid(), NULL, 0UL, NULL, 0UL, 0UL);
 
 	tst_tmpdir();
 	TST_CHECKPOINT_INIT(cleanup);
diff --git a/testcases/kernel/syscalls/cma/process_vm_readv03.c b/testcases/kernel/syscalls/cma/process_vm_readv03.c
index 45f7c92..f09dfb0 100644
--- a/testcases/kernel/syscalls/cma/process_vm_readv03.c
+++ b/testcases/kernel/syscalls/cma/process_vm_readv03.c
@@ -181,7 +181,7 @@ static long *fetch_remote_addrs(void)
 	remote.iov_len = len;
 
 	TEST(ltp_syscall(__NR_process_vm_readv, pids[0], &local,
-			 1, &remote, 1, 0));
+			 1UL, &remote, 1UL, 0UL));
 	if (TEST_RETURN != len)
 		tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");
 
@@ -213,8 +213,9 @@ static void child_invoke(int *bufsz_arr)
 	tst_resm(TINFO, "child 1: %d local iovecs initialized.",
 		 NUM_LOCAL_VECS);
 
-	TEST(ltp_syscall(__NR_process_vm_readv, pids[0], local, NUM_LOCAL_VECS,
-				   remote, nr_iovecs, 0));
+	TEST(ltp_syscall(__NR_process_vm_readv, pids[0], local,
+			    (unsigned long)NUM_LOCAL_VECS, remote,
+			    (unsigned long)nr_iovecs, 0UL));
 	if (TEST_RETURN != bufsz)
 		tst_brkm(TBROK | TERRNO, tst_exit, "process_vm_readv");
 
@@ -248,7 +249,7 @@ static void setup(void)
 	tst_require_root();
 
 	/* Just a sanity check of the existence of syscall */
-	ltp_syscall(__NR_process_vm_readv, getpid(), NULL, 0, NULL, 0, 0);
+	ltp_syscall(__NR_process_vm_readv, getpid(), NULL, 0UL, NULL, 0UL, 0UL);
 
 	nr_iovecs = nflag ? SAFE_STRTOL(NULL, nr_opt, 1, IOV_MAX) : 10;
 	bufsz = sflag ? SAFE_STRTOL(NULL, sz_opt, NUM_LOCAL_VECS, LONG_MAX)
diff --git a/testcases/kernel/syscalls/cma/process_vm_writev02.c b/testcases/kernel/syscalls/cma/process_vm_writev02.c
index b1edba5..2e7a8d6 100644
--- a/testcases/kernel/syscalls/cma/process_vm_writev02.c
+++ b/testcases/kernel/syscalls/cma/process_vm_writev02.c
@@ -172,7 +172,7 @@ static void child_write(void)
 
 	tst_resm(TINFO, "child 2: write to the same memory location.");
 	TEST(ltp_syscall(__NR_process_vm_writev, pids[0], &local,
-			 1, &remote, 1, 0));
+			 1UL, &remote, 1UL, 0UL));
 	if (TEST_RETURN != bufsz)
 		tst_brkm(TFAIL | TERRNO, tst_exit, "process_vm_readv");
 }
@@ -182,7 +182,7 @@ static void setup(void)
 	tst_require_root();
 
 	/* Just a sanity check of the existence of syscall */
-	ltp_syscall(__NR_process_vm_writev, getpid(), NULL, 0, NULL, 0, 0);
+	ltp_syscall(__NR_process_vm_writev, getpid(), NULL, 0UL, NULL, 0UL, 0UL);
 
 	bufsz =
 	    sflag ? SAFE_STRTOL(NULL, sz_opt, 1, LONG_MAX - PADDING_SIZE * 2)
-- 
1.8.3.1


  reply	other threads:[~2019-02-26  2:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03  9:43 [LTP] [PATCH] syscalls/cma: test case should return TCONF if syscall doesn't exist Jason Xing
2018-12-03  9:58 ` Jan Stancek
2018-12-04  2:49   ` Jason Xing
2018-12-04  8:54     ` Jan Stancek
2018-12-05 13:43       ` [LTP] [PATCH v2 1/2] " Jason Xing
2018-12-05 13:43         ` [LTP] [PATCH v2 2/2] lapi/syscalls: Add syscall numbers for process_vm_readv/_writev Jason Xing
2018-12-05 22:07           ` Petr Vorel
2018-12-06  3:37             ` Jason Xing
2019-02-15 10:50         ` [LTP] [PATCH v2 1/2] syscalls/cma: test case should return TCONF if syscall doesn't exist Li Wang
2019-02-15 13:53           ` Jan Stancek
2019-02-16  7:18             ` Li Wang
2019-02-16 10:28               ` Jan Stancek
2019-02-22 18:29                 ` Jan Stancek
2019-02-23  6:21                   ` Caspar Zhang
2019-02-25  8:22                     ` [LTP] [PATCH] syscalls/cma: fix the failure of compiling with O2 option Jason Xing
2019-02-25 10:34                       ` Li Wang
2019-02-25 10:47                       ` Jan Stancek
2019-02-25 13:16                         ` Caspar Zhang
2019-02-26  1:42                           ` [LTP] [PATCH v2] " Jason Xing
2019-02-26  2:22                             ` Jason Xing [this message]
2019-02-26  3:17                               ` [LTP] [PATCH v3] " Li Wang
2019-02-26 16:03                               ` Jan Stancek
2019-02-26  2:00                         ` [LTP] [PATCH] " Jason Xing

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=1551147760-52601-1-git-send-email-kerneljasonxing@linux.alibaba.com \
    --to=kerneljasonxing@linux.alibaba.com \
    --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