21
21
 
#define H5D_TESTING
22
22
 
#define H5FD_FRIEND       /*suppress error about including H5FDpkg      */
23
23
 
#define H5FD_TESTING
24
24
 
25
25
 
#define H5Z_FRIEND        /*suppress error about including H5Zpkg      */
26
26
 
27
27
 
#include "testhdf5.h"
28
28
 
#include "H5srcdir.h"
29
29
 
30
30
 
#include "H5Bprivate.h"
 
31
+
#include "H5CXprivate.h"        /* API Contexts                         */
31
32
 
#include "H5Iprivate.h"
32
33
 
#include "H5Pprivate.h"
33
34
 
34
35
 
#define H5F_FRIEND      /*suppress error about including H5Fpkg */
35
36
 
#define H5F_TESTING
36
37
 
#include "H5Fpkg.h"     /* File access                          */
37
38
 
38
39
 
#define H5S_FRIEND      /*suppress error about including H5Spkg */
39
40
 
#include "H5Spkg.h"     /* Dataspace                            */
40
41
 
Show more
2526
2527
 
    hid_t       fid;            /* File ID */
2527
2528
 
    hid_t       dsid;           /* Dataset ID */
2528
2529
 
    hid_t       sid;            /* Dataspace ID */
2529
2530
 
    hid_t       dcpl;           /* Dataspace creation property list ID */
2530
2531
 
    const hsize_t dims[2] = {DSET_DIM1, DSET_DIM2};         /* Dataspace dimensions */
2531
2532
 
    const hsize_t chunk_dims[2] = {2, 25};      /* Chunk dimensions */
2532
2533
 
    hsize_t     dset_size;      /* Dataset size */
2533
2534
 
    size_t      i,j;            /* Local index variables */
2534
2535
 
    herr_t      ret;            /* Generic return value */
2535
2536
 
    const char *testfile = H5_get_srcdir_filename(FILE_DEFLATE_NAME); /* Corrected test file name */
 
2537
+
    hbool_t     api_ctx_pushed = FALSE;             /* Whether API context pushed */
2536
2538
 
2537
2539
 
    TESTING("dataset access with missing filter");
2538
2540
 
2539
2541
 
    /* Unregister the deflate filter */
2540
2542
 
#ifdef H5_HAVE_FILTER_DEFLATE
2541
2543
 
        /* Verify deflate filter is registered currently */
2542
2544
 
        if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) {
2543
2545
 
            H5_FAILED();
2544
2546
 
            printf("    Line %d: Deflate filter not available\n",__LINE__);
2545
2547
 
            goto error;
2546
2548
 
        } /* end if */
2547
2549
 
 
2550
+
        /* Push API context */
 
2551
+
        if(H5CX_push() < 0) FAIL_STACK_ERROR
 
2552
+
        api_ctx_pushed = TRUE;
 
2553
+
2548
2554
 
        /* Unregister deflate filter */
2549
2555
 
        /* (Use private routine, to avoid range checking on filter ID) */
2550
2556
 
        if(H5Z__unregister(H5Z_FILTER_DEFLATE) < 0) {
2551
2557
 
            H5_FAILED();
2552
2558
 
            printf("    Line %d: Can't unregister deflate filter\n",__LINE__);
2553
2559
 
            goto error;
2554
2560
 
        } /* end if */
2555
2561
 
#endif /* H5_HAVE_FILTER_DEFLATE */
2556
2562
 
        /* Verify deflate filter is not registered currently */
2557
2563
 
        if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=FALSE) {
Show more
2733
2739
 
        } /* end if */
2734
2740
 
2735
2741
 
        /* Verify deflate filter is registered currently */
2736
2742
 
        if(H5Zfilter_avail(H5Z_FILTER_DEFLATE)!=TRUE) {
2737
2743
 
            H5_FAILED();
2738
2744
 
            printf("    Line %d: Deflate filter not available\n",__LINE__);
2739
2745
 
            goto error;
2740
2746
 
        } /* end if */
2741
2747
 
#endif /* H5_HAVE_FILTER_DEFLATE */
2742
2748
 
 
2749
+
    /* Pop API context */
 
2750
+
    if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
 
2751
+
    api_ctx_pushed = FALSE;
 
2752
+
2743
2753
 
    PASSED();
2744
2754
 
    return 0;
2745
2755
 
2746
2756
 
error:
 
2757
+
    if(api_ctx_pushed) H5CX_pop();
 
2758
+
2747
2759
 
    return -1;
2748
2760
 
}
2749
2761
 
2750
2762
 
2751
2763
 
/*-------------------------------------------------------------------------
2752
2764
 
 * Function:  test_onebyte_shuffle
2753
2765
 
 *
2754
2766
 
 * Purpose:   Tests the 8-bit array with shuffling algorithm.
2755
2767
 
 *            The shuffled array  should be the same result as
2756
2768
 
 *            that before the shuffling.