summaryrefslogtreecommitdiffstats
path: root/java/test
diff options
context:
space:
mode:
Diffstat (limited to 'java/test')
-rw-r--r--java/test/TestH5.java4
-rw-r--r--java/test/TestH5E.java18
-rw-r--r--java/test/TestH5Edefault.java43
-rw-r--r--java/test/junit.sh.in38
4 files changed, 67 insertions, 36 deletions
diff --git a/java/test/TestH5.java b/java/test/TestH5.java
index 154390d..8fe4a56 100644
--- a/java/test/TestH5.java
+++ b/java/test/TestH5.java
@@ -162,7 +162,7 @@ public class TestH5 {
*/
@Test
public void testH5get_libversion() {
- int libversion[] = { 1, 10, 3 };
+ int libversion[] = { 1, 10, 4 };
try {
H5.H5get_libversion(libversion);
@@ -184,7 +184,7 @@ public class TestH5 {
*/
@Test
public void testH5check_version() {
- int majnum = 1, minnum = 10, relnum = 3;
+ int majnum = 1, minnum = 10, relnum = 4;
try {
H5.H5check_version(majnum, minnum, relnum);
diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java
index 656069a..59ff50e 100644
--- a/java/test/TestH5E.java
+++ b/java/test/TestH5E.java
@@ -37,6 +37,10 @@ import org.junit.rules.TestName;
public class TestH5E {
@Rule public TestName testname = new TestName();
+
+ public static final int ERRSTACK_CNT = 4;
+ public static final int ERRSTACK_MTY_CNT = 0;
+
long hdf_java_classid = -1;
long current_stackid = -1;
@@ -158,7 +162,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop #:" + num_msg, num_msg == 0);
+ assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT);
try {
num_msg = H5.H5Eget_num(current_stackid);
@@ -168,7 +172,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT);
try {
H5.H5Epop(current_stackid, 1);
@@ -186,7 +190,7 @@ public class TestH5E {
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop", num_msg == 3);
+ assertTrue("H5.H5Epop", num_msg == TestH5E.ERRSTACK_CNT - 1);
}
@Test
@@ -227,7 +231,7 @@ public class TestH5E {
try {
num_msg = H5.H5Eget_num(estack_id);
- assertTrue("testH5Epush #:" + num_msg, num_msg == 0);
+ assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -238,7 +242,7 @@ public class TestH5E {
try {
num_msg = H5.H5Eget_num(estack_id);
- assertTrue("testH5Epush #:" + num_msg, num_msg == 1);
+ assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT + 1);
}
catch (Throwable err) {
err.printStackTrace();
@@ -314,7 +318,7 @@ public class TestH5E {
err.printStackTrace();
fail("testH5Ewalk:H5Eget_num " + err);
}
- assertTrue("testH5Ewalk #:" + num_msg, num_msg == 4);
+ assertTrue("testH5Ewalk #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT);
try {
H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data);
@@ -324,7 +328,7 @@ public class TestH5E {
fail("testH5Ewalk:H5Ewalk2 " + err);
}
assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty());
- assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==4);
+ assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==TestH5E.ERRSTACK_CNT);
}
}
diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java
index 5324d3a..a3057c6 100644
--- a/java/test/TestH5Edefault.java
+++ b/java/test/TestH5Edefault.java
@@ -29,6 +29,9 @@ import org.junit.rules.TestName;
public class TestH5Edefault {
@Rule public TestName testname = new TestName();
+ public static final int ERRSTACK_CNT = 4;
+ public static final int ERRSTACK_MTY_CNT = 0;
+
@Before
public void H5Eset_default_stack() {
assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0);
@@ -91,7 +94,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT);
//Save a copy of the current stack and clears the current stack
try {
@@ -122,7 +125,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Eclose_stack(stack_id);
@@ -153,7 +156,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT);
//Save a copy of the current stack and clears the current stack
try {
@@ -174,7 +177,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_MTY_CNT);
//Verify the copy has the correct number of messages
try {
@@ -184,7 +187,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Generate errors on default stack
try {
@@ -202,7 +205,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT);
//Remove one message from the current stack
try {
@@ -213,7 +216,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == 3);
+ assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT - 1);
//Verify the copy still has the correct number of messages
try {
@@ -223,7 +226,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
}
@Test(expected = IllegalArgumentException.class)
@@ -293,7 +296,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Save a copy of the current stack
try {
@@ -314,7 +317,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Generate errors on default stack
try {
@@ -332,7 +335,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
//Remove one message from the current stack
try {
@@ -343,7 +346,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == 3);
+ assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1);
//Verify the copy still has the correct number of messages
try {
@@ -353,7 +356,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Eset_current_stack(stack_id);
@@ -363,7 +366,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eset_current_stack: " + err);
}
- assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
}
@Test(expected = IllegalArgumentException.class)
@@ -386,7 +389,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop before #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Epop before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1);
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -395,7 +398,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Epop: " + err);
}
- assertTrue("H5.H5Epop after #:" + num_msg, num_msg == 3);
+ assertTrue("H5.H5Epop after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1);
}
@Test(expected = IllegalArgumentException.class)
@@ -471,7 +474,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eclear2_with_msg: " + err);
}
- assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == 4);
+ assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT);
try {
H5.H5Eclear2(HDF5Constants.H5E_DEFAULT);
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
@@ -480,7 +483,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eclear2_with_msg: " + err);
}
- assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == 0);
+ assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT);
}
@Test(expected = IllegalArgumentException.class)
@@ -516,7 +519,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_num: " + err);
}
- assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == 0);
+ assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT);
}
@Test
@@ -534,7 +537,7 @@ public class TestH5Edefault {
err.printStackTrace();
fail("H5.H5Eget_num_with_msg: " + err);
}
- assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0);
+ assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > TestH5Edefault.ERRSTACK_MTY_CNT);
}
}
diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in
index 5d69bee..02d0147 100644
--- a/java/test/junit.sh.in
+++ b/java/test/junit.sh.in
@@ -59,11 +59,13 @@ LIST_LIBRARY_FILES="
$top_builddir/src/.libs/libhdf5.*
$top_builddir/java/src/jni/.libs/libhdf5_java.*
"
-LIST_JAR_FILES="
+LIST_JAR_TESTFILES="
$HDFLIB_HOME/hamcrest-core.jar
$HDFLIB_HOME/junit.jar
$HDFLIB_HOME/slf4j-api-1.7.25.jar
$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
+"
+LIST_JAR_FILES="
$top_builddir/java/src/$JARFILE
"
LIST_DATA_FILES="
@@ -109,6 +111,7 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5Giterate.txt
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARTESTFILES="$LIST_JAR_TESTFILES"
COPY_JARFILES="$LIST_JAR_FILES"
COPY_LIBFILES_TO_BLDLIBDIR()
@@ -138,6 +141,29 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
done
# copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARTESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
for tstfile in $COPY_JARFILES
do
# ignore '#' comment
@@ -172,7 +198,10 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $RM $BLDLIBDIR
+ for tstfile in $COPY_JARTESTFILES
+ do
+ $RM $BLDLIBDIR/tstfile
+ done
fi
}
@@ -281,11 +310,6 @@ if $TEST -z "$LD_LIBRARY_PATH" ; then
fi
case $os_name in
- Darwin)
- DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH
- export DYLD_LIBRARY_PATH
- LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
- ;;
*)
LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH
;;