Merge pull request #1433 in HDFFV/hdf5 from ~BYRN/hdf5_adb:develop to develop

* commit '564565b15ed38d78cb7b29b8c9d9b322d224ab42':
  HDFFV-10664 update reference file
  HDFFV-10664 update reference files
  HDFFV-10664 add missing function and check for restriction
This commit is contained in:
Larry Knox
2019-01-04 14:31:51 -06:00
7 changed files with 90 additions and 28 deletions

View File

@@ -3247,7 +3247,6 @@ public class H5 implements java.io.Serializable {
*
* @param file_id
* IN: Identifier of the target file.
*
* @param minimize
* the minimize hint setting
*
@@ -3257,13 +3256,29 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Fset_dset_no_attrs_hint(long file_id, boolean minimize)
throws HDF5LibraryException;
/**
* H5Fset_libver_bounds sets a different low and high bounds while a file is open.
*
* @param file_id
* IN: Identifier of the target file.
* @param low
* IN: The earliest version of the library that will be used for writing objects
* @param high
* IN: The latest version of the library that will be used for writing objects.
*
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
public synchronized static native void H5Fset_libver_bounds(long file_id, int low, int high)
throws HDF5LibraryException;
// /////// unimplemented ////////
// herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa);
// herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment);
// ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len);
// herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info);
// ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/);
// herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high);
// herr_t H5Fformat_convert(hid_t fid);
// herr_t H5Freset_page_buffering_stats(hid_t file_id);
// herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2],

View File

@@ -149,6 +149,9 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5
(JNIEnv *env, jclass clss, jstring name)
{
htri_t bval = JNI_FALSE;
#ifdef H5_NO_DEPRECATED_SYMBOLS
h5unimplemented(env, "H5Fis_hdf5: not implemented");
#else
const char *fileName;
PIN_JAVA_STRING(name, fileName);
@@ -162,7 +165,7 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5
else if (bval < 0)
h5libraryError(env);
}
#endif
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */
@@ -681,6 +684,22 @@ Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
return bval;
}
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fset_libver_bounds
* Signature: (JII)V
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
(JNIEnv *env, jclass clss, jlong file_id, jint low, jint high)
{
herr_t retVal = -1;
retVal = H5Fset_libver_bounds((hid_t)file_id, (H5F_libver_t)low, (H5F_libver_t)high);
if(retVal < 0)
h5libraryError(env);
} /* end Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds */
#ifdef __cplusplus
} /* end extern "C" */

View File

@@ -273,6 +273,15 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
(JNIEnv *, jclass, jlong);
/*
* Class: hdf_hdf5lib_H5
* Method: H5Fset_libver_bounds
* Signature: (JII)V
*/
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
(JNIEnv *, jclass, jlong, jint, jint);
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */

View File

@@ -69,19 +69,6 @@ public class TestH5Fbasic {
assertTrue(H5fid > 0);
}
@Test
public void testH5Fis_hdf5() {
boolean isH5 = false;
try {
isH5 = H5.H5Fis_hdf5(H5_FILE);
}
catch (Throwable err) {
fail("H5.H5Fis_hdf5 failed on " + H5_FILE + ": " + err);
}
assertTrue(isH5 == true);
}
@Test
public void testH5Fis_accessible() {
boolean isH5 = false;

View File

@@ -22,10 +22,12 @@ import java.io.File;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
import hdf.hdf5lib.structs.H5F_info2_t;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@@ -54,11 +56,6 @@ public class TestH5Fparams {
H5.H5Fopen(null, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
@Test(expected = NullPointerException.class)
public void testH5Fis_hdf5_null() throws Throwable {
H5.H5Fis_hdf5(null);
}
@Test(expected = NullPointerException.class)
public void testH5Fis_accessible_null() throws Throwable {
H5.H5Fis_accessible(null, -1);
@@ -74,7 +71,7 @@ public class TestH5Fparams {
H5.H5Funmount(-1, null);
}
@Test
@Ignore
public void testH5Fis_hdf5_text() {
File txtFile = null;
boolean isH5 = false;
@@ -195,7 +192,7 @@ public class TestH5Fparams {
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fopen: " + err);
fail("H5.H5Fcreate: " + err);
}
try {
@@ -215,4 +212,42 @@ public class TestH5Fparams {
try {H5.H5Fclose(fid);} catch (Exception ex) {}
}
}
@Ignore//(expected = HDF5FunctionArgumentException.class)
public void testH5Fset_libver_bounds_invalidlow() throws Throwable {
long fid = -1;
try {
try {
fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fcreate: " + err);
}
H5.H5Fset_libver_bounds(fid, 5, HDF5Constants.H5F_LIBVER_LATEST);
}
finally {
try {H5.H5Fclose(fid);} catch (Exception ex) {}
}
}
@Ignore//(expected = HDF5FunctionArgumentException.class)
public void testH5Fset_libver_bounds_invalidhigh() throws Throwable {
long fid = -1;
try {
try {
fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
fail("H5.H5Fcreate: " + err);
}
H5.H5Fset_libver_bounds(fid, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1);
}
finally {
try {H5.H5Fclose(fid);} catch (Exception ex) {}
}
}
}

View File

@@ -1,7 +1,6 @@
JUnit version 4.11
.testH5Fget_mdc_size
.testH5Fget_mdc_hit_rate
.testH5Fis_hdf5
.testH5F_dset_no_attrs_hint
.testH5Fget_freespace
.testH5Fclose
@@ -19,5 +18,5 @@ JUnit version 4.11
Time: XXXX
OK (17 tests)
OK (16 tests)

View File

@@ -9,10 +9,8 @@ JUnit version 4.11
.testH5Funmount_null
.testH5Fclose_negative
.testH5Fopen_null
.testH5Fis_hdf5_null
.testH5Fis_hdf5_text
Time: XXXX
OK (12 tests)
OK (10 tests)