develop JNI export references and java updates (#467)
* OESS-98 convert plugin option to FetchContent, add tests * Fixes for pkcfg files because of plugin option * OESS-98 fix tools test for plugins * Keep doxygen comments under 100 chars long - format hint * Whitespace * HDFFV-11144 - Reclassify CMake messages * HDFFV-11099/11100 added help text * Reworked switch statement to compare string instead * Fix typo * Update CDash mode * Correct name of threadsafe * Correct option name * Undo accidental commit * Note LLVM 10 to 11 format default changes * Update format plugin * Undo clang-format version 11 changes * One more correction * Update supported platforms * Revert whitespace changes * Correct whitespace * Changes from PR#3 * HDFFV-11213 added option to control gcc10 warnings diagnostics * HDFFV-11212 Use the new references correctly in JNI utility and tests * format source * Fix typo * Add new test file * HDFFV-11212 - update test and remove unused arg * Minor non-space formatting changes * Use H5I_INVALID_ID instead of "-1" * source formatting * add missing testfile, update jni function * Undo commit of debug code * remove mislocated file * Fix h5repack test for handling of fapls and id close * Update h5diff test files usage text * HDFFV-11212 add new ref tests for JNI export dataset * src format update * Remove blank line typo * src format typo * long double requires %Lg * Another long double foramt specifer S.B. %Lg * issue with t128bit test * Windows issue with h5dump and type. * Fix review issues * refactor function nesting and fix error checks * format fixes * Remove untested functions and javadoc quiet comments * Restore TRY block. * Change string append errors to memory exception * revert to H5_JNI_FATAL_ERROR - support functions need work * Add assertion error for h5util functions * remove duplicate function * format fix * Revert HD function error handling * Update copyright comments * GH #386 java folder copyright corrections * Whitespace * GH #359 implement and fix tools 1.6 API usage * remove excessive comments * Flip inits to correct ifdef section * rework ifdef to be simpler * format issue * Reformat ifdef inits * remove static attribute * format compliance * Update names * Revert because logic relies on float not being int * Changes noticed from creating merge of #412 * Double underscore change * Correct compiler version variable used * Remove header guard underscores * Whitespace cleanup * Split format source and commit changes on repo push * remove pre-split setting * Change windows TS to use older VS. * correct window os name * HDFFV-11212 JNI export util and Javadoc * Suggested review changes * Another change found * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@@ -49,9 +49,13 @@ public class TestH5 {
|
||||
@Rule public TestName testname = new TestName();
|
||||
private static final String H5_FILE = "testData.h5";
|
||||
private static final String EXPORT_FILE = "testExport.txt";
|
||||
private static final String H5_DREG_FILE = "trefer_reg.h5";
|
||||
private static final String EXPORT_DREG_FILE = "testExportReg.txt";
|
||||
private static final String H5_AREG_FILE = "trefer_attr.h5";
|
||||
private static final String H5_REGION_FILE = "trefer_reg.h5";
|
||||
private static final String EXPORT_REGION_FILE = "testExportReg.txt";
|
||||
private static final String H5_ATTR_FILE = "trefer_attr.h5";
|
||||
private static final String EXPORT_ATTR_FILE = "testExportAttr.txt";
|
||||
private static final String H5_DREG_FILE = "tdatareg.h5";
|
||||
private static final String EXPORT_DREG_FILE = "testExportDReg.txt";
|
||||
private static final String H5_AREG_FILE = "tattrreg.h5";
|
||||
private static final String EXPORT_AREG_FILE = "testExportAReg.txt";
|
||||
private static final int DIM_X = 4;
|
||||
private static final int DIM_Y = 6;
|
||||
@@ -129,7 +133,7 @@ public class TestH5 {
|
||||
public void _openH5File(String filename, String dsetname) {
|
||||
try {
|
||||
H5fid = H5.H5Fopen(filename,
|
||||
HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
|
||||
HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
@@ -162,6 +166,7 @@ public class TestH5 {
|
||||
@After
|
||||
public void closeH5File() throws HDF5LibraryException {
|
||||
_closeH5File();
|
||||
assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@@ -415,8 +420,10 @@ public class TestH5 {
|
||||
|
||||
_closeH5File();
|
||||
|
||||
_openH5File(H5_FILE, "/dset");
|
||||
|
||||
try {
|
||||
H5.H5export_dataset(EXPORT_FILE, H5_FILE, "/dset", 99);
|
||||
H5.H5export_dataset(EXPORT_FILE, H5fid, "/dset", 99);
|
||||
}
|
||||
catch (HDF5LibraryException err) {
|
||||
err.printStackTrace();
|
||||
@@ -453,6 +460,86 @@ public class TestH5 {
|
||||
_deleteH5file();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5export_region() {
|
||||
int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108,
|
||||
111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171,
|
||||
186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231,
|
||||
207, 66, 252, 48, 84, 96, 12, 14, 213, 99};
|
||||
int[] dset_indata = new int[DIM_BLKS+DIM_PNTS];
|
||||
String objName = "/Dataset1";
|
||||
|
||||
_openH5File(H5_REGION_FILE, objName);
|
||||
|
||||
try {
|
||||
H5.H5export_dataset(EXPORT_REGION_FILE, H5fid, objName, 99);
|
||||
}
|
||||
catch (HDF5LibraryException err) {
|
||||
err.printStackTrace();
|
||||
fail("H5export_dataset failed: " + err);
|
||||
}
|
||||
|
||||
File file = new File(EXPORT_REGION_FILE);
|
||||
|
||||
try {
|
||||
Reader reader = new FileReader(EXPORT_REGION_FILE);
|
||||
StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
|
||||
int indx = 0;
|
||||
while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
|
||||
if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
|
||||
dset_indata[indx] = (int)streamTokenizer.nval;
|
||||
indx++;
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
catch (IOException err) {
|
||||
err.printStackTrace();
|
||||
fail("read file failed: " + err);
|
||||
}
|
||||
for(int row = 0; row < DIM_X; row++)
|
||||
assertTrue("testH5export_region: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5export_attribute() {
|
||||
int[] dset_data_expect = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11};
|
||||
int[] dset_indata = new int[DIM_ATTR];
|
||||
String objName = "/Dataset3";
|
||||
|
||||
_openH5File(H5_ATTR_FILE, objName);
|
||||
|
||||
try {
|
||||
H5.H5export_dataset(EXPORT_ATTR_FILE, H5did, objName, 99);
|
||||
}
|
||||
catch (HDF5LibraryException err) {
|
||||
err.printStackTrace();
|
||||
fail("H5export_dataset failed: " + err);
|
||||
}
|
||||
|
||||
File file = new File(EXPORT_ATTR_FILE);
|
||||
|
||||
try {
|
||||
Reader reader = new FileReader(EXPORT_ATTR_FILE);
|
||||
StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
|
||||
int indx = 0;
|
||||
int jndx = 0;
|
||||
while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
|
||||
if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
|
||||
dset_indata[indx] = (int)streamTokenizer.nval;
|
||||
indx++;
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
}
|
||||
catch (IOException err) {
|
||||
err.printStackTrace();
|
||||
fail("read file failed: " + err);
|
||||
}
|
||||
for(int row = 0; row < DIM_X; row++)
|
||||
assertTrue("testH5export_attribute: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5export_regdataset() {
|
||||
int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108,
|
||||
@@ -465,7 +552,7 @@ public class TestH5 {
|
||||
_openH5File(H5_DREG_FILE, objName);
|
||||
|
||||
try {
|
||||
H5.H5export_dataset(EXPORT_DREG_FILE, H5_DREG_FILE, objName, 99);
|
||||
H5.H5export_dataset(EXPORT_DREG_FILE, H5fid, objName, 99);
|
||||
}
|
||||
catch (HDF5LibraryException err) {
|
||||
err.printStackTrace();
|
||||
@@ -491,23 +578,27 @@ public class TestH5 {
|
||||
fail("read file failed: " + err);
|
||||
}
|
||||
for(int row = 0; row < DIM_X; row++)
|
||||
assertTrue("H5export_dataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
|
||||
assertTrue("testH5export_regdataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5export_attrdataset() {
|
||||
int[] dset_data_expect = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11};
|
||||
int[] dset_indata = new int[DIM_ATTR];
|
||||
String objName = "/Dataset3";
|
||||
int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108,
|
||||
111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171,
|
||||
186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231,
|
||||
207, 66, 252, 48, 84, 96, 12, 14, 213, 99};
|
||||
int[] dset_indata = new int[DIM_BLKS+DIM_PNTS];
|
||||
String dsetName = "/Dataset1";
|
||||
String objName = "Attribute1";
|
||||
|
||||
_openH5File(H5_AREG_FILE, objName);
|
||||
_openH5File(H5_AREG_FILE, dsetName);
|
||||
|
||||
try {
|
||||
H5.H5export_dataset(EXPORT_AREG_FILE, H5_AREG_FILE, objName, 99);
|
||||
H5.H5export_attribute(EXPORT_AREG_FILE, H5did, objName, 99);
|
||||
}
|
||||
catch (HDF5LibraryException err) {
|
||||
err.printStackTrace();
|
||||
fail("H5export_dataset failed: " + err);
|
||||
fail("H5export_attribute failed: " + err);
|
||||
}
|
||||
|
||||
File file = new File(EXPORT_AREG_FILE);
|
||||
@@ -530,6 +621,6 @@ public class TestH5 {
|
||||
fail("read file failed: " + err);
|
||||
}
|
||||
for(int row = 0; row < DIM_X; row++)
|
||||
assertTrue("H5export_dataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
|
||||
assertTrue("testH5export_attrdataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user