void main() { test_one(); test_two(); test_three(); test_four(); test_five(); test_six(); }
int main(int argc, char *argv[]) { /*int retvalue;*/ if (system("./reply reply &> /dev/null") == -1) printf("system cmd failed\n"); sleep(1); if (test_one()) exit(1); if (test_two()) exit(1); /*retvalue = init_memshare("memtest", SHMEMSIEZ, QUEUESIZE);*/ data_register(data_callback); signal1_register(signal1_callback); signal2_register(signal2_callback); signal3_register(signal3_callback); sleep(2); if (test_three()) exit(1); if (test_four()) exit(1); if (test_five(LARGE_NUM)) exit(1); if (test_five(LARGER_NUM) != 0) exit(1); if (test_five(LARGE_NUM)) exit(1); if (test_six()) exit(1); test_seven(); data("reply", "exit\0", strlen("exit") + 1); return 0; }
void ut_FileReaderSimple::test_Driver() { string filename = ut_Directory + "ut_FileReaderSimple.out"; root.assign("c:\\temp\\ut_file_reader_simple"); ut_out.open(filename.c_str()); if (!ut_out){ ut_out << "Can not open file ..." << filename << endl; return; } ///----create the pending dir------ if (0 != f_File::mkdirRecursive(root)) { ut_out << "Can not create recursive dir: " << root << endl; return; }; ///----set configs------ ut_out << "\n========================================================\n"; ut_out << "\nCONFIGS\n"; ut_out << "\n========================================================\n"; if (this->initReader() != Success){ ut_out << "initReader initialization failed ..." << endl; } else { this->config.dump(ut_out); ut_out << "\n========================================================\n"; ut_out << "\nRunning tests ....\n"; ut_out << "\n========================================================\n"; test_one(); test_two(); test_three(); test_four(); test_five(); test_six(); test_seven(); test_eight(); } ut_out.close(); }
int main(int argc, char **argv) { int opt; int fd; int max_blocks = 0; char *endptr; unsigned int seed = 123; int reboot = 0; int direct_io = 0; long int test = 1; long int tmp; int ret = 0; int flags = O_RDWR|O_CREAT|O_TRUNC; if (argc < 2) usage(); fd = open("/dev/urandom", O_RDONLY); if (fd >= 0) { read(fd, &seed, sizeof(seed)); close(fd); } while ((opt = getopt(argc, argv, "s:rdt:")) != -1) { switch (opt) { case 's': tmp = strtol(optarg, &endptr, 10); if (tmp == LONG_MAX || endptr == optarg) usage(); seed = tmp; break; case 'r': reboot = 1; break; case 'd': direct_io = 1; break; case 't': test = strtol(optarg, &endptr, 10); if (test == LONG_MAX || endptr == optarg) usage(); break; default: usage(); } } if (optind >= argc) usage(); fname = argv[optind]; if (!fname) usage(); printf("Random seed is %u\n", seed); srandom(seed); if (direct_io) { flags |= O_DIRECT; ret = posix_memalign((void **)&buf, getpagesize(), 4096); if (ret) buf = NULL; } else { buf = malloc(4096); } if (!buf) { fprintf(stderr, "Error allocating buf: %d\n", errno); return 1; } test_fd = open(fname, flags, 0644); if (test_fd < 0) { fprintf(stderr, "Error opening file %d (%s)\n", errno, strerror(errno)); return 1; } switch (test) { case 1: ret = test_one(&max_blocks); break; case 2: ret = test_two(&max_blocks); break; case 3: ret = test_three(&max_blocks, 0, 0, 0, 0); break; case 4: ret = test_three(&max_blocks, 1, 0, 0, 0); break; case 5: ret = test_three(&max_blocks, 0, 1, 0, 0); break; case 6: ret = test_three(&max_blocks, 1, 1, 0, 0); break; case 7: ret = test_three(&max_blocks, 0, 0, 1, 0); break; case 8: ret = test_three(&max_blocks, 1, 0, 1, 0); break; case 9: ret = test_three(&max_blocks, 0, 1, 1, 0); break; case 10: ret = test_three(&max_blocks, 1, 1, 1, 0); break; case 11: ret = test_three(&max_blocks, 0, 0, 0, 1); break; case 12: ret = test_three(&max_blocks, 0, 1, 0, 1); break; case 13: ret = test_three(&max_blocks, 0, 0, 1, 1); break; case 14: ret = test_three(&max_blocks, 0, 1, 1, 1); break; case 15: ret = test_three(&max_blocks, 1, 0, 0, 1); break; case 16: ret = test_three(&max_blocks, 1, 1, 0, 1); break; case 17: ret = test_three(&max_blocks, 1, 0, 1, 1); break; case 18: ret = test_three(&max_blocks, 1, 1, 1, 1); break; case 19: ret = test_five(); break; case 20: ret = test_six(); break; case 21: /* * This is just a perf test, keep moving it down so it's always * the last test option. */ reboot = 0; ret = test_four(&max_blocks); goto out; default: usage(); } if (ret) goto out; if (fsync(test_fd)) { fprintf(stderr, "Fsync failed, test results will be invalid: " "%d\n", errno); return 1; } if (reboot) system("reboot -fn"); out: free(buf); close(test_fd); return ret; }
int main(int argc,char *argv[]) { static char *desc[] = { "testlr tests the PPPM and Ewald method for the", "long range electrostatics problem." }; static t_filenm fnm[] = { { efTPX, NULL, NULL, ffREAD }, { efHAT, "-g", "ghat", ffOPTRD }, { efOUT, "-o", "rho", ffOPTWR }, { efOUT, "-op", "lr-pb", ffOPTWR }, { efOUT, "-of", "lr-four", ffOPTWR }, { efOUT, "-opt", "tot-pb", ffOPTWR }, { efOUT, "-oft", "tot-four", ffOPTWR }, { efOUT, "-fin", "lr-four", ffOPTWR }, { efEPS, "-es", "sr", ffOPTWR }, { efEPS, "-elf", "lr-four", ffOPTWR }, { efEPS, "-etf", "tot-four", ffOPTWR }, { efEPS, "-qr", "qk-real", ffOPTWR }, { efEPS, "-qi", "qk-im", ffOPTWR }, { efEPS, "-elp", "lr-pb", ffOPTWR }, { efEPS, "-etp", "tot-pb", ffOPTWR }, { efEPS, "-rho", "rho", ffOPTWR }, { efEPS, "-qq", "charge", ffOPTWR }, { efXVG, "-gt", "gk-tab", ffOPTWR }, { efXVG, "-fcorr","fcorr", ffWRITE }, { efXVG, "-pcorr","pcorr", ffWRITE }, { efXVG, "-ftotcorr","ftotcorr", ffWRITE }, { efXVG, "-ptotcorr","ptotcorr", ffWRITE }, { efLOG, "-l", "fptest", ffWRITE }, { efXVG, "-gr", "spread", ffOPTWR }, { efPDB, "-pf", "pqr-four", ffOPTWR }, { efPDB, "-phitot", "pppm-phitot", ffOPTWR } }; #define NFILE asize(fnm) FILE *log; t_topology top; t_tpxheader stath; t_inputrec ir; t_block *excl; t_forcerec *fr; t_commrec *cr; t_mdatoms *mdatoms; t_graph *graph; int i,step,nre,natoms,nmol; rvec *x,*f_sr,*f_excl,*f_four,*f_pppm,*f_pois,box_size,hbox; matrix box; real t,lambda,vsr,*charge,*phi_f,*phi_pois,*phi_s,*phi_p3m,*rho; static bool bFour=FALSE,bVerbose=FALSE,bGGhat=FALSE,bPPPM=TRUE, bPoisson=FALSE,bOld=FALSE,bOldEwald=TRUE; static int nprocs = 1; static t_pargs pa[] = { { "-np", FALSE, etINT, &nprocs, "Do it in parallel" }, { "-ewald", FALSE, etBOOL, &bFour, "Do an Ewald solution"}, { "-pppm", FALSE, etBOOL, &bPPPM, "Do a PPPM solution" }, { "-poisson",FALSE, etBOOL, &bPoisson,"Do a Poisson solution" }, { "-v", FALSE, etBOOL, &bVerbose,"Verbose on"}, { "-ghat", FALSE, etBOOL, &bGGhat, "Generate Ghat function"}, { "-old", FALSE, etBOOL, &bOld, "Use old function types"}, { "-oldewald",FALSE,etBOOL, &bOldEwald,"Use old Ewald code"} }; CopyRight(stderr,argv[0]); parse_common_args(&argc,argv,PCA_CAN_TIME | PCA_CAN_VIEW, NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL); if (nprocs > 1) { cr = init_par(&argc,argv); open_log(ftp2fn(efLOG,NFILE,fnm),cr); log = stdlog; } else { cr = init_par(&argc,argv); log = ftp2FILE(efLOG,NFILE,fnm,"w"); stdlog = log; } /* Read topology and coordinates */ read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&stath,FALSE); snew(x,stath.natoms); snew(f_sr,stath.natoms); snew(f_excl,stath.natoms); snew(f_four,stath.natoms); snew(f_pppm,stath.natoms); snew(f_pois,stath.natoms); read_tpx(ftp2fn(efTPX,NFILE,fnm),&step,&t,&lambda,&ir, box,&natoms,x,NULL,NULL,&top); excl=&(top.atoms.excl); nmol=top.blocks[ebMOLS].nr; /* Allocate space for potential, charges and rho (charge density) */ snew(charge,stath.natoms); snew(phi_f,stath.natoms); snew(phi_p3m,stath.natoms); snew(phi_pois,stath.natoms); snew(phi_s,stath.natoms); snew(rho,stath.natoms); /* Set the charges */ for(i=0; (i<natoms); i++) charge[i]=top.atoms.atom[i].q; /* Make a simple box vector instead of tensor */ for(i=0; (i<DIM); i++) box_size[i]=box[i][i]; /* Set some constants */ fr = mk_forcerec(); mdatoms = atoms2md(&(top.atoms),FALSE,FALSE); set_LRconsts(log,ir.rcoulomb_switch,ir.rcoulomb,box_size,fr); init_forcerec(log,fr,&ir,&(top.blocks[ebMOLS]),cr, &(top.blocks[ebCGS]),&(top.idef),mdatoms,box,FALSE); calc_shifts(box,box_size,fr->shift_vec,FALSE); /* Periodicity stuff */ graph = mk_graph(&(top.idef),top.atoms.nr,FALSE,FALSE); shift_self(graph,fr->shift_vec,x); calc_LRcorrections(log,0,natoms,ir.rcoulomb_switch, ir.rcoulomb,charge,excl,x,f_excl,bOld); pr_f("f_excl.dat",natoms,f_excl); /* Compute the short range potential */ put_atoms_in_box(natoms,box,x); vsr=phi_sr(log,natoms,x,charge,ir.rcoulomb, ir.rcoulomb_switch,box_size,phi_s,excl,f_sr,bOld); pr_f("f_sr.dat",natoms,f_sr); /* Plot the short range potential in a matrix */ calc_ener(log,"Short Range",TRUE,nmol,natoms,phi_s,charge,excl); if (bFour) test_four(log,NFILE,fnm,&(top.atoms),&ir,x,f_four,box_size,charge,phi_f, phi_s,nmol,cr,bOld,bOldEwald); if (bPPPM) test_pppm(log,bVerbose,bGGhat,opt2fn("-g",NFILE,fnm), &(top.atoms),&ir,x,f_pppm,charge,box_size,phi_p3m,phi_s,nmol, cr,bOld,&(top.blocks[ebCGS])); if (bPoisson) test_poisson(log,bVerbose, &(top.atoms),&ir,x,f_pois,charge,box_size,phi_pois, phi_s,nmol,cr,bFour,f_four,phi_f,bOld); if (bPPPM && bFour) analyse_diff(log,"PPPM", top.atoms.nr,f_four,f_pppm,phi_f,phi_p3m,phi_s, opt2fn("-fcorr",NFILE,fnm), opt2fn("-pcorr",NFILE,fnm), opt2fn("-ftotcorr",NFILE,fnm), opt2fn("-ptotcorr",NFILE,fnm)); if (bPoisson && bFour) analyse_diff(log,"Poisson", top.atoms.nr,f_four,f_pois,phi_f,phi_pois,phi_s, opt2fn("-fcorr",NFILE,fnm), opt2fn("-pcorr",NFILE,fnm), opt2fn("-ftotcorr",NFILE,fnm), opt2fn("-ptotcorr",NFILE,fnm)); gmx_fio_fclose(log); thanx(stderr); return 0; }