From: Petr Vorel <pvorel@suse.cz>
To: paulson <lpaulsonraja@gmail.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] Added test for mmap() with MAP_SHARED_VALIDATE.
Date: Mon, 27 Mar 2023 12:51:10 +0200 [thread overview]
Message-ID: <20230327105110.GA667966@pevik> (raw)
In-Reply-To: <20230323121330.92244-1-paulson@zilogic.com>
Hi,
> +static void test_mmap(void)
> +{
> + mapped_address = mmap(NULL, TEST_FILE_SIZE, PROT_READ | PROT_WRITE,
> + (1 << 7) | MAP_SHARED_VALIDATE, fd_file, 0);
> + if (mapped_address != MAP_FAILED)
> + tst_res(TFAIL | TERRNO, "mmap() is successful, but it should have failed.");
> + else if (errno == EOPNOTSUPP)
> + tst_res(TPASS, "mmap() failed with errno set to EOPNOTSUPP.");
> + else
> + tst_res(TFAIL | TERRNO, "mmap() failed with unexpected error.");
> +}
FYI we have various helpers in include/tst_test_macros.h, e.g. TST_EXP_FAIL()
for expected failures where return is just classical syscalls result
(0 for pass, -1 for error) or TST_EXP_FD() for file descriptors.
But these cannot be used here, because mmap returns pointer to void.
We might want to write helpers which use TEST_VOID() instead of TEST(),
after tests for mmap() are rewritten to new API, they could use it.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-03-27 10:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 12:13 [LTP] [PATCH] Added test for mmap() with MAP_SHARED_VALIDATE paulson
2023-03-24 10:33 ` Petr Vorel
2023-03-25 4:01 ` Paulson Raja L
2023-03-27 10:21 ` Petr Vorel
2023-03-28 3:14 ` Li Wang
2023-03-28 8:17 ` Petr Vorel
2023-03-28 8:30 ` Li Wang
2023-03-28 10:39 ` Petr Vorel
2023-04-04 11:07 ` Petr Vorel
2023-04-04 11:15 ` Petr Vorel
2023-03-27 10:51 ` Petr Vorel [this message]
2023-03-28 3:39 ` Li Wang
2023-03-28 8:11 ` 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=20230327105110.GA667966@pevik \
--to=pvorel@suse.cz \
--cc=lpaulsonraja@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.