From 3de935af7bef6d33aa70682c5144861a92f3411d Mon Sep 17 00:00:00 2001 From: Elena Pourmal Date: Sat, 5 Apr 2003 12:34:31 -0500 Subject: [svn-r6589] Purpose: Bug fix Description: h5import tests will fail if srcdir option is used with configure. Solution: Modified h5importtest.c h5importtestutil.sh files to search for input files in the proper directory and to write output files to the proper directory. Platforms tested: Tested on burrwhite, arabica, and modi4. Unfortunately srcdir option was used only on arabica, since I am having a weird 'timezone' problem on all Linux machines when srcdir is used, and on modi4 build has to be done in the same directory (at least this is a message I am getting from configure; should it work?) Misc. update: --- tools/h5import/Makefile.in | 6 ++---- tools/h5import/h5importtest.c | 31 ++++++++++++++++++---------- tools/h5import/h5importtestutil.sh | 42 +++++++++++++++++++++----------------- 3 files changed, 45 insertions(+), 34 deletions(-) diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index 12fd969..9bbcce9 100755 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in @@ -18,10 +18,8 @@ CPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src \ ## Test programs and scripts. ## -#TEST_PROGS= h5importtest -#TEST_SCRIPTS=$(srcdir)/h5importtestutil.sh -TEST_PROGS= -TEST_SCRIPTS= +TEST_PROGS= h5importtest +TEST_SCRIPTS=$(srcdir)/h5importtestutil.sh ## These are our main targets: library and tools. ## diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index b27d67d..557fe0b 100755 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -15,6 +15,10 @@ * used to test the h5import program. * */ +/* + * Define names for test files + */ + int main(void) { @@ -53,6 +57,7 @@ main(void) double row8[3], col8[4], pln8[5]; double rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0; double rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0; + /* * initialize the row, column, and plane vectors @@ -175,7 +180,8 @@ main(void) #ifndef UNICOS - sp = fopen("testfiles/txtin16", "w"); + + sp = fopen("txtin16", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) { @@ -185,7 +191,7 @@ main(void) } (void) fclose(sp); - sp = fopen("testfiles/txtin32", "w"); + sp = fopen("txtin32", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) { @@ -195,14 +201,15 @@ main(void) } (void) fclose(sp); - sp = fopen("testfiles/bin32", "w"); + sp = fopen("bin32", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) (void) fwrite((char *) &b32i3[k][i][j], sizeof(int), 1, sp); (void) fclose(sp); - sp = fopen("testfiles/buin32", "w"); + + sp = fopen("buin32", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) @@ -210,14 +217,15 @@ main(void) (void) fclose(sp); #ifndef WIN32 - sp = fopen("testfiles/bin64-2", "w"); + + sp = fopen("bin64-2", "w"); for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) (void) fwrite((char *) &b64i2[i][j], sizeof(long_long), 1, sp); (void) fclose(sp); #endif - sp = fopen("testfiles/bfp32", "w"); + sp = fopen("bfp32", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) @@ -225,7 +233,7 @@ main(void) sizeof(float), 1, sp); (void) fclose(sp); - sp = fopen("testfiles/bin16", "w"); + sp = fopen("bin16", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) @@ -233,7 +241,7 @@ main(void) sp); (void) fclose(sp); - sp = fopen("testfiles/buin16", "w"); + sp = fopen("buin16", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) @@ -242,7 +250,8 @@ main(void) (void) fclose(sp); #ifndef WIN32 - sp = fopen("testfiles/bin64-3", "w"); + + sp = fopen("bin64-3", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) @@ -251,7 +260,7 @@ main(void) (void) fclose(sp); #endif - sp = fopen("testfiles/bin8", "w"); + sp = fopen("bin8", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) @@ -265,7 +274,7 @@ main(void) * binary 64-bit file - rank 2 & 3 */ - sp = fopen("testfiles/bfp64", "w"); + sp = fopen("bfp64", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh index 40ce7f5..c8f3f01 100755 --- a/tools/h5import/h5importtestutil.sh +++ b/tools/h5import/h5importtestutil.sh @@ -16,12 +16,12 @@ err=0 ./h5import $* ../h5dump/h5dump $5 >log2 -cd testfiles +cd tmp_testfiles ../../h5dump/h5dump $5 >log1 cd .. -cmp -s testfiles/log1 log2 || err=1 -rm -f log2 testfiles/log1 +cmp -s tmp_testfiles/log1 log2 || err=1 +rm -f log2 tmp_testfiles/log1 if [ $err -eq 1 ]; then errors="` expr $errors + 1 `"; echo "*FAILED*" @@ -38,51 +38,55 @@ echo "==============================" if [ -f h5import -a -f h5importtest ]; then #echo "** Testing h5import ***" -rm -f output.h5 log1 testfiles/tx* testfiles/b* *.dat +rm -f output.h5 log1 tx* b* *.dat + +mkdir tmp_testfiles +cp $srcdir/testfiles/*.h5 tmp_testfiles/ ./h5importtest TESTING "ASCII I32 rank 3 - Output BE " ; -TOOLTEST testfiles/txtin32 -c testfiles/textin32 -o test1.h5 +TOOLTEST txtin32 -c $srcdir/testfiles/textin32 -o test1.h5 TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended" -TOOLTEST testfiles/txtin16 -c testfiles/textin16 -o test2.h5 +TOOLTEST txtin16 -c $srcdir/testfiles/textin16 -o test2.h5 TESTING "ASCII I8 - rank 3 - Output I16 LE-Chunked+Extended+Compressed " -TOOLTEST testfiles/txtin16 -c testfiles/textin8 -o test3.h5 +TOOLTEST txtin16 -c $srcdir/testfiles/textin8 -o test3.h5 TESTING "ASCII UI32 - rank 3 - Output BE" -TOOLTEST testfiles/in1 -c testfiles/textuin32 -o test4.h5 +TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin32 -o test4.h5 TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed " -TOOLTEST testfiles/in1 -c testfiles/textuin16 -o test5.h5 +TOOLTEST $srcdir/testfiles/in1 -c $srcdir/testfiles/textuin16 -o test5.h5 TESTING "ASCII F32 - rank 3 - Output LE " -TOOLTEST testfiles/fp1 -c testfiles/textfp32 -o test6.h5 +TOOLTEST $srcdir/testfiles/fp1 -c $srcdir/testfiles/textfp32 -o test6.h5 TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed " -TOOLTEST testfiles/fp2 -c testfiles/textfp64 -o test7.h5 +TOOLTEST $srcdir/testfiles/fp2 -c $srcdir/testfiles/textfp64 -o test7.h5 TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed " -TOOLTEST testfiles/bfp64 -c testfiles/conbfp64 -o test8.h5 +TOOLTEST bfp64 -c $srcdir/testfiles/conbfp64 -o test8.h5 TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " -TOOLTEST testfiles/bin16 -c testfiles/conbin16 -o test9.h5 +TOOLTEST bin16 -c $srcdir/testfiles/conbin16 -o test9.h5 TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " -TOOLTEST testfiles/bin8 -c testfiles/conbin8 -o test10.h5 +TOOLTEST bin8 -c $srcdir/testfiles/conbin8 -o test10.h5 TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED " -TOOLTEST testfiles/bin32 -c testfiles/conbin32 -o test11.h5 +TOOLTEST bin32 -c $srcdir/testfiles/conbin32 -o test11.h5 TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED " -TOOLTEST testfiles/buin16 -c testfiles/conbuin16 -o test12.h5 +TOOLTEST buin16 -c $srcdir/testfiles/conbuin16 -o test12.h5 TESTING "BINARY UI32 - rank 3 - Output LE + CHUNKED " -TOOLTEST testfiles/buin32 -c testfiles/conbuin32 -o test13.h5 +TOOLTEST buin32 -c $srcdir/testfiles/conbuin32 -o test13.h5 -rm -f testfiles/tx* testfiles/b* *.dat -rm -f test*.h5 testfiles/test*.log +rm -f tx* b* *.dat +rm -f test*.h5 +rm -rf tmp_testfiles else echo "** h5import or h5importtest not available ***" errors="` expr $errors + 1 `"; -- cgit v0.12