From 7e2e0f164d6d19694adef92c7b76a7772df174c0 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 3 Apr 2003 08:58:53 -0500 Subject: [svn-r6582] Purpose: Code cleanup Description: Updated copyright. Removed szip-specific testing in favor of standard testing, now that bugs in the szip filter are fixed. Updated to latest version of H5Pset_szip API Solution: Platforms tested: FreeBSD 4.8 (sleipnir) IRIX64 6.5 (modi4) w/parallel Misc. update: --- test/dsets.c | 397 +++++++---------------------------------------------------- 1 file changed, 46 insertions(+), 351 deletions(-) diff --git a/test/dsets.c b/test/dsets.c index b0317d5..32f25e4 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1,7 +1,18 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + /* - * Copyright (C) 1997 NCSA - * All rights reserved. - * * Programmer: Robb Matzke * Tuesday, December 9, 1997 * @@ -9,7 +20,6 @@ */ #include "h5test.h" -#include "H5Zprivate.h" /* Filter functions */ const char *FILENAME[] = { "dataset", @@ -20,6 +30,7 @@ const char *FILENAME[] = { #define FILE_DEFLATE_NAME "deflate.h5" +/* Dataset names for testing filters */ #define DSET_DEFAULT_NAME "default" #define DSET_CHUNKED_NAME "chunked" #define DSET_COMPACT_NAME "compact" @@ -41,10 +52,13 @@ const char *FILENAME[] = { #define DSET_MISSING_NAME "missing" #define DSET_ONEBYTE_SHUF_NAME "onebyte_shuffle" -#define USER_BLOCK 512 +#define USER_BLOCK 1024 + +/* Temporary filter IDs used for testing */ #define H5Z_BOGUS 305 #define H5Z_CORRUPT 306 +/* Flags for testing filters */ #define DISABLE_FLETCHER32 0 #define ENABLE_FLETCHER32 1 #define DATA_CORRUPTED 1 @@ -768,8 +782,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, * might as well test all we can! */ if ((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) goto error; - tconv_buf = malloc (80000); - if (H5Pset_buffer (dxpl, 80000, tconv_buf, NULL)<0) goto error; + tconv_buf = malloc (1000); + if (H5Pset_buffer (dxpl, 1000, tconv_buf, NULL)<0) goto error; if (if_fletcher32==DISABLE_FLETCHER32) { if(H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)<0) goto error; @@ -818,13 +832,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, } } - if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, points)<0){ + if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, points)<0) goto error; - } - if((*dset_size=H5Dget_storage_size(dataset))==0) { - goto error; - } + if((*dset_size=H5Dget_storage_size(dataset))==0) goto error; PASSED(); @@ -910,7 +921,6 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, if(status>=0) goto error; } else { /* Read the dataset back and check it */ - fflush(stdout); if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) goto error; @@ -1057,331 +1067,6 @@ error: return -1; } -/*------------------------------------------------------------------------- - * Function: test_filter_internal_szip - * - * Purpose: Tests dataset compression. If compression is requested when - * it hasn't been compiled into the library (such as when - * updating an existing compressed dataset) then data is sent to - * the file uncompressed but no errors are returned. - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * - * Modifications: - * Moved out of main test_compression routine - * Quincey Koziol, November 14, 2002 - * - *------------------------------------------------------------------------- - */ -static herr_t -test_filter_internal_szip(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, - int corrupted, hsize_t *dset_size) -{ - hid_t dataset; /* Dataset ID */ - hid_t dxpl; /* Dataset xfer property list ID */ - hid_t sid; /* Dataspace ID */ - const hsize_t size[2] = {100, 200}; /* Dataspace dimensions */ - const hssize_t hs_offset[2] = {7, 30}; /* Hyperslab offset */ - const hsize_t hs_size[2] = {4, 50}; /* Hyperslab size */ - void *tconv_buf = NULL; /* Temporary conversion buffer */ - hsize_t i, j, n; /* Local index variables */ - herr_t status; /* Error status */ - - /* Create the data space */ - if ((sid = H5Screate_simple(2, size, NULL))<0) goto error; - - /* - * Create a small conversion buffer to test strip mining. We - * might as well test all we can! - */ - if ((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) goto error; - tconv_buf = malloc (80000); - if (H5Pset_buffer (dxpl, 80000, tconv_buf, NULL)<0) goto error; - if (if_fletcher32==DISABLE_FLETCHER32) { - if(H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC)<0) - goto error; - if(H5Z_DISABLE_EDC != H5Pget_edc_check(dxpl)) - goto error; - } - TESTING(" filters (setup)"); - - /* Create the dataset */ - if ((dataset = H5Dcreate(fid, name, H5T_NATIVE_INT, sid, - dcpl))<0) goto error; - PASSED(); - - /*---------------------------------------------------------------------- - * STEP 1: Read uninitialized data. It should be zero. - *---------------------------------------------------------------------- - */ - TESTING(" filters (uninitialized read)"); - - if (H5Dread (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; - - for (i=0; i=0) goto error; - - /* Callback decides to continue inspite data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) goto error; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; - - /* Callback decides to fail when data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_fail, NULL)<0) goto error; - H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); - } H5E_END_TRY; - if(status>=0) goto error; - } else { - if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; - - /* Check that the values read are the same as the values written */ - for (i=0; i=0) goto error; - - /* Callback decides to continue inspite data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) goto error; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; - - /* Callback decides to fail when data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_fail, NULL)<0) goto error; - H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); - } H5E_END_TRY; - if(status>=0) goto error; - } else { - /* Read the dataset back and check it */ - if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; - - /* Check that the values read are the same as the values written */ - for (i=0; i=0) goto error; - - /* Callback decides to continue inspite data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) goto error; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; - - /* Callback decides to fail when data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_fail, NULL)<0) goto error; - H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); - } H5E_END_TRY; - if(status>=0) goto error; - } else { - if (H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; - - /* Check that the values read are the same as the values written */ - for (i=0; i=0) goto error; - - /* Callback decides to continue inspite data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL)<0) goto error; - if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check)<0) - goto error; - - /* Callback decides to fail when data is corrupted. */ - if(H5Pset_filter_callback(dxpl, filter_cb_fail, NULL)<0) goto error; - H5E_BEGIN_TRY { - status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check); - } H5E_END_TRY; - if(status>=0) goto error; - } else { - if (H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check)<0) - goto error; - - /* Check that the values read are the same as the values written */ - for (i=0; i