diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2019-08-19 23:35:55 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2019-08-20 01:02:47 (GMT) |
commit | 8c40dab59eaef1dea92df91a9d877edf3ce565d0 (patch) | |
tree | 4c4aa9d824f2229f332aa09dd32eb0b465fadca9 /test | |
parent | 8b6f3bc7e63ad0a44abc434da9f427e8cd84bad8 (diff) | |
download | hdf5-8c40dab59eaef1dea92df91a9d877edf3ce565d0.zip hdf5-8c40dab59eaef1dea92df91a9d877edf3ce565d0.tar.gz hdf5-8c40dab59eaef1dea92df91a9d877edf3ce565d0.tar.bz2 |
Untangle #ifdef mess in ROS3 code.
Diffstat (limited to 'test')
-rw-r--r-- | test/ros3.c | 151 | ||||
-rw-r--r-- | test/s3comms.c | 76 | ||||
-rw-r--r-- | test/vfd.c | 68 |
3 files changed, 56 insertions, 239 deletions
diff --git a/test/ros3.c b/test/ros3.c index 7a12a8d..73b6ac2 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -30,10 +30,9 @@ #include "H5FDros3.h" /* this file driver's utilities */ #include "H5FDs3comms.h" /* for loading of credentials */ - +#ifdef H5_HAVE_ROS3_VFD /* only include the testing macros if needed */ -#ifdef H5_HAVE_ROS3_VFD /***************************************************************************** * @@ -371,14 +370,10 @@ if (strcmp((actual), (expected)) != 0) { \ #endif /* ifdef/else JSVERIFY_EXP_ACT */ -#endif /* H5_HAVE_ROS3_VFD */ - /******************************** * OTHER MACROS AND DEFINITIONS * ********************************/ -#ifdef H5_HAVE_ROS3_VFD - #define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) #define S3_TEST_PROFILE_NAME "ros3_vfd_test" @@ -408,16 +403,15 @@ static char s3_test_aws_access_key_id[64]; static char s3_test_aws_secret_access_key[128]; H5FD_ros3_fapl_t restricted_access_fa = { - H5FD__CURR_ROS3_FAPL_T_VERSION, /* fapl version */ + H5FD_CURR_ROS3_FAPL_T_VERSION, /* fapl version */ TRUE, /* authenticate */ "", /* aws region */ "", /* access key id */ ""}; /* secret access key */ H5FD_ros3_fapl_t anonymous_fa = { - H5FD__CURR_ROS3_FAPL_T_VERSION, + H5FD_CURR_ROS3_FAPL_T_VERSION, FALSE, "", "", "" }; -#endif /* H5_HAVE_ROS3_VFD */ /*--------------------------------------------------------------------------- @@ -437,21 +431,11 @@ H5FD_ros3_fapl_t anonymous_fa = { * Programmer: Jacob Smith * 2017-10-23 * - * Changes: None. - * *--------------------------------------------------------------------------- */ static int test_fapl_config_validation(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 fapl configuration validation"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3_VFD defined */ /********************* * test-local macros * @@ -483,7 +467,7 @@ test_fapl_config_validation(void) struct testcase cases_arr[] = { { "non-authenticating config allows empties.\n", SUCCEED, - { H5FD__CURR_ROS3_FAPL_T_VERSION, /* version */ + { H5FD_CURR_ROS3_FAPL_T_VERSION, /* version */ FALSE, /* authenticate */ "", /* aws_region */ "", /* secret_id */ @@ -492,7 +476,7 @@ test_fapl_config_validation(void) }, { "authenticating config asks for populated strings.\n", FAIL, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, TRUE, "", "", @@ -501,7 +485,7 @@ test_fapl_config_validation(void) }, { "populated strings; key is the empty string?\n", SUCCEED, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, TRUE, "region", "me", @@ -510,7 +494,7 @@ test_fapl_config_validation(void) }, { "id cannot be empty.\n", FAIL, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, TRUE, "", "me", @@ -519,7 +503,7 @@ test_fapl_config_validation(void) }, { "region cannot be empty.\n", FAIL, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, TRUE, "where", "", @@ -528,7 +512,7 @@ test_fapl_config_validation(void) }, { "all strings populated.\n", SUCCEED, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, TRUE, "where", "who", @@ -547,7 +531,7 @@ test_fapl_config_validation(void) { "non-authenticating config cares not for (de)population" "of strings.\n", SUCCEED, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, FALSE, "someregion", "someid", @@ -603,7 +587,7 @@ test_fapl_config_validation(void) H5Pget_fapl_ros3(fapl_id, &fa_fetch), "unable to get fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa_fetch.version, "invalid version number" ) JSVERIFY( config.version, @@ -646,8 +630,6 @@ error: } H5E_END_TRY; } return 1; -#endif /* H5_HAVE_ROS3_VFD */ - } /* test_fapl_config_validation */ @@ -670,23 +652,11 @@ error: * Programmer: John Mainzer * 7/12/17 * - * Changes: Test only fapl and flags. - * Jacob Smith 2017 - * *------------------------------------------------------------------------- */ static int test_ros3_fapl(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 fapl "); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3 defined */ - /************************ * test-local variables * ************************/ @@ -695,7 +665,7 @@ test_ros3_fapl(void) hid_t driver_id = -1; /* ID for this VFD */ unsigned long driver_flags = 0; /* VFD feature flags */ H5FD_ros3_fapl_t ros3_fa_0 = { - H5FD__CURR_ROS3_FAPL_T_VERSION, /* version */ + H5FD_CURR_ROS3_FAPL_T_VERSION, /* version */ FALSE, /* authenticate */ "", /* aws_region */ "", /* secret_id */ @@ -737,7 +707,6 @@ error: } H5E_END_TRY; return 1; -#endif /* H5_HAVE_ROS3_VFD */ } /* test_ros3_fapl() */ @@ -763,14 +732,6 @@ error: static int test_vfd_open(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 VFD-level open"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3_VFD defined */ /********************* * test-local macros * @@ -967,8 +928,6 @@ error: #undef FAPL_H5P_DEFAULT #undef FAPL_ROS3_ANON -#endif /* H5_HAVE_ROS3_VFD */ - } /* test_vfd_open */ @@ -993,14 +952,6 @@ error: static int test_eof_eoa(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 eof/eoa gets and sets"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3_VFD defined */ /********************* * test-local macros * @@ -1119,7 +1070,6 @@ error: } return 1; -#endif /* H5_HAVE_ROS3_VFD */ } /* test_eof_eoa */ @@ -1141,15 +1091,6 @@ error: static int test_H5FDread_without_eoa_set_fails(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 VFD read-eoa temporal coupling library limitation "); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3_VFD defined */ - char buffer[256]; unsigned int i = 0; H5FD_t *file_shakespeare = NULL; @@ -1237,8 +1178,6 @@ error: return 1; -#endif /* H5_HAVE_ROS3_VFD */ - } /* test_H5FDread_without_eoa_set_fails */ @@ -1262,14 +1201,6 @@ error: static int test_read(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 VFD read/range-gets"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3_VFD defined */ /********************* * test-local macros * @@ -1451,8 +1382,6 @@ error: return 1; -#endif /* H5_HAVE_ROS3_VFD */ - } /* test_read */ @@ -1478,15 +1407,6 @@ error: static int test_noops_and_autofails(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 VFD always-fail and no-op routines"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else - /********************* * test-local macros * *********************/ @@ -1606,8 +1526,6 @@ error: return 1; -#endif /* H5_HAVE_ROS3_VFD */ - } /* test_noops_and_autofails*/ @@ -1632,14 +1550,6 @@ error: static int test_cmp(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 cmp (comparison)"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /********************* * test-local macros * @@ -1750,7 +1660,6 @@ error: } return 1; -#endif /* H5_HAVE_ROS3_VFD */ } /* test_cmp */ @@ -1776,15 +1685,6 @@ error: static int test_H5F_integration(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("S3 file access through HD5F library (H5F API)"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else - /********************* * test-local macros * *********************/ @@ -1883,11 +1783,10 @@ HDprintf("\nerror!"); fflush(stdout); (void)H5Fclose(file); return 1; -#endif /* H5_HAVE_ROS3_VFD */ } /* test_H5F_integration */ - +#endif /* H5_HAVE_ROS3_VFD */ /*------------------------------------------------------------------------- @@ -1907,10 +1806,15 @@ HDprintf("\nerror!"); fflush(stdout); int main(void) { +#ifdef H5_HAVE_ROS3_VFD int nerrors = 0; + const char *bucket_url_env = NULL; + +#endif /* H5_HAVE_ROS3_VFD */ + + HDprintf("Testing ros3 VFD functionality.\n"); #ifdef H5_HAVE_ROS3_VFD - const char *bucket_url_env = NULL; /************************ * initialize test urls * @@ -1987,15 +1891,14 @@ main(void) s3_test_credentials_loaded = 1; HDstrncpy(restricted_access_fa.aws_region, (const char *)s3_test_aws_region, - H5FD__ROS3_MAX_REGION_LEN); + H5FD_ROS3_MAX_REGION_LEN); HDstrncpy(restricted_access_fa.secret_id, (const char *)s3_test_aws_access_key_id, - H5FD__ROS3_MAX_SECRET_ID_LEN); + H5FD_ROS3_MAX_SECRET_ID_LEN); HDstrncpy(restricted_access_fa.secret_key, (const char *)s3_test_aws_secret_access_key, - H5FD__ROS3_MAX_SECRET_KEY_LEN); + H5FD_ROS3_MAX_SECRET_KEY_LEN); } -#endif /* H5_HAVE_ROS3_VFD */ /****************** * commence tests * @@ -2003,8 +1906,6 @@ main(void) h5_reset(); - HDprintf("Testing ros3 VFD functionality.\n"); - nerrors += test_fapl_config_validation(); nerrors += test_ros3_fapl(); nerrors += test_vfd_open(); @@ -2025,6 +1926,12 @@ main(void) } return nerrors; /* 0 if no errors, 1 if any errors */ -} /* main() */ +#else + HDprintf("SKIPPED - read-only S3 VFD not built\n"); + return EXIT_SUCCESS; + +#endif /* H5_HAVE_ROS3_VFD */ + +} /* main() */ diff --git a/test/s3comms.c b/test/s3comms.c index 7bc9961..9453b75 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -23,6 +23,8 @@ #include "H5FDs3comms.h" #include "H5MMprivate.h" /* memory management */ +#ifdef H5_HAVE_ROS3_VFD + /***************************************************************************** * * FILE-LOCAL TESTING MACROS @@ -361,8 +363,6 @@ if (strcmp((actual), (expected)) != 0) { \ #endif /* ifdef/else JSVERIFY_EXP_ACT */ -#ifdef H5_HAVE_ROS3_VFD - #define S3_TEST_PROFILE_NAME "ros3_vfd_test" #define S3_TEST_RESOURCE_TEXT_RESTRICTED "t8.shakespeare.txt" @@ -384,8 +384,6 @@ static char s3_test_aws_secret_access_key[128] = ""; static char s3_test_bucket_url[S3_TEST_MAX_URL_SIZE] = ""; static hbool_t s3_test_bucket_defined = FALSE; -#endif /* H5_HAVE_ROS3_VFD */ - /*--------------------------------------------------------------------------- * @@ -1163,7 +1161,6 @@ test_HMAC_SHA256(void) * test-local structures * *************************/ -#ifdef H5_HAVE_ROS3_VFD struct testcase { herr_t ret; /* SUCCEED/FAIL expected from call */ const unsigned char key[SHA256_DIGEST_LENGTH]; @@ -1211,16 +1208,9 @@ test_HMAC_SHA256(void) char *dest = NULL; int i = 0; int n_cases = 3; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("HMAC_SHA256"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else for (i = 0; i < n_cases; i++) { if (cases[i].dest_size == 0) { dest = NULL; @@ -1272,7 +1262,6 @@ test_HMAC_SHA256(void) error: free(dest); return -1; -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_HMAC_SHA256() */ @@ -1706,7 +1695,6 @@ error: static herr_t test_s3r_get_filesize(void) { -#ifdef H5_HAVE_ROS3_VFD /************************ * test-local variables * @@ -1714,16 +1702,9 @@ test_s3r_get_filesize(void) char url_raven[S3_TEST_MAX_URL_SIZE]; s3r_t *handle = NULL; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("s3r_get_filesize"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else /* setup -- compose url to target resource */ if (FALSE == s3_test_bucket_defined) { @@ -1759,7 +1740,6 @@ error: (void)H5FD_s3comms_s3r_close(handle); return -1; -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_s3r_get_filesize() */ @@ -1776,7 +1756,6 @@ error: static herr_t test_s3r_open(void) { -#ifdef H5_HAVE_ROS3_VFD /************************ * test-local variables * @@ -1792,16 +1771,9 @@ test_s3r_open(void) s3r_t *handle = NULL; hbool_t curl_ready = FALSE; parsed_url_t *purl = NULL; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("s3r_open"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else if (s3_test_credentials_loaded == 0) { SKIPPED(); puts(" s3 credentials are not loaded"); @@ -2000,7 +1972,6 @@ error: curl_global_cleanup(); return -1; -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_s3r_open() */ @@ -2029,7 +2000,6 @@ error: static herr_t test_s3r_read(void) { -#ifdef H5_HAVE_ROS3_VFD #define S3COMMS_TEST_BUFFER_SIZE 256 @@ -2042,16 +2012,9 @@ test_s3r_read(void) s3r_t *handle = NULL; hbool_t curl_ready = FALSE; unsigned int i = 0; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("test_s3r_read"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else /* * initial setup */ @@ -2226,7 +2189,6 @@ error: return -1; #undef S3COMMS_TEST_BUFFER_SIZE -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_s3r_read() */ @@ -2249,7 +2211,6 @@ error: static herr_t test_signing_key(void) { -#ifdef H5_HAVE_ROS3_VFD /************************* * test-local structures * *************************/ @@ -2279,16 +2240,9 @@ test_signing_key(void) int i = 0; unsigned char *key = NULL; int ncases = 1; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("signing_key"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else for (i = 0; i < ncases; i++) { key = (unsigned char *)HDmalloc(sizeof(unsigned char) * \ SHA256_DIGEST_LENGTH); @@ -2365,7 +2319,6 @@ error: } return -1; -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_signing_key() */ @@ -2394,7 +2347,6 @@ error: static herr_t test_tostringtosign(void) { -#ifdef H5_HAVE_ROS3_VFD /************************ * test-local variables * ************************/ @@ -2403,16 +2355,9 @@ test_tostringtosign(void) const char iso8601now[] = "20130524T000000Z"; const char region[] = "us-east-1"; char s2s[512]; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("s3comms tostringtosign"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else JSVERIFY( SUCCEED, H5FD_s3comms_tostringtosign(s2s, canonreq, iso8601now, region), "unable to create string to sign" ) @@ -2437,7 +2382,6 @@ test_tostringtosign(void) error : return -1; -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_tostringtosign() */ @@ -2679,6 +2623,7 @@ error: } /* end test_uriencode() */ +#endif /* H5_HAVE_ROS3_VFD */ @@ -2702,13 +2647,14 @@ error: int main(void) { - int nerrors = 0; #ifdef H5_HAVE_ROS3_VFD + int nerrors = 0; const char *bucket_url_env = NULL; -#endif /* H5_HAVE_ROS3_VFD */ h5_reset(); +#endif /* H5_HAVE_ROS3_VFD */ + HDprintf("Testing S3Communications functionality.\n"); #ifdef H5_HAVE_ROS3_VFD @@ -2744,8 +2690,6 @@ main(void) s3_test_bucket_defined = TRUE; } -#endif /* H5_HAVE_ROS3_VFD */ - /* tests ordered rougly by dependence */ nerrors += test_macro_format_credential() < 0 ? 1 : 0; nerrors += test_trim() < 0 ? 1 : 0; @@ -2774,5 +2718,13 @@ main(void) HDprintf("All S3comms tests passed.\n"); return 0; + +#else + + HDprintf("SKIPPED - read-only S3 VFD not built\n"); + return EXIT_SUCCESS; + +#endif /* H5_HAVE_ROS3_VFD */ + } /* end main() */ @@ -58,7 +58,7 @@ const char *FILENAME[] = { "stdio_file", /*7*/ "windows_file", /*8*/ "new_multi_file_v16",/*9*/ - "ro_s3_file6", /*10*/ + "ro_s3_file", /*10*/ NULL }; @@ -1940,6 +1940,7 @@ error: static herr_t test_ros3(void) { +#ifdef H5_HAVE_ROS3_VFD hid_t fid = -1; /* file ID */ hid_t fapl_id = -1; /* file access property list ID */ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */ @@ -1951,14 +1952,20 @@ test_ros3(void) H5FD_ros3_fapl_t test_ros3_fa; H5FD_ros3_fapl_t ros3_fa_0 = { - /* version = */ H5FD__CURR_ROS3_FAPL_T_VERSION, + /* version = */ H5FD_CURR_ROS3_FAPL_T_VERSION, /* authenticate = */ FALSE, /* aws_region = */ "", /* secret_id = */ "", /* secret_key = */ "plugh", }; +#endif /*H5_HAVE_ROS3_VFD */ - TESTING("ROS3 file driver"); + TESTING("Read-only S3 file driver"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + return 0; +#else /* H5_HAVE_ROS3_VFD */ /* Set property list and file name for ROS3 driver. */ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -1988,61 +1995,13 @@ test_ros3(void) if (H5FDdriver_query(driver_id, &driver_flags) < 0) TEST_ERROR; - if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR + if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) + TEST_ERROR /* Check for extra flags not accounted for above */ if(driver_flags != (H5FD_FEAT_DATA_SIEVE)) TEST_ERROR - /* can't create analogs of the following tests until the - * ROS3 driver is up and running in a minimal fashion. - * Comment them out until we get to them. - */ -#if 0 - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) - TEST_ERROR; - - /* Retrieve the access property list... */ - if((fapl_id_out = H5Fget_access_plist(fid)) < 0) - TEST_ERROR; - - /* Check that the driver is correct */ - if(H5FD_ROS3 != H5Pget_driver(fapl_id_out)) - TEST_ERROR; - - /* ...and close the property list */ - if(H5Pclose(fapl_id_out) < 0) - TEST_ERROR; - - /* Check that we can get an operating-system-specific handle from - * the library. - */ - if(H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) - TEST_ERROR; - if(os_file_handle == NULL) - FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle"); - - - /* There is no garantee the size of metadata in file is constant. - * Just try to check if it's reasonable. - * - * Currently it should be around 2 KB. - */ - if(H5Fget_filesize(fid, &file_size) < 0) - TEST_ERROR; - if(file_size < 1 * KB || file_size > 4 * KB) - FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize"); - - /* Close and delete the file */ - if(H5Fclose(fid) < 0) - TEST_ERROR; - h5_delete_test_file(FILENAME[0], fapl_id); - - /* Close the fapl */ - if(H5Pclose(fapl_id) < 0) - TEST_ERROR; -#endif - PASSED(); return 0; @@ -2053,10 +2012,9 @@ error: H5Fclose(fid); } H5E_END_TRY; return -1; +#endif /* H5_HAVE_ROS3_VFD */ } /* end test_ros3() */ - - /*------------------------------------------------------------------------- * Function: main * |