summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2008-06-01 06:58:52 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2008-06-01 06:58:52 (GMT)
commit37793c33f226698dea6916bc61577933dd354320 (patch)
treee72ab52cffad056f9919daf21eb4544ab4feba56 /tools
parent0126d4369888d47975d7340a1780063566a28dd7 (diff)
downloadhdf5-37793c33f226698dea6916bc61577933dd354320.zip
hdf5-37793c33f226698dea6916bc61577933dd354320.tar.gz
hdf5-37793c33f226698dea6916bc61577933dd354320.tar.bz2
[svn-r15115] Changed the function call name to H5Pset_journal.
Remove all test files before creating them anew. (This was partially due to the journal code does not handle existing journal file well.) Changed testh5recover.sh to exit 1 if errors encountered. The old way of "exit $nerrors" could fail if $nerrors happened to be a multiple of the exit code limit (usually 1 byte=256).
Diffstat (limited to 'tools')
-rw-r--r--tools/h5recover/testh5recover.sh.in9
-rw-r--r--tools/h5recover/trecover.h3
-rw-r--r--tools/h5recover/trecover_main.c2
-rw-r--r--tools/h5recover/trecover_writer.c8
4 files changed, 16 insertions, 6 deletions
diff --git a/tools/h5recover/testh5recover.sh.in b/tools/h5recover/testh5recover.sh.in
index 9a6531b..fb1e3d0 100644
--- a/tools/h5recover/testh5recover.sh.in
+++ b/tools/h5recover/testh5recover.sh.in
@@ -136,5 +136,10 @@ if test $nerrors -eq 0 ; then
echo "All $TOOL tests passed."
fi
-exit $nerrors
-
+if test $nerrors -eq 0 ; then
+ echo "All $TOOL tests passed."
+ exit 0
+else
+ echo $nerrors errors encountered.
+ exit 1
+fi
diff --git a/tools/h5recover/trecover.h b/tools/h5recover/trecover.h
index 3c74dd4..7bd3be2 100644
--- a/tools/h5recover/trecover.h
+++ b/tools/h5recover/trecover.h
@@ -46,6 +46,7 @@
#define ChunkY 8
#define H5FILE_NAME "trecover.h5"
#define CTL_H5FILE_NAME "CTL"H5FILE_NAME /* control file name */
+#define JNL_H5FILE_NAME H5FILE_NAME".jnl" /* journal file name */
/* Data Structures */
typedef union CrasherParam_t {
@@ -65,5 +66,5 @@ void wakeup(int signum);
void parser(int ac, char **av); /* command option parser */
void init(void); /* initialization */
void help(void); /* initialization */
-int create_files(char *filename, char *ctl_filename);
+int create_files(char *filename, char *ctl_filename, char *jnl_filename);
int close_file(hid_t fid);
diff --git a/tools/h5recover/trecover_main.c b/tools/h5recover/trecover_main.c
index d8a0f5b..72883c2 100644
--- a/tools/h5recover/trecover_main.c
+++ b/tools/h5recover/trecover_main.c
@@ -144,7 +144,7 @@ main (int ac, char **av)
parser(ac, av);
/* create/open both files. */
- create_files(H5FILE_NAME, CTL_H5FILE_NAME);
+ create_files(H5FILE_NAME, CTL_H5FILE_NAME, JNL_H5FILE_NAME);
/* create datasets in Control file first. */
writer(ctl_file, DSTypes, RANK, dims, dimschunk);
diff --git a/tools/h5recover/trecover_writer.c b/tools/h5recover/trecover_writer.c
index f432d23..01e3ca0 100644
--- a/tools/h5recover/trecover_writer.c
+++ b/tools/h5recover/trecover_writer.c
@@ -26,7 +26,7 @@
#define SZDATASETNAME "IntArraySZCompressed"
int
-create_files(char *filename, char *ctl_filename)
+create_files(char *filename, char *ctl_filename, char *jnl_filename)
{
/*
* Create a new file and the control file using H5F_ACC_TRUNC access,
@@ -36,11 +36,15 @@ create_files(char *filename, char *ctl_filename)
hid_t fapl_id; /* file access property list handle */
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if (H5Pset_fapl_journal(fapl_id, "journal_file") < 0){
+ if (H5Pset_journal(fapl_id, jnl_filename) < 0){
fprintf(stderr, "H5Pset_journal on data file failed\n");
H5Pclose(fapl_id);
return(-1);
}
+ /* remove any existing test files. */
+ remove(filename);
+ remove(ctl_filename);
+ remove(jnl_filename);
file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
ctl_file = H5Fcreate(ctl_filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);