1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group.                                               *
3  * Copyright by the Board of Trustees of the University of Illinois.         *
4  * All rights reserved.                                                      *
5  *                                                                           *
6  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
7  * terms governing use, modification, and redistribution, is contained in    *
8  * the COPYING file, which can be found at the root of the source code       *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.  *
10  * If you do not have access to either file, you may request a copy from     *
11  * help@hdfgroup.org.                                                        *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /*
15    FILE
16    testhdf5.c - HDF5 testing framework main file.
17 
18    REMARKS
19    General test wrapper for HDF5 base library test programs
20 
21    DESIGN
22    Each test function should be implemented as function having no
23    parameters and returning void (i.e. no return value).  They should be put
24    into the list of AddTest() calls in main() below.  Functions which depend
25    on other functionality should be placed below the AddTest() call for the
26    base functionality testing.
27    Each test module should include testhdf5.h and define a unique set of
28    names for test files they create.
29 
30    BUGS/LIMITATIONS
31 
32 
33  */
34 
35 /* ANY new test needs to have a prototype in testhdf5.h */
36 #include "testhdf5.h"
37 
38 int
main(int argc,char * argv[])39 main(int argc, char *argv[])
40 {
41     /* Initialize testing framework */
42     TestInit(argv[0], NULL, NULL);
43 
44     /* Tests are generally arranged from least to most complexity... */
45     AddTest("config", test_configure, cleanup_configure, "Configure definitions", NULL);
46     AddTest("metadata", test_metadata, cleanup_metadata, "Encoding/decoding metadata", NULL);
47     AddTest("checksum", test_checksum, cleanup_checksum, "Checksum algorithm", NULL);
48     AddTest("tst", test_tst, NULL,  "Ternary Search Trees", NULL);
49     AddTest("heap", test_heap, NULL,  "Memory Heaps", NULL);
50     AddTest("skiplist", test_skiplist, NULL,  "Skip Lists", NULL);
51     AddTest("refstr", test_refstr, NULL,  "Reference Counted Strings", NULL);
52     AddTest("file", test_file, cleanup_file, "Low-Level File I/O", NULL);
53     AddTest("objects", test_h5o, cleanup_h5o, "Generic Object Functions", NULL);
54     AddTest("h5s",  test_h5s,  cleanup_h5s,  "Dataspaces", NULL);
55     AddTest("coords",  test_coords,  cleanup_coords,  "Dataspace coordinates", NULL);
56     AddTest("sohm", test_sohm, cleanup_sohm,  "Shared Object Header Messages", NULL);
57     AddTest("attr", test_attr, cleanup_attr,  "Attributes", NULL);
58     AddTest("select", test_select, cleanup_select,  "Selections", NULL);
59     AddTest("time", test_time, cleanup_time,  "Time Datatypes", NULL);
60     AddTest("reference", test_reference, cleanup_reference,  "References", NULL);
61     AddTest("vltypes", test_vltypes, cleanup_vltypes,  "Variable-Length Datatypes", NULL);
62     AddTest("vlstrings", test_vlstrings, cleanup_vlstrings,  "Variable-Length Strings", NULL);
63     AddTest("iterate", test_iterate, cleanup_iterate,  "Group & Attribute Iteration", NULL);
64     AddTest("array", test_array, cleanup_array,  "Array Datatypes", NULL);
65     AddTest("genprop", test_genprop, cleanup_genprop,  "Generic Properties", NULL);
66     AddTest("unicode", test_unicode, cleanup_unicode,  "UTF-8 Encoding", NULL);
67     AddTest("id", test_ids, NULL,  "User-Created Identifiers", NULL);
68     AddTest("misc", test_misc, cleanup_misc,  "Miscellaneous", NULL);
69 
70     /* Display testing information */
71     TestInfo(argv[0]);
72 
73     /* Parse command line arguments */
74     TestParseCmdLine(argc,argv);
75 
76     /* Perform requested testing */
77     PerformTests();
78 
79     /* Display test summary, if requested */
80     if (GetTestSummary())
81         TestSummary();
82 
83     /* Clean up test files, if allowed */
84     if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP"))
85         TestCleanup();
86 
87     /* Release test infrastructure */
88     TestShutdown();
89 
90     /* Exit failure if errors encountered; else exit success. */
91     /* No need to print anything since PerformTests() already does. */
92     if (GetTestNumErrs() > 0)
93         HDexit(EXIT_FAILURE);
94     else
95         HDexit(EXIT_SUCCESS);
96 }   /* end main() */
97 
98