/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests the basic features of Virtual File Drivers * * Return: Success: 0 * Failure: 1 * * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 * *------------------------------------------------------------------------- */ int main(void) { int nerrors = 0; h5_reset(); printf("Testing basic Virtual File Driver functionality.\n"); nerrors += test_sec2() < 0 ? 1 : 0; nerrors += test_core() < 0 ? 1 : 0; nerrors += test_family() < 0 ? 1 : 0; nerrors += test_family_compat() < 0 ? 1 : 0; nerrors += test_multi() < 0 ? 1 : 0; nerrors += test_multi_compat() < 0 ? 1 : 0; nerrors += test_direct() < 0 ? 1 : 0; nerrors += test_log() < 0 ? 1 : 0; nerrors += test_stdio() < 0 ? 1 : 0; nerrors += test_windows() < 0 ? 1 : 0; if(nerrors) { printf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); return 1; } printf("All Virtual File Driver tests passed.\n"); return 0; }
int main (void) { res=0; #if defined __MINILIB_TEST__ res = test_ctype(); res = test_stdio(); res = test_stdlib(); res = test_string(); #endif for (;;); }
int main(void) { test_stdio(); acl::string path("test.eml"); acl::ifstream fp; if (fp.open_read(path) == false) { //if (fp.open(path.c_str(), O_RDWR, 0600) == false) { printf("open %s error(%s)\n", path.c_str(), acl_last_serror()); getchar(); return (-1); } acl::locker locker; if (locker.open(fp.file_handle()) == false) { printf("open %s's lock error\n", path.c_str()); getchar(); return (-1); } if (locker.lock() == true) printf("first lock %s ok\n", path.c_str()); else printf("first lock %s error(%s)\n", path.c_str(), acl_last_serror()); #ifndef WIN32 if (locker.lock() == true) printf("second lock %s ok\n", path.c_str()); else printf("second lock %s error(%s)\n", path.c_str(), acl_last_serror()); #endif acl::string buf; while (1) { if (fp.gets(buf, false) == false) break; printf("%s", buf.c_str()); } fp.close(); printf("enter any key to exit\r\n"); getchar(); return (0); }
int main(int argc, char *argv[]) { int rv; #ifdef ENABLE_XSTREAM_FILE rv = test_file(); if (rv < 0) { fprintf(stderr, "test_file() failed: %d\n", rv); } #endif /* ENABLE_XSTREAM_FILE */ #ifdef ENABLE_XSTREAM_STDIO rv = test_stdio(); if (rv < 0) { fprintf(stderr, "test_stdio() failed: %d\n", rv); } #endif /* ENABLE_XSTREAM_STDIO */ rv = test_xmembuf(); if (rv < 0) { fprintf(stderr, "test_mem() failed: %d\n", rv); } rv = test_xalloc(); if (rv < 0) { fprintf(stderr, "test_xalloc() failed: %d\n", rv); } rv = test_xprint(); if (rv < 0) { fprintf(stderr, "test_xsprintf() failed: %d\n", rv); } return 0; }
int main(int argc, char **argv) { if (argc > 1) { if (!strcmp(argv[1], "v")) { Verbose = 1; } else if (!strcmp(argv[1], "test-stdout")) { test_stdout(); return EXIT_SUCCESS; } if (!strcmp(argv[1], "test-atexit")) { test_atexit(); return EXIT_SUCCESS; } } test_mem(); test_str(); test_sprintf(); test_math(); test_proc(); test_stdio(); test_file(); test_exit(); return EXIT_FAILURE; }
/*------------------------------------------------------------------------- * Function: main * * Purpose: * * Return: Success: * * Failure: * * Programmer: Robb Matzke * Friday, April 10, 1998 * * Modifications: * Albert Cheng, 2002/03/28 * Added command option -fsize. * Albert Cheng, 2002/04/19 * Added command option -c. * * Raymond Lu, 2007/05/25 * Added similar tests for SEC2 and STDIO drivers. * *------------------------------------------------------------------------- */ int main (int ac, char **av) { unsigned long seed = 0; /* Random # seed */ hid_t fapl = -1; hid_t driver = -1; /* parameters setup */ while (--ac > 0){ av++; if (HDstrcmp("-fsize", *av)==0){ /* specify a different family file size */ ac--; av++; if (ac > 0) { family_size_def = (hsize_t)HDstrtoull(*av, NULL, 0); } else{ printf("***Missing fsize value***\n"); usage(); return 1; } } else if (HDstrcmp("-c", *av)==0){ /* turn off file system check before test */ cflag=0; } else if (HDstrcmp("-h", *av)==0){ usage(); return 0; }else{ usage(); return 1; } } /* check VFD to see if this is one we test */ if((fapl = h5_fileaccess()) < 0) goto error; if((driver = H5Pget_driver(fapl)) < 0) goto error; /* check sparse file support unless cflag is not set. */ if(cflag) sparse_support = is_sparse(); /* Choose random # seed */ seed = (unsigned long)HDtime(NULL); #ifdef QAK /* seed = (unsigned long)1155438845; */ HDfprintf(stderr, "Random # seed was: %lu\n", seed); #endif /* QAK */ HDsrandom(seed); /* run VFD-specific test */ if(H5FD_SEC2 == driver) { if(test_sec2(fapl) != 0) goto error; } else if(H5FD_STDIO == driver) { if(test_stdio(fapl) != 0) goto error; } else if(H5FD_FAMILY == driver) { if(test_family(fapl) != 0) goto error; } else HDputs("This VFD is not supported"); /* End with normal exit code */ /* fapls are cleaned up in the vfd test code */ return 0; error: HDputs("*** TEST FAILED ***"); if(fapl > 0) H5Pclose(fapl); return 1; }