summaryrefslogtreecommitdiffstats
path: root/test/gen_filespace.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-11-16 20:45:05 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-11-16 20:45:05 (GMT)
commitd2b87ec47ebdb096c331c7b62a195b9cea2f33ae (patch)
treea066f01361afaf5df457cef612bb0bb9fd80fe18 /test/gen_filespace.c
parentee5a1e07350f0dcf3ef07d9443aa2f4c073392f4 (diff)
downloadhdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.zip
hdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.tar.gz
hdf5-d2b87ec47ebdb096c331c7b62a195b9cea2f33ae.tar.bz2
[svn-r17896] Description:
Bring r17546:17895 from trunk to revise_chunks branch. Changes to fixed and extensible array dataset chunk indexing code to accommodate changes to private APIs in those interfaces. Also, other adjustments to source code and expected output in response to changes on the trunk. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.2 (amazon) in debug mode Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'test/gen_filespace.c')
-rw-r--r--test/gen_filespace.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/test/gen_filespace.c b/test/gen_filespace.c
new file mode 100644
index 0000000..e9dee1c
--- /dev/null
+++ b/test/gen_filespace.c
@@ -0,0 +1,81 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "hdf5.h"
+
+#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
+#define TEST_THRESHOLD2 2 /* Free space section threshold */
+
+const char *FILENAMES[] = {
+ "filespace_persist.h5", /* H5F_FILE_SPACE_ALL_PERSIST */
+ "filespace_default.h5", /* H5F_FILE_SPACE_ALL */
+ "filespace_aggr_vfd.h5", /* H5F_FILE_SPACE_AGGR_VFD */
+ "filespace_vfd.h5", /* H5F_FILE_SPACE_VFD */
+ "filespace_threshold.h5" /* H5F_FILE_SPACE_ALL, non-default threshold */
+};
+
+#define DATASET "dset"
+#define NUM_ELMTS 100
+
+/*
+ * Compile and run this program in file-space branch to generate
+ * HDF5 files with different kinds of file space strategies
+ * Move the HDF5 files to the 1.6 and 1.8 branch for compatibility
+ * testing:test_filespace_compatible() will use the files
+ */
+static void gen_file(void)
+{
+ hid_t fid;
+ hid_t fcpl;
+ hid_t dataset, space;
+ hsize_t dim[1];
+ int data[NUM_ELMTS];
+ unsigned i, j; /* Local index variable */
+ H5F_file_space_type_t fs_type; /* File space handling strategy */
+
+ for(j = 0, fs_type = H5F_FILE_SPACE_ALL_PERSIST; j < NELMTS(FILENAMES); j++, (H5F_file_space_type_t)(fs_type)++) {
+ /* Get a copy of the default file creation property */
+ fcpl = H5Pcreate(H5P_FILE_CREATE);
+
+ if(fs_type == H5F_FILE_SPACE_NTYPES) /* last file */
+ /* Set default strategy but non-default threshold */
+ H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL, (hsize_t)TEST_THRESHOLD2);
+ else
+ /* Set specified file space strategy and free space section threshold */
+ H5Pset_file_space(fcpl, fs_type, (hsize_t)0);
+
+ /* Create the file with the file space info */
+ fid = H5Fcreate(FILENAMES[j], H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
+
+ dim[0] = NUM_ELMTS;
+ space = H5Screate_simple(1, dim, NULL);
+ dataset = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+
+ for(i = 0; i < NUM_ELMTS; i++)
+ data[i] = i;
+
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data);
+ H5Dclose(dataset);
+ H5Sclose(space);
+ H5Fclose(fid);
+ }
+}
+
+int main(void)
+{
+ gen_file();
+
+ return 0;
+}