Signed-off by : Vinay Sridhar <vinaysridhar@in.ibm.com>

-----------Patch-------------

diff -Nuarp ltp-full-20080331_old/testcases/misc/math/float/bessel/genbessel.c ltp-full-20080331/testcases/misc/math/float/bessel/genbessel.c
--- ltp-full-20080331_old/testcases/misc/math/float/bessel/genbessel.c	2008-03-31 12:55:08.000000000 +0530
+++ ltp-full-20080331/testcases/misc/math/float/bessel/genbessel.c	2008-04-23 12:09:33.000000000 +0530
@@ -37,8 +37,6 @@
 #include        <sys/signal.h>
 #include        <math.h>
 
-
-
 /*****************************************************************
  * create file: 
  * 	
@@ -48,6 +46,9 @@
  *			   RESULT_CREATE for output result file
  */
 
+char *TCID = "genbessel";
+int TST_TOTAL = 1;
+
 int create_file(char *func_name, int NbVal)
 {
 	pid_t myproc;
@@ -69,26 +70,30 @@ int create_file(char *func_name, int NbV
 
 int main(int argc, char *argv[])
 {
-	char *funct;
+	char *funct,*ltproot;
 	pid_t child;
-	
-	funct = "./genj0";
+	ltproot = getenv("LTPROOT");
+	funct = malloc(strlen(ltproot));
+	sprintf(funct,"%s",ltproot);
+
+	strcat(funct,"/testcases/misc/math/float/bessel/genj0");
 	child=create_file(funct, 0);
 	waitpid(child,NULL,0);
-
-	funct = "./genj1";
+	
+	funct[strlen(funct)-1] = '1';
 	child=create_file(funct, 0);
 	waitpid(child,NULL,0);
-
-	funct = "./geny0";
+	
+	funct[strlen(funct)-2] = 'y';
+	funct[strlen(funct)-1] = '0';
 	child=create_file(funct, 0);
 	waitpid(child,NULL,0);
-
-	funct = "./geny1";
+	
+	funct[strlen(funct)-1] = '1';
 	child=create_file(funct, 0);
 	waitpid(child,NULL,0);
-
-	funct = "./genlgamma";
+	
+	sprintf(funct,"%s/%s",ltproot,"testcases/misc/math/float/bessel/genlgamma");
 	child=create_file(funct, 0);
 	waitpid(child,NULL,0);
 
diff -Nuarp ltp-full-20080331_old/testcases/misc/math/float/float_bessel.c ltp-full-20080331/testcases/misc/math/float/float_bessel.c
--- ltp-full-20080331_old/testcases/misc/math/float/float_bessel.c	2008-03-31 12:55:08.000000000 +0530
+++ ltp-full-20080331/testcases/misc/math/float/float_bessel.c	2008-04-23 12:09:06.000000000 +0530
@@ -39,7 +39,6 @@ const TH_FUNC th_func[] = {
 };
 
 #define NB_FUNC  (sizeof(th_func)/sizeof(TH_FUNC))
-
 #define GENERATOR "genbessel"
 #include "main.c"
 #include "thread_code.c"
diff -Nuarp ltp-full-20080331_old/testcases/misc/math/float/main.c ltp-full-20080331/testcases/misc/math/float/main.c
--- ltp-full-20080331_old/testcases/misc/math/float/main.c	2008-03-31 12:55:08.000000000 +0530
+++ ltp-full-20080331/testcases/misc/math/float/main.c	2008-04-23 12:09:18.000000000 +0530
@@ -26,7 +26,6 @@
 #include "tfloat.h"
 
 #include "test.h"
-
 /* LTP status reporting */
 char *TCID;	 		/* Test program identifier.    */
 int TST_TOTAL=1;    		/* Total number of test cases. */
@@ -50,8 +49,9 @@ TH_DATA **tabcour;
 #ifndef	PATH_MAX
 #define  PATH_MAX        	1024
 #endif
+#define BUFSIZE			256
 char datadir[PATH_MAX];     		/* DATA directory */
-
+char pwd[BUFSIZE];			/* Current working directory */
 #ifndef PTHREAD_THREADS_MAX
 #define PTHREAD_THREADS_MAX 1024
 #endif
@@ -79,9 +79,10 @@ const double EPS=  0.1e-300;
 
 const int nb_func = NB_FUNC;
 
+
 int generate(char *datadir)
 {
- char *fmt = "cd %s; ./%s";
+ char *fmt = "%s/%s";
  char *cmdline = malloc (strlen(fmt) + strlen(datadir) + strlen(GENERATOR));
  if (cmdline == NULL)
      return(1);
@@ -97,6 +98,10 @@ int main(int argc, char *argv[])
         pid_t           pid;
         extern char     *optarg;
 
+	getcwd(pwd,BUFSIZE);
+
+	tst_tmpdir();
+
         void *exit_value;
         pthread_attr_t newattr;
         pthread_t sig_hand;
@@ -116,9 +121,7 @@ int main(int argc, char *argv[])
 
 	setbuf(stdout, (char *)0);
 	setbuf(stderr, (char *)0);
-	datadir[0] = '.';
-	datadir[1] = '\0';
-
+	strcpy(datadir,pwd);
 	if(argc != 1)
 	{
  	while ( (opt = getopt( argc, argv, "vn:l:D:?" )) != EOF ) {
@@ -139,6 +142,7 @@ int main(int argc, char *argv[])
                         fprintf (stderr, "Usage: %s [-n number_of_threads] [-v]\n", argv[0]);
                         fprintf (stderr, "[-l number_of_loops] ");
                         fprintf (stderr, "[-D DATAs absolute path]\n");
+			tst_rmdir();
                         exit (1);
                 }
         }
@@ -266,7 +270,8 @@ finished:
 		}
 
 	}
-	if (error) exit (1);
+	tst_rmdir();
+	if (error) exit(1);
 	else exit(0);
 	return 0;
 }
@@ -368,6 +373,7 @@ static void *handle_signals (void *arg)
 static void error (const char *msg, int line)
 {
         tst_resm(TFAIL, "ERROR [line: %d] %s", line, msg);
+	tst_rmdir();
         exit (-1);
 }
 
