diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2022-04-21 05:24:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-21 05:24:35 (GMT) |
commit | ec14985c8555bda02021568ea20295384a2cef7e (patch) | |
tree | 491c1f08a68d92e400d939d96fefdc7bfef57ddc /java/test/TestH5Drw.java | |
parent | bc62da7eb911727497475d1cc90991230f33fa3d (diff) | |
download | hdf5-ec14985c8555bda02021568ea20295384a2cef7e.zip hdf5-ec14985c8555bda02021568ea20295384a2cef7e.tar.gz hdf5-ec14985c8555bda02021568ea20295384a2cef7e.tar.bz2 |
VFD SWMR: Merges from develop (#1670)
* Cleans up SWMR test scripts (both legacy and VFD)
* Brings over format source changes for Java
* Normalization of HL, Fortran, C++, Java w/ develop
* Removes the STATIC flavor of FUNC_ENTER macros (#1622)
* Removes the STATIC flavor of FUNC_ENTER macros
* Remove H5_NO_ALIGNMENT_RESTRICTIONS (#1426)
* Do not conditionally compile code that uses a pointer dereference
and assignment to copy a potentially unaligned variable to aligned
automatic storage, or vice versa. Instead, always use naked `memcpy(3)`s.
Disassembling the generated code reveals that the `memcpy(3)`s optimize
(`-O3`) to a single `mov` instruction for x86_64, which is not strict
about alignment.
This change reduces the size of code and scripts by 143 lines, eases
our way to cross-compilation, and avoids invoking undefined behavior.
* Committing clang-format changes
* Per discussion, use HD and add comments.
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Removes unused definitions from module headers (#1624)
* Misc stuff from develop (includes some parallel things)
* Brings over SWMR test quiet mode changes from develop
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'java/test/TestH5Drw.java')
-rw-r--r-- | java/test/TestH5Drw.java | 161 |
1 files changed, 93 insertions, 68 deletions
diff --git a/java/test/TestH5Drw.java b/java/test/TestH5Drw.java index 69fb9d7..b18bed7 100644 --- a/java/test/TestH5Drw.java +++ b/java/test/TestH5Drw.java @@ -33,77 +33,97 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Drw { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_INTS_FILE = "tintsattrs.h5"; private static final String H5_FLTS_FILE = "tfloatsattrs.h5"; - private static final int DIM_X = 8; - private static final int DIM8_Y = 8; - private static final int DIM16_Y = 16; - private static final int DIM32_Y = 32; - private static final int DIM64_Y = 64; - private static final int DIM128_Y = 128; - private static final String DATASETU08 = "DU08BITS"; - private static final String DATASETS08 = "DS08BITS"; - private static final String DATASETU16 = "DU16BITS"; - private static final String DATASETS16 = "DS16BITS"; - private static final String DATASETU32 = "DU32BITS"; - private static final String DATASETS32 = "DS32BITS"; - private static final String DATASETU64 = "DU64BITS"; - private static final String DATASETS64 = "DS64BITS"; - private static final String DATASETF32 = "DS32BITS"; - private static final String DATASETF64 = "DS64BITS"; - private static final String DATASETF128 = "DS128BITS"; - private static final int RANK = 2; - long H5fid = HDF5Constants.H5I_INVALID_HID; - long H5did = HDF5Constants.H5I_INVALID_HID; - - private final void _closeH5file() throws HDF5LibraryException { + private static final int DIM_X = 8; + private static final int DIM8_Y = 8; + private static final int DIM16_Y = 16; + private static final int DIM32_Y = 32; + private static final int DIM64_Y = 64; + private static final int DIM128_Y = 128; + private static final String DATASETU08 = "DU08BITS"; + private static final String DATASETS08 = "DS08BITS"; + private static final String DATASETU16 = "DU16BITS"; + private static final String DATASETS16 = "DS16BITS"; + private static final String DATASETU32 = "DU32BITS"; + private static final String DATASETS32 = "DS32BITS"; + private static final String DATASETU64 = "DU64BITS"; + private static final String DATASETS64 = "DS64BITS"; + private static final String DATASETF32 = "DS32BITS"; + private static final String DATASETF64 = "DS64BITS"; + private static final String DATASETF128 = "DS128BITS"; + private static final int RANK = 2; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + + private final void _closeH5file() throws HDF5LibraryException + { if (H5did >= 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } - public void openH5file(String filename, String dsetname) { - try { - H5fid = H5.H5Fopen(filename, - HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Drw._openH5file: " + err); - } - assertTrue("TestH5Drw._openH5file: H5.H5Fopen: ", H5fid >= 0); - try { - H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Drw._openH5file: " + err); - } - assertTrue("TestH5Drw._openH5file: H5.H5Dopen: ", H5did >= 0); + public void openH5file(String filename, String dsetname) + { + try { + H5fid = H5.H5Fopen(filename, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Drw._openH5file: " + err); + } + assertTrue("TestH5Drw._openH5file: H5.H5Fopen: ", H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Drw._openH5file: " + err); + } + assertTrue("TestH5Drw._openH5file: H5.H5Dopen: ", H5did >= 0); } @After - public void closeH5file() throws HDF5LibraryException { + public void closeH5file() throws HDF5LibraryException + { if (H5did >= 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } H5fid = HDF5Constants.H5I_INVALID_HID; H5did = HDF5Constants.H5I_INVALID_HID; System.out.println(); } @Before - public void verifyCount() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + public void verifyCount() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @Test - public void testH5Dread_8bit_ints() { + public void testH5Dread_8bit_ints() + { byte[][] dset_data = new byte[DIM_X][DIM8_Y]; try { @@ -117,7 +137,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -144,7 +164,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -153,7 +173,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_16bit_ints() { + public void testH5Dread_16bit_ints() + { short[][] dset_data = new short[DIM_X][DIM16_Y]; try { @@ -167,7 +188,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -194,7 +215,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -203,7 +224,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_32bit_ints() { + public void testH5Dread_32bit_ints() + { int[][] dset_data = new int[DIM_X][DIM16_Y]; try { @@ -217,7 +239,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -244,7 +266,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -253,7 +275,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_64bit_ints() { + public void testH5Dread_64bit_ints() + { long[][] dset_data = new long[DIM_X][DIM64_Y]; try { @@ -267,7 +290,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -294,7 +317,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -303,7 +326,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_32bit_floats() { + public void testH5Dread_32bit_floats() + { float[][] dset_data = new float[DIM_X][DIM32_Y]; try { @@ -317,7 +341,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_FLOAT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -328,7 +352,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_64bit_floats() { + public void testH5Dread_64bit_floats() + { double[][] dset_data = new double[DIM_X][DIM64_Y]; try { @@ -342,7 +367,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -353,7 +378,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_128bit_floats() { + public void testH5Dread_128bit_floats() + { byte[][][] dset_data = new byte[DIM_X][DIM128_Y][8]; try { @@ -367,12 +393,11 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_LDOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); fail("testH5Dread_128bit_floats: H5Dread: " + err); } } - } |