summaryrefslogtreecommitdiffstats
path: root/test/hdfs.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-09-30 14:27:10 (GMT)
commitb2d661b508a7fc7a2592c13bc6bdc175551f075d (patch)
tree13baeb0d83a7c2a4c6299993c182b1227c2f6114 /test/hdfs.c
parent29ab58b58dce556639ea3154e262895773a8a8df (diff)
downloadhdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz
hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2
Clang-format of source files
Diffstat (limited to 'test/hdfs.c')
-rw-r--r--test/hdfs.c754
1 files changed, 324 insertions, 430 deletions
diff --git a/test/hdfs.c b/test/hdfs.c
index 31efa08..ee66314 100644
--- a/test/hdfs.c
+++ b/test/hdfs.c
@@ -23,12 +23,11 @@
* 2018-04-23
*/
-#include "h5test.h" /* testing utilities */
-#include "H5FDhdfs.h" /* this file driver's utilities */
-
+#include "h5test.h" /* testing utilities */
+#include "H5FDhdfs.h" /* this file driver's utilities */
#ifdef H5_HAVE_LIBHDFS
-#define HDFS_TEST_DEBUG 0
+#define HDFS_TEST_DEBUG 0
#define HDFS_TEST_MAX_BUF_SIZE 256
/*****************************************************************************
@@ -74,7 +73,6 @@
*
*****************************************************************************/
-
/*----------------------------------------------------------------------------
*
* ifdef flag: JSVERIFY_EXP_ACT
@@ -86,7 +84,6 @@
*/
#define JSVERIFY_EXP_ACT 1L
-
/*----------------------------------------------------------------------------
*
* Macro: JSFAILED_AT()
@@ -103,11 +100,11 @@
*
*----------------------------------------------------------------------------
*/
-#define JSFAILED_AT() { \
- HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \
-}
+#define JSFAILED_AT() \
+ { \
+ HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \
+ }
-
/*----------------------------------------------------------------------------
*
* Macro: FAIL_IF()
@@ -131,13 +128,12 @@
*
*----------------------------------------------------------------------------
*/
-#define FAIL_IF(condition) \
-if (condition) { \
- JSFAILED_AT() \
- goto error; \
-}
+#define FAIL_IF(condition) \
+ if (condition) { \
+ JSFAILED_AT() \
+ goto error; \
+ }
-
/*----------------------------------------------------------------------------
*
* Macro: FAIL_UNLESS()
@@ -161,14 +157,13 @@ if (condition) { \
*----------------------------------------------------------------------------
*/
#if 0 /* UNUSED */
-#define FAIL_UNLESS(condition) \
-if (!(condition)) { \
- JSFAILED_AT() \
- goto error; \
-}
+#define FAIL_UNLESS(condition) \
+ if (!(condition)) { \
+ JSFAILED_AT() \
+ goto error; \
+ }
#endif /* UNUSED */
-
/*----------------------------------------------------------------------------
*
* Macro: JSERR_LONG()
@@ -194,17 +189,17 @@ if (!(condition)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSERR_LONG(expected, actual, reason) { \
- JSFAILED_AT() \
- if (reason!= NULL) { \
- HDprintf("%s\n", (reason)); \
- } else { \
- HDprintf(" ! Expected %ld\n ! Actual %ld\n", \
- (long)(expected), (long)(actual)); \
- } \
-}
-
-
+#define JSERR_LONG(expected, actual, reason) \
+ { \
+ JSFAILED_AT() \
+ if (reason != NULL) { \
+ HDprintf("%s\n", (reason)); \
+ } \
+ else { \
+ HDprintf(" ! Expected %ld\n ! Actual %ld\n", (long)(expected), (long)(actual)); \
+ } \
+ }
+
/*----------------------------------------------------------------------------
*
* Macro: JSERR_STR()
@@ -233,22 +228,20 @@ if (!(condition)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSERR_STR(expected, actual, reason) { \
- const char *_reason = reason; \
- JSFAILED_AT() \
- if (_reason != NULL) { \
- HDprintf("%s\n", _reason); \
- } else { \
- HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", \
- (expected), (actual)); \
- } \
-}
-
-
+#define JSERR_STR(expected, actual, reason) \
+ { \
+ const char *_reason = reason; \
+ JSFAILED_AT() \
+ if (_reason != NULL) { \
+ HDprintf("%s\n", _reason); \
+ } \
+ else { \
+ HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", (expected), (actual)); \
+ } \
+ }
#ifdef JSVERIFY_EXP_ACT
-
/*----------------------------------------------------------------------------
*
* Macro: JSVERIFY()
@@ -265,13 +258,12 @@ if (!(condition)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY(expected, actual, reason) \
-if ((long)(actual) != (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY */
+#define JSVERIFY(expected, actual, reason) \
+ if ((long)(actual) != (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY */
-
/*----------------------------------------------------------------------------
*
* Macro: JSVERIFY_NOT()
@@ -288,13 +280,12 @@ if ((long)(actual) != (long)(expected)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_NOT(expected, actual, reason) \
-if ((long)(actual) == (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY_NOT */
+#define JSVERIFY_NOT(expected, actual, reason) \
+ if ((long)(actual) == (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY_NOT */
-
/*----------------------------------------------------------------------------
*
* Macro: JSVERIFY_STR()
@@ -311,12 +302,11 @@ if ((long)(actual) == (long)(expected)) { \
*
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_STR(expected, actual, reason) \
-if (strcmp((actual), (expected)) != 0) { \
- JSERR_STR((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY_STR */
-
+#define JSVERIFY_STR(expected, actual, reason) \
+ if (strcmp((actual), (expected)) != 0) { \
+ JSERR_STR((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY_STR */
#else
/* JSVERIFY_EXP_ACT not defined
@@ -324,7 +314,6 @@ if (strcmp((actual), (expected)) != 0) { \
* Repeats macros above, but with actual/expected parameters reversed.
*/
-
/*----------------------------------------------------------------------------
* Macro: JSVERIFY()
* See: JSVERIFY documentation above.
@@ -332,13 +321,12 @@ if (strcmp((actual), (expected)) != 0) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY(actual, expected, reason) \
-if ((long)(actual) != (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY */
+#define JSVERIFY(actual, expected, reason) \
+ if ((long)(actual) != (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY */
-
/*----------------------------------------------------------------------------
* Macro: JSVERIFY_NOT()
* See: JSVERIFY_NOT documentation above.
@@ -346,13 +334,12 @@ if ((long)(actual) != (long)(expected)) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_NOT(actual, expected, reason) \
-if ((long)(actual) == (long)(expected)) { \
- JSERR_LONG((expected), (actual), (reason)) \
- goto error; \
-} /* JSVERIFY_NOT */
+#define JSVERIFY_NOT(actual, expected, reason) \
+ if ((long)(actual) == (long)(expected)) { \
+ JSERR_LONG((expected), (actual), (reason)) \
+ goto error; \
+ } /* JSVERIFY_NOT */
-
/*----------------------------------------------------------------------------
* Macro: JSVERIFY_STR()
* See: JSVERIFY_STR documentation above.
@@ -360,11 +347,11 @@ if ((long)(actual) == (long)(expected)) { \
* 2017-10-14
*----------------------------------------------------------------------------
*/
-#define JSVERIFY_STR(actual, expected, reason) \
-if (strcmp((actual), (expected)) != 0) { \
- JSERR_STR((expected), (actual), (reason)); \
- goto error; \
-} /* JSVERIFY_STR */
+#define JSVERIFY_STR(actual, expected, reason) \
+ if (strcmp((actual), (expected)) != 0) { \
+ JSERR_STR((expected), (actual), (reason)); \
+ goto error; \
+ } /* JSVERIFY_STR */
#endif /* ifdef/else JSVERIFY_EXP_ACT */
@@ -373,7 +360,7 @@ if (strcmp((actual), (expected)) != 0) { \
********************************/
/* copied from src/hdfs.c */
-#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
+#define MAXADDR (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1)
#define HDFS_NAMENODE_NAME_MAX_SIZE 128
@@ -386,13 +373,13 @@ static const char filename_bard[] = "/tmp/t8.shakespeare.txt";
static const char filename_raven[] = "/tmp/Poe_Raven.txt";
static const char filename_example_h5[] = "/tmp/t.h5";
-static H5FD_hdfs_fapl_t default_fa = {
- 1, /* fa version */
- "localhost", /* namenode name */
- 0, /* namenode port */
- "", /* user name */
- "", /* kerberos path */
- 1024, /* buffer size */
+static H5FD_hdfs_fapl_t default_fa = {
+ 1, /* fa version */
+ "localhost", /* namenode name */
+ 0, /* namenode port */
+ "", /* user name */
+ "", /* kerberos path */
+ 1024, /* buffer size */
};
#endif /* H5_HAVE_LIBHDFS */
@@ -400,7 +387,6 @@ static H5FD_hdfs_fapl_t default_fa = {
* TEST FUNCTIONS *
******************/
-
/*---------------------------------------------------------------------------
*
* Function: test_fapl_config_validation()
@@ -442,28 +428,30 @@ test_fapl_config_validation(void)
*************************/
struct testcase {
- const char *msg;
- herr_t expected;
- H5FD_hdfs_fapl_t config;
+ const char * msg;
+ herr_t expected;
+ H5FD_hdfs_fapl_t config;
};
/************************
* test-local variables *
************************/
- hid_t fapl_id = -1; /* file access property list ID */
+ hid_t fapl_id = -1; /* file access property list ID */
H5FD_hdfs_fapl_t config;
H5FD_hdfs_fapl_t fa_fetch;
- herr_t success = SUCCEED;
- unsigned int i = 0;
- unsigned int ncases = 6; /* should equal number of cases */
- struct testcase *case_ptr = NULL; /* dumb work-around for possible */
- /* dynamic cases creation because */
- /* of compiler warnings Wlarger-than */
- struct testcase cases_arr[] = {
- { "default config fapl",
+ herr_t success = SUCCEED;
+ unsigned int i = 0;
+ unsigned int ncases = 6; /* should equal number of cases */
+ struct testcase *case_ptr = NULL; /* dumb work-around for possible */
+ /* dynamic cases creation because */
+ /* of compiler warnings Wlarger-than */
+ struct testcase cases_arr[] = {
+ {
+ "default config fapl",
SUCCEED,
- { 1, /* version */
+ {
+ 1, /* version */
"localhost", /* namenode_name */
0, /* namenode_port number */
"some_user", /* user_name */
@@ -471,9 +459,11 @@ test_fapl_config_validation(void)
-1, /* stream_buffer_size */
},
},
- { "invalid version number (2)",
+ {
+ "invalid version number (2)",
FAIL,
- { 2, /* version */
+ {
+ 2, /* version */
"localhost", /* namenode_name */
0, /* namenode_port number */
"some_user", /* user_name */
@@ -481,9 +471,11 @@ test_fapl_config_validation(void)
-1, /* stream_buffer_size */
},
},
- { "invalid version number (0)",
+ {
+ "invalid version number (0)",
FAIL,
- { 0, /* version */
+ {
+ 0, /* version */
"localhost", /* namenode_name */
0, /* namenode_port number */
"some_user", /* user_name */
@@ -491,19 +483,23 @@ test_fapl_config_validation(void)
-1, /* stream_buffer_size */
},
},
- { "nonsense kerberos path still ok?",
+ {
+ "nonsense kerberos path still ok?",
SUCCEED,
- { 1, /* version */
- "localhost", /* namenode_name */
- 0, /* namenode_port number */
- "some_user", /* user_name */
+ {
+ 1, /* version */
+ "localhost", /* namenode_name */
+ 0, /* namenode_port number */
+ "some_user", /* user_name */
"pathToSomewhere", /* kerberos_ticket_cache path */
- -1, /* stream_buffer_size */
+ -1, /* stream_buffer_size */
},
},
- { "namenode port number too high",
+ {
+ "namenode port number too high",
FAIL,
- { 1, /* version */
+ {
+ 1, /* version */
"localhost", /* namenode_name */
88000, /* namenode_port number */
"some_user", /* user_name */
@@ -511,9 +507,11 @@ test_fapl_config_validation(void)
-1, /* stream_buffer_size */
},
},
- { "negative namenode port number",
+ {
+ "negative namenode port number",
FAIL,
- { 1, /* version */
+ {
+ 1, /* version */
"localhost", /* namenode_name */
-1, /* namenode_port number */
"some_user", /* user_name */
@@ -536,60 +534,46 @@ test_fapl_config_validation(void)
*---------------
*/
case_ptr = &cases_arr[i];
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 ) /* sanity-check */
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ FAIL_IF(fapl_id < 0) /* sanity-check */
/*-----------------------------------
* Actually test -- set fapl.
* Mute stack trace in failure cases.
*-----------------------------------
*/
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* `H5FD_hdfs_validate_config(...)` is static/private
* to src/hdfs.c and cannot (and should not?) be tested directly?
* Instead, validate config through public api.
*/
success = H5Pset_fapl_hdfs(fapl_id, &case_ptr->config);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
- JSVERIFY( case_ptr->expected, success, case_ptr->msg )
+ JSVERIFY(case_ptr->expected, success, case_ptr->msg)
/* Make sure we can get back what we put in.
* Only valid if the fapl configuration does not result in error.
*/
if (success == SUCCEED) {
config = case_ptr->config;
- JSVERIFY( SUCCEED,
- H5Pget_fapl_hdfs(fapl_id, &fa_fetch),
- "unable to get fapl" )
- JSVERIFY( H5FD__CURR_HDFS_FAPL_T_VERSION,
- fa_fetch.version,
- "invalid version number" )
- JSVERIFY( config.version,
- fa_fetch.version,
- "version number mismatch" )
- JSVERIFY( config.namenode_port,
- fa_fetch.namenode_port,
- "namenode port mismatch" )
- JSVERIFY( config.stream_buffer_size,
- fa_fetch.stream_buffer_size,
- "streambuffer size mismatch" )
- JSVERIFY_STR( config.namenode_name,
- fa_fetch.namenode_name,
- NULL )
- JSVERIFY_STR( config.user_name,
- fa_fetch.user_name,
- NULL )
- JSVERIFY_STR( config.kerberos_ticket_cache,
- fa_fetch.kerberos_ticket_cache,
- NULL )
+ JSVERIFY(SUCCEED, H5Pget_fapl_hdfs(fapl_id, &fa_fetch), "unable to get fapl")
+ JSVERIFY(H5FD__CURR_HDFS_FAPL_T_VERSION, fa_fetch.version, "invalid version number")
+ JSVERIFY(config.version, fa_fetch.version, "version number mismatch")
+ JSVERIFY(config.namenode_port, fa_fetch.namenode_port, "namenode port mismatch")
+ JSVERIFY(config.stream_buffer_size, fa_fetch.stream_buffer_size, "streambuffer size mismatch")
+ JSVERIFY_STR(config.namenode_name, fa_fetch.namenode_name, NULL)
+ JSVERIFY_STR(config.user_name, fa_fetch.user_name, NULL)
+ JSVERIFY_STR(config.kerberos_ticket_cache, fa_fetch.kerberos_ticket_cache, NULL)
}
/*-----------------------------
* per-test sanitation/teardown
*-----------------------------
*/
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
} /* for each test case */
@@ -603,16 +587,14 @@ error:
***********/
if (fapl_id < 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
#endif /* H5_HAVE_LIBHDFS */
} /* end test_fapl_config_validation() */
-
/*-------------------------------------------------------------------------
*
* Function: test_hdfs_fapl()
@@ -647,10 +629,10 @@ test_hdfs_fapl(void)
* test-local variables *
************************/
- hid_t fapl_id = -1; /* file access property list ID */
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- H5FD_hdfs_fapl_t hdfs_fa_0 = {
+ hid_t fapl_id = -1; /* file access property list ID */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ H5FD_hdfs_fapl_t hdfs_fa_0 = {
1, /* version*/
"", /* node name */
9000, /* node port */
@@ -664,41 +646,38 @@ test_hdfs_fapl(void)
/* Set property list and file name for HDFS driver.
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
+ FAIL_IF(fapl_id < 0)
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &hdfs_fa_0) )
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &hdfs_fa_0))
driver_id = H5Pget_driver(fapl_id);
- FAIL_IF( driver_id < 0 )
+ FAIL_IF(driver_id < 0)
/****************
* Check that the VFD feature flags are correct
* SPEC MAY CHANGE
******************/
- FAIL_IF( H5FDdriver_query(driver_id, &driver_flags) < 0 )
+ FAIL_IF(H5FDdriver_query(driver_id, &driver_flags) < 0)
- JSVERIFY_NOT( 0, (driver_flags & H5FD_FEAT_DATA_SIEVE),
- "bit(s) in `driver_flags` must align with "
- "H5FD_FEAT_DATA_SIEVE" )
+ JSVERIFY_NOT(0, (driver_flags & H5FD_FEAT_DATA_SIEVE),
+ "bit(s) in `driver_flags` must align with "
+ "H5FD_FEAT_DATA_SIEVE")
- JSVERIFY( H5FD_FEAT_DATA_SIEVE, driver_flags,
- "H5FD_FEAT_DATA_SIEVE should be the only supported flag")
+ JSVERIFY(H5FD_FEAT_DATA_SIEVE, driver_flags, "H5FD_FEAT_DATA_SIEVE should be the only supported flag")
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
return 1;
#endif /* H5_HAVE_LIBHDFS */
} /* end test_hdfs_fapl() */
-
/*---------------------------------------------------------------------------
*
* Function: test_vfd_open()
@@ -746,10 +725,10 @@ test_vfd_open(void)
struct test_condition {
const char *message;
const char *url;
- unsigned flags;
- int which_fapl;
- haddr_t maxaddr;
- hbool_t might_use_other_driver;
+ unsigned flags;
+ int which_fapl;
+ haddr_t maxaddr;
+ hbool_t might_use_other_driver;
};
/************************
@@ -757,70 +736,80 @@ test_vfd_open(void)
************************/
struct test_condition failing_conditions[] = {
- { "default property list (H5P_DEFAULT) is invalid",
+ {
+ "default property list (H5P_DEFAULT) is invalid",
filename_bard,
H5F_ACC_RDONLY,
FAPL_H5P_DEFAULT,
MAXADDR,
TRUE,
},
- { "generic file access property list is invalid",
+ {
+ "generic file access property list is invalid",
filename_bard,
H5F_ACC_RDONLY,
FAPL_UNCONFIGURED,
MAXADDR,
TRUE,
},
- { "filename cannot be null",
+ {
+ "filename cannot be null",
NULL,
H5F_ACC_RDONLY,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "filename cannot be empty",
+ {
+ "filename cannot be empty",
"",
H5F_ACC_RDONLY,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "file at filename must exist",
+ {
+ "file at filename must exist",
filename_missing,
H5F_ACC_RDONLY,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "read-write flag not supported",
+ {
+ "read-write flag not supported",
filename_bard,
H5F_ACC_RDWR,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "truncate flag not supported",
+ {
+ "truncate flag not supported",
filename_bard,
H5F_ACC_TRUNC,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "create flag not supported",
+ {
+ "create flag not supported",
filename_bard,
H5F_ACC_CREAT,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "EXCL flag not supported",
+ {
+ "EXCL flag not supported",
filename_bard,
H5F_ACC_EXCL,
FAPL_HDFS,
MAXADDR,
FALSE,
},
- { "maxaddr cannot be 0 (caught in `H5FD_open()`)",
+ {
+ "maxaddr cannot be 0 (caught in `H5FD_open()`)",
filename_bard,
H5F_ACC_RDONLY,
FAPL_HDFS,
@@ -828,20 +817,20 @@ test_vfd_open(void)
FALSE,
},
};
- unsigned i = 0;
- unsigned failing_conditions_count = 10;
- H5FD_t *fd = NULL;
- hid_t fapl_hdfs = -1;
- hid_t fapl_unconfigured = -1;
+ unsigned i = 0;
+ unsigned failing_conditions_count = 10;
+ H5FD_t *fd = NULL;
+ hid_t fapl_hdfs = -1;
+ hid_t fapl_unconfigured = -1;
TESTING("HDFS VFD-level open");
fapl_unconfigured = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_unconfigured < 0 )
+ FAIL_IF(fapl_unconfigured < 0)
fapl_hdfs = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_hdfs < 0 )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_hdfs, &default_fa) )
+ FAIL_IF(fapl_hdfs < 0)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_hdfs, &default_fa))
/*********
* TESTS *
@@ -850,16 +839,15 @@ test_vfd_open(void)
/* all the test cases that will _not_ open
*/
for (i = 0; i < failing_conditions_count; i++) {
- struct test_condition T = failing_conditions[i];
- hid_t fapl_id = H5P_DEFAULT;
+ struct test_condition T = failing_conditions[i];
+ hid_t fapl_id = H5P_DEFAULT;
fd = NULL;
if (T.which_fapl == FAPL_UNCONFIGURED) {
fapl_id = fapl_unconfigured;
}
- else
- if (T.which_fapl == FAPL_HDFS) {
+ else if (T.which_fapl == FAPL_HDFS) {
fapl_id = fapl_hdfs;
}
@@ -867,18 +855,14 @@ test_vfd_open(void)
HDfprintf(stderr, "testing: %s\n", T.message);
#endif /* HDFS_TEST_DEBUG */
- H5E_BEGIN_TRY {
- fd = H5FDopen(T.url, T.flags, fapl_id, T.maxaddr);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { fd = H5FDopen(T.url, T.flags, fapl_id, T.maxaddr); }
+ H5E_END_TRY;
if (NULL != fd) {
- if (TRUE == T.might_use_other_driver &&
- H5FD_HDFS != fd->driver_id)
- {
- HDfprintf(stderr, "\n!!!!! WARNING !!!!!\n" \
- " Successful open of file on local system " \
- "with non-HDFS VFD.\n");
- JSVERIFY(SUCCEED, H5FDclose(fd),
- "unable to close errant open");
+ if (TRUE == T.might_use_other_driver && H5FD_HDFS != fd->driver_id) {
+ HDfprintf(stderr, "\n!!!!! WARNING !!!!!\n"
+ " Successful open of file on local system "
+ "with non-HDFS VFD.\n");
+ JSVERIFY(SUCCEED, H5FDclose(fd), "unable to close errant open");
fd = NULL;
}
else {
@@ -887,36 +871,32 @@ test_vfd_open(void)
}
}
- FAIL_IF( NULL != fd ) /* sanity check */
+ FAIL_IF(NULL != fd) /* sanity check */
#if HDFS_TEST_DEBUG
- HDfprintf(stderr, "nominal open\n");
+ HDfprintf(stderr, "nominal open\n");
#endif /* HDFS_TEST_DEBUG */
/* finally, show that a file can be opened
*/
- fd = H5FDopen(
- filename_bard,
- H5F_ACC_RDONLY,
- fapl_hdfs,
- MAXADDR);
- FAIL_IF( NULL == fd )
+ fd = H5FDopen(filename_bard, H5F_ACC_RDONLY, fapl_hdfs, MAXADDR);
+ FAIL_IF(NULL == fd)
/************
* TEARDOWN *
************/
#if HDFS_TEST_DEBUG
- HDfprintf(stderr, "teardown...\n");
+ HDfprintf(stderr, "teardown...\n");
#endif /* HDFS_TEST_DEBUG */
- FAIL_IF( FAIL == H5FDclose(fd) )
+ FAIL_IF(FAIL == H5FDclose(fd))
fd = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_hdfs) )
+ FAIL_IF(FAIL == H5Pclose(fapl_hdfs))
fapl_hdfs = -1;
- FAIL_IF( FAIL == H5Pclose(fapl_unconfigured) )
+ FAIL_IF(FAIL == H5Pclose(fapl_unconfigured))
fapl_unconfigured = -1;
PASSED();
@@ -931,14 +911,16 @@ error:
if (fd) {
(void)H5FDclose(fd);
}
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
if (fapl_hdfs >= 0) {
(void)H5Pclose(fapl_hdfs);
}
if (fapl_unconfigured >= 0) {
(void)H5Pclose(fapl_unconfigured);
}
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return 1;
@@ -950,7 +932,6 @@ error:
} /* end test_vfd_open() */
-
/*---------------------------------------------------------------------------
*
* Function: test_eof_eoa()
@@ -993,8 +974,8 @@ test_eof_eoa(void)
* test-local variables *
************************/
- H5FD_t *fd_shakespeare = NULL;
- hid_t fapl_id = -1;
+ H5FD_t *fd_shakespeare = NULL;
+ hid_t fapl_id = -1;
TESTING("HDFS eof/eoa gets and sets");
@@ -1003,15 +984,11 @@ test_eof_eoa(void)
*********/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( 0 > fapl_id )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
+ FAIL_IF(0 > fapl_id)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa))
- fd_shakespeare = H5FDopen(
- filename_bard,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == fd_shakespeare )
+ fd_shakespeare = H5FDopen(filename_bard, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF);
+ FAIL_IF(NULL == fd_shakespeare)
/*********
* TESTS *
@@ -1019,46 +996,31 @@ test_eof_eoa(void)
/* verify as found
*/
- JSVERIFY( 5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), NULL )
- JSVERIFY( H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
- H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW),
- "mismatch between DEFAULT and RAW memory types" )
- JSVERIFY( 0,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoA should be unset by H5FDopen" )
+ JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), NULL)
+ JSVERIFY(H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW),
+ "mismatch between DEFAULT and RAW memory types")
+ JSVERIFY(0, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA should be unset by H5FDopen")
/* set EoA below EoF
*/
- JSVERIFY( SUCCEED,
- H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202),
- "unable to set EoA (lower)" )
- JSVERIFY( 5458199,
- H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoF changed" )
- JSVERIFY( 44442202,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoA unchanged" )
+ JSVERIFY(SUCCEED, H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202), "unable to set EoA (lower)")
+ JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EoF changed")
+ JSVERIFY(44442202, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA unchanged")
/* set EoA above EoF
*/
- JSVERIFY( SUCCEED,
- H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012),
- "unable to set EoA (higher)" )
- JSVERIFY( 5458199,
- H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoF changed" )
- JSVERIFY( 6789012,
- H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
- "EoA unchanged" )
+ JSVERIFY(SUCCEED, H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012), "unable to set EoA (higher)")
+ JSVERIFY(5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EoF changed")
+ JSVERIFY(6789012, H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA unchanged")
/************
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(fd_shakespeare) )
+ FAIL_IF(FAIL == H5FDclose(fd_shakespeare))
fd_shakespeare = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1074,9 +1036,8 @@ error:
(void)H5FDclose(fd_shakespeare);
}
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
@@ -1085,7 +1046,6 @@ error:
} /* end test_eof_eoa() */
-
/*-----------------------------------------------------------------------------
*
* Function: test_H5FDread_without_eoa_set_fails()
@@ -1112,10 +1072,10 @@ test_H5FDread_without_eoa_set_fails(void)
#else
- char buffer[HDFS_TEST_MAX_BUF_SIZE];
- unsigned int i = 0;
- H5FD_t *file_shakespeare = NULL;
- hid_t fapl_id = -1;
+ char buffer[HDFS_TEST_MAX_BUF_SIZE];
+ unsigned int i = 0;
+ H5FD_t *file_shakespeare = NULL;
+ hid_t fapl_id = -1;
TESTING("HDFS VFD read-eoa temporal coupling library limitation");
@@ -1126,18 +1086,13 @@ test_H5FDread_without_eoa_set_fails(void)
/* create HDFS fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
+ FAIL_IF(fapl_id < 0)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa))
- file_shakespeare = H5FDopen(
- filename_bard,
- H5F_ACC_RDONLY,
- fapl_id,
- MAXADDR);
- FAIL_IF( NULL == file_shakespeare )
+ file_shakespeare = H5FDopen(filename_bard, H5F_ACC_RDONLY, fapl_id, MAXADDR);
+ FAIL_IF(NULL == file_shakespeare)
- JSVERIFY( 0, H5FDget_eoa(file_shakespeare, H5FD_MEM_DEFAULT),
- "EoA should remain unset by H5FDopen" )
+ JSVERIFY(0, H5FDget_eoa(file_shakespeare, H5FD_MEM_DEFAULT), "EoA should remain unset by H5FDopen")
/* zero buffer contents */
for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) {
@@ -1148,28 +1103,21 @@ test_H5FDread_without_eoa_set_fails(void)
* TEST *
********/
- H5E_BEGIN_TRY { /* mute stack trace on expected failure */
- JSVERIFY( FAIL,
- H5FDread(file_shakespeare,
- H5FD_MEM_DRAW,
- H5P_DEFAULT,
- 1200699,
- 102,
- buffer),
- "cannot read before eoa is set" )
- } H5E_END_TRY;
+ H5E_BEGIN_TRY{/* mute stack trace on expected failure */
+ JSVERIFY(FAIL, H5FDread(file_shakespeare, H5FD_MEM_DRAW, H5P_DEFAULT, 1200699, 102, buffer),
+ "cannot read before eoa is set")} H5E_END_TRY;
for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) {
- JSVERIFY( 0, (unsigned)buffer[i], "buffer was modified by write!" )
+ JSVERIFY(0, (unsigned)buffer[i], "buffer was modified by write!")
}
/************
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(file_shakespeare) )
+ FAIL_IF(FAIL == H5FDclose(file_shakespeare))
file_shakespeare = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1185,9 +1133,8 @@ error:
(void)H5FDclose(file_shakespeare);
}
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
@@ -1196,8 +1143,6 @@ error:
} /* end test_H5FDread_without_eoa_set_fails() */
-
-
/*---------------------------------------------------------------------------
*
* Function: test_read()
@@ -1235,10 +1180,10 @@ test_read(void)
*************************/
struct testcase {
const char *message; /* purpose of test case */
- haddr_t eoa_set; /* set file EOA to this prior to read */
- size_t addr; /* offset of read in file */
- size_t len; /* length of read in file */
- herr_t success; /* expected return value of read function */
+ haddr_t eoa_set; /* set file EOA to this prior to read */
+ size_t addr; /* offset of read in file */
+ size_t len; /* length of read in file */
+ herr_t success; /* expected return value of read function */
const char *expected; /* expected contents of buffer; failure ignores */
};
@@ -1246,42 +1191,48 @@ test_read(void)
* test-local variables *
************************/
struct testcase cases[] = {
- { "successful range-get",
+ {
+ "successful range-get",
6464,
5691,
32, /* fancy quotes are three bytes each(?) */
SUCCEED,
"Quoth the Raven “Nevermore.”",
},
- { "read past EOA fails (EOA < EOF < addr)",
+ {
+ "read past EOA fails (EOA < EOF < addr)",
3000,
4000,
100,
FAIL,
NULL,
},
- { "read overlapping EOA fails (EOA < addr < EOF < (addr+len))",
+ {
+ "read overlapping EOA fails (EOA < addr < EOF < (addr+len))",
3000,
8000,
100,
FAIL,
NULL,
},
- { "read past EOA/EOF fails ((EOA==EOF) < addr)",
+ {
+ "read past EOA/EOF fails ((EOA==EOF) < addr)",
6464,
7000,
100,
FAIL,
NULL,
},
- { "read overlapping EOA/EOF fails (addr < (EOA==EOF) < (addr+len))",
+ {
+ "read overlapping EOA/EOF fails (addr < (EOA==EOF) < (addr+len))",
6464,
6400,
100,
FAIL,
NULL,
},
- { "read between EOF and EOA fails (EOF < addr < (addr+len) < EOA)",
+ {
+ "read between EOF and EOA fails (EOF < addr < (addr+len) < EOA)",
8000,
7000,
100,
@@ -1289,14 +1240,14 @@ test_read(void)
NULL,
},
};
- unsigned testcase_count = 6;
- unsigned test_i = 0;
- struct testcase test;
- herr_t open_return = FAIL;
- char buffer[HDFS_TEST_MAX_BUF_SIZE];
- unsigned int i = 0;
- H5FD_t *file_raven = NULL;
- hid_t fapl_id = -1;
+ unsigned testcase_count = 6;
+ unsigned test_i = 0;
+ struct testcase test;
+ herr_t open_return = FAIL;
+ char buffer[HDFS_TEST_MAX_BUF_SIZE];
+ unsigned int i = 0;
+ H5FD_t *file_raven = NULL;
+ hid_t fapl_id = -1;
TESTING("HDFS VFD read/range-gets");
@@ -1307,8 +1258,8 @@ test_read(void)
/* create HDFS fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
+ FAIL_IF(fapl_id < 0)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa))
/* zero buffer contents */
for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) {
@@ -1317,14 +1268,11 @@ test_read(void)
/* open file
*/
- file_raven = H5FDopen(
- filename_raven,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF); /* Demonstrate success with "automatic" value */
- FAIL_IF( NULL == file_raven )
+ file_raven = H5FDopen(filename_raven, H5F_ACC_RDONLY, fapl_id,
+ HADDR_UNDEF); /* Demonstrate success with "automatic" value */
+ FAIL_IF(NULL == file_raven)
- JSVERIFY( 6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), NULL )
+ JSVERIFY(6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), NULL)
/*********
* TESTS *
@@ -1336,13 +1284,12 @@ test_read(void)
* per-test setup *
* -------------- */
- test = cases[test_i];
+ test = cases[test_i];
open_return = FAIL;
- FAIL_IF( HDFS_TEST_MAX_BUF_SIZE < test.len ) /* buffer too small! */
+ FAIL_IF(HDFS_TEST_MAX_BUF_SIZE < test.len) /* buffer too small! */
- FAIL_IF( FAIL ==
- H5FDset_eoa( file_raven, H5FD_MEM_DEFAULT, test.eoa_set) )
+ FAIL_IF(FAIL == H5FDset_eoa(file_raven, H5FD_MEM_DEFAULT, test.eoa_set))
/* zero buffer contents */
for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) {
@@ -1353,22 +1300,16 @@ test_read(void)
* conduct test *
* ------------ */
- H5E_BEGIN_TRY {
- open_return = H5FDread(
- file_raven,
- H5FD_MEM_DRAW,
- H5P_DEFAULT,
- test.addr,
- test.len,
- buffer);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ open_return = H5FDread(file_raven, H5FD_MEM_DRAW, H5P_DEFAULT, test.addr, test.len, buffer);
+ }
+ H5E_END_TRY;
- JSVERIFY( test.success,
- open_return,
- test.message )
+ JSVERIFY(test.success, open_return, test.message)
if (open_return == SUCCEED) {
- JSVERIFY_STR( test.expected, buffer, NULL )
+ JSVERIFY_STR(test.expected, buffer, NULL)
}
} /* for each testcase */
@@ -1377,10 +1318,10 @@ test_read(void)
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(file_raven) )
+ FAIL_IF(FAIL == H5FDclose(file_raven))
file_raven = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1392,13 +1333,12 @@ error:
* CLEANUP *
***********/
- if (file_raven != 0) {
+ if (file_raven != 0) {
(void)H5FDclose(file_raven);
}
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
return 1;
@@ -1407,7 +1347,6 @@ error:
} /* end test_read() */
-
/*---------------------------------------------------------------------------
*
* Function: test_noops_and_autofails()
@@ -1455,9 +1394,9 @@ test_noops_and_autofails(void)
* test-local variables *
************************/
- hid_t fapl_id = -1;
- H5FD_t *file = NULL;
- const char data[36] = "The Force shall be with you, always";
+ hid_t fapl_id = -1;
+ H5FD_t *file = NULL;
+ const char data[36] = "The Force shall be with you, always";
TESTING("HDFS VFD always-fail and no-op routines");
@@ -1468,17 +1407,13 @@ test_noops_and_autofails(void)
/* create HDFS fapl
*/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( fapl_id < 0 )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
+ FAIL_IF(fapl_id < 0)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa))
/* open file
*/
- file = H5FDopen(
- filename_bard,
- H5F_ACC_RDONLY,
- fapl_id,
- HADDR_UNDEF);
- FAIL_IF( NULL == file )
+ file = H5FDopen(filename_bard, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF);
+ FAIL_IF(NULL == file)
/*********
* TESTS *
@@ -1486,35 +1421,19 @@ test_noops_and_autofails(void)
/* auto-fail calls to write and truncate
*/
- H5E_BEGIN_TRY {
- JSVERIFY( FAIL,
- H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data),
- "write must fail" )
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- JSVERIFY( FAIL,
- H5FDtruncate(file, H5P_DEFAULT, FALSE),
- "truncate must fail" )
- } H5E_END_TRY;
-
- H5E_BEGIN_TRY {
- JSVERIFY( FAIL,
- H5FDtruncate(file, H5P_DEFAULT, TRUE),
- "truncate must fail (closing)" )
- } H5E_END_TRY;
+ H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data),
+ "write must fail")} H5E_END_TRY;
+
+ H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, FALSE), "truncate must fail")} H5E_END_TRY;
+
+ H5E_BEGIN_TRY{
+ JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, TRUE), "truncate must fail (closing)")} H5E_END_TRY;
/* no-op calls to `lock()` and `unlock()`
*/
- JSVERIFY( SUCCEED,
- H5FDlock(file, TRUE),
- "lock always succeeds; has no effect" )
- JSVERIFY( SUCCEED,
- H5FDlock(file, FALSE),
- NULL )
- JSVERIFY( SUCCEED,
- H5FDunlock(file),
- NULL )
+ JSVERIFY(SUCCEED, H5FDlock(file, TRUE), "lock always succeeds; has no effect")
+ JSVERIFY(SUCCEED, H5FDlock(file, FALSE), NULL)
+ JSVERIFY(SUCCEED, H5FDunlock(file), NULL)
/* Lock/unlock with null file or similar error crashes tests.
* HDassert in calling heirarchy, `H5FD[un]lock()` and `H5FD_[un]lock()`
*/
@@ -1523,10 +1442,10 @@ test_noops_and_autofails(void)
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5FDclose(file) )
+ FAIL_IF(FAIL == H5FDclose(file))
file = NULL;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1539,9 +1458,8 @@ error:
***********/
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
if (file != NULL) {
(void)H5FDclose(file);
@@ -1553,7 +1471,6 @@ error:
} /* end test_noops_and_autofails() */
-
/*---------------------------------------------------------------------------
*
* Function: test_cmp()
@@ -1577,15 +1494,12 @@ test_cmp(void)
{
TESTING("HDFS cmp (comparison)");
SKIPPED();
- HDfprintf(
- stderr,
- " TODO: Distinct valid fapls to open the same file.\n");
+ HDfprintf(stderr, " TODO: Distinct valid fapls to open the same file.\n");
return 0;
} /* end test_cmp() */
-
/*---------------------------------------------------------------------------
*
* Function: test_H5F_integration()
@@ -1632,7 +1546,7 @@ test_H5F_integration(void)
* test-local variables *
************************/
- hid_t file = -1;
+ hid_t file = -1;
hid_t fapl_id = -1;
TESTING("HDFS file access through HD5F library (H5F API)");
@@ -1642,8 +1556,8 @@ test_H5F_integration(void)
*********/
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- FAIL_IF( 0 > fapl_id )
- FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
+ FAIL_IF(0 > fapl_id)
+ FAIL_IF(FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa))
/*********
* TESTS *
@@ -1651,39 +1565,26 @@ test_H5F_integration(void)
/* Read-Write Open access is not allowed with this file driver.
*/
- H5E_BEGIN_TRY {
- FAIL_IF( 0 <= H5Fopen(
- filename_example_h5,
- H5F_ACC_RDWR,
- fapl_id) )
- } H5E_END_TRY;
+ H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fopen(filename_example_h5, H5F_ACC_RDWR, fapl_id))} H5E_END_TRY;
/* H5Fcreate() is not allowed with this file driver.
*/
- H5E_BEGIN_TRY {
- FAIL_IF( 0 <= H5Fcreate(
- filename_missing,
- H5F_ACC_RDONLY,
- H5P_DEFAULT,
- fapl_id) )
- } H5E_END_TRY;
+ H5E_BEGIN_TRY{
+ FAIL_IF(0 <= H5Fcreate(filename_missing, H5F_ACC_RDONLY, H5P_DEFAULT, fapl_id))} H5E_END_TRY;
/* Successful open.
*/
- file = H5Fopen(
- filename_example_h5,
- H5F_ACC_RDONLY,
- fapl_id);
- FAIL_IF( file < 0 )
+ file = H5Fopen(filename_example_h5, H5F_ACC_RDONLY, fapl_id);
+ FAIL_IF(file < 0)
/************
* TEARDOWN *
************/
- FAIL_IF( FAIL == H5Fclose(file) )
+ FAIL_IF(FAIL == H5Fclose(file))
file = -1;
- FAIL_IF( FAIL == H5Pclose(fapl_id) )
+ FAIL_IF(FAIL == H5Pclose(fapl_id))
fapl_id = -1;
PASSED();
@@ -1695,13 +1596,13 @@ error:
***********/
#if HDFS_TEST_DEBUG
- HDprintf("\nerror!"); fflush(stdout);
+ HDprintf("\nerror!");
+ fflush(stdout);
#endif /* HDFS_TEST_DEBUG */
if (fapl_id >= 0) {
- H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); }
+ H5E_END_TRY;
}
if (file > 0) {
(void)H5Fclose(file);
@@ -1713,7 +1614,6 @@ error:
} /* test_H5F_integration */
-
/*-------------------------------------------------------------------------
*
* Function: main
@@ -1739,17 +1639,15 @@ main(void)
#ifdef H5_HAVE_LIBHDFS
static char hdfs_namenode_name[HDFS_NAMENODE_NAME_MAX_SIZE] = "";
- const char *hdfs_namenode_name_env = NULL;
+ const char *hdfs_namenode_name_env = NULL;
hdfs_namenode_name_env = HDgetenv("HDFS_TEST_NAMENODE_NAME");
if (hdfs_namenode_name_env == NULL || hdfs_namenode_name_env[0] == '\0') {
HDstrncpy(hdfs_namenode_name, "localhost", HDFS_NAMENODE_NAME_MAX_SIZE);
}
else {
- HDstrncpy( /* TODO: error-check? */
- default_fa.namenode_name,
- hdfs_namenode_name_env,
- HDFS_NAMENODE_NAME_MAX_SIZE);
+ HDstrncpy(/* TODO: error-check? */
+ default_fa.namenode_name, hdfs_namenode_name_env, HDFS_NAMENODE_NAME_MAX_SIZE);
}
#endif /* H5_HAVE_LIBHDFS */
@@ -1768,9 +1666,7 @@ main(void)
nerrors += test_H5F_integration();
if (nerrors > 0) {
- HDprintf("***** %d hdfs TEST%s FAILED! *****\n",
- nerrors,
- nerrors > 1 ? "S" : "");
+ HDprintf("***** %d hdfs TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : "");
nerrors = 1;
}
else {
@@ -1779,5 +1675,3 @@ main(void)
return nerrors; /* 0 if no errors, 1 if any errors */
} /* end main() */
-
-