diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2013-11-22 17:27:08 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2013-11-22 17:27:08 (GMT) |
commit | 8f3a6ae8b7bf2554478b668a102f37a9f1363e3e (patch) | |
tree | 8ca4b4d22964f978670e8668e240f99aa43f3f47 /tools/h5diff | |
parent | 10d221961cd178734d674cb7d20465374ac37afd (diff) | |
download | hdf5-8f3a6ae8b7bf2554478b668a102f37a9f1363e3e.zip hdf5-8f3a6ae8b7bf2554478b668a102f37a9f1363e3e.tar.gz hdf5-8f3a6ae8b7bf2554478b668a102f37a9f1363e3e.tar.bz2 |
[svn-r24462] Bring revision #24457 from revise_chunks.
Diffstat (limited to 'tools/h5diff')
-rw-r--r-- | tools/h5diff/h5diff_common.c | 2 | ||||
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 22 | ||||
-rw-r--r-- | tools/h5diff/testh5diff.sh.in | 17 |
3 files changed, 29 insertions, 12 deletions
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index cf46e74..59cab0d 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -174,7 +174,7 @@ void parse_command_line(int argc, options->exclude_path = 1; /* create linked list of excluding objects */ - if( (exclude_node = (struct exclude_path_list*) malloc(sizeof(struct exclude_path_list))) == NULL) + if( (exclude_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL) { printf("Error: lack of memory!\n"); h5diff_exit(EXIT_FAILURE); diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 517f496..a31f423 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -4576,7 +4576,7 @@ static void test_comps_vlen (const char * fname, const char *dset, const char *a for(i=0; i<SDIM_DSET; i++) { wdata[i].i1 = i; - wdata[i].vl.p = malloc((i+1)*sizeof(cmpd2_t)); + wdata[i].vl.p = HDmalloc((i+1)*sizeof(cmpd2_t)); wdata[i].vl.len = i+1; for(j=0; j<(i+1); j++) { @@ -4701,7 +4701,7 @@ static void test_comps_array_vlen (const char * fname, const char *dset,const ch for(j=0; j < SDIM_CMPD_ARRAY; j++) { wdata[i].cmpd2[j].i2 = j*10; - wdata[i].cmpd2[j].vl.p = malloc((j+1)*sizeof(cmpd3_t)); + wdata[i].cmpd2[j].vl.p = HDmalloc((j+1)*sizeof(cmpd3_t)); wdata[i].cmpd2[j].vl.len = j+1; for(k=0; k<(j+1); k++) { @@ -4845,7 +4845,7 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch { /* compound 1 data */ wdata[i].i1 = i; - wdata[i].vl.p = malloc((i+1)*sizeof(cmpd2_t)); + wdata[i].vl.p = HDmalloc((i+1)*sizeof(cmpd2_t)); wdata[i].vl.len = i+1; for(j=0; j<(i+1); j++) { @@ -5557,10 +5557,10 @@ void write_attr_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = malloc( 1 * sizeof(int)); + buf5[0].p = HDmalloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; buf5[1].len = 2; - buf5[1].p = malloc( 2 * sizeof(int)); + buf5[1].p = HDmalloc( 2 * sizeof(int)); ((int *)buf5[1].p)[0]=2; ((int *)buf5[1].p)[1]=3; @@ -5844,7 +5844,7 @@ void write_attr_in(hid_t loc_id, n=0; for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { - buf52[i][j].p = malloc((i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; for (l = 0; l < i + 1; l++) if (make_diffs)((int *)buf52[i][j].p)[l] = 0; @@ -6260,7 +6260,7 @@ void write_attr_in(hid_t loc_id, for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { for (k = 0; k < 2; k++) { - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); buf53[i][j][k].len = i + 1; for (l = 0; l < i + 1; l++) if (make_diffs)((int *)buf53[i][j][k].p)[l] = 0; @@ -6591,10 +6591,10 @@ void write_dset_in(hid_t loc_id, /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; - buf5[0].p = malloc( 1 * sizeof(int)); + buf5[0].p = HDmalloc( 1 * sizeof(int)); ((int *)buf5[0].p)[0]=1; buf5[1].len = 2; - buf5[1].p = malloc( 2 * sizeof(int)); + buf5[1].p = HDmalloc( 2 * sizeof(int)); ((int *)buf5[1].p)[0]=2; ((int *)buf5[1].p)[1]=3; @@ -6804,7 +6804,7 @@ void write_dset_in(hid_t loc_id, { for(j = 0; j < 2; j++) { - buf52[i][j].p = malloc((i + 1) * sizeof(int)); + buf52[i][j].p = HDmalloc((i + 1) * sizeof(int)); buf52[i][j].len = i + 1; for(l = 0; l < i + 1; l++) { @@ -7017,7 +7017,7 @@ void write_dset_in(hid_t loc_id, { for(k = 0; k < 2; k++) { - buf53[i][j][k].p = malloc((i + 1) * sizeof(int)); + buf53[i][j][k].p = HDmalloc((i + 1) * sizeof(int)); buf53[i][j][k].len = i + 1; for(l = 0; l < i + 1; l++) { diff --git a/tools/h5diff/testh5diff.sh.in b/tools/h5diff/testh5diff.sh.in index 3455287..549da49 100644 --- a/tools/h5diff/testh5diff.sh.in +++ b/tools/h5diff/testh5diff.sh.in @@ -38,6 +38,7 @@ EXIT_FAILURE=1 H5DIFF=h5diff # The tool name H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary +RM='rm -rf' CMP='cmp -s' DIFF='diff -c' CP='cp' @@ -336,6 +337,19 @@ COPY_TESTFILES_TO_TESTDIR() done } +CLEAN_TESTFILES_AND_TESTDIR() +{ + # skip rm 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 $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $TESTDIR + fi +} + # Parse option # -p run ph5diff tests # -h print help page @@ -1096,6 +1110,9 @@ TOOLTEST h5diff_646.txt -v --use-system-epsilon -p 0.05 h5diff_basic1.h5 h5diff_ # # END # ############################################################################## +# Clean up temporary files/directories +CLEAN_TESTFILES_AND_TESTDIR + if test $nerrors -eq 0 ; then echo "All $TESTNAME tests passed." exit $EXIT_SUCCESS |