summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2007-04-11 05:17:13 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2007-04-11 05:17:13 (GMT)
commit4b716c38b8cbaf3bc27c0bea7acb6f02b55df740 (patch)
treeb68c22160bfa8dde89ebf2c100d524e299ac6d57
parent79a2871982693ad80104424d37458eda656bad4f (diff)
downloadhdf5-4b716c38b8cbaf3bc27c0bea7acb6f02b55df740.zip
hdf5-4b716c38b8cbaf3bc27c0bea7acb6f02b55df740.tar.gz
hdf5-4b716c38b8cbaf3bc27c0bea7acb6f02b55df740.tar.bz2
[svn-r13633] Purpose
New feature Description: Added test scripts to test the compiler scripts (h5cc, h5fc and h5c++) Tested platform: Kagiso (serial and pp)
-rw-r--r--MANIFEST4
-rw-r--r--c++/examples/Makefile.am1
-rw-r--r--c++/examples/Makefile.in7
-rwxr-xr-xc++/examples/testh5c++.sh.in272
-rwxr-xr-xconfigure5
-rw-r--r--configure.in3
-rw-r--r--examples/Makefile.am1
-rw-r--r--examples/Makefile.in7
-rwxr-xr-xexamples/testh5cc.sh.in228
-rw-r--r--fortran/examples/Makefile.am1
-rw-r--r--fortran/examples/Makefile.in7
-rwxr-xr-xfortran/examples/testh5fc.sh.in239
12 files changed, 768 insertions, 7 deletions
diff --git a/MANIFEST b/MANIFEST
index 15b9198..8e37cdd 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -141,6 +141,8 @@
./examples/h5_ref2reg.c
./examples/h5_shared_mesg.c
./examples/ph5example.c
+./examples/testh5cc.sh.in
+
#------------------------------------------------------------------------------
@@ -170,6 +172,7 @@
./fortran/examples/refregexample.f90
./fortran/examples/rwdsetexample.f90
./fortran/examples/selectele.f90
+./fortran/examples/testh5fc.sh.in
./fortran/src/H5_f.c
./fortran/src/H5_ff.f90
@@ -265,6 +268,7 @@
./c++/examples/h5group.cpp
./c++/examples/readdata.cpp
./c++/examples/testexamples.sh
+./c++/examples/testh5c++.sh.in
./c++/examples/writedata.cpp
./c++/examples/Makefile.am
./c++/examples/Makefile.in
diff --git a/c++/examples/Makefile.am b/c++/examples/Makefile.am
index 7f8bcfa..9e94e03 100644
--- a/c++/examples/Makefile.am
+++ b/c++/examples/Makefile.am
@@ -24,6 +24,7 @@ include $(top_srcdir)/config/commence.am
# These are the programs that 'make all' or 'make prog' will build and
# which 'make check' will run. List them in the order they should be run.
TEST_PROG=create readdata writedata compound extend_ds chunks h5group
+TEST_SCRIPT=testh5c++.sh
# These are the example files to be installed
INSTALL_FILES=create.cpp readdata.cpp writedata.cpp compound.cpp \
diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in
index 48da702..04da8e2 100644
--- a/c++/examples/Makefile.in
+++ b/c++/examples/Makefile.in
@@ -53,7 +53,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/config/commence.am \
+ $(srcdir)/testh5c++.sh.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am \
$(top_srcdir)/config/examples.am
TESTS =
@@ -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 = testh5c++.sh
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -294,6 +294,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5
# These are the programs that 'make all' or 'make prog' will build and
# which 'make check' will run. List them in the order they should be run.
TEST_PROG = create readdata writedata compound extend_ds chunks h5group
+TEST_SCRIPT = testh5c++.sh
# These are the example files to be installed
INSTALL_FILES = create.cpp readdata.cpp writedata.cpp compound.cpp \
@@ -362,6 +363,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
+testh5c++.sh: $(top_builddir)/config.status $(srcdir)/testh5c++.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
diff --git a/c++/examples/testh5c++.sh.in b/c++/examples/testh5c++.sh.in
new file mode 100755
index 0000000..3eb2bcd
--- /dev/null
+++ b/c++/examples/testh5c++.sh.in
@@ -0,0 +1,272 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING and Copyright.html. COPYING can be found at the root
+# of the source code distribution tree; Copyright.html can be found at the
+# root level of an installed copy of the electronic HDF5 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from help@hdfgroup.org.
+#
+# Tests for the h5c++ compiler tool
+# Created: Albert Cheng, 2007/3/14
+#
+# Modification:
+#
+
+# Initializations
+# Where the tool is installed.
+prefix="@prefix@"
+AR=@AR@
+RANLIB=@RANLIB@
+H5TOOL="h5c++" # The tool name
+H5TOOL_BIN="${prefix}/bin/${H5TOOL}" # The path of the tool binary
+
+CMP='cmp -s'
+DIFF='diff -c'
+
+nerrors=0
+verbose=yes
+
+# setup my machine information.
+myos=`uname -s`
+myhostnama=`uname -n`
+
+# The build (current) directory might be different than the source directory.
+if test -z "$srcdir"; then
+ srcdir=.
+fi
+
+# Generate some source files and library for tests.
+hdf5main=${H5TOOL}_hdf5main.cpp
+hdf5main_o=${H5TOOL}_hdf5main.o
+appmain=${H5TOOL}_appmain.cpp
+appmain_o=${H5TOOL}_appmain.o
+prog1=${H5TOOL}_prog1.cpp
+prog1_o=${H5TOOL}_prog1.o
+prog2=${H5TOOL}_prog2.cpp
+prog2_o=${H5TOOL}_prog2.o
+applib=libapp${H5TOOL}.a
+
+# short hands
+temp_SRC="$hdf5main $appmain $prog1 $prog2"
+temp_OBJ=`echo $temp_SRC | sed -e 's/\.cpp/.o/g'`
+temp_FILES="a.out *.h5 $applib"
+
+# Generate appmain:
+# An application Main that calls hdf5 and application's own functions.
+cat > $appmain <<EOF
+#include <string>
+
+#ifdef OLD_HEADER_FILENAME
+#include <iostream.h>
+#else
+#include <iostream>
+#endif
+
+#include "H5Cpp.h"
+
+#ifndef H5_NO_NAMESPACE
+using namespace H5;
+#endif
+
+const H5std_string FILE_NAME( "tmpapp.h5" );
+int sub1(void);
+int sub2(void);
+
+int main (void)
+{
+ sub1();
+ sub2();
+ H5File file( FILE_NAME, H5F_ACC_TRUNC );
+ return 0;
+}
+
+EOF
+
+# generate prog1
+cat > $prog1 <<EOF
+#ifdef OLD_HEADER_FILENAME
+ #include <iostream.h>
+#else
+ #include <iostream>
+#endif
+#include <string>
+
+#ifndef H5_NO_NAMESPACE
+#ifndef H5_NO_STD
+ using std::cout;
+ using std::endl;
+#endif // H5_NO_STD
+#endif
+int sub1(void)
+{
+ cout << "in sub1" << endl;
+ return 0;
+}
+EOF
+
+# generate prog2
+cat > $prog2 <<EOF
+#ifdef OLD_HEADER_FILENAME
+ #include <iostream.h>
+#else
+ #include <iostream>
+#endif
+#include <string>
+
+#ifndef H5_NO_NAMESPACE
+#ifndef H5_NO_STD
+ using std::cout;
+ using std::endl;
+#endif // H5_NO_STD
+#endif
+int sub2(void)
+{
+ cout << "in sub2" << endl;
+ return 0;
+}
+EOF
+
+# Generate HDF5 Main Program:
+# An HDF5 sample program that calls hdf5 functions.
+cat > $hdf5main <<EOF
+#include <string>
+
+#ifdef OLD_HEADER_FILENAME
+#include <iostream.h>
+#else
+#include <iostream>
+#endif
+
+#include "H5Cpp.h"
+
+#ifndef H5_NO_NAMESPACE
+using namespace H5;
+#endif
+
+const H5std_string FILE_NAME( "tmphdf5.h5" );
+
+int main (void)
+{
+ H5File file( FILE_NAME, H5F_ACC_TRUNC );
+ return 0;
+}
+EOF
+
+
+# Parse option
+# None
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+ SPACES=" "
+ echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+
+# Debug printing
+# Change : to echo to print the debug statement
+DPRINT() {
+ : $*
+}
+
+# Run a test and print PASS or *FAIL*. If a test fails then increment
+# the `nerrors' global variable and (if $verbose is set) display the
+# failed output. The actual output is not removed if $HDF5_NOCLEANUP is
+# defined.
+#
+TOOLTEST() {
+ out=test_$H5TOOL_$$.out
+ err=test_$H5TOOL_$$.err
+
+ # Run test.
+ TESTING $H5TOOL $@
+ $H5TOOL_BIN $@ > $out 2>&1
+ result=$?
+ if [ $result = 0 ]; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && \
+ ( echo "========== results ==========="; cat $out;
+ echo "===============================================") |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $out
+ fi
+}
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $H5TOOL $@
+ echo " -SKIP-"
+}
+
+
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+#
+# HDF5 program that calls HDF5 APIs.
+echo "***"Simple Compile and Link in one step.
+TOOLTEST $hdf5main
+# Application program that calls HDF5 and its own functions.
+TOOLTEST $appmain $prog1 $prog2
+
+# Compile, then link.
+echo "***"Compile and Link in two steps.
+TOOLTEST -c $hdf5main
+TOOLTEST $hdf5main_o
+TOOLTEST -c $appmain $prog1 $prog2
+TOOLTEST $appmain_o $prog1_o $prog2_o
+
+# Build external library, then link with it.
+echo "***"Build external library and link with it.
+TOOLTEST -c $prog1 $prog2
+rm -f $applib
+$AR cru $applib $prog1_o $prog2_o
+$RANLIB $applib
+TOOLTEST $appmain $applib
+TOOLTEST $appmain_o $applib
+# This is peculiar but should work. (See bug ID 729)
+TOOLTEST -c $hdf5main
+rm -f $applib
+$AR cru $applib $hdf5main_o
+$RANLIB $applib
+# SunOS does not support this. Skip it.
+if [ $myos = SunOS ]; then
+ SKIP -o a.out $applib
+else
+ TOOLTEST -o a.out $applib
+fi
+
+# Just cpp, no compile, no link.
+echo "***"Just cpp, no compile, no link.
+TOOLTEST -E $hdf5main
+TOOLTEST -E $appmain $prog1 $prog2
+
+##############################################################################
+# END
+##############################################################################
+
+# Clean up file
+if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $temp_SRC $temp_OBJ $temp_FILES
+fi
+
+if test $nerrors -eq 0 ; then
+ echo "All $H5TOOL tests passed."
+fi
+
+exit $nerrors
diff --git a/configure b/configure
index d718bb6..ada15c3 100755
--- a/configure
+++ b/configure
@@ -52356,7 +52356,7 @@ if test -n "$TESTPARALLEL"; then
fi
fi
-ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/misc/testh5stat.sh examples/Makefile c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/examples/Makefile fortran/Makefile fortran/src/h5fc fortran/src/libhdf5_fortran.settings fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile hl/Makefile hl/src/Makefile hl/test/Makefile hl/tools/Makefile hl/tools/gif2h5/Makefile hl/examples/Makefile hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile"
+ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/misc/testh5stat.sh examples/Makefile examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/examples/Makefile c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/libhdf5_fortran.settings fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/tools/Makefile hl/tools/gif2h5/Makefile hl/examples/Makefile hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile"
cat >confcache <<\_ACEOF
@@ -53035,11 +53035,13 @@ do
"tools/misc/testh5repart.sh") CONFIG_FILES="$CONFIG_FILES tools/misc/testh5repart.sh" ;;
"tools/misc/testh5stat.sh") CONFIG_FILES="$CONFIG_FILES tools/misc/testh5stat.sh" ;;
"examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
+ "examples/testh5cc.sh") CONFIG_FILES="$CONFIG_FILES examples/testh5cc.sh" ;;
"c++/Makefile") CONFIG_FILES="$CONFIG_FILES c++/Makefile" ;;
"c++/src/Makefile") CONFIG_FILES="$CONFIG_FILES c++/src/Makefile" ;;
"c++/src/h5c++") CONFIG_FILES="$CONFIG_FILES c++/src/h5c++" ;;
"c++/test/Makefile") CONFIG_FILES="$CONFIG_FILES c++/test/Makefile" ;;
"c++/examples/Makefile") CONFIG_FILES="$CONFIG_FILES c++/examples/Makefile" ;;
+ "c++/examples/testh5c++.sh") CONFIG_FILES="$CONFIG_FILES c++/examples/testh5c++.sh" ;;
"fortran/Makefile") CONFIG_FILES="$CONFIG_FILES fortran/Makefile" ;;
"fortran/src/h5fc") CONFIG_FILES="$CONFIG_FILES fortran/src/h5fc" ;;
"fortran/src/libhdf5_fortran.settings") CONFIG_FILES="$CONFIG_FILES fortran/src/libhdf5_fortran.settings" ;;
@@ -53047,6 +53049,7 @@ do
"fortran/test/Makefile") CONFIG_FILES="$CONFIG_FILES fortran/test/Makefile" ;;
"fortran/testpar/Makefile") CONFIG_FILES="$CONFIG_FILES fortran/testpar/Makefile" ;;
"fortran/examples/Makefile") CONFIG_FILES="$CONFIG_FILES fortran/examples/Makefile" ;;
+ "fortran/examples/testh5fc.sh") CONFIG_FILES="$CONFIG_FILES fortran/examples/testh5fc.sh" ;;
"hl/Makefile") CONFIG_FILES="$CONFIG_FILES hl/Makefile" ;;
"hl/src/Makefile") CONFIG_FILES="$CONFIG_FILES hl/src/Makefile" ;;
"hl/test/Makefile") CONFIG_FILES="$CONFIG_FILES hl/test/Makefile" ;;
diff --git a/configure.in b/configure.in
index 10900c7..b7d367f 100644
--- a/configure.in
+++ b/configure.in
@@ -3607,11 +3607,13 @@ AC_CONFIG_FILES([src/libhdf5.settings
tools/misc/testh5repart.sh
tools/misc/testh5stat.sh
examples/Makefile
+ examples/testh5cc.sh
c++/Makefile
c++/src/Makefile
c++/src/h5c++
c++/test/Makefile
c++/examples/Makefile
+ c++/examples/testh5c++.sh
fortran/Makefile
fortran/src/h5fc
fortran/src/libhdf5_fortran.settings
@@ -3619,6 +3621,7 @@ AC_CONFIG_FILES([src/libhdf5.settings
fortran/test/Makefile
fortran/testpar/Makefile
fortran/examples/Makefile
+ fortran/examples/testh5fc.sh
hl/Makefile
hl/src/Makefile
hl/test/Makefile
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 56e4fd7..c81213b 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -32,6 +32,7 @@ endif
TEST_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \
h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \
h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg
+TEST_SCRIPT=testh5cc.sh
# Install files
# List all file that should be installed in examples directory
diff --git a/examples/Makefile.in b/examples/Makefile.in
index b3782bf..d863031 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -53,7 +53,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/config/commence.am \
+ $(srcdir)/testh5cc.sh.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am \
$(top_srcdir)/config/examples.am
TESTS =
@@ -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 = testh5cc.sh
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -300,6 +300,7 @@ TEST_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \
h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers \
h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg
+TEST_SCRIPT = testh5cc.sh
# Install files
# List all file that should be installed in examples directory
@@ -372,6 +373,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
+testh5cc.sh: $(top_builddir)/config.status $(srcdir)/testh5cc.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in
new file mode 100755
index 0000000..9a2c14d
--- /dev/null
+++ b/examples/testh5cc.sh.in
@@ -0,0 +1,228 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING and Copyright.html. COPYING can be found at the root
+# of the source code distribution tree; Copyright.html can be found at the
+# root level of an installed copy of the electronic HDF5 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from help@hdfgroup.org.
+#
+# Tests for the h5cc compiler tool
+# Created: Albert Cheng, 2007/3/13
+#
+# Modification:
+#
+
+# Initializations
+# Where the tool is installed.
+prefix="@prefix@"
+PARALLEL=@PARALLEL@ # Am I in parallel mode?
+AR=@AR@
+RANLIB=@RANLIB@
+if [ "$PARALLEL" = no ]; then
+ H5TOOL="h5cc" # The tool name
+else
+ H5TOOL="h5pcc" # The tool name
+fi
+H5TOOL_BIN="${prefix}/bin/${H5TOOL}" # The path of the tool binary
+
+CMP='cmp -s'
+DIFF='diff -c'
+
+nerrors=0
+verbose=yes
+
+# The build (current) directory might be different than the source directory.
+if test -z "$srcdir"; then
+ srcdir=.
+fi
+
+# Generate some source files and library for tests.
+hdf5main=${H5TOOL}_hdf5main.c
+hdf5main_o=${H5TOOL}_hdf5main.o
+appmain=${H5TOOL}_appmain.c
+appmain_o=${H5TOOL}_appmain.o
+prog1=${H5TOOL}_prog1.c
+prog1_o=${H5TOOL}_prog1.o
+prog2=${H5TOOL}_prog2.c
+prog2_o=${H5TOOL}_prog2.o
+applib=libapp${H5TOOL}.a
+
+# short hands
+temp_SRC="$hdf5main $appmain $prog1 $prog2"
+temp_OBJ=`echo $temp_SRC | sed -e 's/\.c/.o/g'`
+temp_FILES="a.out *.h5 $applib"
+
+# Generate appmain:
+# An application Main that calls hdf5 and application's own functions.
+cat > $appmain <<EOF
+#include "hdf5.h"
+#define H5FILE_NAME "tmp.h5"
+int
+main (void)
+{
+ hid_t file; /* file and dataset handles */
+
+ /*
+ * Create a new file using H5F_ACC_TRUNC access,
+ * default file creation properties, and default file
+ * access properties.
+ */
+ sub1();
+ sub2();
+ file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ H5Fclose(file);
+
+ printf("HDF5 C Sample program ran successfully. File %s generated.\n", H5FILE_NAME);
+ remove(H5FILE_NAME);
+
+ return 0;
+}
+EOF
+
+# generate prog1
+cat > $prog1 <<EOF
+sub1(void)
+{
+ printf("in sub1\n");
+}
+EOF
+
+# generate prog2
+cat > $prog2 <<EOF
+sub2(void)
+{
+ printf("in sub2\n");
+}
+EOF
+
+# Generate HDF5 Main Program:
+# An HDF5 sample program that calls hdf5 functions.
+cat > $hdf5main <<EOF
+#include "hdf5.h"
+#define H5FILE_NAME "tmp.h5"
+int
+main (void)
+{
+ hid_t file; /* file and dataset handles */
+
+ /*
+ * Create a new file using H5F_ACC_TRUNC access,
+ * default file creation properties, and default file
+ * access properties.
+ */
+ file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ H5Fclose(file);
+
+ printf("HDF5 C Sample program ran successfully. File %s generated.\n", H5FILE_NAME);
+ remove(H5FILE_NAME);
+
+ return 0;
+}
+EOF
+
+
+# Parse option
+# None
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+ SPACES=" "
+ echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+
+# Debug printing
+# Change : to echo to print the debug statement
+DPRINT() {
+ : $*
+}
+
+# Run a test and print PASS or *FAIL*. If a test fails then increment
+# the `nerrors' global variable and (if $verbose is set) display the
+# failed output. The actual output is not removed if $HDF5_NOCLEANUP is
+# defined.
+#
+TOOLTEST() {
+ out=test_$H5TOOL_$$.out
+ err=test_$H5TOOL_$$.err
+
+ # Run test.
+ TESTING $H5TOOL $@
+ $H5TOOL_BIN $@ > $out 2>&1
+ result=$?
+ if [ $result = 0 ]; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && \
+ ( echo "========== results ==========="; cat $out;
+ echo "===============================================") |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $out
+ fi
+}
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $H5TOOL $@
+ echo " -SKIP-"
+}
+
+
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+#
+# HDF5 program that calls HDF5 APIs.
+echo "***"Simple Compile and Link in one step.
+TOOLTEST $hdf5main
+# Application program that calls HDF5 and its own functions.
+TOOLTEST $appmain $prog1 $prog2
+
+# Compile, then link.
+echo "***"Compile and Link in two steps.
+TOOLTEST -c $hdf5main
+TOOLTEST $hdf5main_o
+TOOLTEST -c $appmain $prog1 $prog2
+TOOLTEST $appmain_o $prog1_o $prog2_o
+
+# Build external library, then link with it.
+echo "***"Build external library and link with it.
+TOOLTEST -c $prog1 $prog2
+$AR cru $applib $prog1_o $prog2_o
+$RANLIB $applib
+TOOLTEST $appmain $applib
+TOOLTEST $appmain_o $applib
+
+# Just cpp, no compile, no link.
+echo "***"Just cpp, no compile, no link.
+TOOLTEST -E $hdf5main
+TOOLTEST -E $appmain $prog1 $prog2
+
+##############################################################################
+# END
+##############################################################################
+
+# Clean up file
+if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $temp_SRC $temp_OBJ $temp_FILES
+fi
+
+if test $nerrors -eq 0 ; then
+ echo "All $H5TOOL tests passed."
+fi
+
+exit $nerrors
diff --git a/fortran/examples/Makefile.am b/fortran/examples/Makefile.am
index 3afc91b..9ac7bc9 100644
--- a/fortran/examples/Makefile.am
+++ b/fortran/examples/Makefile.am
@@ -34,6 +34,7 @@ endif
TEST_PROG=dsetexample fileexample rwdsetexample attrexample groupexample \
grpsexample grpdsetexample hyperslab selectele grpit refobjexample \
refregexample mountexample compound
+TEST_SCRIPT=testh5fc.sh
# List files to be installed here
INSTALL_FILES=dsetexample.f90 fileexample.f90 rwdsetexample.f90 \
diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in
index e60e9dc..37b7346 100644
--- a/fortran/examples/Makefile.in
+++ b/fortran/examples/Makefile.in
@@ -53,7 +53,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(top_srcdir)/config/commence.am \
+ $(srcdir)/testh5fc.sh.in $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am \
$(top_srcdir)/config/examples.am
TESTS =
@@ -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 = testh5fc.sh
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -303,6 +303,7 @@ TEST_PROG = dsetexample fileexample rwdsetexample attrexample groupexample \
grpsexample grpdsetexample hyperslab selectele grpit refobjexample \
refregexample mountexample compound
+TEST_SCRIPT = testh5fc.sh
# List files to be installed here
INSTALL_FILES = dsetexample.f90 fileexample.f90 rwdsetexample.f90 \
@@ -373,6 +374,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
+testh5fc.sh: $(top_builddir)/config.status $(srcdir)/testh5fc.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
diff --git a/fortran/examples/testh5fc.sh.in b/fortran/examples/testh5fc.sh.in
new file mode 100755
index 0000000..b16c2e9
--- /dev/null
+++ b/fortran/examples/testh5fc.sh.in
@@ -0,0 +1,239 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the files COPYING and Copyright.html. COPYING can be found at the root
+# of the source code distribution tree; Copyright.html can be found at the
+# root level of an installed copy of the electronic HDF5 document set and
+# is linked from the top-level documents page. It can also be found at
+# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
+# access to either file, you may request a copy from help@hdfgroup.org.
+#
+# Tests for the h5fc compiler tool
+# Created: Albert Cheng, 2007/3/14
+#
+# Modification:
+#
+
+# Initializations
+# Where the tool is installed.
+prefix="@prefix@"
+PARALLEL=@PARALLEL@ # Am I in parallel mode?
+AR=@AR@
+RANLIB=@RANLIB@
+if [ "$PARALLEL" = no ]; then
+ H5TOOL="h5fc" # The tool name
+else
+ H5TOOL="h5pfc" # The tool name
+fi
+H5TOOL_BIN="${prefix}/bin/${H5TOOL}" # The path of the tool binary
+
+CMP='cmp -s'
+DIFF='diff -c'
+
+nerrors=0
+verbose=yes
+
+# The build (current) directory might be different than the source directory.
+if test -z "$srcdir"; then
+ srcdir=.
+fi
+
+# Generate some source files and library for tests.
+suffix=f90 # source file suffix
+hdf5main=${H5TOOL}_hdf5main.$suffix
+hdf5main_o=${H5TOOL}_hdf5main.o
+appmain=${H5TOOL}_appmain.$suffix
+appmain_o=${H5TOOL}_appmain.o
+prog1=${H5TOOL}_prog1.$suffix
+prog1_o=${H5TOOL}_prog1.o
+prog2=${H5TOOL}_prog2.$suffix
+prog2_o=${H5TOOL}_prog2.o
+applib=libapp${H5TOOL}.a
+
+# short hands
+temp_SRC="$hdf5main $appmain $prog1 $prog2"
+temp_OBJ=`echo $temp_SRC | sed -e 's/${suffix}/.o/g'`
+temp_FILES="a.out *.h5 $applib"
+
+# Generate appmain:
+# An application Main that calls hdf5 and application's own functions.
+cat > $appmain <<EOF
+ PROGRAM FILEEXAMPLE
+ USE HDF5 ! This module contains all necessary modules
+
+ IMPLICIT NONE
+
+ CHARACTER(LEN=8), PARAMETER :: filename = "apptmp.h5" ! File name
+ INTEGER(HID_T) :: file_id ! File identifier
+
+ INTEGER :: error ! Error flag
+
+ CALL sub1
+ CALL h5open_f (error)
+ CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error)
+ CALL h5fclose_f(file_id, error)
+ CALL h5close_f(error)
+ CALL sub2
+ END PROGRAM FILEEXAMPLE
+EOF
+
+# generate prog1
+cat > $prog1 <<EOF
+ subroutine sub1
+ print *, "in sub1"
+ end
+EOF
+
+# generate prog2
+cat > $prog2 <<EOF
+ subroutine sub2
+ print *, "in sub2"
+ end
+EOF
+
+# Generate HDF5 Main Program:
+# An HDF5 sample program that calls hdf5 functions.
+cat > $hdf5main <<EOF
+ PROGRAM FILEEXAMPLE
+ USE HDF5 ! This module contains all necessary modules
+
+ IMPLICIT NONE
+
+ CHARACTER(LEN=8), PARAMETER :: filename = "apptmp.h5" ! File name
+ INTEGER(HID_T) :: file_id ! File identifier
+
+ INTEGER :: error ! Error flag
+
+ CALL h5open_f (error)
+ CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error)
+ CALL h5fclose_f(file_id, error)
+ CALL h5close_f(error)
+ END PROGRAM FILEEXAMPLE
+EOF
+
+
+
+# Parse option
+# None
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+ SPACES=" "
+ echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+
+# Debug printing
+# Change : to echo to print the debug statement
+DPRINT() {
+ : $*
+}
+
+# Run a test and print PASS or *FAIL*. If a test fails then increment
+# the `nerrors' global variable and (if $verbose is set) display the
+# difference between the actual output and the expected output. The
+# expected output is given as the first argument to this function and
+# the actual output file is calculated by replacing the `.ddl' with
+# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a
+# non-zero value.
+#
+# This test shows what commands will be run and verify they are as expected.
+# It does not actually execute the compiler script to compile source code.
+# The actual execution ability is tested somewhere else.
+#
+# Algorithm:
+# First figure out the parameters (e.g., compiler name and option, linker name and
+# options, libraries used, ....) that the h5cc command uses. Then use the -show to
+# display what commands the tool will use for different parameter and verify if they
+# are as expected.
+# The paramters have two part, prefix and suffix. The prefix part is the real compiler
+# or linker command name, options (-I, -D, ...). The suffix part is the link options,
+# libraries, ....
+#
+
+#
+# $1: -C compile only; -L link only; -CL compile and link.
+# $2-$: remainign arguments
+#
+TOOLTEST() {
+ out=test_$H5TOOL_$$.out
+ err=test_$H5TOOL_$$.err
+
+ # Run test.
+ TESTING $H5TOOL $@
+ $H5TOOL_BIN $@ > $out 2>&1
+ result=$?
+ if [ $result = 0 ]; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && \
+ ( echo "========== results ==========="; cat $out;
+ echo "===============================================") |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $out
+ fi
+}
+
+# Print a "SKIP" message
+SKIP() {
+ TESTING $H5TOOL $@
+ echo " -SKIP-"
+}
+
+
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+#
+# HDF5 program that calls HDF5 APIs.
+echo "***"Simple Compile and Link in one step.
+TOOLTEST $hdf5main
+# Application program that calls HDF5 and its own functions.
+TOOLTEST $appmain $prog1 $prog2
+
+# Compile, then link.
+echo "***"Compile and Link in two steps.
+TOOLTEST -c $hdf5main
+TOOLTEST $hdf5main_o
+TOOLTEST -c $appmain $prog1 $prog2
+TOOLTEST $appmain_o $prog1_o $prog2_o
+
+# Build external library, then link with it.
+echo "***"Build external library and link with it.
+TOOLTEST -c $prog1 $prog2
+$AR cru $applib $prog1_o $prog2_o
+$RANLIB $applib
+SKIP $appmain $applib
+SKIP $appmain_o $applib
+
+# Just cpp, no compile, no link.
+echo "***"Just cpp, no compile, no link.
+TOOLTEST -E $hdf5main
+TOOLTEST -E $appmain $prog1 $prog2
+
+##############################################################################
+# END
+##############################################################################
+
+# Clean up file
+if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $temp_SRC $temp_OBJ $temp_FILES
+fi
+
+if test $nerrors -eq 0 ; then
+ echo "All $H5TOOL tests passed."
+fi
+
+exit $nerrors