On Fri, 2008-04-25 at 12:31 +0530, Sridhar Vinay wrote:
> Hi,
>
> With regard to the discussion on the patch to the "float_bessel" testcase,
> I've prepared a patch for all the " float_* " testcases that resolves
> concurrency issues while running multiple instances of these.
Thanks Vinay. This seems to be a very good Patch. I would wait for
Renaud to comment on this, as, he has been working in the forefront of
LTP-concurrency fixes.
Meanwhile, does this patch also includes the last Patch you submitted
for float_bessel ? Or both are mutually exclusive ??
Regards--
Subrata
>
>
> (See attached file: float_all.patch)
>
> Rgds,
> Vinay
>
> --------------------------------------------------
> Vinay Sridhar,
> Linux Technology Centre,
> IBM India Systems & Technology Labs,
> Bangalore, India
> --------------------------------------------------
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss
> this year's exciting event. There's still time to save $100. Use priority
> code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
Signed-off by : Vinay Sridhar <[EMAIL PROTECTED]>
----------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-25 12:17:34.000000000 +0530
@@ -37,8 +37,6 @@
#include <sys/signal.h>
#include <math.h>
-
-
/*****************************************************************
* create file:
*
@@ -48,6 +46,8 @@
* RESULT_CREATE for output result file
*/
+#define BUFSIZE 256
+
int create_file(char *func_name, int NbVal)
{
pid_t myproc;
@@ -69,26 +69,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) + BUFSIZE);
+ 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+strlen(funct)-2,"%s","lgamma");
child=create_file(funct, 0);
waitpid(child,NULL,0);
diff -Nuarp ltp-full-20080331_old/testcases/misc/math/float/exp_log/genexp_log.c ltp-full-20080331/testcases/misc/math/float/exp_log/genexp_log.c
--- ltp-full-20080331_old/testcases/misc/math/float/exp_log/genexp_log.c 2008-03-31 12:55:08.000000000 +0530
+++ ltp-full-20080331/testcases/misc/math/float/exp_log/genexp_log.c 2008-04-25 12:18:41.000000000 +0530
@@ -37,7 +37,7 @@
#include <sys/signal.h>
#include <math.h>
-
+#define BUFSIZE 256
/*****************************************************************
* create file:
@@ -68,34 +68,37 @@ int create_file(char *func_name, int NbV
int main(int argc, char *argv[])
{
- char *funct;
+ char *funct,*ltproot;
pid_t child;
-
- funct = "./genexp";
+ ltproot = getenv("LTPROOT");
+ funct = malloc(strlen(ltproot) + BUFSIZE);
+ sprintf(funct,"%s",ltproot);
+
+ strcat(funct,"/testcases/misc/math/float/exp_log/genexp");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genlog";
+ sprintf(funct+strlen(funct)-3,"%s","log");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genlog10";
+ strcat(funct,"10");
child=create_file(funct, 0);
waitpid(child,NULL,0);
-
- funct = "./genfrexp";
+
+ sprintf(funct+strlen(funct)-5,"%s","frexp");
child=create_file(funct, 0);
waitpid(child,NULL,0);
-
- funct = "./genldexp";
+
+ sprintf(funct+strlen(funct)-5,"%s","ldexp");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genhypot";
+ sprintf(funct+strlen(funct)-5,"%s","hypot");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genmodf";
+ sprintf(funct+strlen(funct)-5,"%s","modf");
child=create_file(funct, 0);
waitpid(child,NULL,0);
diff -Nuarp ltp-full-20080331_old/testcases/misc/math/float/iperb/geniperb.c ltp-full-20080331/testcases/misc/math/float/iperb/geniperb.c
--- ltp-full-20080331_old/testcases/misc/math/float/iperb/geniperb.c 2008-03-31 12:55:08.000000000 +0530
+++ ltp-full-20080331/testcases/misc/math/float/iperb/geniperb.c 2008-04-25 12:19:33.000000000 +0530
@@ -37,7 +37,7 @@
#include <sys/signal.h>
#include <math.h>
-
+#define BUFSIZE 256
/*****************************************************************
* create file:
@@ -68,18 +68,21 @@ int create_file(char *func_name, int NbV
int main(int argc, char *argv[])
{
- char *funct;
+ char *funct,*ltproot;
pid_t child;
-
- funct = "./gencosh";
+ ltproot = getenv("LTPROOT");
+ funct = malloc(strlen(ltproot) + BUFSIZE);
+ sprintf(funct,"%s",ltproot);
+
+ strcat(funct,"/testcases/misc/math/float/iperb/gencosh");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./gensinh";
+ sprintf(funct+strlen(funct)-4,"%s","sinh");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./gentanh";
+ sprintf(funct+strlen(funct)-4,"%s","tanh");
child=create_file(funct, 0);
waitpid(child,NULL,0);
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-25 12:24:44.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);
}
}
@@ -150,6 +154,9 @@ int main(int argc, char *argv[])
else /*Parent*/
waitpid(pid,NULL,0);
+ getcwd(pwd,BUFSIZE);
+ strcpy(datadir,pwd);
+
if(debug)
tst_resm(TINFO, "%s: will run for %d loops", argv[0], num_loops);
@@ -266,7 +273,8 @@ finished:
}
}
- if (error) exit (1);
+ tst_rmdir();
+ if (error) exit(1);
else exit(0);
return 0;
}
@@ -368,6 +376,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);
}
diff -Nuarp ltp-full-20080331_old/testcases/misc/math/float/power/genpower.c ltp-full-20080331/testcases/misc/math/float/power/genpower.c
--- ltp-full-20080331_old/testcases/misc/math/float/power/genpower.c 2008-03-31 12:55:08.000000000 +0530
+++ ltp-full-20080331/testcases/misc/math/float/power/genpower.c 2008-04-25 12:20:26.000000000 +0530
@@ -37,7 +37,7 @@
#include <sys/signal.h>
#include <math.h>
-
+#define BUFSIZE 256
/*****************************************************************
* create file:
@@ -68,31 +68,33 @@ int create_file(char *func_name, int NbV
int main(int argc, char *argv[])
{
- char *funct;
+ char *funct, *ltproot;
pid_t child;
+ ltproot = getenv("LTPROOT");
+ funct = malloc(strlen(ltproot) + BUFSIZE);
+ sprintf(funct,"%s",ltproot);
-
- funct = "./genceil";
+ strcat(funct,"/testcases/misc/math/float/power/genceil");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genfabs";
+ sprintf(funct+strlen(funct)-4,"%s","fabs");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genfloor";
+ sprintf(funct+strlen(funct)-4,"%s","floor");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genfmod";
+ sprintf(funct+strlen(funct)-5,"%s","fmod");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genpow";
+ sprintf(funct+strlen(funct)-4,"%s","pow");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./gensqrt";
+ sprintf(funct+strlen(funct)-3,"%s","sqrt");
child=create_file(funct, 0);
waitpid(child,NULL,0);
diff -Nuarp ltp-full-20080331_old/testcases/misc/math/float/thread_code.c ltp-full-20080331/testcases/misc/math/float/thread_code.c
--- ltp-full-20080331_old/testcases/misc/math/float/thread_code.c 2008-03-31 12:55:08.000000000 +0530
+++ ltp-full-20080331/testcases/misc/math/float/thread_code.c 2008-04-25 12:09:49.000000000 +0530
@@ -46,6 +46,7 @@ static size_t read_file(char *fname, voi
int fd;
int maxretries = 1;
+
(void)sprintf(path, "%s/%s", datadir, fname);
errno = 0;
@@ -282,6 +283,7 @@ void * thread_code(void * arg)
double *din, *dex, *dex2 = (double *)0;
int imax, index;
+
fsize = read_file(th_data->th_func.din_fname, (void **)&din);
if(fsize == (size_t)0) {
sprintf(th_data->detail_data,
diff -Nuarp ltp-full-20080331_old/testcases/misc/math/float/trigo/gentrigo.c ltp-full-20080331/testcases/misc/math/float/trigo/gentrigo.c
--- ltp-full-20080331_old/testcases/misc/math/float/trigo/gentrigo.c 2008-03-31 12:55:08.000000000 +0530
+++ ltp-full-20080331/testcases/misc/math/float/trigo/gentrigo.c 2008-04-25 12:21:14.000000000 +0530
@@ -38,7 +38,7 @@
#include <math.h>
#define M_PIl 3.1415926535897932384626433832795029L L
-
+#define BUFSIZE 256
/*****************************************************************
* create file:
@@ -69,34 +69,37 @@ int create_file(char *func_name, int NbV
int main(int argc, char *argv[])
{
- char *funct;
+ char *funct, *ltproot;
pid_t child;
-
- funct = "./gencos";
+ ltproot = getenv("LTPROOT");
+ funct = malloc(strlen(ltproot) + BUFSIZE);
+ sprintf(funct,"%s",ltproot);
+
+ strcat(funct,"/testcases/misc/math/float/trigo/gencos");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./gensin";
+ sprintf(funct+strlen(funct)-3,"%s","sin");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./gentan";
+ sprintf(funct+strlen(funct)-3,"%s","tan");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genatan";
+ sprintf(funct+strlen(funct)-3,"%s","atan");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genatan2";
+ sprintf(funct+strlen(funct)-4,"%s","atan2");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genacos";
+ sprintf(funct+strlen(funct)-5,"%s","acos");
child=create_file(funct, 0);
waitpid(child,NULL,0);
- funct = "./genasin";
+ sprintf(funct+strlen(funct)-4,"%s","asin");
child=create_file(funct, 0);
waitpid(child,NULL,0);
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list