public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* Re: [LTP] [PATCH v3 1/4] hugemmap01: auto mount the temporary dir for testing
       [not found] ` <1328689302-5506-2-git-send-email-gaowanlong@cn.fujitsu.com>
@ 2012-02-08  8:31   ` Caspar Zhang
  2012-02-08  8:37     ` Wanlong Gao
  0 siblings, 1 reply; 4+ messages in thread
From: Caspar Zhang @ 2012-02-08  8:31 UTC (permalink / raw)
  To: Wanlong Gao; +Cc: caspar, ltp-list

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH v3 1/4] hugemmap01: auto mount the temporary dir for testing
  2012-02-08  8:31   ` [LTP] [PATCH v3 1/4] hugemmap01: auto mount the temporary dir for testing Caspar Zhang
@ 2012-02-08  8:37     ` Wanlong Gao
  2012-02-08  8:41       ` Caspar Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Wanlong Gao @ 2012-02-08  8:37 UTC (permalink / raw)
  To: Caspar Zhang; +Cc: ltp-list

On 02/08/2012 04:31 PM, Caspar Zhang wrote:

> 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.


as set_sys_tune defined in mem lib, this restore work should be done there,
too.

right?

Thanks
-Wanlong Gao

> 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH v3 1/4] hugemmap01: auto mount the temporary dir for testing
  2012-02-08  8:37     ` Wanlong Gao
@ 2012-02-08  8:41       ` Caspar Zhang
  2012-02-08  8:48         ` Wanlong Gao
  0 siblings, 1 reply; 4+ messages in thread
From: Caspar Zhang @ 2012-02-08  8:41 UTC (permalink / raw)
  To: gaowanlong; +Cc: ltp-list

On 02/08/2012 04:37 PM, Wanlong Gao wrote:
>> > 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.
> 
> as set_sys_tune defined in mem lib, this restore work should be done there,
> too.

no, set_sys_tune only set the value and verify the content if the third
parameter is setting to "1".

You should save the original value by using get_sys_tune in setup() and
restore it in cleanup() by using set_sys_tune again.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH v3 1/4] hugemmap01: auto mount the temporary dir for testing
  2012-02-08  8:41       ` Caspar Zhang
@ 2012-02-08  8:48         ` Wanlong Gao
  0 siblings, 0 replies; 4+ messages in thread
From: Wanlong Gao @ 2012-02-08  8:48 UTC (permalink / raw)
  To: Caspar Zhang; +Cc: ltp-list

On 02/08/2012 04:41 PM, Caspar Zhang wrote:

> On 02/08/2012 04:37 PM, Wanlong Gao wrote:
>>>> 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.
>>
>> as set_sys_tune defined in mem lib, this restore work should be done there,
>> too.
> 
> no, set_sys_tune only set the value and verify the content if the third
> parameter is setting to "1".
> 
> You should save the original value by using get_sys_tune in setup() and
> restore it in cleanup() by using set_sys_tune again.


Ah, OK. I will do.

Thanks
-Wanlong Gao

> 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-08  8:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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   ` [LTP] [PATCH v3 1/4] hugemmap01: auto mount the temporary dir for testing Caspar Zhang
2012-02-08  8:37     ` Wanlong Gao
2012-02-08  8:41       ` Caspar Zhang
2012-02-08  8:48         ` Wanlong Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox