summaryrefslogtreecommitdiffstats
path: root/java/test/TestH5Edefault.java
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-04-21 05:24:35 (GMT)
committerGitHub <noreply@github.com>2022-04-21 05:24:35 (GMT)
commitec14985c8555bda02021568ea20295384a2cef7e (patch)
tree491c1f08a68d92e400d939d96fefdc7bfef57ddc /java/test/TestH5Edefault.java
parentbc62da7eb911727497475d1cc90991230f33fa3d (diff)
downloadhdf5-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/TestH5Edefault.java')
-rw-r--r--java/test/TestH5Edefault.java161
1 files changed, 97 insertions, 64 deletions
diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java
index 9e93cea..c412cf2 100644
--- a/java/test/TestH5Edefault.java
+++ b/java/test/TestH5Edefault.java
@@ -15,25 +15,28 @@ package test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
-import org.junit.Ignore;
import org.junit.rules.TestName;
public class TestH5Edefault {
- @Rule public TestName testname = new TestName();
+ @Rule
+ public TestName testname = new TestName();
public static final int ERRSTACK_CNT = 6;
@Before
- public void H5Eset_default_stack() {
- assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
+ public void H5Eset_default_stack()
+ {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0);
System.out.print(testname.getMethodName());
try {
@@ -46,23 +49,26 @@ public class TestH5Edefault {
}
}
@After
- public void nextTestName() {
+ public void nextTestName()
+ {
System.out.println();
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eprint2_invalid_classid() throws Throwable {
+ public void testH5Eprint2_invalid_classid() throws Throwable
+ {
H5.H5Eprint2(-1, null);
}
@Ignore
- public void testH5Eprint() {
+ public void testH5Eprint()
+ {
/*
- * If HDF5_VOL_CONNECTOR is set, this might not be the
- * native connector and the error stack might be different.
- * Only check for the specific error stack if the native
- * connector is being used.
- */
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error stack might be different.
+ * Only check for the specific error stack if the native
+ * connector is being used.
+ */
String connector = System.getenv("HDF5_VOL_CONNECTOR");
if (connector == null) {
try {
@@ -81,19 +87,20 @@ public class TestH5Edefault {
}
@Test
- public void testH5Eget_current_stack() {
- long num_msg = -1;
- long num_msg_default = -1;
- long saved_num_msg = -1;
- long stack_id = -1;
+ public void testH5Eget_current_stack()
+ {
+ long num_msg = -1;
+ long num_msg_default = -1;
+ long saved_num_msg = -1;
+ long stack_id = -1;
long stack_id_default = HDF5Constants.H5E_DEFAULT;
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- //default stack id will be different after exception
+ // default stack id will be different after exception
stack_id_default = HDF5Constants.H5E_DEFAULT;
- //err.printStackTrace(); //This will clear the error stack
+ // err.printStackTrace(); //This will clear the error stack
}
// Verify we have messages on the error stack
try {
@@ -147,16 +154,17 @@ public class TestH5Edefault {
}
@Test
- public void testH5Eget_current_stack_pop() {
- long num_msg = -1;
+ public void testH5Eget_current_stack_pop()
+ {
+ long num_msg = -1;
long num_msg_default = -1;
- long saved_num_msg = -1;
- long stack_id = -1;
+ long saved_num_msg = -1;
+ long stack_id = -1;
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- //err.printStackTrace(); //This will clear the error stack
+ // err.printStackTrace(); //This will clear the error stack
}
// Verify there are error messages on the stack and save it
@@ -179,7 +187,8 @@ public class TestH5Edefault {
fail("H5.H5Eget_current_stack: " + err);
}
assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id < 0);
- assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT);
+ assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id,
+ stack_id == HDF5Constants.H5E_DEFAULT);
// Verify the stack is empty
try {
@@ -206,7 +215,7 @@ public class TestH5Edefault {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- //err.printStackTrace(); //This will clear the error stack
+ // err.printStackTrace(); //This will clear the error stack
}
// Verify we have a nonzero number of messages and save it
@@ -243,37 +252,44 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eclose_stack_invalid_stackid() throws Throwable {
+ public void testH5Eclose_stack_invalid_stackid() throws Throwable
+ {
H5.H5Eclose_stack(-1);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eget_class_name_invalid_classid() throws Throwable {
+ public void testH5Eget_class_name_invalid_classid() throws Throwable
+ {
H5.H5Eget_class_name(-1);
}
@Test(expected = HDF5LibraryException.class)
- public void testH5Eget_class_name_invalid_classname() throws Throwable {
+ public void testH5Eget_class_name_invalid_classname() throws Throwable
+ {
H5.H5Eget_class_name(HDF5Constants.H5E_DEFAULT);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eclose_msg_invalid_errid() throws Throwable {
+ public void testH5Eclose_msg_invalid_errid() throws Throwable
+ {
H5.H5Eclose_msg(-1);
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Ecreate_msg_invalid_errid() throws Throwable {
+ public void testH5Ecreate_msg_invalid_errid() throws Throwable
+ {
H5.H5Ecreate_msg(-1, HDF5Constants.H5E_MAJOR, "null");
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eget_msg_invalid_msgid() throws Throwable {
+ public void testH5Eget_msg_invalid_msgid() throws Throwable
+ {
H5.H5Eget_msg(-1, null);
}
@Test
- public void testH5Ecreate_stack() {
+ public void testH5Ecreate_stack()
+ {
try {
long stack_id = H5.H5Ecreate_stack();
assertTrue("H5.H5Ecreate_stack", stack_id > 0);
@@ -286,14 +302,16 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eset_current_stack_invalid_stkid() throws Throwable {
+ public void testH5Eset_current_stack_invalid_stkid() throws Throwable
+ {
H5.H5Eset_current_stack(-1);
}
@Test
- public void testH5Eset_current_stack() {
- long num_msg = -1;
- long stack_id = -1;
+ public void testH5Eset_current_stack()
+ {
+ long num_msg = -1;
+ long stack_id = -1;
long saved_num_msg = -1;
// Generate errors on the default stack
@@ -301,7 +319,7 @@ public class TestH5Edefault {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- //err.printStackTrace(); //This will clear the error stack
+ // err.printStackTrace(); //This will clear the error stack
}
// Verify we have a nonzero number of messages and save it
@@ -324,7 +342,8 @@ public class TestH5Edefault {
fail("H5.H5Eset_current_stack: " + err);
}
assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id < 0);
- assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT);
+ assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id,
+ stack_id == HDF5Constants.H5E_DEFAULT);
// Verify the copy has the same number of messages as the original stack
try {
@@ -341,7 +360,7 @@ public class TestH5Edefault {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- //err.printStackTrace(); //This will clear the error stack
+ // err.printStackTrace(); //This will clear the error stack
}
// Verify we have the same number of messages as before
@@ -388,13 +407,15 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Epop_invalid_stkid() throws Throwable {
+ public void testH5Epop_invalid_stkid() throws Throwable
+ {
H5.H5Epop(-1, 0);
}
@Test
- public void testH5Epop() throws Throwable {
- long num_msg = -1;
+ public void testH5Epop() throws Throwable
+ {
+ long num_msg = -1;
long saved_num_msg = -1;
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
@@ -422,28 +443,33 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Epush_invalid_stkid() throws Throwable {
+ public void testH5Epush_invalid_stkid() throws Throwable
+ {
H5.H5Epush(-1, "Invalid", "Invalid", 0, -1, -1, -1, "Invalid message");
}
@Test(expected = NullPointerException.class)
- public void testH5Epush_null_name() throws Throwable {
- H5.H5Epush(HDF5Constants.H5E_DEFAULT, null, "Invalid", 0, HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, "Invalid message");
+ public void testH5Epush_null_name() throws Throwable
+ {
+ H5.H5Epush(HDF5Constants.H5E_DEFAULT, null, "Invalid", 0, HDF5Constants.H5E_DEFAULT,
+ HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, "Invalid message");
}
@Test(expected = IllegalArgumentException.class)
- public void testH5EprintInt_invalid_classid() throws Throwable {
+ public void testH5EprintInt_invalid_classid() throws Throwable
+ {
H5.H5Eprint2(-1, null);
}
@Ignore
- public void testH5EprintInt() {
+ public void testH5EprintInt()
+ {
/*
- * If HDF5_VOL_CONNECTOR is set, this might not be the
- * native connector and the error stack might be different.
- * Only check for the specific error stack if the native
- * connector is being used.
- */
+ * If HDF5_VOL_CONNECTOR is set, this might not be the
+ * native connector and the error stack might be different.
+ * Only check for the specific error stack if the native
+ * connector is being used.
+ */
String connector = System.getenv("HDF5_VOL_CONNECTOR");
if (connector == null) {
try {
@@ -462,7 +488,8 @@ public class TestH5Edefault {
}
@Test
- public void testH5EclearInt() {
+ public void testH5EclearInt()
+ {
try {
H5.H5Eclear(HDF5Constants.H5E_DEFAULT);
}
@@ -473,12 +500,14 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eclear2_invalid_stkid() throws Throwable {
+ public void testH5Eclear2_invalid_stkid() throws Throwable
+ {
H5.H5Eclear2(-1);
}
@Test
- public void testH5Eclear() {
+ public void testH5Eclear()
+ {
try {
H5.H5Eclear2(HDF5Constants.H5E_DEFAULT);
}
@@ -489,7 +518,8 @@ public class TestH5Edefault {
}
@Test
- public void testH5Eclear2_with_msg() {
+ public void testH5Eclear2_with_msg()
+ {
long num_msg = -1;
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
@@ -516,12 +546,14 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eauto_is_v2_invalid_stkid() throws Throwable {
+ public void testH5Eauto_is_v2_invalid_stkid() throws Throwable
+ {
H5.H5Eauto_is_v2(-1);
}
@Test
- public void testH5Eauto_is_v2() {
+ public void testH5Eauto_is_v2()
+ {
boolean is_v2 = false;
try {
is_v2 = H5.H5Eauto_is_v2(HDF5Constants.H5E_DEFAULT);
@@ -534,12 +566,14 @@ public class TestH5Edefault {
}
@Test(expected = IllegalArgumentException.class)
- public void testH5Eget_num_invalid_stkid() throws Throwable {
+ public void testH5Eget_num_invalid_stkid() throws Throwable
+ {
H5.H5Eget_num(-1);
}
@Test
- public void testH5Eget_num() {
+ public void testH5Eget_num()
+ {
long num_msg = -1;
try {
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -552,7 +586,8 @@ public class TestH5Edefault {
}
@Test
- public void testH5Eget_num_with_msg() {
+ public void testH5Eget_num_with_msg()
+ {
long num_msg = -1;
try {
H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
@@ -568,6 +603,4 @@ public class TestH5Edefault {
}
assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0);
}
-
}
-