1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Copyright by The HDF Group. *
3 * Copyright by the Board of Trustees of the University of Illinois. *
4 * All rights reserved. *
5 * *
6 * This file is part of HDF5. The full HDF5 copyright notice, including *
7 * terms governing use, modification, and redistribution, is contained in *
8 * the COPYING file, which can be found at the root of the source code *
9 * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
10 * If you do not have access to either file, you may request a copy from *
11 * help@hdfgroup.org. *
12 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13
14 /*
15 * Purpose: This program is to generate HDF5 data files used to test
16 * version bounds.
17 *
18 * Description
19 * ===========
20 * gen_bounds.c will generate the following files:
21 * - bounds_earliest_latest.h5
22 * - bounds_earliest_v18.h5
23 * - bounds_latest_latest.h5
24 * - bounds_v18_latest.h5
25 * - bounds_v18_v18.h5
26 * These files are copied to 1.6 and 1.8 libraries for verifying
27 * that they can or cannot read particular file format.
28 */
29
30 #include "h5test.h"
31
32 /***********************************************************************
33 * gen_earliest_latest() creates file "bounds_earliest_latest.h5"
34 *
35 * File contents:
36 * - Version 0 superblock (default)
37 * - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
38 * - A chunked dataset with layout version 4, "DS_chunked_layout_4". (H5Pset_chunk_opts)
39 *
40 * Return: SUCCEED/FAIL
41 *
42 ***********************************************************************/
43
44 /* File names for different file format */
45 #define FILENAME_E_L "bounds_earliest_latest.h5"
46 #define FILENAME_E_18 "bounds_earliest_v18.h5"
47 #define FILENAME_L_L "bounds_latest_latest.h5"
48 #define FILENAME_18_L "bounds_v18_latest.h5"
49 #define FILENAME_18_18 "bounds_v18_v18.h5"
50
51 /* 2-D dataset with fixed dimensions */
52 #define RANK 2
53 #define DIM1 100
54 #define DIM2 200
55 #define CHK_DIM1 50
56 #define CHK_DIM2 50
57
gen_earliest_latest(void)58 static herr_t gen_earliest_latest(void)
59 {
60 hid_t fid = -1; /* File ID */
61 hid_t fapl = -1; /* File access property list ID */
62 hid_t fcpl = -1; /* File creation property list ID */
63 hid_t dcpl = -1; /* Dataset creation property list ID */
64 hid_t space = -1; /* Dataspace ID */
65 hid_t dset = -1; /* Dataset ID */
66 float *buf = NULL; /* Buffer for writing data */
67 float *bufp = NULL; /* Pointer to data buffer */
68 hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
69 hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
70 int i, j;
71 herr_t ret = SUCCEED; /* Generic return value */
72
73 /* Create file creation property list */
74 if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
75
76 /* Create file access property list */
77 if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
78
79 /* Set the "use the earliest/latest version of the format" bounds
80 for creating objects in the file */
81 if(H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST) < 0)
82 TEST_ERROR;
83
84 /* Create file */
85 if((fid = H5Fcreate(FILENAME_E_L, H5F_ACC_TRUNC, fcpl, fapl)) <0)
86 TEST_ERROR;
87
88 /* Close file property lists */
89 if(H5Pclose(fapl) < 0) TEST_ERROR;
90 if(H5Pclose(fcpl) < 0) TEST_ERROR;
91
92 /*
93 * Add a chunked dataset with layout version 3 (default)
94 */
95 buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
96 if (buf == NULL) TEST_ERROR;
97
98 /* Fill sample data */
99 bufp = buf;
100 for (i = 0; i < DIM1; i++)
101 for (j = 0; j < DIM2; j++)
102 *bufp = 100.0F;
103
104 /* Create the dataspace */
105 if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
106
107 /* Create the dataset creation property list */
108 if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
109
110 /* Set up for chunked data */
111 if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
112
113 /* Create and write the dataset */
114 dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
115 if (dset < 0) TEST_ERROR;
116
117 ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
118 if (ret < 0) TEST_ERROR;
119
120 /* Close property list and dataset, will reuse dataspace */
121 if(H5Pclose(dcpl) < 0) TEST_ERROR;
122 if(H5Dclose(dset) < 0) TEST_ERROR;
123
124 /*
125 * Add a chunked dataset with layout version 4 (H5Pset_chunk_opts)
126 */
127
128 /* Create the dataset creation property list */
129 if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
130
131 /* Set up for chunked data */
132 if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
133
134 /* Disable partial chunk filters, triggers layout version 4 */
135 if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
136 TEST_ERROR;
137
138 /* Create and write the dataset */
139 dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
140 if (dset < 0) TEST_ERROR;
141 ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
142 if (ret < 0) TEST_ERROR;
143
144 /* Release allocated buffer */
145 HDfree(buf);
146 bufp = buf = NULL;
147
148 /* Close everything */
149 if(H5Pclose(dcpl) < 0) TEST_ERROR;
150 if(H5Dclose(dset) < 0) TEST_ERROR;
151 if(H5Sclose(space) < 0) TEST_ERROR;
152 if(H5Fclose(fid) < 0) TEST_ERROR;
153
154 return SUCCEED;
155
156 error:
157 H5E_BEGIN_TRY {
158 H5Dclose(dset);
159 H5Sclose(space);
160 H5Pclose(dcpl);
161 H5Pclose(fcpl);
162 H5Pclose(fapl);
163 H5Fclose(fid);
164 HDfree(buf);
165 } H5E_END_TRY;
166 return FAIL;
167 } /* gen_earliest_latest */
168
169 /***********************************************************************
170 * gen_earliest_v18() creates file "bounds_earliest_v18.h5"
171 *
172 * File contents:
173 * - Version 0 superblock (default)
174 * - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
175 *
176 * Return: SUCCEED/FAIL
177 *
178 ***********************************************************************/
gen_earliest_v18(void)179 static herr_t gen_earliest_v18(void)
180 {
181 hid_t fid = -1; /* File ID */
182 hid_t fapl = -1; /* File access property list ID */
183 hid_t fcpl = -1; /* File creation property list ID */
184 hid_t dcpl = -1; /* Dataset creation property list ID */
185 hid_t space = -1; /* Dataspace ID */
186 hid_t dset = -1; /* Dataset ID */
187 float *buf = NULL; /* Buffer for writing data */
188 float *bufp = NULL; /* Pointer to data buffer */
189 hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
190 hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
191 int i, j;
192 herr_t ret = SUCCEED; /* Generic return value */
193
194 /* Create file creation property list */
195 if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
196
197 /* Create file access property list */
198 if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
199
200 /* Set the "use the earliest/v18 version of the format" bounds
201 for creating objects in the file */
202 if(H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18) < 0)
203 TEST_ERROR;
204
205 /* Create file */
206 if((fid = H5Fcreate(FILENAME_E_18, H5F_ACC_TRUNC, fcpl, fapl)) <0)
207 TEST_ERROR;
208
209 /* Close file property lists */
210 if(H5Pclose(fapl) < 0) TEST_ERROR;
211 if(H5Pclose(fcpl) < 0) TEST_ERROR;
212
213 /*
214 * Add a chunked dataset with layout version 3 (default)
215 */
216
217 buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
218 if (buf == NULL) TEST_ERROR;
219
220 /* Fill sample data */
221 bufp = buf;
222 for (i = 0; i < DIM1; i++)
223 for (j = 0; j < DIM2; j++)
224 *bufp = 100.0F;
225
226 /* Create the dataspace */
227 if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
228
229 /* Create the dataset creation property list */
230 if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
231
232 /* Set up for chunked data */
233 if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
234
235 /* Create and write the dataset */
236 dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
237 if (dset < 0) TEST_ERROR;
238
239 ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
240 if (ret < 0) TEST_ERROR;
241
242 /* Release allocated buffer */
243 HDfree(buf);
244 bufp = buf = NULL;
245
246 /* Close everything */
247 if(H5Pclose(dcpl) < 0) TEST_ERROR;
248 if(H5Dclose(dset) < 0) TEST_ERROR;
249 if(H5Sclose(space) < 0) TEST_ERROR;
250 if(H5Fclose(fid) < 0) TEST_ERROR;
251
252 return SUCCEED;
253
254 error:
255 H5E_BEGIN_TRY {
256 H5Dclose(dset);
257 H5Sclose(space);
258 H5Pclose(dcpl);
259 H5Pclose(fcpl);
260 H5Pclose(fapl);
261 H5Fclose(fid);
262 HDfree(buf);
263 } H5E_END_TRY;
264 return FAIL;
265 } /* gen_earliest_v18 */
266
267 /***********************************************************************
268 * gen_latest_latest() creates file "bounds_latest_latest.h5"
269 *
270 * NOTE: As of March 2018, latest is 1.10.
271 *
272 * File contents:
273 * - Version 3 superblock (NOTE: this can also be triggered by passing in
274 * H5F_ACC_SWMR_WRITE, in place of H5F_ACC_TRUNC, to H5Fcreate)
275 * - A chunked dataset with layout version 4, "DS_chunked_layout_4".
276 * (triggered by H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS)
277 *
278 * Return: SUCCEED/FAIL
279 *
280 ***********************************************************************/
gen_latest_latest(void)281 static herr_t gen_latest_latest(void)
282 {
283 hid_t fid = -1; /* File ID */
284 hid_t fapl = -1; /* File access property list ID */
285 hid_t dcpl = -1; /* Dataset creation property list ID */
286 hid_t space = -1; /* Dataspace ID */
287 hid_t dset = -1; /* Dataset ID */
288 float *buf = NULL; /* Buffer for writing data */
289 float *bufp = NULL; /* Pointer to data buffer */
290 hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
291 hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
292 int i, j;
293 herr_t ret = SUCCEED; /* Generic return value */
294
295 /* Create file access property list */
296 if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
297
298 /* Set the "use the latest/latest version of the format" bounds
299 for creating objects in the file */
300 if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
301 TEST_ERROR;
302
303 /* Create the file with version 3 superblock */
304 fid = H5Fcreate(FILENAME_L_L, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
305 if (fid < 0) TEST_ERROR;
306
307 /*
308 * Add a chunked dataset with layout version 4 (H5Pset_chunk_opts)
309 */
310
311 buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
312 if (buf == NULL) TEST_ERROR;
313
314 /* Fill sample data */
315 bufp = buf;
316 for (i = 0; i < DIM1; i++)
317 for (j = 0; j < DIM2; j++)
318 *bufp = 100.0F;
319
320 /* Create the dataspace */
321 if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
322
323 /* Create the dataset creation property list */
324 if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
325
326 /* Set up for chunked data */
327 if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
328
329 /* Disable partial chunk filters, triggers layout version 4 */
330 if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
331 TEST_ERROR;
332
333 /* Create and write the dataset */
334 dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
335 if (dset < 0) TEST_ERROR;
336 ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
337 if (ret < 0) TEST_ERROR;
338
339 /* Release allocated buffer */
340 HDfree(buf);
341 bufp = buf = NULL;
342
343 /* Close everything */
344 if(H5Pclose(dcpl) < 0) TEST_ERROR;
345 if(H5Dclose(dset) < 0) TEST_ERROR;
346 if(H5Sclose(space) < 0) TEST_ERROR;
347 if(H5Fclose(fid) < 0) TEST_ERROR;
348
349 return SUCCEED;
350
351 error:
352 H5E_BEGIN_TRY {
353 H5Dclose(dset);
354 H5Sclose(space);
355 H5Pclose(dcpl);
356 H5Fclose(fid);
357 HDfree(buf);
358 } H5E_END_TRY;
359 return FAIL;
360 } /* gen_latest_latest */
361
362 /***********************************************************************
363 * gen_v18_latest() creates file "bounds_v18_latest.h5"
364 *
365 * NOTE: As of March 2018, latest is 1.10.
366 *
367 * File contents:
368 * - Version 2 superblock
369 * - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
370 *
371 * Return: SUCCEED/FAIL
372 *
373 ***********************************************************************/
gen_v18_latest(void)374 static herr_t gen_v18_latest(void)
375 {
376 hid_t fid = -1; /* File ID */
377 hid_t fapl = -1; /* File access property list ID */
378 hid_t fcpl = -1; /* File creation property list ID */
379 hid_t dcpl = -1; /* Dataset creation property list ID */
380 hid_t space = -1; /* Dataspace ID */
381 hid_t dset = -1; /* Dataset ID */
382 float *buf = NULL; /* Buffer for writing data */
383 float *bufp = NULL; /* Pointer to data buffer */
384 hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
385 hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
386 int i, j;
387 herr_t ret = SUCCEED; /* Generic return value */
388
389 /* Create file creation property list */
390 if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
391
392 /* Create file access property list */
393 if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
394
395 /* Set the "use the v18/latest version of the format" bounds
396 for creating objects in the file, also trigger version 2 superblock */
397 if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
398 TEST_ERROR;
399
400 /* Create file */
401 if((fid = H5Fcreate(FILENAME_18_L, H5F_ACC_TRUNC, fcpl, fapl)) <0)
402 TEST_ERROR;
403
404 /* Close file property lists */
405 if(H5Pclose(fapl) < 0) TEST_ERROR;
406 if(H5Pclose(fcpl) < 0) TEST_ERROR;
407
408 /*
409 * Add a chunked dataset with layout version 3 (default)
410 */
411
412 buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
413 if (buf == NULL) TEST_ERROR;
414
415 /* Fill sample data */
416 bufp = buf;
417 for (i = 0; i < DIM1; i++)
418 for (j = 0; j < DIM2; j++)
419 *bufp = 100.0F;
420
421 /* Create the dataspace */
422 if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
423
424 /* Create the dataset creation property list */
425 if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
426
427 /* Set up for chunked data */
428 if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
429
430 /* Create and write the dataset */
431 dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
432 if (dset < 0) TEST_ERROR;
433 ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
434 if (ret < 0) TEST_ERROR;
435
436 /* Release allocated buffer */
437 HDfree(buf);
438 bufp = buf = NULL;
439
440 /* Close property list and dataset, will reuse dataspace */
441 if(H5Pclose(dcpl) < 0) TEST_ERROR;
442 if(H5Dclose(dset) < 0) TEST_ERROR;
443 if(H5Sclose(space) < 0) TEST_ERROR;
444 if(H5Fclose(fid) < 0) TEST_ERROR;
445
446 return SUCCEED;
447
448 error:
449 H5E_BEGIN_TRY {
450 H5Dclose(dset);
451 H5Sclose(space);
452 H5Pclose(dcpl);
453 H5Pclose(fcpl);
454 H5Pclose(fapl);
455 H5Fclose(fid);
456 HDfree(buf);
457 } H5E_END_TRY;
458 return FAIL;
459 } /* gen_v18_latest */
460
461 /***********************************************************************
462 * gen_v18_v18() creates file "bounds_v18_v18.h5"
463 *
464 * File contents:
465 * - Version 2 superblock (H5Pset_libver_bounds(v18, v18)
466 * - A chunked dataset with layout version 3, "DS_chunked_layout_3". (default)
467 * - A chunked dataset with layout version 4, "DS_chunked_layout_4". (H5Pset_chunk_opts)
468 *
469 * Return: SUCCEED/FAIL
470 *
471 ***********************************************************************/
gen_v18_v18(void)472 static herr_t gen_v18_v18(void)
473 {
474 hid_t fid = -1; /* File ID */
475 hid_t fapl = -1; /* File access property list ID */
476 hid_t fcpl = -1; /* File creation property list ID */
477 hid_t dcpl = -1; /* Dataset creation property list ID */
478 hid_t space = -1; /* Dataspace ID */
479 hid_t dset = -1; /* Dataset ID */
480 float *buf = NULL; /* Buffer for writing data */
481 float *bufp = NULL; /* Pointer to data buffer */
482 hsize_t dims[RANK] = {DIM1, DIM2}; /* Dimensions */
483 hsize_t chunk_dims[RANK] = {CHK_DIM1, CHK_DIM2}; /* Dimensions of chunk */
484 int i, j;
485 herr_t ret = SUCCEED; /* Generic return value */
486
487 /* Create file creation property list */
488 if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR;
489
490 /* Create file access property list */
491 if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
492
493 /* Set the "use the v18 version of the format" bounds
494 for creating objects in the file */
495 if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_V18) < 0)
496 TEST_ERROR;
497
498 /* Create file */
499 if((fid = H5Fcreate(FILENAME_18_18, H5F_ACC_TRUNC, fcpl, fapl)) <0)
500 TEST_ERROR;
501
502 /* Close file property lists */
503 if(H5Pclose(fapl) < 0) TEST_ERROR;
504 if(H5Pclose(fcpl) < 0) TEST_ERROR;
505
506 /*
507 * Add a chunked dataset with layout version 3 (default)
508 */
509
510 buf = (float *)HDmalloc((size_t)DIM1 * (size_t)DIM2 * sizeof(float));
511 if (buf == NULL) TEST_ERROR;
512
513 /* Fill sample data */
514 bufp = buf;
515 for (i = 0; i < DIM1; i++)
516 for (j = 0; j < DIM2; j++)
517 *bufp = 100.0F;
518
519 /* Create the dataspace */
520 if((space = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR;
521
522 /* Create the dataset creation property list */
523 if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
524
525 /* Set up for chunked data */
526 if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
527
528 /* Create and write the dataset */
529 dset = H5Dcreate2(fid, "DS_chunked_layout_3", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
530 if (dset < 0) TEST_ERROR;
531 ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
532 if (ret < 0) TEST_ERROR;
533
534 /* Close property list and dataset, will reuse dataspace */
535 if(H5Pclose(dcpl) < 0) TEST_ERROR;
536 if(H5Dclose(dset) < 0) TEST_ERROR;
537
538 /* Close the file, then reopen it with the latest version */
539 if(H5Fclose(fid) < 0) TEST_ERROR;
540
541 /* Create file access property list */
542 if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR;
543
544 /* Set the "use the v18/latest version of the format" bounds
545 for creating a layout version 4 object in the file */
546 if(H5Pset_libver_bounds(fapl, H5F_LIBVER_V18, H5F_LIBVER_LATEST) < 0)
547 TEST_ERROR;
548
549 if((fid = H5Fopen(FILENAME_18_18, H5F_ACC_RDWR, fapl)) < 0)
550 TEST_ERROR;
551
552 /*
553 * Add a chunked dataset with layout version 4 (H5Pset_chunk_opts)
554 */
555
556 /* Create the dataset creation property list */
557 if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
558
559 /* Set up for chunked data */
560 if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) TEST_ERROR;
561
562 /* Disable partial chunk filters */
563 if(H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0)
564 TEST_ERROR;
565
566 /* Create and write the dataset */
567 dset = H5Dcreate2(fid, "DS_chunked_layout_4", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
568 if (dset < 0) TEST_ERROR;
569 ret = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
570 if (ret < 0) TEST_ERROR;
571
572 /* Release allocated buffer */
573 HDfree(buf);
574 bufp = buf = NULL;
575
576 /* Close everything */
577 if(H5Pclose(dcpl) < 0) TEST_ERROR;
578 if(H5Pclose(fapl) < 0) TEST_ERROR;
579 if(H5Dclose(dset) < 0) TEST_ERROR;
580 if(H5Sclose(space) < 0) TEST_ERROR;
581 if(H5Fclose(fid) < 0) TEST_ERROR;
582 return SUCCEED;
583
584 error:
585 H5E_BEGIN_TRY {
586 H5Dclose(dset);
587 H5Sclose(space);
588 H5Pclose(dcpl);
589 H5Pclose(fcpl);
590 H5Pclose(fapl);
591 H5Fclose(fid);
592 HDfree(buf);
593 } H5E_END_TRY;
594 return FAIL;
595 } /* gen_v18_v18 */
596
main(void)597 int main(void)
598 {
599 /* Generate file bounds_earliest_latest.h5 */
600 if (gen_earliest_latest() < 0) TEST_ERROR;
601
602 /* Generate file bounds_earliest_v18.h5 */
603 if (gen_earliest_v18() < 0) TEST_ERROR;
604
605 /* Generate file bounds_latest_latest.h5 */
606 if (gen_latest_latest() < 0) TEST_ERROR;
607
608 /* Generate file bounds_v18_latest.h5 */
609 if (gen_v18_latest() < 0) TEST_ERROR;
610
611 /* Generate file bounds_v18_v18.h5 */
612 if (gen_v18_v18() < 0) TEST_ERROR;
613
614 return EXIT_SUCCESS;
615
616 error:
617 return EXIT_FAILURE;
618 }
619
620