From: Subrata <sub...@us...> - 2008-04-29 08:53:11
|
Update of /cvsroot/ltp/ltp/testcases/misc/math/float/power In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5239/ltp/testcases/misc/math/float/power Modified Files: genpower.c Log Message: The float_bessel testcases, as a matter of fact, all float_* testcases seem to fail when multiple instances are run concurrently. The failures occur because file sizes don't match or because the number of bytes read don't match the file size. This can be attributed to the parallel instance reading a file before the write to it (by another instance) has completed. In such situations, either the file size has not been updated in the inode header or the file size has been updated but the file's write operation has not been updated completely. To fix this concurrency problem, my suggestion is to check for an existing instance and wait for it to finish before beginning the current instance. Any other concurrency resolution technique may complicate matters. A message to the console indicating such a decision might be added. By Sridhar Vinay <vin...@in...> & Renaud Lottiaux <Ren...@ke...>. Index: genpower.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/misc/math/float/power/genpower.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** genpower.c 4 Dec 2002 21:45:04 -0000 1.1 --- genpower.c 29 Apr 2008 08:52:59 -0000 1.2 *************** *** 38,42 **** #include <math.h> ! /***************************************************************** --- 38,42 ---- #include <math.h> ! #define MAX_FNAME_LEN 16 /***************************************************************** *************** *** 69,97 **** int main(int argc, char *argv[]) { ! char *funct; pid_t child; ! ! funct = "./genceil"; child=create_file(funct, 0); waitpid(child,NULL,0); ! funct = "./genfabs"; child=create_file(funct, 0); waitpid(child,NULL,0); ! funct = "./genfloor"; child=create_file(funct, 0); waitpid(child,NULL,0); ! funct = "./genfmod"; child=create_file(funct, 0); waitpid(child,NULL,0); ! funct = "./genpow"; child=create_file(funct, 0); waitpid(child,NULL,0); ! funct = "./gensqrt"; child=create_file(funct, 0); waitpid(child,NULL,0); --- 69,104 ---- int main(int argc, char *argv[]) { ! char *funct, *bin_path; pid_t child; ! if (argc != 2){ ! printf ("ERROR: need the path to generation binaries\n"); ! abort(); ! } ! ! bin_path = argv[1]; ! ! funct = malloc (strlen (bin_path) + MAX_FNAME_LEN); ! sprintf (funct, "%s/genceil", bin_path); child=create_file(funct, 0); waitpid(child,NULL,0); ! sprintf (funct, "%s/genfabs", bin_path); child=create_file(funct, 0); waitpid(child,NULL,0); ! sprintf (funct, "%s/genfloor", bin_path); child=create_file(funct, 0); waitpid(child,NULL,0); ! sprintf (funct, "%s/genfmod", bin_path); child=create_file(funct, 0); waitpid(child,NULL,0); ! sprintf (funct, "%s/genpow", bin_path); child=create_file(funct, 0); waitpid(child,NULL,0); ! sprintf (funct, "%s/gensqrt", bin_path); child=create_file(funct, 0); waitpid(child,NULL,0); |