mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
Fix compiler warnings with diabled ROS3 and HDFS VFDs.
Fix misuse of [HD]strncpy and [HD]snprintf. Minor formatting changes. Fix test cleanup issue with java groups example.
This commit is contained in:
parent
2b72832d97
commit
2e5cd3d2b2
@ -179,17 +179,9 @@ COPY_DATAFILES_TO_BLDDIR()
|
||||
|
||||
CLEAN_DATAFILES_AND_BLDDIR()
|
||||
{
|
||||
$RM $BLDDIR/examples.groups.H5Ex_G_*.txt
|
||||
$RM $BLDDIR/H5Ex_G_*.out
|
||||
$RM $BLDDIR/H5Ex_G_*.h5
|
||||
$RM $BLDDIR/h5ex_g_*.h5
|
||||
SDIR=`$DIRNAME $tstfile`
|
||||
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
|
||||
INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'`
|
||||
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then SDIR=`$DIRNAME $tstfile`
|
||||
$RM $BLDDIR/h5ex_g_iterate.h5
|
||||
$RM $BLDDIR/h5ex_g_visit.h5
|
||||
fi
|
||||
$RM $BLDDIR/examples.groups.H5Ex_G_*.txt
|
||||
$RM $BLDDIR/H5Ex_G_*.out
|
||||
$RM $BLDDIR/H5Ex_G_*.h5
|
||||
}
|
||||
|
||||
COPY_ITERFILES="$LIST_ITER_FILES"
|
||||
|
500
src/H5FDhdfs.c
500
src/H5FDhdfs.c
File diff suppressed because it is too large
Load Diff
400
src/H5FDros3.c
400
src/H5FDros3.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -577,7 +577,9 @@ H5_DLL herr_t H5FD_s3comms_s3r_read(s3r_t *handle,
|
||||
H5_DLL struct tm * gmnow(void);
|
||||
|
||||
herr_t H5FD_s3comms_aws_canonical_request(char *canonical_request_dest,
|
||||
int cr_size,
|
||||
char *signed_headers_dest,
|
||||
int sh_size,
|
||||
hrb_t *http_request);
|
||||
|
||||
H5_DLL herr_t H5FD_s3comms_bytes_to_hex(char *dest,
|
||||
|
443
test/hdfs.c
443
test/hdfs.c
@ -11,9 +11,9 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Read-Only HDFS Virtual File Driver (VFD)
|
||||
* Read-Only HDFS Virtual File Driver (VFD)
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Verify behavior for Read-Only HDFS VFD.
|
||||
*
|
||||
@ -27,11 +27,10 @@
|
||||
#include "H5FDhdfs.h" /* this file driver's utilities */
|
||||
|
||||
|
||||
#ifdef H5_HAVE_LIBHDFS
|
||||
#define HDFS_TEST_DEBUG 0
|
||||
#define HDFS_TEST_MAX_BUF_SIZE 256
|
||||
#if 0
|
||||
#define S3_TEST_MAX_URL_SIZE 256
|
||||
#endif /* s3comms relic */
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
@ -39,7 +38,7 @@
|
||||
*
|
||||
* Purpose:
|
||||
*
|
||||
* 1) Upon test failure, goto-jump to single-location teardown in test
|
||||
* 1) Upon test failure, goto-jump to single-location teardown in test
|
||||
* function. E.g., `error:` (consistency with HDF corpus) or
|
||||
* `failed:` (reflects purpose).
|
||||
* >>> using "error", in part because `H5E_BEGIN_TRY` expects it.
|
||||
@ -48,22 +47,22 @@
|
||||
* requires reading of entire line to know whether this if/call is
|
||||
* part of the test setup, test operation, or a test unto itself.
|
||||
* 3) Provide testing macros with optional user-supplied failure message;
|
||||
* if not supplied (NULL), generate comparison output in the spirit of
|
||||
* if not supplied (NULL), generate comparison output in the spirit of
|
||||
* test-driven development. E.g., "expected 5 but was -3"
|
||||
* User messages clarify test's purpose in code, encouraging description
|
||||
* without relying on comments.
|
||||
* 4) Configurable expected-actual order in generated comparison strings.
|
||||
* Some prefer `VERIFY(expected, actual)`, others
|
||||
* Some prefer `VERIFY(expected, actual)`, others
|
||||
* `VERIFY(actual, expected)`. Provide preprocessor ifdef switch
|
||||
* to satifsy both parties, assuming one paradigm per test file.
|
||||
* (One could #undef and redefine the flag through the file as desired,
|
||||
* but _why_.)
|
||||
*
|
||||
* Provided as courtesy, per consideration for inclusion in the library
|
||||
* Provided as courtesy, per consideration for inclusion in the library
|
||||
* proper.
|
||||
*
|
||||
* Macros:
|
||||
*
|
||||
*
|
||||
* JSVERIFY_EXP_ACT - ifdef flag, configures comparison order
|
||||
* FAIL_IF() - check condition
|
||||
* FAIL_UNLESS() - check _not_ condition
|
||||
@ -80,8 +79,8 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
*
|
||||
* ifdef flag: JSVERIFY_EXP_ACT
|
||||
*
|
||||
* JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason])
|
||||
*
|
||||
* JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason])
|
||||
* default, if this is undefined, is (ACTUAL, EXPECTED[, reason])
|
||||
*
|
||||
*----------------------------------------------------------------------------
|
||||
@ -114,10 +113,10 @@
|
||||
*
|
||||
* Macro: FAIL_IF()
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Make tests more accessible and less cluttered than
|
||||
* `if (thing == otherthing()) TEST_ERROR`
|
||||
* `if (thing == otherthing()) TEST_ERROR`
|
||||
* paradigm.
|
||||
*
|
||||
* The following lines are roughly equivalent:
|
||||
@ -148,7 +147,7 @@ if (condition) { \
|
||||
*
|
||||
* TEST_ERROR wrapper to reduce cognitive overhead from "negative tests",
|
||||
* e.g., "a != b".
|
||||
*
|
||||
*
|
||||
* Opposite of FAIL_IF; fails if the given condition is _not_ true.
|
||||
*
|
||||
* `FAIL_IF( 5 != my_op() )`
|
||||
@ -254,10 +253,10 @@ if (!(condition)) { \
|
||||
*
|
||||
* Macro: JSVERIFY()
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Verify that two long integers are equal.
|
||||
* If unequal, print failure message
|
||||
* If unequal, print failure message
|
||||
* (with `reason`, if not NULL; expected/actual if NULL)
|
||||
* and jump to `error` at end of function
|
||||
*
|
||||
@ -277,10 +276,10 @@ if ((long)(actual) != (long)(expected)) { \
|
||||
*
|
||||
* Macro: JSVERIFY_NOT()
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Verify that two long integers are _not_ equal.
|
||||
* If equal, print failure message
|
||||
* If equal, print failure message
|
||||
* (with `reason`, if not NULL; expected/actual if NULL)
|
||||
* and jump to `error` at end of function
|
||||
*
|
||||
@ -300,10 +299,10 @@ if ((long)(actual) == (long)(expected)) { \
|
||||
*
|
||||
* Macro: JSVERIFY_STR()
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Verify that two strings are equal.
|
||||
* If unequal, print failure message
|
||||
* If unequal, print failure message
|
||||
* (with `reason`, if not NULL; expected/actual if NULL)
|
||||
* and jump to `error` at end of function
|
||||
*
|
||||
@ -319,8 +318,8 @@ if (strcmp((actual), (expected)) != 0) { \
|
||||
} /* JSVERIFY_STR */
|
||||
|
||||
|
||||
#else
|
||||
/* JSVERIFY_EXP_ACT not defined
|
||||
#else
|
||||
/* JSVERIFY_EXP_ACT not defined
|
||||
*
|
||||
* Repeats macros above, but with actual/expected parameters reversed.
|
||||
*/
|
||||
@ -373,23 +372,30 @@ if (strcmp((actual), (expected)) != 0) { \
|
||||
* OTHER MACROS AND DEFINITIONS *
|
||||
********************************/
|
||||
|
||||
/* copied from src/hdfs.c
|
||||
/* copied from src/hdfs.c
|
||||
*/
|
||||
#ifdef H5_HAVE_LIBHDFS
|
||||
#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
|
||||
#define MAX_HDFS_NAMENODE_NAME 128
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
#define HDFS_NAMENODE_NAME_MAX_SIZE 128
|
||||
|
||||
/*******************************
|
||||
* FILE-LOCAL GLOBAL VARIABLES *
|
||||
*******************************/
|
||||
|
||||
#ifdef H5_HAVE_LIBHDFS
|
||||
static const char filename_missing[] = "/tmp/missing.txt";
|
||||
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";
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
static H5FD_hdfs_fapl_t default_fa = {
|
||||
1, /* fa version */
|
||||
"localhost", /* namenode name */
|
||||
0, /* namenode port */
|
||||
"", /* user name */
|
||||
"", /* user name */
|
||||
"", /* kerberos path */
|
||||
1024, /* buffer size */
|
||||
};
|
||||
@ -403,7 +409,7 @@ static H5FD_hdfs_fapl_t default_fa = {
|
||||
*
|
||||
* Function: test_fapl_config_validation()
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Test data consistency of fapl configuration.
|
||||
* Tests `H5FD_hdfs_validate_config` indirectly through `H5Pset_fapl_hdfs`.
|
||||
@ -522,7 +528,7 @@ test_fapl_config_validation(void)
|
||||
for (i = 0; i < ncases; i++) {
|
||||
|
||||
/*---------------
|
||||
* per-test setup
|
||||
* per-test setup
|
||||
*---------------
|
||||
*/
|
||||
case_ptr = &cases_arr[i];
|
||||
@ -535,7 +541,7 @@ test_fapl_config_validation(void)
|
||||
*-----------------------------------
|
||||
*/
|
||||
H5E_BEGIN_TRY {
|
||||
/* `H5FD_hdfs_validate_config(...)` is static/private
|
||||
/* `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.
|
||||
*/
|
||||
@ -543,7 +549,7 @@ test_fapl_config_validation(void)
|
||||
} H5E_END_TRY;
|
||||
|
||||
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.
|
||||
*/
|
||||
@ -566,7 +572,7 @@ test_fapl_config_validation(void)
|
||||
"streambuffer size mismatch" )
|
||||
JSVERIFY_STR( config.namenode_name,
|
||||
fa_fetch.namenode_name,
|
||||
NULL )
|
||||
NULL )
|
||||
JSVERIFY_STR( config.user_name,
|
||||
fa_fetch.user_name,
|
||||
NULL )
|
||||
@ -599,7 +605,7 @@ error:
|
||||
}
|
||||
return 1;
|
||||
|
||||
} /* test_fapl_config_validation */
|
||||
} /* end test_fapl_config_validation() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -608,7 +614,7 @@ error:
|
||||
*
|
||||
* Purpose: Tests the file handle interface for the HDFS driver.
|
||||
*
|
||||
* For now, test only fapl & flags. Extend as the
|
||||
* For now, test only fapl & flags. Extend as the
|
||||
* work on the VFD continues.
|
||||
*
|
||||
* Return: Success: 0
|
||||
@ -642,7 +648,7 @@ test_hdfs_fapl(void)
|
||||
|
||||
TESTING("HDFS fapl ");
|
||||
|
||||
/* Set property list and file name for HDFS driver.
|
||||
/* Set property list and file name for HDFS driver.
|
||||
*/
|
||||
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
||||
FAIL_IF( fapl_id < 0 )
|
||||
@ -654,12 +660,12 @@ test_hdfs_fapl(void)
|
||||
|
||||
/****************
|
||||
* Check that the VFD feature flags are correct
|
||||
* SPEC MAY CHANGE
|
||||
* SPEC MAY CHANGE
|
||||
******************/
|
||||
|
||||
FAIL_IF( H5FDdriver_query(driver_id, &driver_flags) < 0 )
|
||||
|
||||
JSVERIFY_NOT( 0, (driver_flags & 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" )
|
||||
|
||||
@ -676,14 +682,14 @@ error:
|
||||
|
||||
return 1;
|
||||
|
||||
} /* test_hdfs_fapl() */
|
||||
} /* end test_hdfs_fapl() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_vfd_open()
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Demonstrate/specify VFD-level "Open" failure cases
|
||||
*
|
||||
@ -700,6 +706,16 @@ error:
|
||||
static int
|
||||
test_vfd_open(void)
|
||||
{
|
||||
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
TESTING("HDFS VFD-level open");
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
/*********************
|
||||
* test-local macros *
|
||||
*********************/
|
||||
@ -709,7 +725,6 @@ test_vfd_open(void)
|
||||
#define FAPL_UNCONFIGURED -3 /* H5P_FILE_ACCESS */
|
||||
#define FAPL_HDFS -4
|
||||
|
||||
#ifdef H5_HAVE_LIBHDFS
|
||||
/*************************
|
||||
* test-local structures *
|
||||
*************************/
|
||||
@ -799,21 +814,14 @@ test_vfd_open(void)
|
||||
FALSE,
|
||||
},
|
||||
};
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
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;
|
||||
|
||||
TESTING("HDFS VFD-level open");
|
||||
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
fapl_unconfigured = H5Pcreate(H5P_FILE_ACCESS);
|
||||
FAIL_IF( fapl_unconfigured < 0 )
|
||||
|
||||
@ -833,10 +841,13 @@ test_vfd_open(void)
|
||||
|
||||
fd = NULL;
|
||||
|
||||
if (T.which_fapl == FAPL_UNCONFIGURED)
|
||||
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;
|
||||
}
|
||||
|
||||
#if HDFS_TEST_DEBUG
|
||||
HDfprintf(stderr, "testing: %s\n", T.message);
|
||||
@ -852,10 +863,11 @@ test_vfd_open(void)
|
||||
HDfprintf(stderr, "\n!!!!! WARNING !!!!!\n" \
|
||||
" Successful open of file on local system " \
|
||||
"with non-HDFS VFD.\n");
|
||||
JSVERIFY(SUCCEED, H5FDclose(fd),
|
||||
JSVERIFY(SUCCEED, H5FDclose(fd),
|
||||
"unable to close errant open");
|
||||
fd = NULL;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
JSVERIFY(1, 0, T.message); /* print message and fail */
|
||||
}
|
||||
}
|
||||
@ -867,14 +879,14 @@ test_vfd_open(void)
|
||||
HDfprintf(stderr, "nominal open\n");
|
||||
#endif /* HDFS_TEST_DEBUG */
|
||||
|
||||
/* finally, show that a file can be opened
|
||||
/* finally, show that a file can be opened
|
||||
*/
|
||||
fd = H5FDopen(
|
||||
filename_bard,
|
||||
H5F_ACC_RDONLY,
|
||||
fapl_hdfs,
|
||||
filename_bard,
|
||||
H5F_ACC_RDONLY,
|
||||
fapl_hdfs,
|
||||
MAXADDR);
|
||||
FAIL_IF( NULL == fd )
|
||||
FAIL_IF( NULL == fd )
|
||||
|
||||
/************
|
||||
* TEARDOWN *
|
||||
@ -895,20 +907,23 @@ test_vfd_open(void)
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
error:
|
||||
|
||||
/***********
|
||||
* CLEANUP *
|
||||
***********/
|
||||
|
||||
if (fd)
|
||||
(void)H5FDclose(fd);
|
||||
if (fd) {
|
||||
(void)H5FDclose(fd);
|
||||
}
|
||||
H5E_BEGIN_TRY {
|
||||
if (fapl_hdfs >= 0)
|
||||
if (fapl_hdfs >= 0) {
|
||||
(void)H5Pclose(fapl_hdfs);
|
||||
if (fapl_unconfigured >= 0)
|
||||
}
|
||||
if (fapl_unconfigured >= 0) {
|
||||
(void)H5Pclose(fapl_unconfigured);
|
||||
}
|
||||
} H5E_END_TRY;
|
||||
|
||||
return 1;
|
||||
@ -917,14 +932,16 @@ error:
|
||||
#undef FAPL_UNCONFIGURED
|
||||
#undef FAPL_HDFS
|
||||
|
||||
} /* test_vfd_open */
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
} /* end test_vfd_open() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_eof_eoa()
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Demonstrate behavior of get_eof, get_eoa, and set_eoa.
|
||||
*
|
||||
@ -941,6 +958,15 @@ error:
|
||||
static int
|
||||
test_eof_eoa(void)
|
||||
{
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
TESTING("HDFS eof/eoa gets and sets");
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
/*********************
|
||||
* test-local macros *
|
||||
*********************/
|
||||
@ -958,16 +984,10 @@ test_eof_eoa(void)
|
||||
|
||||
TESTING("HDFS eof/eoa gets and sets");
|
||||
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
/*********
|
||||
* SETUP *
|
||||
*********/
|
||||
|
||||
|
||||
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
||||
FAIL_IF( 0 > fapl_id )
|
||||
FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
|
||||
@ -990,31 +1010,31 @@ test_eof_eoa(void)
|
||||
H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW),
|
||||
"mismatch between DEFAULT and RAW memory types" )
|
||||
JSVERIFY( 0,
|
||||
H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
|
||||
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),
|
||||
JSVERIFY( SUCCEED,
|
||||
H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202),
|
||||
"unable to set EoA (lower)" )
|
||||
JSVERIFY( 5458199,
|
||||
H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
|
||||
JSVERIFY( 5458199,
|
||||
H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
|
||||
"EoF changed" )
|
||||
JSVERIFY( 44442202,
|
||||
H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
|
||||
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),
|
||||
JSVERIFY( SUCCEED,
|
||||
H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012),
|
||||
"unable to set EoA (higher)" )
|
||||
JSVERIFY( 5458199,
|
||||
H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
|
||||
JSVERIFY( 5458199,
|
||||
H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT),
|
||||
"EoF changed" )
|
||||
JSVERIFY( 6789012,
|
||||
H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
|
||||
JSVERIFY( 6789012,
|
||||
H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT),
|
||||
"EoA unchanged" )
|
||||
|
||||
/************
|
||||
@ -1029,9 +1049,9 @@ test_eof_eoa(void)
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
error:
|
||||
|
||||
/***********
|
||||
* CLEANUP *
|
||||
***********/
|
||||
@ -1039,7 +1059,7 @@ error:
|
||||
if (fd_shakespeare != NULL) {
|
||||
(void)H5FDclose(fd_shakespeare);
|
||||
}
|
||||
if (fapl_id >= 0) {
|
||||
if (fapl_id >= 0) {
|
||||
H5E_BEGIN_TRY {
|
||||
(void)H5Pclose(fapl_id);
|
||||
} H5E_END_TRY;
|
||||
@ -1047,15 +1067,17 @@ error:
|
||||
|
||||
return 1;
|
||||
|
||||
} /* test_eof_eoa */
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
} /* end test_eof_eoa() */
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_H5FDread_without_eoa_set_fails()
|
||||
*
|
||||
*
|
||||
* Purpose:
|
||||
*
|
||||
*
|
||||
* Demonstrate a not-obvious constraint by the library, preventing
|
||||
* file read before EoA is set
|
||||
*
|
||||
@ -1067,26 +1089,27 @@ error:
|
||||
static int
|
||||
test_H5FDread_without_eoa_set_fails(void)
|
||||
{
|
||||
#ifdef H5_HAVE_LIBHDFS
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
TESTING("HDFS VFD read-eoa temporal coupling library limitation");
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
char buffer[HDFS_TEST_MAX_BUF_SIZE];
|
||||
unsigned int i = 0;
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
H5FD_t *file_shakespeare = NULL;
|
||||
hid_t fapl_id = -1;
|
||||
|
||||
TESTING("HDFS VFD read-eoa temporal coupling library limitation");
|
||||
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
/*********
|
||||
* SETUP *
|
||||
*********/
|
||||
|
||||
/* create HDFS fapl
|
||||
/* create HDFS fapl
|
||||
*/
|
||||
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
||||
FAIL_IF( fapl_id < 0 )
|
||||
@ -1137,9 +1160,9 @@ test_H5FDread_without_eoa_set_fails(void)
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
error:
|
||||
|
||||
/***********
|
||||
* CLEANUP *
|
||||
***********/
|
||||
@ -1155,7 +1178,9 @@ error:
|
||||
|
||||
return 1;
|
||||
|
||||
} /* test_H5FDread_without_eoa_set_fails */
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
} /* end test_H5FDread_without_eoa_set_fails() */
|
||||
|
||||
|
||||
|
||||
@ -1163,7 +1188,7 @@ error:
|
||||
*
|
||||
* Function: test_read()
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Return:
|
||||
*
|
||||
@ -1178,11 +1203,19 @@ error:
|
||||
static int
|
||||
test_read(void)
|
||||
{
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
TESTING("HDFS VFD read/range-gets");
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
/*********************
|
||||
* test-local macros *
|
||||
*********************/
|
||||
|
||||
#ifdef H5_HAVE_LIBHDFS
|
||||
/*************************
|
||||
* test-local structures *
|
||||
*************************/
|
||||
@ -1248,23 +1281,16 @@ test_read(void)
|
||||
herr_t open_return = FAIL;
|
||||
char buffer[HDFS_TEST_MAX_BUF_SIZE];
|
||||
unsigned int i = 0;
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
H5FD_t *file_raven = NULL;
|
||||
hid_t fapl_id = -1;
|
||||
|
||||
TESTING("HDFS VFD read/range-gets");
|
||||
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
/*********
|
||||
* SETUP *
|
||||
*********/
|
||||
|
||||
/* create HDFS fapl
|
||||
/* create HDFS fapl
|
||||
*/
|
||||
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
||||
FAIL_IF( fapl_id < 0 )
|
||||
@ -1275,7 +1301,7 @@ test_read(void)
|
||||
buffer[i] = 0;
|
||||
}
|
||||
|
||||
/* open file
|
||||
/* open file
|
||||
*/
|
||||
file_raven = H5FDopen(
|
||||
filename_raven,
|
||||
@ -1301,7 +1327,7 @@ test_read(void)
|
||||
|
||||
FAIL_IF( HDFS_TEST_MAX_BUF_SIZE < test.len ) /* buffer too small! */
|
||||
|
||||
FAIL_IF( FAIL ==
|
||||
FAIL_IF( FAIL ==
|
||||
H5FDset_eoa( file_raven, H5FD_MEM_DEFAULT, test.eoa_set) )
|
||||
|
||||
/* zero buffer contents */
|
||||
@ -1345,15 +1371,16 @@ test_read(void)
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
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);
|
||||
@ -1362,14 +1389,16 @@ error:
|
||||
|
||||
return 1;
|
||||
|
||||
} /* test_read */
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
} /* end test_read() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_noops_and_autofails()
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Demonstrate the unavailable and do-nothing routines unique to
|
||||
* Read-Only VFD.
|
||||
@ -1391,6 +1420,15 @@ error:
|
||||
static int
|
||||
test_noops_and_autofails(void)
|
||||
{
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
TESTING("HDFS VFD always-fail and no-op routines");
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
/*********************
|
||||
* test-local macros *
|
||||
*********************/
|
||||
@ -1413,13 +1451,7 @@ test_noops_and_autofails(void)
|
||||
* SETUP *
|
||||
*********/
|
||||
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
/* create HDFS fapl
|
||||
/* create HDFS fapl
|
||||
*/
|
||||
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
||||
FAIL_IF( fapl_id < 0 )
|
||||
@ -1441,7 +1473,7 @@ test_noops_and_autofails(void)
|
||||
/* auto-fail calls to write and truncate
|
||||
*/
|
||||
H5E_BEGIN_TRY {
|
||||
JSVERIFY( FAIL,
|
||||
JSVERIFY( FAIL,
|
||||
H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data),
|
||||
"write must fail" )
|
||||
} H5E_END_TRY;
|
||||
@ -1485,9 +1517,9 @@ test_noops_and_autofails(void)
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
error:
|
||||
|
||||
/***********
|
||||
* CLEANUP *
|
||||
***********/
|
||||
@ -1503,14 +1535,16 @@ error:
|
||||
|
||||
return 1;
|
||||
|
||||
} /* test_noops_and_autofails*/
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
} /* end test_noops_and_autofails() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_cmp()
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Verify "file comparison" behavior.
|
||||
*
|
||||
@ -1527,117 +1561,6 @@ error:
|
||||
static int
|
||||
test_cmp(void)
|
||||
{
|
||||
#if 0
|
||||
/*********************
|
||||
* test-local macros *
|
||||
*********************/
|
||||
|
||||
/*************************
|
||||
* test-local structures *
|
||||
*************************/
|
||||
|
||||
/************************
|
||||
* test-local variables *
|
||||
************************/
|
||||
|
||||
H5FD_t *fd_raven = NULL;
|
||||
H5FD_t *fd_shakes = NULL;
|
||||
H5FD_t *fd_raven_2 = NULL;
|
||||
hbool_t curl_ready = FALSE;
|
||||
hid_t fapl_id = -1;
|
||||
|
||||
|
||||
|
||||
TESTING("HDFS cmp (comparison)");
|
||||
|
||||
if (s3_test_credentials_loaded == 0) {
|
||||
SKIPPED();
|
||||
puts(" s3 credentials are not loaded");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*********
|
||||
* SETUP *
|
||||
*********/
|
||||
|
||||
FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) )
|
||||
curl_ready = TRUE;
|
||||
|
||||
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
||||
FAIL_IF( 0 > fapl_id )
|
||||
JSVERIFY( SUCCEED, H5Pset_fapl_hdfs(fapl_id, &restricted_access_fa), NULL )
|
||||
|
||||
fd_raven = H5FDopen(
|
||||
url_text_public,
|
||||
H5F_ACC_RDONLY,
|
||||
fapl_id,
|
||||
HADDR_UNDEF);
|
||||
FAIL_IF( NULL == fd_raven )
|
||||
|
||||
fd_shakes = H5FDopen(
|
||||
url_text_restricted,
|
||||
H5F_ACC_RDONLY,
|
||||
fapl_id,
|
||||
HADDR_UNDEF);
|
||||
FAIL_IF( NULL == fd_shakes )
|
||||
|
||||
fd_raven_2 = H5FDopen(
|
||||
url_text_public,
|
||||
H5F_ACC_RDONLY,
|
||||
fapl_id,
|
||||
HADDR_UNDEF);
|
||||
FAIL_IF( NULL == fd_raven_2 )
|
||||
|
||||
/*********
|
||||
* TESTS *
|
||||
*********/
|
||||
|
||||
JSVERIFY( 0, H5FDcmp(fd_raven, fd_raven_2), NULL )
|
||||
JSVERIFY( -1, H5FDcmp(fd_raven, fd_shakes), NULL )
|
||||
JSVERIFY( 1, H5FDcmp(fd_shakes, fd_raven_2), NULL )
|
||||
|
||||
/************
|
||||
* TEARDOWN *
|
||||
************/
|
||||
|
||||
FAIL_IF( FAIL == H5FDclose(fd_raven) )
|
||||
fd_raven = NULL;
|
||||
FAIL_IF( FAIL == H5FDclose(fd_shakes) )
|
||||
fd_shakes = NULL;
|
||||
FAIL_IF( FAIL == H5FDclose(fd_raven_2) )
|
||||
fd_raven_2 = NULL;
|
||||
FAIL_IF( FAIL == H5Pclose(fapl_id) )
|
||||
fapl_id = -1;
|
||||
|
||||
curl_global_cleanup();
|
||||
curl_ready = FALSE;
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
|
||||
error:
|
||||
/***********
|
||||
* CLEANUP *
|
||||
***********/
|
||||
|
||||
if (fd_raven != NULL) (void)H5FDclose(fd_raven);
|
||||
if (fd_raven_2 != NULL) (void)H5FDclose(fd_raven_2);
|
||||
if (fd_shakes != NULL) (void)H5FDclose(fd_shakes);
|
||||
if (TRUE == curl_ready) curl_global_cleanup();
|
||||
if (fapl_id >= 0) {
|
||||
H5E_BEGIN_TRY {
|
||||
(void)H5Pclose(fapl_id);
|
||||
} H5E_END_TRY;
|
||||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
JSFAILED_AT()
|
||||
HDprintf("TODO\n");
|
||||
return 1;
|
||||
*/
|
||||
|
||||
TESTING("HDFS cmp (comparison)");
|
||||
SKIPPED();
|
||||
HDfprintf(
|
||||
@ -1645,16 +1568,15 @@ error:
|
||||
" TODO: Distinct valid fapls to open the same file.\n");
|
||||
|
||||
return 0;
|
||||
#endif /* s3comms relic */
|
||||
|
||||
} /* test_cmp */
|
||||
} /* end test_cmp() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_H5F_integration()
|
||||
*
|
||||
* Purpose:
|
||||
* Purpose:
|
||||
*
|
||||
* Demonstrate H5F (File interface) behavior with files on HDFS.
|
||||
*
|
||||
@ -1675,6 +1597,15 @@ error:
|
||||
static int
|
||||
test_H5F_integration(void)
|
||||
{
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
TESTING("HDFS file access through HD5F library (H5F API)");
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
/*********************
|
||||
* test-local macros *
|
||||
*********************/
|
||||
@ -1696,12 +1627,6 @@ test_H5F_integration(void)
|
||||
* SETUP *
|
||||
*********/
|
||||
|
||||
#ifndef H5_HAVE_LIBHDFS
|
||||
SKIPPED();
|
||||
puts(" HDFS VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
||||
FAIL_IF( 0 > fapl_id )
|
||||
FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) )
|
||||
@ -1749,7 +1674,6 @@ test_H5F_integration(void)
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
error:
|
||||
/***********
|
||||
@ -1771,6 +1695,8 @@ error:
|
||||
|
||||
return 1;
|
||||
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
} /* test_H5F_integration */
|
||||
|
||||
|
||||
@ -1796,15 +1722,19 @@ main(void)
|
||||
/******************
|
||||
* commence tests *
|
||||
******************/
|
||||
|
||||
static char hdfs_namenode_name[MAX_HDFS_NAMENODE_NAME] = "";
|
||||
|
||||
static char hdfs_namenode_name[HDFS_NAMENODE_NAME_MAX_SIZE] = "";
|
||||
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", 9);
|
||||
} else {
|
||||
HDstrncpy(default_fa.namenode_name, hdfs_namenode_name_env, MAX_HDFS_NAMENODE_NAME);
|
||||
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);
|
||||
}
|
||||
|
||||
h5_reset();
|
||||
@ -1823,14 +1753,15 @@ main(void)
|
||||
|
||||
if (nerrors > 0) {
|
||||
HDprintf("***** %d hdfs TEST%s FAILED! *****\n",
|
||||
nerrors,
|
||||
nerrors,
|
||||
nerrors > 1 ? "S" : "");
|
||||
nerrors = 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
HDprintf("All hdfs tests passed.\n");
|
||||
}
|
||||
return nerrors; /* 0 if no errors, 1 if any errors */
|
||||
|
||||
} /* main() */
|
||||
} /* end main() */
|
||||
|
||||
|
||||
|
174
test/ros3.c
174
test/ros3.c
@ -11,7 +11,7 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Read-Only S3 Virtual File Driver (VFD)
|
||||
* Read-Only S3 Virtual File Driver (VFD)
|
||||
*
|
||||
* Purpose:
|
||||
*
|
||||
@ -32,6 +32,9 @@
|
||||
|
||||
|
||||
|
||||
/* only include the testing macros if needed */
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* FILE-LOCAL TESTING MACROS
|
||||
@ -368,15 +371,16 @@ if (strcmp((actual), (expected)) != 0) { \
|
||||
|
||||
#endif /* ifdef/else JSVERIFY_EXP_ACT */
|
||||
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
/********************************
|
||||
* OTHER MACROS AND DEFINITIONS *
|
||||
********************************/
|
||||
|
||||
/* copied from src/ros3.c
|
||||
*/
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
|
||||
#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
#define S3_TEST_PROFILE_NAME "ros3_vfd_test"
|
||||
|
||||
#define S3_TEST_MAX_URL_SIZE 256
|
||||
@ -440,6 +444,15 @@ H5FD_ros3_fapl_t anonymous_fa = {
|
||||
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 *
|
||||
*********************/
|
||||
@ -458,7 +471,6 @@ test_fapl_config_validation(void)
|
||||
* test-local variables *
|
||||
************************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
hid_t fapl_id = -1; /* file access property list ID */
|
||||
H5FD_ros3_fapl_t config;
|
||||
H5FD_ros3_fapl_t fa_fetch;
|
||||
@ -544,21 +556,12 @@ test_fapl_config_validation(void)
|
||||
},
|
||||
};
|
||||
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("ROS3 fapl configuration validation");
|
||||
|
||||
/*********
|
||||
* TESTS *
|
||||
*********/
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
|
||||
if (FALSE == s3_test_bucket_defined) {
|
||||
SKIPPED();
|
||||
puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
|
||||
@ -655,7 +658,7 @@ error:
|
||||
* Purpose: Tests the file handle interface for the ROS3 driver
|
||||
*
|
||||
* As the ROS3 driver is 1) read only, 2) requires access
|
||||
* to an S3 server (minio for now), this test is quite
|
||||
* to an S3 server, this test is quite
|
||||
* different from the other tests.
|
||||
*
|
||||
* For now, test only fapl & flags. Extend as the
|
||||
@ -675,11 +678,19 @@ error:
|
||||
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 *
|
||||
************************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
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 */
|
||||
@ -690,16 +701,9 @@ test_ros3_fapl(void)
|
||||
"", /* secret_id */
|
||||
"plugh", /* secret_key */
|
||||
};
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("ROS3 fapl ");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
/* Set property list and file name for ROS3 driver.
|
||||
*/
|
||||
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
|
||||
@ -759,11 +763,19 @@ 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 *
|
||||
*********************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
|
||||
#define FAPL_H5P_DEFAULT -2
|
||||
#define FAPL_FILE_ACCESS -3
|
||||
@ -853,17 +865,9 @@ test_vfd_open(void)
|
||||
hid_t fapl_file_access = -1;
|
||||
unsigned i = 0;
|
||||
unsigned tests_count = 10;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("ROS3 VFD-level open");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
|
||||
if (FALSE == s3_test_bucket_defined) {
|
||||
SKIPPED();
|
||||
puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined");
|
||||
@ -989,6 +993,15 @@ 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 *
|
||||
*********************/
|
||||
@ -1001,20 +1014,12 @@ test_eof_eoa(void)
|
||||
* test-local variables *
|
||||
************************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
H5FD_t *fd_shakespeare = NULL;
|
||||
hbool_t curl_ready = FALSE;
|
||||
hid_t fapl_id = -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("ROS3 eof/eoa gets and sets");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
if (s3_test_credentials_loaded == 0) {
|
||||
SKIPPED();
|
||||
puts(" s3 credentials are not loaded");
|
||||
@ -1136,21 +1141,22 @@ error:
|
||||
static int
|
||||
test_H5FDread_without_eoa_set_fails(void)
|
||||
{
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
char buffer[256];
|
||||
unsigned int i = 0;
|
||||
H5FD_t *file_shakespeare = NULL;
|
||||
hid_t fapl_id = -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("ROS3 VFD read-eoa temporal coupling library limitation ");
|
||||
|
||||
#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
|
||||
|
||||
#else /* H5_HAVE_ROS3_VFD defined */
|
||||
|
||||
char buffer[256];
|
||||
unsigned int i = 0;
|
||||
H5FD_t *file_shakespeare = NULL;
|
||||
hid_t fapl_id = -1;
|
||||
|
||||
TESTING("ROS3 VFD read-eoa temporal coupling library limitation ");
|
||||
|
||||
if (s3_test_credentials_loaded == 0) {
|
||||
SKIPPED();
|
||||
puts(" s3 credentials are not loaded");
|
||||
@ -1256,6 +1262,15 @@ 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 *
|
||||
*********************/
|
||||
@ -1275,7 +1290,6 @@ test_read(void)
|
||||
/************************
|
||||
* test-local variables *
|
||||
************************/
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
struct testcase cases[] = {
|
||||
{ "successful range-get",
|
||||
6464,
|
||||
@ -1328,16 +1342,9 @@ test_read(void)
|
||||
unsigned int i = 0;
|
||||
H5FD_t *file_raven = NULL;
|
||||
hid_t fapl_id = -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("ROS3 VFD read/range-gets");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
if (s3_test_credentials_loaded == 0) {
|
||||
SKIPPED();
|
||||
puts(" s3 credentials are not loaded");
|
||||
@ -1471,6 +1478,15 @@ 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 *
|
||||
*********************/
|
||||
@ -1483,21 +1499,13 @@ test_noops_and_autofails(void)
|
||||
* test-local variables *
|
||||
************************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
hbool_t curl_ready = FALSE;
|
||||
hid_t fapl_id = -1;
|
||||
H5FD_t *file = NULL;
|
||||
const char data[36] = "The Force shall be with you, always";
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("ROS3 VFD always-fail and no-op routines");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
|
||||
if (FALSE == s3_test_bucket_defined) {
|
||||
SKIPPED();
|
||||
@ -1624,6 +1632,15 @@ 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 *
|
||||
*********************/
|
||||
@ -1636,22 +1653,14 @@ test_cmp(void)
|
||||
* test-local variables *
|
||||
************************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
H5FD_t *fd_raven = NULL;
|
||||
H5FD_t *fd_shakes = NULL;
|
||||
H5FD_t *fd_raven_2 = NULL;
|
||||
hbool_t curl_ready = FALSE;
|
||||
hid_t fapl_id = -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("ROS3 cmp (comparison)");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
if (s3_test_credentials_loaded == 0) {
|
||||
SKIPPED();
|
||||
puts(" s3 credentials are not loaded");
|
||||
@ -1767,6 +1776,15 @@ 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 *
|
||||
*********************/
|
||||
@ -1779,19 +1797,11 @@ test_H5F_integration(void)
|
||||
* test-local variables *
|
||||
************************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
hid_t file = -1;
|
||||
hid_t fapl_id = -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("S3 file access through HD5F library (H5F API)");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
if (s3_test_credentials_loaded == 0) {
|
||||
SKIPPED();
|
||||
puts(" s3 credentials are not loaded");
|
||||
|
215
test/s3comms.c
215
test/s3comms.c
@ -11,7 +11,7 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Read-Only S3 Virtual File Driver (VFD)
|
||||
* Read-Only S3 Virtual File Driver (VFD)
|
||||
*
|
||||
* Purpose: Unit tests for the S3 Communications (s3comms) module.
|
||||
*
|
||||
@ -386,7 +386,7 @@ static hbool_t s3_test_bucket_defined = FALSE;
|
||||
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_macro_format_credential()
|
||||
@ -408,7 +408,6 @@ test_macro_format_credential(void)
|
||||
* test-local variables *
|
||||
************************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
char dest[256];
|
||||
const char access[] = "AKIAIOSFODNN7EXAMPLE";
|
||||
const char date[] = "20130524";
|
||||
@ -416,16 +415,9 @@ test_macro_format_credential(void)
|
||||
const char service[] = "s3";
|
||||
const char expected[] =
|
||||
"AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/aws4_request";
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("test_macro_format_credential");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
FAIL_IF( S3COMMS_MAX_CREDENTIAL_SIZE <
|
||||
S3COMMS_FORMAT_CREDENTIAL(dest, access, date, region, service) )
|
||||
|
||||
@ -433,14 +425,13 @@ test_macro_format_credential(void)
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
error:
|
||||
return -1;
|
||||
|
||||
} /* test_macro_format_credential */
|
||||
|
||||
} /* end test_macro_format_credential() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_aws_canonical_request()
|
||||
@ -465,7 +456,6 @@ test_aws_canonical_request(void)
|
||||
* test-local structures *
|
||||
*************************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
struct header {
|
||||
const char *name;
|
||||
const char *value;
|
||||
@ -520,16 +510,9 @@ test_aws_canonical_request(void)
|
||||
hrb_node_t *node = NULL; /* http headers list pointer */
|
||||
unsigned int n_cases = 3;
|
||||
char sh_dest[64]; /* signed headers */
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("test_aws_canonical_request");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
for (i = 0; i < n_cases; i++) {
|
||||
/* pre-test bookkeeping
|
||||
*/
|
||||
@ -559,16 +542,22 @@ test_aws_canonical_request(void)
|
||||
/* test
|
||||
*/
|
||||
JSVERIFY( SUCCEED,
|
||||
H5FD_s3comms_aws_canonical_request(cr_dest, sh_dest, hrb),
|
||||
H5FD_s3comms_aws_canonical_request(
|
||||
cr_dest,
|
||||
512,
|
||||
sh_dest,
|
||||
64,
|
||||
hrb),
|
||||
" unable to compose canonical request" )
|
||||
JSVERIFY_STR( C->exp_headers, sh_dest, NULL )
|
||||
JSVERIFY_STR( C->exp_request, cr_dest, NULL )
|
||||
|
||||
/* tear-down
|
||||
*/
|
||||
while (node != NULL)
|
||||
while (node != NULL) {
|
||||
FAIL_IF( FAIL ==
|
||||
H5FD_s3comms_hrb_node_set(&node, node->name, NULL));
|
||||
}
|
||||
HDassert(NULL == node);
|
||||
FAIL_IF( FAIL == H5FD_s3comms_hrb_destroy(&hrb));
|
||||
HDassert(NULL == hrb);
|
||||
@ -581,14 +570,29 @@ test_aws_canonical_request(void)
|
||||
|
||||
/* malformed hrb and/or node-list
|
||||
*/
|
||||
JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(cr_dest, sh_dest, NULL),
|
||||
JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(
|
||||
cr_dest,
|
||||
20,
|
||||
sh_dest,
|
||||
20,
|
||||
NULL),
|
||||
"http request object cannot be null" )
|
||||
|
||||
hrb = H5FD_s3comms_hrb_init_request("GET", "/", "HTTP/1.1");
|
||||
JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(NULL, sh_dest, hrb),
|
||||
JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(
|
||||
NULL,
|
||||
20,
|
||||
sh_dest,
|
||||
20,
|
||||
hrb),
|
||||
"canonical request destination cannot be NULL" )
|
||||
|
||||
JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(cr_dest, NULL, hrb),
|
||||
JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(
|
||||
cr_dest,
|
||||
20,
|
||||
NULL,
|
||||
20,
|
||||
hrb),
|
||||
"signed headers destination cannot be null" )
|
||||
|
||||
FAIL_IF( FAIL == H5FD_s3comms_hrb_destroy(&hrb) )
|
||||
@ -604,15 +608,15 @@ error:
|
||||
(void)H5FD_s3comms_hrb_node_set(&node, node->name, NULL);
|
||||
HDassert( node == NULL );
|
||||
}
|
||||
if (hrb != NULL)
|
||||
if (hrb != NULL) {
|
||||
(void)H5FD_s3comms_hrb_destroy(&hrb);
|
||||
}
|
||||
|
||||
return -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_aws_canonical_request */
|
||||
|
||||
} /* end test_aws_canonical_request() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_bytes_to_hex
|
||||
@ -706,9 +710,9 @@ test_bytes_to_hex(void)
|
||||
error:
|
||||
return -1;
|
||||
|
||||
} /* test_bytes_to_hex */
|
||||
|
||||
} /* end test_bytes_to_hex() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_hrb_init_request()
|
||||
@ -725,7 +729,6 @@ error:
|
||||
static herr_t
|
||||
test_hrb_init_request(void)
|
||||
{
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
/*********************
|
||||
* test-local macros *
|
||||
*********************/
|
||||
@ -769,7 +772,7 @@ test_hrb_init_request(void)
|
||||
"HTTP/1.1",
|
||||
FALSE,
|
||||
},
|
||||
{ "slash prepented to resource path, if necessary",
|
||||
{ "slash prepended to resource path, if necessary",
|
||||
NULL,
|
||||
"MYPATH/MYFILE.tiff",
|
||||
"/MYPATH/MYFILE.tiff",
|
||||
@ -788,29 +791,25 @@ test_hrb_init_request(void)
|
||||
unsigned int i = 0;
|
||||
unsigned int ncases = 5;
|
||||
hrb_t *req = NULL;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("hrb_init_request");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
for (i = 0; i < ncases; i++) {
|
||||
C = &cases[i];
|
||||
req = H5FD_s3comms_hrb_init_request(C->verb,
|
||||
C->resource,
|
||||
C->version);
|
||||
req = H5FD_s3comms_hrb_init_request(
|
||||
C->verb,
|
||||
C->resource,
|
||||
C->version);
|
||||
if (cases[i].ret_null == TRUE) {
|
||||
FAIL_IF( req != NULL );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
FAIL_IF( req == NULL );
|
||||
JSVERIFY( S3COMMS_HRB_MAGIC, req->magic, NULL )
|
||||
if (C->verb == NULL) {
|
||||
JSVERIFY_STR( "GET", req->verb, NULL )
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
JSVERIFY_STR( req->verb, C->verb, NULL )
|
||||
}
|
||||
JSVERIFY_STR( "HTTP/1.1", req->version, NULL )
|
||||
@ -823,7 +822,7 @@ test_hrb_init_request(void)
|
||||
FAIL_IF( NULL != req ); /* should annull pointer as well as free */
|
||||
}
|
||||
|
||||
} /* for each testcase */
|
||||
} /* end for each testcase */
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
@ -832,11 +831,10 @@ error:
|
||||
(void)H5FD_s3comms_hrb_destroy(&req);
|
||||
|
||||
return -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_hrb_init_request */
|
||||
|
||||
} /* end test_hrb_init_request() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_hrb_node_set()
|
||||
@ -853,7 +851,6 @@ error:
|
||||
static herr_t
|
||||
test_hrb_node_set(void)
|
||||
{
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
/*************************
|
||||
* test-local structures *
|
||||
*************************/
|
||||
@ -1071,18 +1068,10 @@ test_hrb_node_set(void)
|
||||
};
|
||||
unsigned testcases_count = 16;
|
||||
unsigned test_i = 0;
|
||||
|
||||
hrb_node_t *list = NULL;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("test_hrb_node_t");
|
||||
TESTING("hrb_node_t (test_hrb_node_set)");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
for (test_i = 0; test_i < testcases_count; test_i++) {
|
||||
const hrb_node_t *node = NULL;
|
||||
const testcase *test = &(cases[test_i]);
|
||||
@ -1137,21 +1126,22 @@ test_hrb_node_set(void)
|
||||
FAIL_IF( SUCCEED !=
|
||||
H5FD_s3comms_hrb_node_set(&list, list->name, NULL) )
|
||||
}
|
||||
}
|
||||
} /* end for each testcase */
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
|
||||
error:
|
||||
while (list != NULL)
|
||||
while (list != NULL) {
|
||||
(void)H5FD_s3comms_hrb_node_set(&list, list->name, NULL);
|
||||
}
|
||||
|
||||
return -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_hrb_node_t */
|
||||
} /* end test_hrb_node_t() */
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_HMAC_SHA256()
|
||||
@ -1265,13 +1255,13 @@ test_HMAC_SHA256(void)
|
||||
dest);
|
||||
TEST_ERROR;
|
||||
}
|
||||
#else
|
||||
#else /* VERBOSE not defined */
|
||||
/* simple pass/fail test
|
||||
*/
|
||||
JSVERIFY( 0,
|
||||
strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)),
|
||||
NULL);
|
||||
#endif
|
||||
#endif /* VERBOSE */
|
||||
}
|
||||
free(dest);
|
||||
}
|
||||
@ -1284,9 +1274,9 @@ error:
|
||||
return -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_HMAC_SHA256 */
|
||||
|
||||
} /* end test_HMAC_SHA256() */
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_nlowercase()
|
||||
@ -1307,7 +1297,6 @@ test_nlowercase(void)
|
||||
* test-local structures *
|
||||
*************************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
struct testcase {
|
||||
const char *in;
|
||||
size_t len;
|
||||
@ -1338,16 +1327,9 @@ test_nlowercase(void)
|
||||
char *dest = NULL;
|
||||
int i = 0;
|
||||
int n_cases = 3;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("nlowercase");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
for (i = 0; i < n_cases; i++) {
|
||||
dest = (char *)HDmalloc(sizeof(char) * 16);
|
||||
|
||||
@ -1360,7 +1342,7 @@ test_nlowercase(void)
|
||||
JSVERIFY( 0, strncmp(dest, cases[i].exp, cases[i].len), NULL )
|
||||
}
|
||||
free(dest);
|
||||
}
|
||||
} /* end for each testcase */
|
||||
|
||||
JSVERIFY( FAIL,
|
||||
H5FD_s3comms_nlowercase(NULL,
|
||||
@ -1374,11 +1356,10 @@ test_nlowercase(void)
|
||||
error:
|
||||
free(dest);
|
||||
return -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_nlowercase */
|
||||
|
||||
} /* end test_nlowercase() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_parse_url()
|
||||
@ -1399,7 +1380,6 @@ test_parse_url(void)
|
||||
* test-local structures *
|
||||
*************************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
typedef struct {
|
||||
const char *scheme;
|
||||
const char *host;
|
||||
@ -1540,16 +1520,9 @@ test_parse_url(void)
|
||||
"non-decimal PORT (01a3)",
|
||||
},
|
||||
};
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("url-parsing functionality");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
/*********
|
||||
* TESTS *
|
||||
*********/
|
||||
@ -1564,7 +1537,8 @@ test_parse_url(void)
|
||||
if (cases[i].exp_ret == FAIL) {
|
||||
/* on FAIL, `purl` should be untouched--remains NULL */
|
||||
FAIL_UNLESS( purl == NULL )
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* on SUCCEED, `purl` should be set */
|
||||
FAIL_IF( purl == NULL )
|
||||
|
||||
@ -1612,7 +1586,7 @@ test_parse_url(void)
|
||||
} else {
|
||||
FAIL_UNLESS( NULL == purl->query )
|
||||
}
|
||||
} /* if parse-url return SUCCEED/FAIL */
|
||||
} /* end if parse-url return SUCCEED/FAIL */
|
||||
|
||||
/* per-test cleanup
|
||||
* well-behaved, even if `purl` is NULL
|
||||
@ -1620,7 +1594,7 @@ test_parse_url(void)
|
||||
FAIL_IF( FAIL == H5FD_s3comms_free_purl(purl) )
|
||||
purl = NULL;
|
||||
|
||||
} /* for each testcase */
|
||||
} /* end for each testcase */
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
@ -1632,11 +1606,10 @@ error:
|
||||
(void)H5FD_s3comms_free_purl(purl);
|
||||
|
||||
return -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_parse_url */
|
||||
|
||||
} /* end test_parse_url() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_percent_encode_char()
|
||||
@ -1662,7 +1635,6 @@ test_percent_encode_char(void)
|
||||
* test-local structures *
|
||||
*************************/
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
struct testcase {
|
||||
const char c;
|
||||
const char *exp;
|
||||
@ -1692,16 +1664,9 @@ test_percent_encode_char(void)
|
||||
size_t dest_len = 0;
|
||||
int i = 0;
|
||||
int n_cases = 5;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
TESTING("percent encode characters");
|
||||
|
||||
#ifndef H5_HAVE_ROS3_VFD
|
||||
SKIPPED();
|
||||
puts(" ROS3 VFD is not enabled");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
#else
|
||||
for (i = 0; i < n_cases; i++) {
|
||||
JSVERIFY( SUCCEED,
|
||||
H5FD_s3comms_percent_encode_char(
|
||||
@ -1726,11 +1691,9 @@ test_percent_encode_char(void)
|
||||
|
||||
error:
|
||||
return -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_percent_encode_char */
|
||||
|
||||
} /* end test_percent_encode_char() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: test_s3r_open()
|
||||
*
|
||||
@ -1798,9 +1761,9 @@ error:
|
||||
return -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_s3r_get_filesize */
|
||||
|
||||
} /* end test_s3r_get_filesize() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Function: test_s3r_open()
|
||||
*
|
||||
@ -2039,9 +2002,9 @@ error:
|
||||
return -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_s3r_open */
|
||||
|
||||
} /* end test_s3r_open() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_s3r_read()
|
||||
@ -2265,7 +2228,7 @@ error:
|
||||
#undef S3COMMS_TEST_BUFFER_SIZE
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_s3r_read */
|
||||
} /* end test_s3r_read() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
@ -2404,9 +2367,9 @@ error:
|
||||
return -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_signing_key */
|
||||
|
||||
} /* end test_signing_key() */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_tostringtosign()
|
||||
@ -2476,9 +2439,9 @@ error :
|
||||
return -1;
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
} /* test_tostringtosign */
|
||||
|
||||
} /* end test_tostringtosign() */
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_trim()
|
||||
@ -2563,7 +2526,7 @@ test_trim(void)
|
||||
}
|
||||
free(str);
|
||||
str = NULL;
|
||||
}
|
||||
} /* end for each testcase */
|
||||
|
||||
JSVERIFY( SUCCEED, H5FD_s3comms_trim(dest, NULL, 3, &dest_len),
|
||||
"should not fail when trimming a null string" );
|
||||
@ -2582,13 +2545,14 @@ test_trim(void)
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (str != NULL)
|
||||
if (str != NULL) {
|
||||
free(str);
|
||||
}
|
||||
return -1;
|
||||
|
||||
} /* test_trim */
|
||||
|
||||
} /* end test_trim() */
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
*
|
||||
* Function: test_uriencode()
|
||||
@ -2685,7 +2649,7 @@ test_uriencode(void)
|
||||
|
||||
free(dest);
|
||||
dest = NULL;
|
||||
}
|
||||
} /* end for each testcase */
|
||||
|
||||
/***************
|
||||
* ERROR CASES *
|
||||
@ -2713,11 +2677,11 @@ error:
|
||||
}
|
||||
return -1;
|
||||
|
||||
} /* test_uriencode */
|
||||
|
||||
} /* end test_uriencode() */
|
||||
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main()
|
||||
*
|
||||
@ -2774,7 +2738,8 @@ main(void)
|
||||
if (bucket_url_env == NULL || bucket_url_env[0] == '\0') {
|
||||
HDprintf("WARNING: S3 bucket url is not defined in enviornment " \
|
||||
"variable 'HDF5_ROS3_TEST_BUCKET_URL'!\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
HDstrncpy(s3_test_bucket_url, bucket_url_env, S3_TEST_MAX_URL_SIZE);
|
||||
s3_test_bucket_defined = TRUE;
|
||||
}
|
||||
@ -2799,12 +2764,12 @@ main(void)
|
||||
nerrors += test_s3r_get_filesize() < 0 ? 1 : 0;
|
||||
nerrors += test_s3r_read() < 0 ? 1 : 0;
|
||||
|
||||
if(nerrors) {
|
||||
if (nerrors) {
|
||||
HDprintf("***** %d S3comms TEST%s FAILED! *****\n",
|
||||
nerrors,
|
||||
nerrors > 1 ? "S" : "");
|
||||
return 1;
|
||||
} /* end if */
|
||||
}
|
||||
|
||||
HDprintf("All S3comms tests passed.\n");
|
||||
|
||||
|
@ -24,6 +24,7 @@ static int doxml = 0;
|
||||
static int useschema = 1;
|
||||
static const char *xml_dtd_uri = NULL;
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
static H5FD_ros3_fapl_t ros3_fa = {
|
||||
1, /* version */
|
||||
false, /* authenticate */
|
||||
@ -31,7 +32,9 @@ static H5FD_ros3_fapl_t ros3_fa = {
|
||||
"", /* access key id */
|
||||
"", /* secret access key */
|
||||
};
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
#ifdef H5_HAVE_LIBHDFS
|
||||
static H5FD_hdfs_fapl_t hdfs_fa = {
|
||||
1, /* fapl version */
|
||||
"localhost", /* namenode name */
|
||||
@ -40,6 +43,7 @@ static H5FD_hdfs_fapl_t hdfs_fa = {
|
||||
"", /* user name */
|
||||
2048, /* stream buffer size */
|
||||
};
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
/* module-scoped variables for XML option */
|
||||
#define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd"
|
||||
|
@ -2612,6 +2612,7 @@ main(int argc, const char *argv[])
|
||||
int err_exit = 0;
|
||||
hid_t fapl_id = H5P_DEFAULT;
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
/* default "anonymous" s3 configuration */
|
||||
H5FD_ros3_fapl_t ros3_fa = {
|
||||
1, /* fapl version */
|
||||
@ -2620,7 +2621,9 @@ main(int argc, const char *argv[])
|
||||
"", /* access key id */
|
||||
"", /* secret access key */
|
||||
};
|
||||
#endif /* H5_HVAE_ROS3_VFD */
|
||||
|
||||
#ifdef H5_HAVE_LIBHDFS
|
||||
/* "default" HDFS configuration */
|
||||
H5FD_hdfs_fapl_t hdfs_fa = {
|
||||
1, /* fapl version */
|
||||
@ -2630,6 +2633,7 @@ main(int argc, const char *argv[])
|
||||
"", /* user name */
|
||||
2048, /* stream buffer size */
|
||||
};
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
h5tools_setprogname(PROGRAMNAME);
|
||||
h5tools_setstatus(EXIT_SUCCESS);
|
||||
|
@ -120,6 +120,7 @@ typedef struct iter_t {
|
||||
|
||||
static const char *drivername = "";
|
||||
|
||||
#ifdef H5_HAVE_ROS3_VFD
|
||||
/* default "anonymous" s3 configuration
|
||||
*/
|
||||
static H5FD_ros3_fapl_t ros3_fa = {
|
||||
@ -129,7 +130,9 @@ static H5FD_ros3_fapl_t ros3_fa = {
|
||||
"", /* access key id */
|
||||
"", /* secret access key */
|
||||
};
|
||||
#endif /* H5_HAVE_ROS3_VFD */
|
||||
|
||||
#ifdef H5_HAVE_LIBHDFS
|
||||
/* default HDFS access configuration
|
||||
*/
|
||||
static H5FD_hdfs_fapl_t hdfs_fa = {
|
||||
@ -140,6 +143,7 @@ static H5FD_hdfs_fapl_t hdfs_fa = {
|
||||
"", /* user name */
|
||||
2048, /* stream buffer size */
|
||||
};
|
||||
#endif /* H5_HAVE_LIBHDFS */
|
||||
|
||||
static int display_all = TRUE;
|
||||
|
||||
@ -544,8 +548,8 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
|
||||
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed");
|
||||
|
||||
/* Get storage info */
|
||||
if((storage = H5Dget_storage_size(did)) < 0)
|
||||
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_storage_size() failed");
|
||||
/* Failure 0 indistinguishable from no-data-stored 0 */
|
||||
storage = H5Dget_storage_size(did);
|
||||
|
||||
/* Gather layout statistics */
|
||||
if((dcpl = H5Dget_create_plist(did)) < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user