diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2013-10-15 22:44:34 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2013-10-15 22:44:34 (GMT) |
commit | 0c8a2b2a74528749045f7070ad728bd93455ae41 (patch) | |
tree | 210d13091e9d71fe916556f1c8269837d32b2822 /test | |
parent | dfd9816c8d5ea707dfb2a19adad3176c7a15c5d2 (diff) | |
download | hdf5-0c8a2b2a74528749045f7070ad728bd93455ae41.zip hdf5-0c8a2b2a74528749045f7070ad728bd93455ae41.tar.gz hdf5-0c8a2b2a74528749045f7070ad728bd93455ae41.tar.bz2 |
[svn-r24297] Merge r24067 from branches/revise_chunks.
Creating the test program of order of writes.
For now, it is just a dummy program. Checking it in
so that I can check them out for my Mac laptop to work on offsite.
tested: koala
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 5 | ||||
-rw-r--r-- | test/Makefile.in | 52 | ||||
-rw-r--r-- | test/twriteorder.c | 68 |
3 files changed, 102 insertions, 23 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 5ee8ae1..e1c152c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -43,7 +43,8 @@ check_SCRIPTS = $(TEST_SCRIPT) # other current library code tests. TEST_PROG= testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ pool accum hyperslab istore bittests dt_arith \ - dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ + dtypes dsets cmpd_dset filter_fail extend external efc objcopy\ + links twriteorder unlink \ big mtime fillval mount flush1 flush2 app_ref enum \ set_extent ttsafe enc_dec_plist enc_dec_plist_with_endianess\ getname vfd ntypes dangle dtransform reserved cross_read \ @@ -145,7 +146,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 \ stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \ tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \ fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 ttime.h5 \ - trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 flush.h5 \ + trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 twriteorder.dat flush.h5 \ enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 \ tmisc[0-9]*.h5 set_extent[1-5].h5 ext[12].bin \ getname.h5 getname[1-3].h5 sec2_file.h5 direct_file.h5 \ diff --git a/test/Makefile.in b/test/Makefile.in index 8a91960..7a71fcc 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -168,10 +168,10 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ dt_arith$(EXEEXT) dtypes$(EXEEXT) dsets$(EXEEXT) \ cmpd_dset$(EXEEXT) filter_fail$(EXEEXT) extend$(EXEEXT) \ external$(EXEEXT) efc$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) \ - unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) fillval$(EXEEXT) \ - mount$(EXEEXT) flush1$(EXEEXT) flush2$(EXEEXT) \ - app_ref$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \ - ttsafe$(EXEEXT) enc_dec_plist$(EXEEXT) \ + twriteorder$(EXEEXT) unlink$(EXEEXT) big$(EXEEXT) \ + mtime$(EXEEXT) fillval$(EXEEXT) mount$(EXEEXT) flush1$(EXEEXT) \ + flush2$(EXEEXT) app_ref$(EXEEXT) enum$(EXEEXT) \ + set_extent$(EXEEXT) ttsafe$(EXEEXT) enc_dec_plist$(EXEEXT) \ enc_dec_plist_with_endianess$(EXEEXT) getname$(EXEEXT) \ vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \ dtransform$(EXEEXT) reserved$(EXEEXT) cross_read$(EXEEXT) \ @@ -544,6 +544,10 @@ am_ttsafe_OBJECTS = ttsafe.$(OBJEXT) ttsafe_dcreate.$(OBJEXT) \ ttsafe_OBJECTS = $(am_ttsafe_OBJECTS) ttsafe_LDADD = $(LDADD) ttsafe_DEPENDENCIES = libh5test.la $(LIBHDF5) +twriteorder_SOURCES = twriteorder.c +twriteorder_OBJECTS = twriteorder.$(OBJEXT) +twriteorder_LDADD = $(LDADD) +twriteorder_DEPENDENCIES = libh5test.la $(LIBHDF5) unlink_SOURCES = unlink.c unlink_OBJECTS = unlink.$(OBJEXT) unlink_LDADD = $(LDADD) @@ -621,7 +625,7 @@ SOURCES = $(libdynlib1_la_SOURCES) $(libdynlib2_la_SOURCES) \ swmr_generator.c swmr_reader.c swmr_remove_reader.c \ swmr_remove_writer.c swmr_sparse_reader.c swmr_sparse_writer.c \ swmr_writer.c tcheck_version.c $(testhdf5_SOURCES) testmeta.c \ - $(ttsafe_SOURCES) unlink.c unregister.c \ + $(ttsafe_SOURCES) twriteorder.c unlink.c unregister.c \ $(use_append_chunk_SOURCES) $(use_append_mchunks_SOURCES) \ vfd.c DIST_SOURCES = $(am__libdynlib1_la_SOURCES_DIST) \ @@ -646,7 +650,7 @@ DIST_SOURCES = $(am__libdynlib1_la_SOURCES_DIST) \ swmr_generator.c swmr_reader.c swmr_remove_reader.c \ swmr_remove_writer.c swmr_sparse_reader.c swmr_sparse_writer.c \ swmr_writer.c tcheck_version.c $(testhdf5_SOURCES) testmeta.c \ - $(ttsafe_SOURCES) unlink.c unregister.c \ + $(ttsafe_SOURCES) twriteorder.c unlink.c unregister.c \ $(use_append_chunk_SOURCES) $(use_append_mchunks_SOURCES) \ vfd.c am__can_run_installinfo = \ @@ -959,20 +963,21 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog accum.h5 cmpd_dset.h5 \ tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \ fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 \ ttime.h5 trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 \ - flush.h5 enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 \ - tmisc[0-9]*.h5 set_extent[1-5].h5 ext[12].bin getname.h5 \ - getname[1-3].h5 sec2_file.h5 direct_file.h5 \ - family_file000[0-3][0-9].h5 new_family_v16_000[0-3][0-9].h5 \ - multi_file-[rs].h5 core_file plugin.h5 new_move_[ab].h5 \ - ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 dtransform.h5 \ - test_filters.h5 get_file_name.h5 tstint[1-2].h5 \ - unlink_chunked.h5 btree2.h5 objcopy_src.h5 objcopy_dst.h5 \ - objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 \ - earray.h5 efc[0-5].h5 log_vfd_out.log new_multi_file_v16-r.h5 \ - new_multi_file_v16-s.h5 split_get_file_image_test-m.h5 \ - split_get_file_image_test-r.h5 file_image_core_test.h5.copy \ - unregister_filter_1.h5 unregister_filter_2.h5 swmr_data.h5 \ - use_append_chunk.h5 use_append_mchunks.h5 flushrefresh.h5 \ + twriteorder.dat flush.h5 enum1.h5 titerate.h5 ttsafe.h5 \ + tarray1.h5 tgenprop.h5 tmisc[0-9]*.h5 set_extent[1-5].h5 \ + ext[12].bin getname.h5 getname[1-3].h5 sec2_file.h5 \ + direct_file.h5 family_file000[0-3][0-9].h5 \ + new_family_v16_000[0-3][0-9].h5 multi_file-[rs].h5 core_file \ + plugin.h5 new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 \ + err_compat.h5 dtransform.h5 test_filters.h5 get_file_name.h5 \ + tstint[1-2].h5 unlink_chunked.h5 btree2.h5 objcopy_src.h5 \ + objcopy_dst.h5 objcopy_ext.dat trefer1.h5 trefer2.h5 \ + app_ref.h5 farray.h5 earray.h5 efc[0-5].h5 log_vfd_out.log \ + new_multi_file_v16-r.h5 new_multi_file_v16-s.h5 \ + split_get_file_image_test-m.h5 split_get_file_image_test-r.h5 \ + file_image_core_test.h5.copy unregister_filter_1.h5 \ + unregister_filter_2.h5 swmr_data.h5 use_append_chunk.h5 \ + use_append_mchunks.h5 flushrefresh.h5 \ flushrefresh_VERIFICATION_START \ flushrefresh_VERIFICATION_CHECKPOINT1 \ flushrefresh_VERIFICATION_CHECKPOINT2 \ @@ -997,7 +1002,8 @@ check_SCRIPTS = $(TEST_SCRIPT) # other current library code tests. TEST_PROG = testhdf5 lheap ohdr stab gheap cache cache_api cache_tagging \ pool accum hyperslab istore bittests dt_arith \ - dtypes dsets cmpd_dset filter_fail extend external efc objcopy links unlink \ + dtypes dsets cmpd_dset filter_fail extend external efc objcopy\ + links twriteorder unlink \ big mtime fillval mount flush1 flush2 app_ref enum \ set_extent ttsafe enc_dec_plist enc_dec_plist_with_endianess\ getname vfd ntypes dangle dtransform reserved cross_read \ @@ -1494,6 +1500,9 @@ testmeta$(EXEEXT): $(testmeta_OBJECTS) $(testmeta_DEPENDENCIES) $(EXTRA_testmeta ttsafe$(EXEEXT): $(ttsafe_OBJECTS) $(ttsafe_DEPENDENCIES) $(EXTRA_ttsafe_DEPENDENCIES) @rm -f ttsafe$(EXEEXT) $(AM_V_CCLD)$(LINK) $(ttsafe_OBJECTS) $(ttsafe_LDADD) $(LIBS) +twriteorder$(EXEEXT): $(twriteorder_OBJECTS) $(twriteorder_DEPENDENCIES) $(EXTRA_twriteorder_DEPENDENCIES) + @rm -f twriteorder$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(twriteorder_OBJECTS) $(twriteorder_LDADD) $(LIBS) unlink$(EXEEXT): $(unlink_OBJECTS) $(unlink_DEPENDENCIES) $(EXTRA_unlink_DEPENDENCIES) @rm -f unlink$(EXEEXT) $(AM_V_CCLD)$(LINK) $(unlink_OBJECTS) $(unlink_LDADD) $(LIBS) @@ -1637,6 +1646,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tunicode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tvlstr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tvltypes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/twriteorder.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unlink.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unregister.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/use_append_chunk.Po@am__quote@ diff --git a/test/twriteorder.c b/test/twriteorder.c new file mode 100644 index 0000000..4a6909e --- /dev/null +++ b/test/twriteorder.c @@ -0,0 +1,68 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*********************************************************** +* +* Test program: twriteorder +* +* Test to verify that the write order is strictly consistent. +* The SWMR feature requires that the order of write is strictly consistent. +* <<design requirements of SWMR>> +*************************************************************/ + +/*********************************************************** +* +* Algorithm +* +* The test simulates what SWMR does by writing chained blocks and see if +* they can be read back correctly. +* There is a writer process and multiple read processes. +* The file is divided into 2KB partitions. Then writer writes 1 chained +* block, each of 1KB big, in each partition after the first partition. +* Each chained block has this structure: +* Byte 0-7: offset address of its child block. The last child uses 0 as NULL. +* Byte 8-1023: some artificial data. +* The child block address of Block 1 is NULL (0). +* The child block address of Block 2 is the offset address of Block 1. +* The child block address of Block n is the offset address of Block n-1. +* After all n blocks are written, the offset address of Block n is written +* to the offset 0 of the first partition. +* Therefore, by the time the offset address of Block n is written to this +* position, all n chain-linked blocks have been written. +* +* The other reader processes will try to read the address value at the +* offset 0. The value is initially NULL(0). When it changes to non-zero, +* it signifies the writer process has written all the chain-link blocks +* and they are ready for the reader processes to access. +* +* If the system, in which the writer and reader processes run, the readers +* will always get all chain-linked blocks correctly. If the order of write +* is not maintained, some reader processes may found unexpect block data. +* +*************************************************************/ + +#include "testhdf5.h" + +#include "hdf5.h" + +#define DATAFILE "twriteorder.dat" + +int +main(int ac, char **av) +{ + if (ac > 0 && ac < 10){ /* just to shut up the warnings */ + printf("This is a dummy of %s with datafile %s\n", *av, DATAFILE); + } + return(0); +} |