コード例 #1
0
ファイル: h5test.c プロジェクト: Hulalazz/rnnlib
/*-------------------------------------------------------------------------
 * Function:  h5_cleanup
 *
 * Purpose:  Cleanup temporary test files.
 *    base_name contains the list of test file names.
 *    The file access property list is also closed.
 *
 * Return:  Non-zero if cleanup actions were performed; zero otherwise.
 *
 * Programmer:  Albert Cheng
 *              May 28, 1998
 *
 *-------------------------------------------------------------------------
 */
int
h5_cleanup(const char *base_name[], hid_t fapl)
{
    int    retval = 0;

    if(GetTestCleanup()) {
        int i;

        for(i = 0; base_name[i]; i++) {
            char filename[1024];
            char temp[2048];
            hid_t driver;

            if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename)))
                continue;

            driver = H5Pget_driver(fapl);

            if(driver == H5FD_FAMILY) {
                int j;

                for(j = 0; /*void*/; j++) {
                    HDsnprintf(temp, sizeof temp, filename, j);

                    if(HDaccess(temp, F_OK) < 0)
                        break;

                    HDremove(temp);
                } /* end for */
            } else if(driver == H5FD_CORE) {
                hbool_t backing;        /* Whether the core file has backing store */

                H5Pget_fapl_core(fapl, NULL, &backing);

                /* If the file was stored to disk with bacing store, remove it */
                if(backing)
                    HDremove(filename);
            } else if (driver == H5FD_MULTI) {
                H5FD_mem_t mt;

                HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);

                for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
                    HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]);
                    HDremove(temp); /*don't care if it fails*/
                } /* end for */
            } else {
                HDremove(filename);
            }
        } /* end for */

        retval = 1;
    } /* end if */

    H5Pclose(fapl);
    return retval;
}
コード例 #2
0
ファイル: h5test.c プロジェクト: zlongshen/hdf5
/*-------------------------------------------------------------------------
 * Function:  h5_cleanup
 *
 * Purpose:  Cleanup temporary test files.
 *    base_name contains the list of test file names.
 *    The file access property list is also closed.
 *
 * Return:  Non-zero if cleanup actions were performed; zero otherwise.
 *
 * Programmer:  Albert Cheng
 *              May 28, 1998
 *
 *-------------------------------------------------------------------------
 */
int
h5_cleanup(const char *base_name[], hid_t fapl)
{
    int    retval = 0;

    if(GetTestCleanup()) {
        /* Clean up files in base_name, and the FAPL */
        h5_clean_files(base_name, fapl);

        retval = 1;
    } /* end if */

    /* Restore the original error reporting routine */
    h5_restore_err();

    return retval;
} /* end h5_cleanup() */
コード例 #3
0
ファイル: testhdf5.c プロジェクト: MattNapsAlot/rHDF5
int
main(int argc, char *argv[])
{
    /* Initialize testing framework */
    TestInit(argv[0], NULL, NULL);

    /* Tests are generally arranged from least to most complexity... */
    AddTest("config", test_configure, cleanup_configure, "Configure definitions", NULL);
    AddTest("metadata", test_metadata, cleanup_metadata, "Encode/decode metadata code", NULL);
    AddTest("tst", test_tst, NULL,  "Ternary Search Trees", NULL);
    AddTest("heap", test_heap, NULL,  "Memory Heaps", NULL);
    AddTest("skiplist", test_skiplist, NULL,  "Skip Lists", NULL);
    AddTest("refstr", test_refstr, NULL,  "Reference Counted Strings", NULL);
    AddTest("file", test_file, cleanup_file, "Low-Level File I/O", NULL);
    AddTest("h5s",  test_h5s,  cleanup_h5s,  "Dataspaces", NULL);
    AddTest("coords",  test_coords,  cleanup_coords,  "Dataspace coordinates", NULL);
    AddTest("attr", test_attr, cleanup_attr,  "Attributes", NULL);
    AddTest("select", test_select, cleanup_select,  "Selections", NULL);
    AddTest("time", test_time, cleanup_time,  "Time Datatypes", NULL);
    AddTest("reference", test_reference, cleanup_reference,  "References", NULL);
    AddTest("vltypes", test_vltypes, cleanup_vltypes,  "Variable-Length Datatypes", NULL);
    AddTest("vlstrings", test_vlstrings, cleanup_vlstrings,  "Variable-Length Strings", NULL);
    AddTest("iterate", test_iterate, cleanup_iterate,  "Group & Attribute Iteration", NULL);
    AddTest("array", test_array, cleanup_array,  "Array Datatypes", NULL);
    AddTest("genprop", test_genprop, cleanup_genprop,  "Generic Properties", NULL);
    AddTest("misc", test_misc, cleanup_misc,  "Miscellaneous", NULL);

    /* Display testing information */
    TestInfo(argv[0]);

    /* Parse command line arguments */
    TestParseCmdLine(argc,argv);

    /* Perform requested testing */
    PerformTests();

    /* Display test summary, if requested */
    if (GetTestSummary())
        TestSummary();

    /* Clean up test files, if allowed */
    if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
        TestCleanup();

    return (GetTestNumErrs());
}                               /* end main() */