summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am5
-rw-r--r--test/Makefile.in12
-rw-r--r--test/err_compat.c64
-rw-r--r--test/error_test.c27
-rw-r--r--test/h5test.c4
-rw-r--r--test/testerror.sh.in (renamed from test/testerror.sh)17
-rw-r--r--test/testframe.c2
7 files changed, 82 insertions, 49 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index a60c1a0..ae89ca2 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -24,7 +24,7 @@ include $(top_srcdir)/config/commence.am
INCLUDES=-I$(top_srcdir)/src -I$(top_builddir)/src
# Test script for error_test and err_compat
-TEST_SCRIPT = $(top_srcdir)/test/testerror.sh
+TEST_SCRIPT = testerror.sh
check_SCRIPTS = $(TEST_SCRIPT)
SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
@@ -125,4 +125,7 @@ testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
trefer.c trefstr.c tselect.c tsohm.c tskiplist.c ttst.c tunicode.c tvltypes.c \
tvlstr.c
+# Temporary files.
+DISTCLEANFILES=testerror.sh
+
include $(top_srcdir)/config/conclude.am
diff --git a/test/Makefile.in b/test/Makefile.in
index c46aa5c..d09072f 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -51,7 +51,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/config/commence.am \
+ $(srcdir)/testerror.sh.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am COPYING
check_PROGRAMS = $(am__EXEEXT_1) error_test$(EXEEXT) \
err_compat$(EXEEXT) testmeta$(EXEEXT)
@@ -64,7 +64,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = testerror.sh
LTLIBRARIES = $(noinst_LTLIBRARIES)
libh5test_la_LIBADD =
am_libh5test_la_OBJECTS = h5test.lo testframe.lo cache_common.lo
@@ -610,7 +610,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \
INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src
# Test script for error_test and err_compat
-TEST_SCRIPT = $(top_srcdir)/test/testerror.sh
+TEST_SCRIPT = testerror.sh
check_SCRIPTS = $(TEST_SCRIPT)
SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
@@ -663,6 +663,9 @@ testhdf5_SOURCES = testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
tvlstr.c
+# Temporary files.
+DISTCLEANFILES = testerror.sh
+
# Automake needs to be taught how to build lib, progs, and tests targets.
# These will be filled in automatically for the most part (e.g.,
# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and
@@ -711,6 +714,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+testerror.sh: $(top_builddir)/config.status $(srcdir)/testerror.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -1121,6 +1126,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
diff --git a/test/err_compat.c b/test/err_compat.c
index a057a20..a4d0968 100644
--- a/test/err_compat.c
+++ b/test/err_compat.c
@@ -21,13 +21,13 @@
*/
#include "h5test.h"
-#ifndef H5_WANT_H5_V1_6_COMPAT
+#ifdef H5_NO_DEPRECATED_SYMBOLS
int main(void)
{
- printf("Test skipped because backward compatbility with v1.6 is NOT configured in\n");
+ printf("Test skipped because backward compatability with v1.6 is NOT configured in\n");
return 0;
}
-#else
+#else /* H5_NO_DEPRECATED_SYMBOLS */
const char *FILENAME[] = {
"errors_compat",
@@ -42,7 +42,7 @@ int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
#define DSET_NAME "a_dataset"
#define FAKE_ID -1
-herr_t custom_print_cb(int n, H5E_error_t *err_desc, void* client_data);
+herr_t custom_print_cb(unsigned n, const H5E_error1_t *err_desc, void* client_data);
/*-------------------------------------------------------------------------
@@ -68,7 +68,7 @@ test_error(hid_t file)
hid_t dataset, space;
hsize_t dims[2];
const char *FUNC_test_error="test_error";
- H5E_auto_t old_func;
+ H5E_auto1_t old_func;
void *old_data;
TESTING("error API based on data I/O");
@@ -87,32 +87,37 @@ test_error(hid_t file)
/* Create the dataset */
if ((dataset = H5Dcreate(file, DSET_NAME, H5T_STD_I32BE, space,
H5P_DEFAULT))<0) {
- H5Epush(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_CANTCREATE,
+ H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_CANTCREATE,
"H5Dcreate failed");
goto error;
}
/* Test enabling and disabling default printing */
- if (H5Eget_auto(&old_func, &old_data)<0)
+ if (H5Eget_auto1(&old_func, &old_data)<0)
TEST_ERROR;
if (old_data != NULL)
TEST_ERROR;
if (!old_func)
TEST_ERROR;
- if (old_func != (H5E_auto_t)H5Eprint)
+#ifdef H5_USE_16_API
+ if (old_func != (H5E_auto1_t)H5Eprint1)
TEST_ERROR;
+#else /* H5_USE_16_API */
+ if (old_func != (H5E_auto1_t)H5Eprint2)
+ TEST_ERROR;
+#endif /* H5_USE_16_API */
- if(H5Eset_auto(NULL, NULL)<0)
+ if(H5Eset_auto1(NULL, NULL)<0)
TEST_ERROR;
/* Make H5Dwrite fail, verify default print is disabled */
if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)<0) {
- H5Epush(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_WRITEERROR,
+ H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_WRITEERROR,
"H5Dwrite shouldn't succeed");
goto error;
}
- if(H5Eset_auto(old_func, old_data)<0)
+ if(H5Eset_auto1(old_func, old_data)<0)
TEST_ERROR;
/* In case program comes to this point, close dataset */
@@ -147,12 +152,12 @@ dump_error(void)
{
/* Print errors in library default way */
fprintf(stderr, "********* Print error stack in HDF5 default way *********\n");
- if(H5Eprint(stderr)<0)
+ if(H5Eprint1(stderr) < 0)
TEST_ERROR;
/* Customized way to print errors */
fprintf(stderr, "\n********* Print error stack in customized way *********\n");
- if(H5Ewalk(H5E_WALK_UPWARD, custom_print_cb, stderr)<0)
+ if(H5Ewalk1(H5E_WALK_UPWARD, custom_print_cb, stderr) < 0)
TEST_ERROR;
return 0;
@@ -179,30 +184,30 @@ dump_error(void)
*-------------------------------------------------------------------------
*/
herr_t
-custom_print_cb(int n, H5E_error_t *err_desc, void* client_data)
+custom_print_cb(unsigned n, const H5E_error1_t *err_desc, void* client_data)
{
FILE *stream = (FILE *)client_data;
- const char *maj;
- const char *min;
+ char *maj;
+ char *min;
const int indent = 4;
- if((min = H5Eget_minor(err_desc->min_num))==NULL)
+ if(NULL == (min = H5Eget_minor(err_desc->min_num)))
TEST_ERROR;
- if((maj = H5Eget_major(err_desc->maj_num))==NULL)
+ if(NULL == (maj = H5Eget_major(err_desc->maj_num)))
TEST_ERROR;
- fprintf (stream, "%*serror #%03d: %s in %s(): line %u\n",
+ fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n",
indent, "", n, err_desc->file_name,
err_desc->func_name, err_desc->line);
- fprintf (stream, "%*smajor: %s\n", indent*2, "", maj);
+ fprintf(stream, "%*smajor: %s\n", indent*2, "", maj);
HDfree(maj);
fprintf (stream, "%*sminor: %s\n", indent*2, "", min);
HDfree(min);
return 0;
- error:
+error:
return -1;
}
@@ -230,29 +235,29 @@ main(void)
fapl = h5_fileaccess();
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR ;
/* Test error stack */
/* Push an error onto error stack */
- H5Epush(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADVALUE,
+ H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADVALUE,
"Error test failed");
/* Print out the errors on stack */
dump_error();
/* Empty error stack */
- H5Eclear();
+ H5Eclear1();
/* Test error API */
- if(test_error(file)<0) {
- H5Epush(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADMESG,
+ if(test_error(file) < 0) {
+ H5Epush1(__FILE__, FUNC_main, __LINE__, H5E_ERROR, H5E_BADMESG,
"Error test failed");
- H5Eprint(stderr);
+ H5Eprint1(stderr);
}
- if (H5Fclose(file)<0) TEST_ERROR ;
+ if(H5Fclose(file) < 0) TEST_ERROR ;
h5_cleanup(FILENAME, fapl);
printf("All error API tests passed.\n");
@@ -262,4 +267,5 @@ main(void)
printf("***** ERROR TEST FAILED! *****\n");
return 1;
}
-#endif /*H5_WANT_H5_V1_6_COMPAT*/
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
diff --git a/test/error_test.c b/test/error_test.c
index 7850ff1..3b3b617 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -21,13 +21,13 @@
*/
#include "h5test.h"
-#ifdef H5_WANT_H5_V1_6_COMPAT
+#ifdef H5_USE_16_API
int main(void)
{
printf("Test skipped because backward compatbility with v1.6 is configured in\n");
return 0;
}
-#else
+#else /* H5_USE_16_API */
const char *FILENAME[] = {
"errors",
@@ -119,7 +119,7 @@ test_error(hid_t file)
/* Create the dataset */
if((dataset = H5Dcreate(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT)) < 0) {
- H5Epush2(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE,
+ H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE,
"H5Dcreate failed");
goto error;
} /* end if */
@@ -129,15 +129,20 @@ test_error(hid_t file)
TEST_ERROR;
if(old_data != NULL)
TEST_ERROR;
- if(old_func != (H5E_auto2_t)H5Eprint2)
+#ifdef H5_USE_16_API
+ if (old_func != (H5E_auto_t)H5Eprint)
TEST_ERROR;
+#else /* H5_USE_16_API */
+ if (old_func != (H5E_auto2_t)H5Eprint2)
+ TEST_ERROR;
+#endif /* H5_USE_16_API */
if(H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
TEST_ERROR;
/* Make H5Dwrite fail, verify default print is disabled */
if(H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) >= 0) {
- H5Epush2(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE,
+ H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE,
"H5Dwrite shouldn't succeed");
goto error;
} /* end if */
@@ -147,7 +152,7 @@ test_error(hid_t file)
/* Test saving and restoring the current error stack */
if(H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) {
- H5Epush2(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE,
+ H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE,
"H5Dwrite failed as supposed to");
estack_id = H5Eget_current_stack();
H5Dclose(dataset);
@@ -263,7 +268,7 @@ error_stack(void)
/* Make it push error, force this function to fail */
if((err_num = H5Eget_num(ERR_STACK)) == 0) {
- H5Epush2(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM,
+ H5Epush(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM,
"Get number test failed, returned %d", err_num);
goto error;
} /* end if */
@@ -341,7 +346,7 @@ test_long_desc(void)
if(H5Eclear2(H5E_DEFAULT) < 0) TEST_ERROR;
/* Push an error with a long description */
- if(H5Epush2(H5E_DEFAULT, __FILE__, test_FUNC, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, format, long_desc) < 0) TEST_ERROR;
+ if(H5Epush(H5E_DEFAULT, __FILE__, test_FUNC, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, format, long_desc) < 0) TEST_ERROR;
/* Create the string that should be in the description */
HDsnprintf(full_desc, LONG_DESC_SIZE + 128, format, long_desc);
@@ -518,7 +523,7 @@ main(void)
/* Test error stack */
if(error_stack() < 0) {
/* Push an error onto error stack */
- if(H5Epush2(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK,
+ if(H5Epush(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK,
"Error stack test failed") < 0) TEST_ERROR;
/* Delete an error from the top of error stack */
@@ -536,7 +541,7 @@ main(void)
/* Test error API */
if(test_error(file) < 0) {
- H5Epush2(H5E_DEFAULT, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE,
+ H5Epush(H5E_DEFAULT, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE,
"Error test failed, %s", "it's wrong");
estack_id = H5Eget_current_stack();
H5Eprint2(estack_id, stderr);
@@ -560,5 +565,5 @@ error:
printf("***** ERROR TEST FAILED! *****\n");
return 1;
}
-#endif /*H5_WANT_H5_V1_6_COMPAT*/
+#endif /* H5_USE_16_API */
diff --git a/test/h5test.c b/test/h5test.c
index 31ad231..2eb87c1 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -113,7 +113,7 @@ static herr_t
h5_errors(void UNUSED *client_data)
{
H5_FAILED();
- H5Eprint(stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
return 0;
}
@@ -215,7 +215,7 @@ h5_reset(void)
HDfflush(stdout);
HDfflush(stderr);
H5close();
- H5Eset_auto(h5_errors, NULL);
+ H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL);
/*
* Cause the library to emit some diagnostics early so they don't
diff --git a/test/testerror.sh b/test/testerror.sh.in
index 93b49e9..7f9657a 100644
--- a/test/testerror.sh
+++ b/test/testerror.sh.in
@@ -15,6 +15,9 @@
#
# Tests for test_error and err_compat
+# Determine backward compatibility options eneabled
+DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@"
+
CMP='cmp -s'
DIFF='diff -c'
@@ -32,8 +35,8 @@ test -d ./testfiles || mkdir ./testfiles
# beginning with the word "Testing".
#
TESTING() {
- SPACES=" "
- echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+ SPACES=" "
+ echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
}
# Run a test and print PASS or *FAIL*. If a test fails then increment
@@ -88,6 +91,12 @@ TEST() {
fi
}
+# Print a "SKIP" message
+SKIP() {
+ TESTING $@
+ echo " -SKIP-"
+}
+
##############################################################################
##############################################################################
### T H E T E S T S ###
@@ -95,7 +104,11 @@ TEST() {
##############################################################################
# test for err_compat
+if test $DEPRECATED_SYMBOLS != "yes"; then
+SKIP err_compat
+else
TEST err_compat
+fi
# test for error_test
TEST error_test
diff --git a/test/testframe.c b/test/testframe.c
index 88f9a06..dd2f2f4 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -135,7 +135,7 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p
* half the functions this test calls are private, so automatic error
* reporting wouldn't do much good since it's triggered at the API layer.
*/
- H5Eset_auto(NULL, NULL);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
/*
* Record the program name and private routines if provided.