public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Caspar Zhang <caspar@casparzhang.com>
To: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Cc: caspar@casparzhang.com, ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v3 1/4] hugemmap01: auto mount the temporary dir for testing
Date: Wed, 08 Feb 2012 16:31:40 +0800	[thread overview]
Message-ID: <4F3232EC.4030007@casparzhang.com> (raw)
In-Reply-To: <1328689302-5506-2-git-send-email-gaowanlong@cn.fujitsu.com>

On 02/08/2012 04:21 PM, Wanlong Gao wrote:
> -static void setup(void)
> +void setup(void)
>  {
> -	char mypid[40];
> -
> -	sprintf(mypid, "/%d", getpid());
> -	TEMPFILE = strcat(mypid, TEMPFILE);
> -	TEMPFILE = strcat(Hopt, TEMPFILE);
> -
> -	tst_sig(FORK, DEF_HANDLER, cleanup);
> -
>  	TEST_PAUSE;
> -
> +	tst_require_root(NULL);
> +	if (mount("none", Hopt, "hugetlbfs", 0, NULL) < 0)
> +		tst_brkm(TBROK|TERRNO, NULL,
> +			 "mount failed on %s", Hopt);
> +
> +	set_sys_tune("nr_hugepages", hugepages, 1);
> +	snprintf(TEMPFILE, sizeof(TEMPFILE), "%s/mmapfile%d",
> +		 Hopt, getpid());
>  }
>  
> -static void cleanup(void)
> +void cleanup(void)
>  {
>  	TEST_CLEANUP;
>  
>  	unlink(TEMPFILE);
>  
> +	umount(Hopt);
> +	tst_rmdir();
>  }

Hi, I just have another concern, that you might want to keep the initial
value of nr_hugepages and restore it once the test is done.

Thanks,
Caspar

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

       reply	other threads:[~2012-02-08  8:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1328689302-5506-1-git-send-email-gaowanlong@cn.fujitsu.com>
     [not found] ` <1328689302-5506-2-git-send-email-gaowanlong@cn.fujitsu.com>
2012-02-08  8:31   ` Caspar Zhang [this message]
2012-02-08  8:37     ` [LTP] [PATCH v3 1/4] hugemmap01: auto mount the temporary dir for testing Wanlong Gao
2012-02-08  8:41       ` Caspar Zhang
2012-02-08  8:48         ` Wanlong Gao

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=4F3232EC.4030007@casparzhang.com \
    --to=caspar@casparzhang.com \
    --cc=gaowanlong@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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