public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V2] controllers/memcg: Mark testcase_2 as pass when mlock failed
Date: Mon, 6 Jun 2016 15:16:54 +0200	[thread overview]
Message-ID: <20160606131653.GA21264@rei> (raw)
In-Reply-To: <20160602013657.GA8737@localhost.localdomain>

Hi!
> @@ -229,8 +229,11 @@ test_proc_kill()
>  	ps -p $pid > /dev/null 2> /dev/null
>  	if [ $? -ne 0 ]; then
>  		wait $pid
> -		if [ $? -eq 1 ]; then
> +		ret=$?
> +		if [ $ret -eq 1 ]; then
>  			result $FAIL "process $pid is killed by error"
> +		elif [[ $ret -eq 2 ]]; then
> +			result $PASS "Failed to lock memory"

The [[ is bashism (and will not work on Debian), use single brackets
instead.

>  		else
>  			result $PASS "process $pid is killed"
>  		fi
> diff --git a/testcases/kernel/controllers/memcg/functional/memcg_process.c b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> index 3d34394..40c677b 100644
> --- a/testcases/kernel/controllers/memcg/functional/memcg_process.c
> +++ b/testcases/kernel/controllers/memcg/functional/memcg_process.c
> @@ -203,8 +203,12 @@ void mmap_lock2()
>  		if (p == MAP_FAILED)
>  			err(1, "mmap failed");
>  
> -		if (mlock(p, memsize) == -1)
> -			err(1, "mlock failed");
> +		if (mlock(p, memsize) == -1) {
> +			if (errno == EAGAIN)
> +				exit(2);
> +                        else
> +				err(1, "mlock failed");
> +                }

The code indented by spaces again. Plase use tabs only.

>  	} else {
>  		if (munmap(p, memsize) == -1)
>  			err(1, "munmap failed");
-- 
Cyril Hrubis
chrubis@suse.cz

  parent reply	other threads:[~2016-06-06 13:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01  3:00 [LTP] [PATCH] controllers/memcg: Mark testcase_2 as pass when mlock failed Dong ZHu
2016-06-01  9:07 ` [LTP] [Re-Send][PATCH] " Dong ZHu
2016-06-01  9:36   ` Cyril Hrubis
2016-06-02  1:36     ` [LTP] [PATCH V2] " Dong ZHu
2016-06-06  1:20       ` Dong ZHu
2016-06-06 13:16       ` Cyril Hrubis [this message]
2016-06-07  1:44         ` [LTP] [PATCH V3] " Dong ZHu
2016-06-07 10:45           ` 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=20160606131653.GA21264@rei \
    --to=chrubis@suse.cz \
    --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