From: Cyril Hrubis <chrubis@suse.cz>
To: Avinesh Kumar <akumar@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/5] syscalls/mmap08: Rewrite the test using new LTP API
Date: Wed, 30 Aug 2023 14:51:05 +0200 [thread overview]
Message-ID: <ZO87OQ7ZC3QMIIZ9@rei> (raw)
In-Reply-To: <20230825063932.30875-1-akumar@suse.de>
Hi!
Pushed with a minor changes, thanks.
Apart from changes similar to the previous tests I've also removed the
whole part that writes the file. There is no point in writing the file
if we are closing the fd before we pass it to the mmap() since the fd is
no longer associated with the file content. So now the test just open
and closes file and then uses that fd as an invalid one.
Full diff:
--- a/testcases/kernel/syscalls/mmap/mmap08.c
+++ b/testcases/kernel/syscalls/mmap/mmap08.c
@@ -21,30 +21,22 @@ static int fd;
static void setup(void)
{
- char *buf;
-
- page_sz = getpagesize();
-
- buf = SAFE_CALLOC(page_sz, sizeof(char));
- memset(buf, 'A', page_sz);
-
fd = SAFE_OPEN(TEMPFILE, O_RDWR | O_CREAT, 0666);
- SAFE_WRITE(SAFE_WRITE_ALL, fd, buf, page_sz);
- free(buf);
SAFE_CLOSE(fd);
}
static void run(void)
{
- TESTPTR(mmap(0, page_sz, PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0));
+ TESTPTR(mmap(NULL, page_sz, PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0));
if (TST_RET_PTR != MAP_FAILED) {
tst_res(TFAIL, "mmap() passed unexpectedly");
SAFE_MUNMAP(TST_RET_PTR, page_sz);
- } else if (TST_ERR == EBADF)
+ } else if (TST_ERR == EBADF) {
tst_res(TPASS, "mmap() failed with EBADF");
- else
+ } else {
tst_res(TFAIL | TERRNO, "mmap() failed with an invalid errno");
+ }
}
static void cleanup(void)
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2023-08-30 12:51 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-25 6:38 [LTP] [PATCH 1/5] syscalls/mmap08: Rewrite the test using new LTP API Avinesh Kumar
2023-08-25 6:38 ` [LTP] [PATCH 2/5] syscalls/mmap09: " Avinesh Kumar
2023-09-01 8:27 ` Richard Palethorpe
2023-09-01 9:04 ` Cyril Hrubis
2023-09-01 9:11 ` Richard Palethorpe
2023-08-25 6:38 ` [LTP] [PATCH 3/5] syscalls/mmap13: Rewrite the test using new API Avinesh Kumar
2023-09-04 8:54 ` Richard Palethorpe
2023-08-25 6:38 ` [LTP] [PATCH 4/5] syscalls/mmap14: Rewrite test using new LTP API Avinesh Kumar
2023-09-01 9:23 ` Richard Palethorpe
2023-09-05 13:28 ` [LTP] [PATCH v2] " Avinesh Kumar
2023-10-09 10:59 ` Richard Palethorpe
2023-10-31 15:39 ` Cyril Hrubis
2023-08-25 6:38 ` [LTP] [PATCH 5/5] syscalls/mmap15: " Avinesh Kumar
2023-09-04 9:23 ` Richard Palethorpe
2023-09-05 16:01 ` [LTP] [PATCH v2] " Avinesh Kumar
2023-10-31 15:31 ` Cyril Hrubis
2023-12-11 20:49 ` [LTP] [PATCH v3] " Avinesh Kumar
2024-01-09 17:15 ` Petr Vorel
2024-01-10 9:41 ` Avinesh Kumar
2023-08-30 12:51 ` Cyril Hrubis [this message]
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=ZO87OQ7ZC3QMIIZ9@rei \
--to=chrubis@suse.cz \
--cc=akumar@suse.de \
--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