Esempio n. 1
0
void Tests::Init(std::vector<TestInfo> &testlist)
{
	testlist.push_back(TestInfo("{}", &Tests::test_empty));
/*	testlist.push_back(TestInfo("{i++;}", &Tests::test_i_plus_plus));
	testlist.push_back(TestInfo("{float_value = (float) int_value;}", &Tests::test_int_to_float));
	testlist.push_back(TestInfo("{int_value = (int) float_value;}", &Tests::test_float_to_int));
	testlist.push_back(TestInfo("{double_value = (double) int_value;}", &Tests::test_int_to_double));
	testlist.push_back(TestInfo("{int_value = (int) double_value;}", &Tests::test_double_to_int));
	testlist.push_back(TestInfo("{int_value += int_sixteen + int_seven;}", &Tests::test_int_add));
	testlist.push_back(TestInfo("{int_value += int_sixteen * int_seven;}", &Tests::test_int_multiply));
	testlist.push_back(TestInfo("{int_value += int_sixteen / int_seven;}", &Tests::test_int_divide));
	testlist.push_back(TestInfo("{float_value += float_sixteen + float_seven;}", &Tests::test_float_add));
	testlist.push_back(TestInfo("{float_value += float_sixteen * float_seven;}", &Tests::test_float_multiply));
	testlist.push_back(TestInfo("{float_value += float_sixteen / float_seven;}", &Tests::test_float_divide));
	testlist.push_back(TestInfo("{double_value += double_sixteen + double_seven;}", &Tests::test_double_add));
	testlist.push_back(TestInfo("{double_value += double_sixteen * double_seven;}", &Tests::test_double_multiply));
	testlist.push_back(TestInfo("{double_value += double_sixteen / double_seven;}", &Tests::test_double_divide));
	testlist.push_back(TestInfo("{string = std::string();}", &Tests::test_create_string));
	testlist.push_back(TestInfo("{char_value = string[0]}", &Tests::test_string_index));
	testlist.push_back(TestInfo("{char_value = string.cstr()[0]}", &Tests::test_string_cstr_index));
	testlist.push_back(TestInfo("{char_value = char_array[0];}", &Tests::test_char_array_index));
	testlist.push_back(TestInfo("{for (int cnt=0; cnt<sixteen; cnt++) char_value += string2[cnt];}", &Tests::test_string_multi_index));
	testlist.push_back(TestInfo("{for (int cnt=0; cnt<sixteen; cnt++) char_value += char_array[cnt];}", &Tests::test_char_array_multi_index));

	testlist.push_back(TestInfo("{string = \"123456789012345\";}", &Tests::test_create_string_from_15chars));
	testlist.push_back(TestInfo("{string = std::string(\"123456789012345\");}", &Tests::test_create_new_string_from_15chars));
	testlist.push_back(TestInfo("{string.assign(\"123456789012345\");}", &Tests::test_assign_string_from_15chars));
	testlist.push_back(TestInfo("{string = \"123456789012345678901234567890123456789\";}", &Tests::test_create_string_from_39chars));
	testlist.push_back(TestInfo("{string = std::string(\"123456789012345678901234567890123456789\");}", &Tests::test_create_new_string_from_39chars));
	testlist.push_back(TestInfo("{string.assign(\"123456789012345678901234567890123456789\");}", &Tests::test_assign_string_from_39chars));

	testlist.push_back(TestInfo("{int_value += *int_ptr;}", &Tests::test_pointer_index));
	testlist.push_back(TestInfo("{int_value += *int_shared_ptr;}", &Tests::test_shared_index));

	testlist.push_back(TestInfo("{for (size_t cnt=0; cnt<std_vector_int_size16.size(); cnt++) { int_value +=  std_vector_int_size16[cnt]; }}", &Tests::test_size1_vector));
	testlist.push_back(TestInfo("{for (size_t cnt=0, max = std_vector_int_size16.size(); cnt<max; cnt++) { int_value +=  std_vector_int_size16[cnt]; }}", &Tests::test_size2_vector));

	testlist.push_back(TestInfo("{for (auto it = std_vector_int_size16.begin(); it != std_vector_int_size16.end(); ++it) { int_value += *it; }}", &Tests::test_size3_vector));
	testlist.push_back(TestInfo("{for (auto it = std_vector_int_size16.begin(); it != std_vector_int_size16.end(); it++) { int_value += *it; }}", &Tests::test_size4_vector));

	testlist.push_back(TestInfo("{utils.function();}    : void function() {}", &Tests::test_calling_empty));
	testlist.push_back(TestInfo("{int_value = utils.function();}    : int function() {return five;}", &Tests::test_return_int));
	testlist.push_back(TestInfo("{string = utils.function();}    : std::string function() {return string_hello_world;}", &Tests::test_return_string_v1));
	testlist.push_back(TestInfo("{string = utils.function();}    : std::string &function() {return string_hello_world;}", &Tests::test_return_string_v2));
	testlist.push_back(TestInfo("{string = utils.function();}    : std::string function() {return \"hello world\";}", &Tests::test_return_string_v3));
	testlist.push_back(TestInfo("{utils.function(string);}    : void function(std::string &out_string) {out_string = string_hello_world;}", &Tests::test_get_string));
*/
	testlist.push_back(TestInfo("{int_value += utils.function(\"~15chars~\");}    : int function(const std::string &s) {return s.length();}", &Tests::test_string_v8));
	testlist.push_back(TestInfo("{int_value += utils.function(string_15);}    : int function(const std::string &s) {return s.length();}", &Tests::test_string_v8b));

}
Esempio n. 2
0
/**
 * Interface to CTestList-derived classes for getting all information about the next test to be run.
 *
 * @return
 * Returns a pointer to a CTestInfo object containing all available information about the next test.
 */
CTestInfo*
CWineTest::GetNextTestInfo()
{
    while(!m_CurrentFile.empty() || GetNextFile())
    {
        try
        {
            while(GetNextTest())
            {
                /* If the user specified a test through the command line, check this here */
                if(!Configuration.GetTest().empty() && Configuration.GetTest() != m_CurrentTest)
                    continue;

                {
                    auto_ptr<CTestInfo> TestInfo(new CTestInfo());
                    size_t UnderscorePosition;

                    /* Build the command line */
                    TestInfo->CommandLine = m_TestPath;
                    TestInfo->CommandLine += m_CurrentFile;
                    TestInfo->CommandLine += ' ';
                    TestInfo->CommandLine += AsciiToUnicode(m_CurrentTest);

                    /* Store the Module name */
                    UnderscorePosition = m_CurrentFile.find_last_of('_');

                    if(UnderscorePosition == m_CurrentFile.npos)
                    {
                        stringstream ss;

                        ss << "Invalid test file name: " << UnicodeToAscii(m_CurrentFile) << endl;
                        SSEXCEPTION;
                    }

                    TestInfo->Module = UnicodeToAscii(m_CurrentFile.substr(0, UnderscorePosition));

                    /* Store the test */
                    TestInfo->Test = m_CurrentTest;

                    return TestInfo.release();
                }
            }
        }
        catch(CTestException& e)
        {
            stringstream ss;

            ss << "An exception occurred trying to list tests for: " << UnicodeToAscii(m_CurrentFile) << endl;
            StringOut(ss.str());
            StringOut(e.GetMessage());
            StringOut("\n");
            m_CurrentFile.clear();
            delete[] m_ListBuffer;
        }
    }

    return NULL;
}
Esempio n. 3
0
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() */
Esempio n. 4
0
	void
	CollectorOutput::test_start(const string& name)
	{
		_cur_suite->_tests.push_back(TestInfo(name));
		_cur_test = &_cur_suite->_tests.back();
	}
int main(int argc, char **argv)
{
    int mpi_size, mpi_rank;				/* mpi variables */
    H5Ptest_param_t ndsets_params, ngroups_params;
    H5Ptest_param_t collngroups_params;
    H5Ptest_param_t io_mode_confusion_params;

    /* Un-buffer the stdout and stderr */
    setbuf(stderr, NULL);
    setbuf(stdout, NULL);

    MPI_Init(&argc, &argv);
    MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
    MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);

    dim0 = ROW_FACTOR*mpi_size;
    dim1 = COL_FACTOR*mpi_size;

    if (MAINPROCESS) {
        printf("===================================\n");
        printf("PHDF5 TESTS START\n");
        printf("===================================\n");
    }
    H5open();
    h5_show_hostname();

    /* Initialize testing framework */
    TestInit(argv[0], usage, parse_options);

    /* Tests are generally arranged from least to most complexity... */
    AddTest("mpiodup", test_fapl_mpio_dup, NULL,
            "fapl_mpio duplicate", NULL);
    AddTest("posixdup", test_fapl_mpiposix_dup, NULL,
            "fapl_mpiposix duplicate", NULL);

    AddTest("split", test_split_comm_access, NULL,
            "dataset using split communicators", PARATESTFILE);

    AddTest("idsetw", dataset_writeInd, NULL,
            "dataset independent write", PARATESTFILE);
    AddTest("idsetr", dataset_readInd, NULL,
            "dataset independent read", PARATESTFILE);

    AddTest("cdsetw", dataset_writeAll, NULL,
            "dataset collective write", PARATESTFILE);
    AddTest("cdsetr", dataset_readAll, NULL,
            "dataset collective read", PARATESTFILE);

    AddTest("eidsetw", extend_writeInd, NULL,
            "extendible dataset independent write", PARATESTFILE);
    AddTest("eidsetr", extend_readInd, NULL,
            "extendible dataset independent read", PARATESTFILE);
    AddTest("ecdsetw", extend_writeAll, NULL,
            "extendible dataset collective write", PARATESTFILE);
    AddTest("ecdsetr", extend_readAll, NULL,
            "extendible dataset collective read", PARATESTFILE);
    AddTest("eidsetw2", extend_writeInd2, NULL,
            "extendible dataset independent write #2", PARATESTFILE);
    AddTest("selnone", none_selection_chunk, NULL,
            "chunked dataset with none-selection", PARATESTFILE);
    AddTest("calloc", test_chunk_alloc, NULL,
            "parallel extend Chunked allocation on serial file", PARATESTFILE);
    AddTest("fltread", test_filter_read, NULL,
            "parallel read of dataset written serially with filters", PARATESTFILE);

#ifdef H5_HAVE_FILTER_DEFLATE
    AddTest("cmpdsetr", compress_readAll, NULL,
            "compressed dataset collective read", PARATESTFILE);
#endif /* H5_HAVE_FILTER_DEFLATE */

    ndsets_params.name = PARATESTFILE;
    ndsets_params.count = ndatasets;
    AddTest("ndsetw", multiple_dset_write, NULL,
            "multiple datasets write", &ndsets_params);

    ngroups_params.name = PARATESTFILE;
    ngroups_params.count = ngroups;
    AddTest("ngrpw", multiple_group_write, NULL,
            "multiple groups write", &ngroups_params);
    AddTest("ngrpr", multiple_group_read, NULL,
            "multiple groups read", &ngroups_params);

    AddTest("compact", compact_dataset, NULL,
            "compact dataset test", PARATESTFILE);

    collngroups_params.name = PARATESTFILE;
    collngroups_params.count = ngroups;
    AddTest("cngrpw", collective_group_write, NULL,
            "collective group and dataset write", &collngroups_params);
    AddTest("ingrpr", independent_group_read, NULL,
            "independent group and dataset read", &collngroups_params);
    AddTest("bigdset", big_dataset, NULL,
            "big dataset test", PARATESTFILE);
    AddTest("fill", dataset_fillvalue, NULL,
            "dataset fill value", PARATESTFILE);

    AddTest("cchunk1",
            coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE);
    AddTest("cchunk2",
            coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE);
    AddTest("cchunk3",
            coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE);
    AddTest("cchunk4",
            coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE);

    if((mpi_size < 3)&& MAINPROCESS ) {
        printf("Collective chunk IO optimization APIs ");
        printf("needs at least 3 processes to participate\n");
        printf("Collective chunk IO API tests will be skipped \n");
    }
    AddTest((mpi_size <3)? "-cchunk5":"cchunk5" ,
            coll_chunk5,NULL,
            "linked chunk collective IO without optimization",PARATESTFILE);
    AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6",
            coll_chunk6,NULL,
            "multi-chunk collective IO without optimization",PARATESTFILE);
    AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7",
            coll_chunk7,NULL,
            "linked chunk collective IO with optimization",PARATESTFILE);
    AddTest((mpi_size < 3)? "-cchunk8" : "cchunk8",
            coll_chunk8,NULL,
            "linked chunk collective IO transferring to multi-chunk",PARATESTFILE);
    AddTest((mpi_size < 3)? "-cchunk9" : "cchunk9",
            coll_chunk9,NULL,
            "multiple chunk collective IO with optimization",PARATESTFILE);
    AddTest((mpi_size < 3)? "-cchunk10" : "cchunk10",
            coll_chunk10,NULL,
            "multiple chunk collective IO transferring to independent IO",PARATESTFILE);



    /* irregular collective IO tests*/
    AddTest("ccontw",
            coll_irregular_cont_write,NULL,
            "collective irregular contiguous write",PARATESTFILE);
    AddTest("ccontr",
            coll_irregular_cont_read,NULL,
            "collective irregular contiguous read",PARATESTFILE);
    AddTest("cschunkw",
            coll_irregular_simple_chunk_write,NULL,
            "collective irregular simple chunk write",PARATESTFILE);
    AddTest("cschunkr",
            coll_irregular_simple_chunk_read,NULL,
            "collective irregular simple chunk read",PARATESTFILE);
    AddTest("ccchunkw",
            coll_irregular_complex_chunk_write,NULL,
            "collective irregular complex chunk write",PARATESTFILE);
    AddTest("ccchunkr",
            coll_irregular_complex_chunk_read,NULL,
            "collective irregular complex chunk read",PARATESTFILE);


#if 0
    if((mpi_size > 3) && MAINPROCESS) {
        printf("Collective irregular chunk IO tests haven't been tested \n");
        printf("  for the number of process greater than 3.\n");
        printf("Please try with the number of process \n");
        printf("  no greater than 3 for collective irregular chunk IO test.\n");
        printf("Collective irregular chunk tests will be skipped \n");
    }
    AddTest((mpi_size > 3) ? "-ccontw" : "ccontw",
            coll_irregular_cont_write,NULL,
            "collective irregular contiguous write",PARATESTFILE);
    AddTest((mpi_size > 3) ? "-ccontr" : "ccontr",
            coll_irregular_cont_read,NULL,
            "collective irregular contiguous read",PARATESTFILE);
    AddTest((mpi_size > 3) ? "-cschunkw" : "cschunkw",
            coll_irregular_simple_chunk_write,NULL,
            "collective irregular simple chunk write",PARATESTFILE);
    AddTest((mpi_size > 3) ? "-cschunkr" : "cschunkr",
            coll_irregular_simple_chunk_read,NULL,
            "collective irregular simple chunk read",PARATESTFILE);
    AddTest((mpi_size > 3) ? "-ccchunkw" : "ccchunkw",
            coll_irregular_complex_chunk_write,NULL,
            "collective irregular complex chunk write",PARATESTFILE);
    AddTest((mpi_size > 3) ? "-ccchunkr" : "ccchunkr",
            coll_irregular_complex_chunk_read,NULL,
            "collective irregular complex chunk read",PARATESTFILE);
#endif


    AddTest("null", null_dataset, NULL,
            "null dataset test", PARATESTFILE);

    io_mode_confusion_params.name  = PARATESTFILE;
    io_mode_confusion_params.count = 0; /* value not used */

    AddTest("I/Omodeconf", io_mode_confusion, NULL,
            "I/O mode confusion test -- hangs quickly on failure",
            &io_mode_confusion_params);

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

    /* setup file access property list */
    fapl = H5Pcreate (H5P_FILE_ACCESS);
    H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);

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

    if (facc_type == FACC_MPIPOSIX && MAINPROCESS) {
        printf("===================================\n"
               "   Using MPIPOSIX driver\n"
               "===================================\n");
    }

    if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS) {
        printf("===================================\n"
               "   Using Independent I/O with file set view to replace collective I/O \n"
               "===================================\n");
    }


    /* Perform requested testing */
    PerformTests();

    /* make sure all processes are finished before final report, cleanup
     * and exit.
     */
    MPI_Barrier(MPI_COMM_WORLD);

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

    /* Clean up test files */
    h5_cleanup(FILENAME, fapl);

    nerrors += GetTestNumErrs();

    /* Gather errors from all processes */
    {
        int temp;
        MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
        nerrors=temp;
    }

    if (MAINPROCESS) {		/* only process 0 reports */
        printf("===================================\n");
        if (nerrors)
            printf("***PHDF5 tests detected %d errors***\n", nerrors);
        else
            printf("PHDF5 tests finished with no errors\n");
        printf("===================================\n");
    }
    /* close HDF5 library */
    H5close();

    /* MPI_Finalize must be called AFTER H5close which may use MPI calls */
    MPI_Finalize();

    /* cannot just return (nerrors) because exit code is limited to 1byte */
    return(nerrors!=0);
}