From 6b959b1e2118389f56fd5ee960603c2cc19ed65b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 9 Nov 2018 14:38:03 -0600 Subject: Fix target files for commands --- tools/test/h5dump/CMakeTests.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index b02dc35..382e664 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -750,10 +750,10 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES DEPENDS "H5DUMP-IMPORT-${resultfile}-clear-objects") - add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND h5import ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) + add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND $ ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-${resultfile}) - add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND h5diff ${testfile} ${resultfile}.h5 /integer /integer) + add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND $ ${testfile} ${resultfile}.h5 /integer /integer) set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-h5import-${resultfile}) endif () -- cgit v0.12 From ba609275d8874a8681f8f077cfac33b3b516c41f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 12 Nov 2018 11:52:46 -0600 Subject: Fix target depends --- src/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 376260e..0bf433d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -956,12 +956,19 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) else () add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ - ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) + add_custom_target (gen_H5Tinit ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp" "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" + DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp + ) set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) endif () endif () -- cgit v0.12 From 7e204759f861f4f482db2032127a4dc406fcd1d6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 12 Nov 2018 12:26:11 -0600 Subject: Fix generate file commands --- src/CMakeLists.txt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0bf433d..31a38be 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -947,13 +947,12 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} ESCAPE_QUOTES @ONLY ) add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp COMMAND ${HDF5_BATCH_CMD} ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) else () add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp @@ -962,15 +961,15 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) - add_custom_target (gen_H5Tinit ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp" "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" - DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp - ) - set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) endif () + add_custom_target (gen_H5Tinit ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp" "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" + DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.tmp + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) endif () if (BUILD_SHARED_LIBS) add_custom_command ( -- cgit v0.12 From ef29549f0d66612fcdeefc763785c6826c67ad8b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 12 Nov 2018 13:31:10 -0800 Subject: Updated the Java tests so that they don't fail when the error stack changes. --- java/test/TestH5E.java | 28 +++++++------ java/test/TestH5Edefault.java | 92 ++++++++++++++++++++++++------------------- java/test/junit.sh.in | 85 +++++++++++++++++++-------------------- 3 files changed, 107 insertions(+), 98 deletions(-) diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index 542a092..fd015c0 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -38,9 +38,6 @@ import org.junit.rules.TestName; public class TestH5E { @Rule public TestName testname = new TestName(); - public static final int ERRSTACK_CNT = 6; - public static final int ERRSTACK_MTY_CNT = 0; - long hdf_java_classid = -1; long current_stackid = -1; @@ -130,6 +127,10 @@ public class TestH5E { @Test public void testH5Epop() { + + long num_msg = -1; + long saved_num_msg = -1; + try { H5.H5Eset_current_stack(current_stackid); } @@ -144,7 +145,7 @@ public class TestH5E { catch (Throwable err) { } - // save current stack contents + // Save current stack contents try { current_stackid = H5.H5Eget_current_stack(); } @@ -153,7 +154,6 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - long num_msg = -1; try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -162,7 +162,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT); + assertTrue("H5.H5Epop #:" + num_msg, num_msg == 0); try { num_msg = H5.H5Eget_num(current_stackid); @@ -172,8 +172,9 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT); + assertTrue("H5.H5Epop #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; try { H5.H5Epop(current_stackid, 1); } @@ -190,7 +191,7 @@ public class TestH5E { fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop", num_msg == TestH5E.ERRSTACK_CNT - 1); + assertTrue("H5.H5Epop", num_msg == saved_num_msg - 1); } @Test @@ -231,7 +232,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT); + assertTrue("testH5Epush #:" + num_msg, num_msg == 0); } catch (Throwable err) { err.printStackTrace(); @@ -242,7 +243,7 @@ public class TestH5E { try { num_msg = H5.H5Eget_num(estack_id); - assertTrue("testH5Epush #:" + num_msg, num_msg == TestH5E.ERRSTACK_MTY_CNT + 1); + assertTrue("testH5Epush #:" + num_msg, num_msg == 1); } catch (Throwable err) { err.printStackTrace(); @@ -302,7 +303,7 @@ public class TestH5E { catch (Throwable err) { } - // save current stack contents + // Save current stack contents try { current_stackid = H5.H5Eget_current_stack(); } @@ -318,7 +319,7 @@ public class TestH5E { err.printStackTrace(); fail("testH5Ewalk:H5Eget_num " + err); } - assertTrue("testH5Ewalk #:" + num_msg, num_msg == TestH5E.ERRSTACK_CNT); + assertTrue("testH5Ewalk #:" + num_msg, num_msg > 0); try { H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data); @@ -328,7 +329,8 @@ 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()==TestH5E.ERRSTACK_CNT); + assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size() > 0); } } + diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 4676205..591793f 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -30,7 +30,6 @@ public class TestH5Edefault { @Rule public TestName testname = new TestName(); public static final int ERRSTACK_CNT = 6; - public static final int ERRSTACK_MTY_CNT = 0; @Before public void H5Eset_default_stack() { @@ -76,6 +75,7 @@ public class TestH5Edefault { 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 { @@ -86,7 +86,7 @@ public class TestH5Edefault { stack_id_default = HDF5Constants.H5E_DEFAULT; //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have messages on the error stack try { num_msg_default = H5.H5Eget_num(stack_id_default); } @@ -94,9 +94,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg_default; - //Save a copy of the current stack and clears the current stack + // Save a copy of the current stack and clear the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -107,7 +108,7 @@ public class TestH5Edefault { 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 == stack_id_default); - // Verify we have the correct number of messages + // Verify the default stack is empty try { num_msg_default = H5.H5Eget_num(stack_id_default); } @@ -117,7 +118,7 @@ public class TestH5Edefault { } assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0); - //Verify the copy has the correct number of messages + // Verify the copy has the same number of messages as the original try { num_msg = H5.H5Eget_num(stack_id); } @@ -125,7 +126,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); try { H5.H5Eclose_stack(stack_id); @@ -140,6 +141,7 @@ public class TestH5Edefault { public void testH5Eget_current_stack_pop() { long num_msg = -1; long num_msg_default = -1; + long saved_num_msg = -1; long stack_id = -1; try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); @@ -148,7 +150,7 @@ public class TestH5Edefault { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify there are error messages on the stack and save it try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -156,9 +158,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg_default; - //Save a copy of the current stack and clears the current stack + // Save a copy of the current stack and clear the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -169,7 +172,7 @@ public class TestH5Edefault { 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); - // Verify we have the correct number of messages + // Verify the stack is empty try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -177,9 +180,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_MTY_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == 0); - //Verify the copy has the correct number of messages + // Verify the copy has the correct number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -187,9 +190,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Generate errors on default stack + // Generate errors on default stack try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } @@ -197,7 +200,7 @@ public class TestH5Edefault { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have a nonzero number of messages and save it try { num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -205,9 +208,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, num_msg_default > 0); + saved_num_msg = num_msg; - //Remove one message from the current stack + // Remove one message from the current stack try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -216,9 +220,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == TestH5Edefault.ERRSTACK_CNT - 1); + assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, num_msg_default == saved_num_msg - 1); - //Verify the copy still has the correct number of messages + // Verify the copy still has the old number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -226,7 +230,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); } @Test(expected = IllegalArgumentException.class) @@ -281,6 +285,9 @@ public class TestH5Edefault { public void testH5Eset_current_stack() { long num_msg = -1; long stack_id = -1; + long saved_num_msg = -1; + + // Generate errors on the default stack try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } @@ -288,7 +295,7 @@ public class TestH5Edefault { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have a nonzero number of messages and save it try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -296,9 +303,10 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; - //Save a copy of the current stack + // Save a copy of the current stack try { stack_id = H5.H5Eget_current_stack(); } @@ -309,7 +317,7 @@ public class TestH5Edefault { 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); - //Verify the copy has the correct number of messages + // Verify the copy has the same number of messages as the original stack try { num_msg = H5.H5Eget_num(stack_id); } @@ -317,9 +325,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Generate errors on default stack + // Generate errors on default stack (again, in the same way) try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } @@ -327,7 +335,7 @@ public class TestH5Edefault { //err.printStackTrace(); //This will clear the error stack } - // Verify we have the correct number of messages + // Verify we have the same number of messages as before try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); } @@ -335,9 +343,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); - //Remove one message from the current stack + // Remove one message from the current stack try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -346,9 +354,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1); + assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, num_msg == saved_num_msg - 1); - //Verify the copy still has the correct number of messages + // Verify the copy still has the correct number of messages try { num_msg = H5.H5Eget_num(stack_id); } @@ -356,8 +364,9 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg); + // Se the current stack to be the default and try that again try { H5.H5Eset_current_stack(stack_id); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -366,7 +375,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eset_current_stack: " + err); } - assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, num_msg == saved_num_msg); } @Test(expected = IllegalArgumentException.class) @@ -377,6 +386,7 @@ public class TestH5Edefault { @Test 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); } @@ -389,7 +399,8 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Epop before #:" + num_msg, num_msg > 0); + saved_num_msg = num_msg; try { H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -398,7 +409,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Epop: " + err); } - assertTrue("H5.H5Epop after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT - 1); + assertTrue("H5.H5Epop after #:" + num_msg, num_msg == saved_num_msg - 1); } @Test(expected = IllegalArgumentException.class) @@ -474,7 +485,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eclear2_with_msg: " + err); } - assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_CNT); + assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, num_msg > 0); try { H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -483,7 +494,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eclear2_with_msg: " + err); } - assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT); + assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == 0); } @Test(expected = IllegalArgumentException.class) @@ -519,7 +530,7 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_num: " + err); } - assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == TestH5Edefault.ERRSTACK_MTY_CNT); + assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == 0); } @Test @@ -537,7 +548,8 @@ public class TestH5Edefault { err.printStackTrace(); fail("H5.H5Eget_num_with_msg: " + err); } - assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > TestH5Edefault.ERRSTACK_MTY_CNT); + assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0); } } + diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 02d0147..350fb7b 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -1010,53 +1010,48 @@ else test yes = "$verbose" && $DIFF JUnit-TestH5Z.txt JUnit-TestH5Z.out |sed 's/^/ /' fi -if test "X-$BUILD_MODE" = "X-production" ; then - if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" - TESTING JUnit-TestH5E - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) - - # Extract file name, line number, version and thread IDs because they may be different - sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ - -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - JUnit-TestH5E.ext > JUnit-TestH5E.out - - if diff JUnit-TestH5E.out JUnit-TestH5E.txt > /dev/null; then - echo " PASSED JUnit-TestH5E" - else - echo "**FAILED** JUnit-TestH5E" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF JUnit-TestH5E.txt JUnit-TestH5E.out |sed 's/^/ /' - fi - fi +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E" +TESTING JUnit-TestH5E +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5E > JUnit-TestH5E.ext) - if test $USE_FILTER_SZIP = "yes"; then - echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" - TESTING JUnit-TestH5Edefault - ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) - - # Extract file name, line number, version and thread IDs because they may be different - sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ - -e 's/line [0-9]*/line (number)/' \ - -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ - -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ - -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ - JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out - - if diff JUnit-TestH5Edefault.out JUnit-TestH5Edefault.txt > /dev/null; then - echo " PASSED JUnit-TestH5Edefault" - else - echo "**FAILED** JUnit-TestH5Edefault" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF JUnit-TestH5Edefault.txt JUnit-TestH5Edefault.out |sed 's/^/ /' - fi - fi +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5E.ext > JUnit-TestH5E.out + +if diff JUnit-TestH5E.out JUnit-TestH5E.txt > /dev/null; then + echo " PASSED JUnit-TestH5E" +else + echo "**FAILED** JUnit-TestH5E" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5E.txt JUnit-TestH5E.out |sed 's/^/ /' fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault" +TESTING JUnit-TestH5Edefault +($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Edefault > JUnit-TestH5Edefault.ext) + +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out + +if diff JUnit-TestH5Edefault.out JUnit-TestH5Edefault.txt > /dev/null; then + echo " PASSED JUnit-TestH5Edefault" +else + echo "**FAILED** JUnit-TestH5Edefault" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5Edefault.txt JUnit-TestH5Edefault.out |sed 's/^/ /' +fi + if test $USE_FILTER_SZIP = "yes"; then echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate" TESTING JUnit-TestH5Giterate -- cgit v0.12