[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ltp-list
Subject:    Re: [LTP] [PATCH] [syscalls] mmap11: fix broken testcase
From:       Cyril Hrubis <chrubis () suse ! cz>
Date:       2011-05-20 11:41:00
Message-ID: 20110520114100.GA13413 () saboteur ! suse ! cz
[Download RAW message or body]

Hi!
>  modify_ldt01 modify_ldt01
>  modify_ldt02 modify_ldt02
> diff --git a/testcases/kernel/syscalls/mmap/mmap11.c b/testcases/kernel/syscalls/mmap/mmap11.c
> index 786724b..4cbad58 100644
> --- a/testcases/kernel/syscalls/mmap/mmap11.c
> +++ b/testcases/kernel/syscalls/mmap/mmap11.c
> @@ -58,7 +58,7 @@
>  char *TCID = "mmap11";
>  int TST_TOTAL = 1;
>  
> -#define MAL_SIZE (100*1024)
> +#define MAL_SIZE (8*1024*1024)
>  
>  static void *wait_thread(void *args);
>  static void *wait_thread2(void *args);
> @@ -112,13 +112,15 @@ void check(void)
>  	for (lc = 0; TEST_LOOPING(lc); lc++) {
>  		Tst_count = 0;
>  		ret = pthread_create(&th, &attr, wait_thread, NULL);
> -		if (ret) {
> +		if (ret && errno != ENOMEM && errno != EAGAIN) {
>  			tst_resm(TINFO, "[%d] ", count);
>  			tst_brkm(TBROK|TERRNO, cleanup, "pthread_create");
>  		}
> +		if (count % 100 == 0)
> +			usleep(10000);

Hmm throwing in random sleeps often makes it work only on certain
systems. What are you trying to assert? That wait_thread() last long
enough so that wait_thread2 is executed meanwhile? You should use proper
locks for that otherwise it will start failing again sooner or later.

>  		count++;
>  		ret = pthread_create(&thread[lc], &attr, wait_thread2, NULL);
> -		if (ret) {
> +		if (ret && errno != ENOMEM && errno != EAGAIN) {
>  			tst_resm(TINFO, "[%d] ", count);
>  			tst_brkm(TBROK|TERRNO, cleanup, "pthread_create");
>  		}
> @@ -133,13 +135,13 @@ void *wait_thread(void *args)
>  	void *addr;
>  
>  	addr = malloc(MAL_SIZE);
> -	if (addr)
> -		memset(addr, 1, MAL_SIZE);
> -	sleep(1);
> +	sleep(10);
> +
>  	return NULL;
>  }
>  
>  void *wait_thread2(void *args)
>  {
> +	sleep(60);
>  	return NULL;
>  }


-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic