From: Cyril Hrubis <chrubis@suse.cz>
To: Avinesh Kumar <akumar@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] syscalls/mmap15: Rewrite test using new LTP API
Date: Tue, 31 Oct 2023 16:31:59 +0100 [thread overview]
Message-ID: <ZUEd79N7aiC_VCDO@yuki> (raw)
In-Reply-To: <20230905160143.1076-1-akumar@suse.de>
Hi!
> + if (TST_RET_PTR != MAP_FAILED) {
> + tst_res(TFAIL, "mmap() into high mem region succeeded unexpectedly");
> + SAFE_MUNMAP(TST_RET_PTR, page_size);
> + return;
> + } else if (TST_RET_PTR == MAP_FAILED && (TST_ERR == ENOMEM || TST_ERR == EINVAL)) {
There is no reason for an else branch if we do return in the previous
one.
Also we do return so TST_RET_PTR is always MAP_FAILED here, no need to
test it again.
> + tst_res(TPASS | TERRNO, "mmap() failed with expected errno");
> + } else {
> + tst_res(TFAIL | TERRNO, "mmap() failed with unexpected errno");
> }
>
> - cleanup();
> - tst_exit();
> + SAFE_CLOSE(fd);
> }
>
> static void setup(void)
> {
> - tst_require_root();
> -
> - tst_tmpdir();
> -
> page_size = getpagesize();
> -
> - TEST_PAUSE;
> }
>
> static void cleanup(void)
> {
> - tst_rmdir();
> + if (fd > 0)
> + SAFE_CLOSE(fd);
> }
> +
> +static struct tst_test test = {
> + .setup = setup,
> + .cleanup = cleanup,
> + .test_all = run,
> + .needs_root = 1,
Do we really need root?
> + .needs_tmpdir = 1
> +};
> --
> 2.41.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-10-31 15:31 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 [this message]
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 ` [LTP] [PATCH 1/5] syscalls/mmap08: Rewrite the " Cyril Hrubis
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=ZUEd79N7aiC_VCDO@yuki \
--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