static int test_sec2(hid_t fapl) { char filename[1024]; fsizes_t testsize; testsize = supports_big(); if(testsize == NOFILE) { HDfprintf(stdout, "Test for sec2 is skipped because file system does not support big files.\n"); goto quit; } /* Test big file with the SEC2 driver */ HDputs("Testing big file with the SEC2 Driver "); h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if(writer(filename, fapl, testsize, WRT_N)) goto error; if(reader(filename, fapl)) goto error; HDputs("Test passed with the SEC2 Driver."); quit: /* End with normal return code */ /* Clean up the test file */ if(h5_cleanup(FILENAME, fapl)) HDremove(DNAME); return 0; error: HDputs("*** TEST FAILED ***"); return 1; } /* end test_sec2() */
static int test_stdio(hid_t fapl) { char filename[1024]; fsizes_t testsize; testsize = supports_big(); if(testsize == NOFILE) { HDfprintf(stdout, "Test for stdio is skipped because file system does not support big files.\n"); goto quit; } HDputs("\nTesting big file with the STDIO Driver "); h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if(writer(filename, fapl, testsize, WRT_N)) goto error; if(reader(filename, fapl)) goto error; HDputs("Test passed with the STDIO Driver."); /* Flush stdout at the end of this test routine to ensure later * output to stderr will not come out before it. */ quit: /* End with normal return code */ /* Clean up the test file */ if(h5_cleanup(FILENAME, fapl)) HDremove(DNAME); HDfflush(stdout); return 0; error: HDputs("*** TEST FAILED ***"); HDfflush(stdout); return 1; } /* end test_stdio() */
/*------------------------------------------------------------------------- * 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. * *------------------------------------------------------------------------- */ int main (int ac, char **av) { hid_t fapl=-1; hsize_t family_size; hsize_t family_size_def; /* default family file size */ double family_size_def_dbl; /* default family file size */ int cflag=1; /* check file system before test */ char filename[1024]; /* parameters setup */ family_size_def = FAMILY_SIZE; while (--ac > 0){ av++; if (strcmp("-fsize", *av)==0){ /* specify a different family file size */ ac--; av++; if (ac > 0){ family_size_def_dbl = atof(*av); H5_ASSIGN_OVERFLOW(family_size_def,family_size_def_dbl,double,hsize_t); if (family_size_def <= 0) family_size_def = (hsize_t)FAMILY_SIZE; } else{ printf("***Missing fsize value***\n"); usage(); return 1; } } else if (strcmp("-c", *av)==0){ /* turn off file system check before test */ cflag=0; } else if (strcmp("-h", *av)==0){ usage(); return 0; }else{ usage(); return 1; } } /* Reset library */ h5_reset(); fapl = h5_fileaccess(); /* Test big file with the family driver */ puts("Testing big file with the Family Driver "); if (H5FD_FAMILY!=H5Pget_driver(fapl)) { HDfprintf(stdout, "Changing file drivers to the family driver, %Hu bytes each\n", family_size_def); if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT)<0) goto error; } else if (H5Pget_fapl_family(fapl, &family_size, NULL)<0) { goto error; } else if (family_size!=family_size_def) { HDfprintf(stdout, "Changing family member size from %Hu to %Hu\n", family_size, family_size_def); if (H5Pset_fapl_family(fapl, family_size_def, H5P_DEFAULT)<0) goto error; } if (cflag){ /* * We shouldn't run this test if the file system doesn't support holes * because we would generate multi-gigabyte files. */ puts("Checking if file system is adequate for this test..."); if (sizeof(long_long)<8 || 0==GB8LL) { puts("Test skipped because sizeof(long_long) is too small. This"); puts("hardware apparently doesn't support 64-bit integer types."); usage(); goto quit; } if (!is_sparse()) { puts("Test skipped because file system does not support holes."); usage(); goto quit; } if (!enough_room(fapl)) { puts("Test skipped because of quota (file size or num open files)."); usage(); goto quit; } if (sizeof(hsize_t)<=4) { puts("Test skipped because the hdf5 library was configured with the"); puts("--disable-hsizet flag in order to work around a compiler bug."); usage(); goto quit; } } /* Do the test with the Family Driver */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if (writer(filename, fapl, WRT_N)) goto error; if (reader(filename, fapl)) goto error; puts("Test passed with the Family Driver."); /* * We shouldn't run this test if the file system doesn't support big files * because we would generate multi-gigabyte files. */ puts("\nChecking if file system supports big files..."); if (!supports_big()) { puts("Tests for sec2 and stdio are skipped because file system does not support big files."); usage(); goto quit; } /* Clean up the test file */ if (h5_cleanup(FILENAME, fapl)) remove(DNAME); /* Test big file with the SEC2 driver */ puts("Testing big file with the SEC2 Driver "); fapl = h5_fileaccess(); if(H5Pset_fapl_sec2(fapl)<0) HDmemset(filename, 0, sizeof(filename)); h5_fixname(FILENAME[2], fapl, filename, sizeof filename); if (writer(filename, fapl, WRT_N)) goto error; if (reader(filename, fapl)) goto error; puts("Test passed with the SEC2 Driver."); #ifdef H5_HAVE_FSEEKO /* Clean up the test file */ if (h5_cleanup(FILENAME, fapl)) remove(DNAME); /* Test big file with the STDIO driver only if fseeko is supported, * because the OFFSET parameter of fseek has the type LONG, not big * enough to support big files. */ puts("\nTesting big file with the STDIO Driver "); fapl = h5_fileaccess(); if(H5Pset_fapl_stdio(fapl)<0) HDmemset(filename, 0, sizeof(filename)); h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if (writer(filename, fapl, WRT_N)) goto error; if (reader(filename, fapl)) goto error; puts("Test passed with the STDIO Driver."); #endif quit: /* End with normal exit code */ if (h5_cleanup(FILENAME, fapl)) remove(DNAME); return 0; error: if (fapl>=0) H5Pclose(fapl); puts("*** TEST FAILED ***"); return 1; }