All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] cpuctl of controllers: fix the bug of while loop
@ 2009-09-08  6:08 liubo
  0 siblings, 0 replies; 7+ messages in thread
From: liubo @ 2009-09-08  6:08 UTC (permalink / raw)
  To: ltp-list

When running the ltp tool by "./runltp -f controllers",
I found "while" loop cannot stop in following files of
cpuctl test.

File list:
cpuctl_def_task01.c
cpuctl_def_task02.c
cpuctl_def_task03.c
cpuctl_def_task04.c
cpuctl_test01.c
cpuctl_test02.c
cpuctl_test03.c
cpuctl_test04.c

Key code:
timer_expired=0;
while(!timer_expired)
	f=sqrt(f*f);

Reason:
During the compilation of these files, gcc's O2 mechanism
  causes the change of variable "timer_expired" to be omitted,
hence the loop, "while(!timer_expired) f=sqrt(f*f);" cannot
get out from itself.

Change the type of "timer_expired" from "int" to "volatile int"
to fix this bug.

By the way, it is necessary to modify the file,
ltp-full-xxxxxxxx/testcases/kernel/controllers/libcontrollers/
libcontrollers.h for compilation.


Signed-off-by: Miao Xie<miaox@cn.fujitsu.com>
Signed-off-by: Liu Bo<liubo-fnst@cn.fujitsu.com>
---
diff --git a/cpuctl_def_task01.c b/cpuctl_def_task01.c
index 00a25bc..1fb398a 100644
--- a/cpuctl_def_task01.c
+++ b/cpuctl_def_task01.c
@@ -82,7 +82,7 @@ extern void cleanup()
         kill(scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
         tst_exit();             /* Report exit status*/
  }
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/cpuctl_def_task02.c b/cpuctl_def_task02.c
index 1bfa187..56ddacc 100644
--- a/cpuctl_def_task02.c
+++ b/cpuctl_def_task02.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit();             /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/cpuctl_def_task03.c b/cpuctl_def_task03.c
index e4ce3ad..4f3ddc1 100644
--- a/cpuctl_def_task03.c
+++ b/cpuctl_def_task03.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit();               /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/cpuctl_def_task04.c b/cpuctl_def_task04.c
index 15e2b5f..7f184c8 100644
--- a/cpuctl_def_task04.c
+++ b/cpuctl_def_task04.c
@@ -78,7 +78,7 @@ cleanup()
         tst_exit();               /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/cpuctl_test01.c b/cpuctl_test01.c
index ab0a4c9..7d7cc48 100644
--- a/cpuctl_test01.c
+++ b/cpuctl_test01.c
@@ -80,7 +80,7 @@ cleanup()
         kill (scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
         tst_exit ();            /* Report exit status*/
  }
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/cpuctl_test02.c b/cpuctl_test02.c
index 801716d..153a293 100644
--- a/cpuctl_test02.c
+++ b/cpuctl_test02.c
@@ -80,7 +80,7 @@ cleanup()
  }

  int migrate_task ();
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/cpuctl_test03.c b/cpuctl_test03.c
index c4b9978..c21b69c 100644
--- a/cpuctl_test03.c
+++ b/cpuctl_test03.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit ();              /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/cpuctl_test04.c b/cpuctl_test04.c
index b0a2329..ed00b0d 100644
--- a/cpuctl_test04.c
+++ b/cpuctl_test04.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit ();              /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/libcontrollers.h b/libcontrollers.h
index 777ff67..e6ab6a0 100644
--- a/libcontrollers.h
+++ b/libcontrollers.h
@@ -48,7 +48,8 @@ char fullpath[PATH_MAX];
  char fullpath[1024]; /* Guess */
  #endif

-int FLAG, timer_expired;
+int FLAG;
+volatile int timer_expired;

  int retval;






------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] cpuctl of controllers: fix the bug of while loop
  2009-09-09  8:33 liubo
@ 2009-09-09 17:55 ` Subrata Modak
  0 siblings, 0 replies; 7+ messages in thread
From: Subrata Modak @ 2009-09-09 17:55 UTC (permalink / raw)
  To: liubo, Miao Xie; +Cc: ltp-list

On Wed, 2009-09-09 at 16:33 +0800, liubo wrote: 
> Here is the right patch.
> I'm sorry for my carelessness.
> 
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> Signed-off-by: Liu Bo <liubo-fnst@cn.fujitsu.com>

Thanks.

Regards--
Subrata

> ---
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
> index 00a25bc..1fb398a 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
> @@ -82,7 +82,7 @@ extern void cleanup()
>  	kill(scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
>  	tst_exit();		/* Report exit status*/
>  }
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>  int main(int argc, char *argv[])
>  {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
> index 1bfa187..56ddacc 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
> @@ -79,7 +79,7 @@ cleanup()
>  	tst_exit();		/* Report exit status*/
>  }
> 
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>  int main(int argc, char *argv[])
>  {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
> index e4ce3ad..4f3ddc1 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
> @@ -79,7 +79,7 @@ cleanup()
>  	tst_exit();		  /* Report exit status*/
>  }
> 
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>  int main(int argc, char *argv[])
>  {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
> index 15e2b5f..7f184c8 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
> @@ -78,7 +78,7 @@ cleanup()
>  	tst_exit();		  /* Report exit status*/
>  }
> 
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>  int main(int argc, char *argv[])
>  {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
> index ab0a4c9..7d7cc48 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
> @@ -80,7 +80,7 @@ cleanup()
>  	kill (scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
>  	tst_exit ();		/* Report exit status*/
>  }
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>  int main(int argc, char* argv[])
>  {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
> index 801716d..153a293 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
> @@ -80,7 +80,7 @@ cleanup()
>  }
> 
>  int migrate_task ();
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>  int main(int argc, char* argv[])
>  {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
> index c4b9978..c21b69c 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
> @@ -79,7 +79,7 @@ cleanup()
>  	tst_exit ();		  /* Report exit status*/
>  }
> 
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>  int main(int argc, char* argv[])
>  {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
> index b0a2329..ed00b0d 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
> @@ -79,7 +79,7 @@ cleanup()
>  	tst_exit ();		  /* Report exit status*/
>  }
> 
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>  int main(int argc, char* argv[])
>  {
> diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.h b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
> index 777ff67..e6ab6a0 100644
> --- a/testcases/kernel/controllers/libcontrollers/libcontrollers.h
> +++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
> @@ -48,7 +48,8 @@ char fullpath[PATH_MAX];
>  char fullpath[1024]; /* Guess */
>  #endif
> 
> -int FLAG, timer_expired;
> +int FLAG;
> +volatile int timer_expired;
> 
>  int retval;
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH] cpuctl of controllers: fix the bug of while loop
@ 2009-09-09  8:33 liubo
  2009-09-09 17:55 ` Subrata Modak
  0 siblings, 1 reply; 7+ messages in thread
From: liubo @ 2009-09-09  8:33 UTC (permalink / raw)
  To: ltp-list

Here is the right patch.
I'm sorry for my carelessness.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Liu Bo <liubo-fnst@cn.fujitsu.com>
---
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
index 00a25bc..1fb398a 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
@@ -82,7 +82,7 @@ extern void cleanup()
 	kill(scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
 	tst_exit();		/* Report exit status*/
 }
-int timer_expired = 0;
+volatile int timer_expired = 0;
 
 int main(int argc, char *argv[])
 {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
index 1bfa187..56ddacc 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
@@ -79,7 +79,7 @@ cleanup()
 	tst_exit();		/* Report exit status*/
 }
 
-int timer_expired = 0;
+volatile int timer_expired = 0;
 
 int main(int argc, char *argv[])
 {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
index e4ce3ad..4f3ddc1 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
@@ -79,7 +79,7 @@ cleanup()
 	tst_exit();		  /* Report exit status*/
 }
 
-int timer_expired = 0;
+volatile int timer_expired = 0;
 
 int main(int argc, char *argv[])
 {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
index 15e2b5f..7f184c8 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
@@ -78,7 +78,7 @@ cleanup()
 	tst_exit();		  /* Report exit status*/
 }
 
-int timer_expired = 0;
+volatile int timer_expired = 0;
 
 int main(int argc, char *argv[])
 {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
index ab0a4c9..7d7cc48 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
@@ -80,7 +80,7 @@ cleanup()
 	kill (scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
 	tst_exit ();		/* Report exit status*/
 }
-int timer_expired = 0;
+volatile int timer_expired = 0;
 
 int main(int argc, char* argv[])
 {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
index 801716d..153a293 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
@@ -80,7 +80,7 @@ cleanup()
 }
 
 int migrate_task ();
-int timer_expired = 0;
+volatile int timer_expired = 0;
 
 int main(int argc, char* argv[])
 {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
index c4b9978..c21b69c 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
@@ -79,7 +79,7 @@ cleanup()
 	tst_exit ();		  /* Report exit status*/
 }
 
-int timer_expired = 0;
+volatile int timer_expired = 0;
 
 int main(int argc, char* argv[])
 {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
index b0a2329..ed00b0d 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
@@ -79,7 +79,7 @@ cleanup()
 	tst_exit ();		  /* Report exit status*/
 }
 
-int timer_expired = 0;
+volatile int timer_expired = 0;
 
 int main(int argc, char* argv[])
 {
diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.h b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
index 777ff67..e6ab6a0 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.h
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
@@ -48,7 +48,8 @@ char fullpath[PATH_MAX];
 char fullpath[1024]; /* Guess */
 #endif
 
-int FLAG, timer_expired;
+int FLAG;
+volatile int timer_expired;
 
 int retval;

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] cpuctl of controllers: fix the bug of while loop
  2009-09-08  9:15 liubo
@ 2009-09-09  6:50 ` Subrata Modak
  0 siblings, 0 replies; 7+ messages in thread
From: Subrata Modak @ 2009-09-09  6:50 UTC (permalink / raw)
  To: liubo; +Cc: ltp-list

On Tue, 2009-09-08 at 17:15 +0800, liubo wrote: 
> When running the ltp tool by "./runltp -f controllers",
> I found "while" loop cannot stop in following files of
> cpuctl test.
> 
> File list:
> cpuctl_def_task01.c
> cpuctl_def_task02.c
> cpuctl_def_task03.c
> cpuctl_def_task04.c
> cpuctl_test01.c
> cpuctl_test02.c
> cpuctl_test03.c
> cpuctl_test04.c
> 
> Key code:
> timer_expired=0;
> while(!timer_expired)
> 	f=sqrt(f*f);
> 
> Reason:
> During the compilation of these files, gcc's O2 mechanism
>   causes the change of variable "timer_expired" to be omitted,
> hence the loop, "while(!timer_expired) f=sqrt(f*f);" cannot
> get out from itself.
> 
> Change the type of "timer_expired" from "int" to "volatile int"
> to fix this bug.
> 
> By the way, it is necessary to modify the file,
> ltp-full-xxxxxxxx/testcases/kernel/controllers/libcontrollers/
> libcontrollers.h for compilation.
> 
> 
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> Signed-off-by: Liu Bo <liubo-fnst@cn.fujitsu.com>

This fails to apply. Needs to be re-created against the latest LTP
snapshots from CVS:

patching file testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
Hunk #1 FAILED at 82.
1 out of 1 hunk FAILED -- saving rejects to file
testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c.rej
patching file testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
Hunk #1 succeeded at 79 with fuzz 2.
patching file testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
Hunk #1 succeeded at 79 with fuzz 2.
patching file testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
Hunk #1 succeeded at 78 with fuzz 2.
patching file testcases/kernel/controllers/cpuctl/cpuctl_test01.c
Hunk #1 FAILED at 80.
1 out of 1 hunk FAILED -- saving rejects to file
testcases/kernel/controllers/cpuctl/cpuctl_test01.c.rej
patching file testcases/kernel/controllers/cpuctl/cpuctl_test02.c
Hunk #1 FAILED at 80.
1 out of 1 hunk FAILED -- saving rejects to file
testcases/kernel/controllers/cpuctl/cpuctl_test02.c.rej
patching file testcases/kernel/controllers/cpuctl/cpuctl_test03.c
Hunk #1 succeeded at 79 with fuzz 2.
patching file testcases/kernel/controllers/cpuctl/cpuctl_test04.c
Hunk #1 succeeded at 79 with fuzz 2.
patching file
testcases/kernel/controllers/libcontrollers/libcontrollers.h
Hunk #1 succeeded at 48 with fuzz 2.

Regards--
Subrata

> ---
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c 
> b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
> index 00a25bc..1fb398a 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
> @@ -82,7 +82,7 @@ extern void cleanup()
>          kill(scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
>          tst_exit();             /* Report exit status*/
>   }
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>   int main(int argc, char *argv[])
>   {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c 
> b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
> index 1bfa187..56ddacc 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
> @@ -79,7 +79,7 @@ cleanup()
>          tst_exit();             /* Report exit status*/
>   }
> 
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>   int main(int argc, char *argv[])
>   {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c 
> b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
> index e4ce3ad..4f3ddc1 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
> @@ -79,7 +79,7 @@ cleanup()
>          tst_exit();               /* Report exit status*/
>   }
> 
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>   int main(int argc, char *argv[])
>   {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c 
> b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
> index 15e2b5f..7f184c8 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
> @@ -78,7 +78,7 @@ cleanup()
>          tst_exit();               /* Report exit status*/
>   }
> 
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>   int main(int argc, char *argv[])
>   {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c 
> b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
> index ab0a4c9..7d7cc48 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
> @@ -80,7 +80,7 @@ cleanup()
>          kill (scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
>          tst_exit ();            /* Report exit status*/
>   }
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>   int main(int argc, char* argv[])
>   {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c 
> b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
> index 801716d..153a293 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
> @@ -80,7 +80,7 @@ cleanup()
>   }
> 
>   int migrate_task ();
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>   int main(int argc, char* argv[])
>   {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c 
> b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
> index c4b9978..c21b69c 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
> @@ -79,7 +79,7 @@ cleanup()
>          tst_exit ();              /* Report exit status*/
>   }
> 
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>   int main(int argc, char* argv[])
>   {
> diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c 
> b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
> index b0a2329..ed00b0d 100644
> --- a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
> +++ b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
> @@ -79,7 +79,7 @@ cleanup()
>          tst_exit ();              /* Report exit status*/
>   }
> 
> -int timer_expired = 0;
> +volatile int timer_expired = 0;
> 
>   int main(int argc, char* argv[])
>   {
> diff --git 
> a/testcases/kernel/controllers/libcontrollers/libcontrollers.h 
> b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
> index 777ff67..e6ab6a0 100644
> --- a/testcases/kernel/controllers/libcontrollers/libcontrollers.h
> +++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
> @@ -48,7 +48,8 @@ char fullpath[PATH_MAX];
>   char fullpath[1024]; /* Guess */
>   #endif
> 
> -int FLAG, timer_expired;
> +int FLAG;
> +volatile int timer_expired;
> 
>   int retval;
> 
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH] cpuctl of controllers: fix the bug of while loop
@ 2009-09-08  9:15 liubo
  2009-09-09  6:50 ` Subrata Modak
  0 siblings, 1 reply; 7+ messages in thread
From: liubo @ 2009-09-08  9:15 UTC (permalink / raw)
  To: ltp-list

When running the ltp tool by "./runltp -f controllers",
I found "while" loop cannot stop in following files of
cpuctl test.

File list:
cpuctl_def_task01.c
cpuctl_def_task02.c
cpuctl_def_task03.c
cpuctl_def_task04.c
cpuctl_test01.c
cpuctl_test02.c
cpuctl_test03.c
cpuctl_test04.c

Key code:
timer_expired=0;
while(!timer_expired)
	f=sqrt(f*f);

Reason:
During the compilation of these files, gcc's O2 mechanism
  causes the change of variable "timer_expired" to be omitted,
hence the loop, "while(!timer_expired) f=sqrt(f*f);" cannot
get out from itself.

Change the type of "timer_expired" from "int" to "volatile int"
to fix this bug.

By the way, it is necessary to modify the file,
ltp-full-xxxxxxxx/testcases/kernel/controllers/libcontrollers/
libcontrollers.h for compilation.


Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Liu Bo <liubo-fnst@cn.fujitsu.com>
---
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
index 00a25bc..1fb398a 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
@@ -82,7 +82,7 @@ extern void cleanup()
         kill(scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
         tst_exit();             /* Report exit status*/
  }
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
index 1bfa187..56ddacc 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit();             /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
index e4ce3ad..4f3ddc1 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit();               /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
index 15e2b5f..7f184c8 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
@@ -78,7 +78,7 @@ cleanup()
         tst_exit();               /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
index ab0a4c9..7d7cc48 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
@@ -80,7 +80,7 @@ cleanup()
         kill (scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
         tst_exit ();            /* Report exit status*/
  }
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
index 801716d..153a293 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
@@ -80,7 +80,7 @@ cleanup()
  }

  int migrate_task ();
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
index c4b9978..c21b69c 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit ();              /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
index b0a2329..ed00b0d 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit ();              /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git 
a/testcases/kernel/controllers/libcontrollers/libcontrollers.h 
b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
index 777ff67..e6ab6a0 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.h
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
@@ -48,7 +48,8 @@ char fullpath[PATH_MAX];
  char fullpath[1024]; /* Guess */
  #endif

-int FLAG, timer_expired;
+int FLAG;
+volatile int timer_expired;

  int retval;







------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH] cpuctl of controllers: fix the bug of while loop
@ 2009-09-08  8:27 liubo
  0 siblings, 0 replies; 7+ messages in thread
From: liubo @ 2009-09-08  8:27 UTC (permalink / raw)
  To: ltp-list

When running the ltp tool by "./runltp -f controllers",
I found "while" loop cannot stop in following files of
cpuctl test.

File list:
cpuctl_def_task01.c
cpuctl_def_task02.c
cpuctl_def_task03.c
cpuctl_def_task04.c
cpuctl_test01.c
cpuctl_test02.c
cpuctl_test03.c
cpuctl_test04.c

Key code:
timer_expired=0;
while(!timer_expired)
	f=sqrt(f*f);

Reason:
During the compilation of these files, gcc's O2 mechanism
  causes the change of variable "timer_expired" to be omitted,
hence the loop, "while(!timer_expired) f=sqrt(f*f);" cannot
get out from itself.

Change the type of "timer_expired" from "int" to "volatile int"
to fix this bug.

By the way, it is necessary to modify the file,
ltp-full-xxxxxxxx/testcases/kernel/controllers/libcontrollers/
libcontrollers.h for compilation.


Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Liu Bo <liubo-fnst@cn.fujitsu.com>
---
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
index 00a25bc..1fb398a 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
@@ -82,7 +82,7 @@ extern void cleanup()
         kill(scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
         tst_exit();             /* Report exit status*/
  }
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
index 1bfa187..56ddacc 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit();             /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
index e4ce3ad..4f3ddc1 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit();               /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
index 15e2b5f..7f184c8 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
@@ -78,7 +78,7 @@ cleanup()
         tst_exit();               /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
index ab0a4c9..7d7cc48 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
@@ -80,7 +80,7 @@ cleanup()
         kill (scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
         tst_exit ();            /* Report exit status*/
  }
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
index 801716d..153a293 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
@@ -80,7 +80,7 @@ cleanup()
  }

  int migrate_task ();
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
index c4b9978..c21b69c 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit ();              /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
index b0a2329..ed00b0d 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit ();              /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git 
a/testcases/kernel/controllers/libcontrollers/libcontrollers.h 
b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
index 777ff67..e6ab6a0 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.h
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
@@ -48,7 +48,8 @@ char fullpath[PATH_MAX];
  char fullpath[1024]; /* Guess */
  #endif

-int FLAG, timer_expired;
+int FLAG;
+volatile int timer_expired;

  int retval;







------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* [LTP] [PATCH] cpuctl of controllers: fix the bug of while loop
@ 2009-09-08  6:40 liubo
  0 siblings, 0 replies; 7+ messages in thread
From: liubo @ 2009-09-08  6:40 UTC (permalink / raw)
  To: ltp-list

When running the ltp tool by "./runltp -f controllers",
I found "while" loop cannot stop in following files of
cpuctl test.

File list:
cpuctl_def_task01.c
cpuctl_def_task02.c
cpuctl_def_task03.c
cpuctl_def_task04.c
cpuctl_test01.c
cpuctl_test02.c
cpuctl_test03.c
cpuctl_test04.c

Key code:
timer_expired=0;
while(!timer_expired)
	f=sqrt(f*f);

Reason:
During the compilation of these files, gcc's O2 mechanism
  causes the change of variable "timer_expired" to be omitted,
hence the loop, "while(!timer_expired) f=sqrt(f*f);" cannot
get out from itself.

Change the type of "timer_expired" from "int" to "volatile int"
to fix this bug.

By the way, it is necessary to modify the file,
ltp-full-xxxxxxxx/testcases/kernel/controllers/libcontrollers/
libcontrollers.h for compilation.


Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Liu Bo <liubo-fnst@cn.fujitsu.com>
---
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
index 00a25bc..1fb398a 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task01.c
@@ -82,7 +82,7 @@ extern void cleanup()
         kill(scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
         tst_exit();             /* Report exit status*/
  }
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
index 1bfa187..56ddacc 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task02.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit();             /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
index e4ce3ad..4f3ddc1 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task03.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit();               /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
index 15e2b5f..7f184c8 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_def_task04.c
@@ -78,7 +78,7 @@ cleanup()
         tst_exit();               /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char *argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
index ab0a4c9..7d7cc48 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
@@ -80,7 +80,7 @@ cleanup()
         kill (scriptpid, SIGUSR1);/* Inform the shell to do cleanup*/
         tst_exit ();            /* Report exit status*/
  }
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
index 801716d..153a293 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
@@ -80,7 +80,7 @@ cleanup()
  }

  int migrate_task ();
-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
index c4b9978..c21b69c 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit ();              /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c 
b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
index b0a2329..ed00b0d 100644
--- a/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
+++ b/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
@@ -79,7 +79,7 @@ cleanup()
         tst_exit ();              /* Report exit status*/
  }

-int timer_expired = 0;
+volatile int timer_expired = 0;

  int main(int argc, char* argv[])
  {
diff --git 
a/testcases/kernel/controllers/libcontrollers/libcontrollers.h 
b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
index 777ff67..e6ab6a0 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.h
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
@@ -48,7 +48,8 @@ char fullpath[PATH_MAX];
  char fullpath[1024]; /* Guess */
  #endif

-int FLAG, timer_expired;
+int FLAG;
+volatile int timer_expired;

  int retval;







------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2009-09-09 17:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-08  6:08 [LTP] [PATCH] cpuctl of controllers: fix the bug of while loop liubo
2009-09-08  6:40 liubo
2009-09-08  8:27 liubo
2009-09-08  9:15 liubo
2009-09-09  6:50 ` Subrata Modak
2009-09-09  8:33 liubo
2009-09-09 17:55 ` Subrata Modak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.