public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Alexey Kodanev <alexey.kodanev@oracle.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] Clean up hugemmap02 testcase
Date: Mon, 11 Jan 2016 14:47:17 +0300	[thread overview]
Message-ID: <56939645.2080805@oracle.com> (raw)
In-Reply-To: <1452241254-4113-1-git-send-email-shuang.qiu@oracle.com>

Hi,
On 01/08/2016 11:20 AM, shuang.qiu@oracle.com wrote:
> From: Shuang Qiu <shuang.qiu@oracle.com>
>
> It misses the cleanup when continue in the loop.
> And it also needs to munmap() addr2 for 32-bit.
>
> Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
> ---
>   testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c |   14 ++++----------
>   1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c
> index 1a44993..8c2a9b2 100644
> --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c
> +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap02.c
> @@ -155,24 +155,20 @@ int main(int ac, char **av)
>   		addr2 = mmap((void *)low_addr2, map_sz, PROT_READ | PROT_WRITE,
>   			     MAP_SHARED, fildes, 0);
>   #if __WORDSIZE == 64		/* 64-bit process */
> -		if (addr2 == MAP_FAILED) {
> +		if (addr2 == MAP_FAILED)
>   			tst_resm(TFAIL | TERRNO, "huge mmap failed unexpectedly"
>   				 " with %s (64-bit)", TEMPFILE);
> -			close(fildes);
> -			continue;
> -		} else {
> +		else {
>   			tst_resm(TPASS, "huge mmap succeeded (64-bit)");

Looking at the test, there is one more fd ("nfildes") that stays not 
closed after each loop iteration...  we can move open("/dev/zero",...)  
to setup() or close it in the end of the loop, what do you think?

Best regards,
Alexey


  reply	other threads:[~2016-01-11 11:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08  8:20 [LTP] [PATCH] Clean up hugemmap02 testcase shuang.qiu
2016-01-11 11:47 ` Alexey Kodanev [this message]
2016-01-13  4:30   ` Shuang Qiu

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=56939645.2080805@oracle.com \
    --to=alexey.kodanev@oracle.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