804
804
 
            FAIL_STACK_ERROR
805
805
 
        PASSED();
806
806
 
807
807
 
808
808
 
        /* release resources */
809
809
 
        TESTING("object header closing");
810
810
 
        if(H5O_close(&oh_loc) < 0)
811
811
 
            FAIL_STACK_ERROR
812
812
 
        PASSED();
813
813
 
814
 
-
        /*
815
 
-
         * Test moving message to first chunk
816
 
-
         */
817
 
-
        TESTING("locking messages");
818
 
-
        HDmemset(&oh_loc, 0, sizeof(oh_loc));
819
 
-
        if(H5O_create(f, H5AC_ind_read_dxpl_id, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0)
820
 
-
            FAIL_STACK_ERROR
821
 
-
        if(1 != H5O_link(&oh_loc, 1, H5AC_ind_read_dxpl_id))
822
 
-
            FAIL_STACK_ERROR
823
 
-
824
 
-
        /* Create second object header, to guarantee that first object header uses multiple chunks */
825
 
-
        HDmemset(&oh_loc2, 0, sizeof(oh_loc2));
826
 
-
        if(H5O_create(f, H5AC_ind_read_dxpl_id, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc2/*out*/) < 0)
827
 
-
            FAIL_STACK_ERROR
828
 
-
        if(1 != H5O_link(&oh_loc2, 1, H5AC_ind_read_dxpl_id))
829
 
-
            FAIL_STACK_ERROR
830
 
-
831
 
-
        /* Fill object header with messages, creating multiple chunks */
832
 
-
        for(i = 0; i < 10; i++) {
833
 
-
            time_new = (i + 1) * 1000 + 10;
834
 
-
            if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
835
 
-
                FAIL_STACK_ERROR
836
 
-
        } /* end for */
837
 
-
838
 
-
        /* Get # of object header chunks */
839
 
-
        if(H5O_get_hdr_info(&oh_loc, H5AC_ind_read_dxpl_id, &hdr_info) < 0)
840
 
-
            FAIL_STACK_ERROR
841
 
-
        if(hdr_info.nchunks != 2)
842
 
-
            TEST_ERROR
843
 
-
844
 
-
        /* Add message to lock to object header */
845
 
-
        time_new = 11111111;
846
 
-
        if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
847
 
-
            FAIL_STACK_ERROR
848
 
-
849
 
-
        /* Verify chunk index for message */
850
 
-
        if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5AC_ind_read_dxpl_id)) < 0)
851
 
-
            FAIL_STACK_ERROR
852
 
-
        if(chunkno != 1)
853
 
-
            TEST_ERROR
854
 
-
855
 
-
        /* Lock the message into the chunk */
856
 
-
        if(H5O_msg_lock(&oh_loc, H5O_MTIME_ID, H5AC_ind_read_dxpl_id) < 0)
857
 
-
            FAIL_STACK_ERROR
858
 
-
859
 
-
        /* Attempt to lock the message twice */
860
 
-
        H5E_BEGIN_TRY {
861
 
-
            ret = H5O_msg_lock(&oh_loc, H5O_MTIME_ID, H5AC_ind_read_dxpl_id);
862
 
-
        } H5E_END_TRY;
863
 
-
        if(ret >= 0)
864
 
-
            TEST_ERROR
865
 
-
866
 
-
        /* Delete all the other messages, which would move the message into
867
 
-
         * chunk #0, if it wasn't locked
868
 
-
         */
869
 
-
        if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE, H5AC_ind_read_dxpl_id) < 0)
870
 
-
            FAIL_STACK_ERROR
871
 
-
872
 
-
        /* Verify chunk index for message */
873
 
-
        if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5AC_ind_read_dxpl_id)) < 0)
874
 
-
            FAIL_STACK_ERROR
875
 
-
        if(chunkno != 1)
876
 
-
            TEST_ERROR
877
 
-
878
 
-
        /* Unlock the message */
879
 
-
        if(H5O_msg_unlock(&oh_loc, H5O_MTIME_ID, H5AC_ind_read_dxpl_id) < 0)
880
 
-
            FAIL_STACK_ERROR
881
 
-
882
 
-
        /* Attempt to unlock the message twice */
883
 
-
        H5E_BEGIN_TRY {
884
 
-
            ret = H5O_msg_unlock(&oh_loc, H5O_MTIME_ID, H5AC_ind_read_dxpl_id);
885
 
-
        } H5E_END_TRY;
886
 
-
        if(ret >= 0)
887
 
-
            TEST_ERROR
888
 
-
889
 
-
        /* Close object headers */
890
 
-
        if(H5O_close(&oh_loc2) < 0)
891
 
-
            FAIL_STACK_ERROR
892
 
-
        if(H5O_close(&oh_loc) < 0)
893
 
-
            FAIL_STACK_ERROR
894
 
-
895
 
-
        /* Open first object header */
896
 
-
        HDmemset(&oh_loc, 0, sizeof(oh_loc));
897
 
-
        if(H5O_create(f, H5AC_ind_read_dxpl_id, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0)
898
 
-
            FAIL_STACK_ERROR
899
 
-
        if(1 != H5O_link(&oh_loc, 1, H5AC_ind_read_dxpl_id))
900
 
-
            FAIL_STACK_ERROR
901
 
-
902
 
-
        /* Create second object header, to guarantee that first object header uses multiple chunks */
903
 
-
        HDmemset(&oh_loc2, 0, sizeof(oh_loc2));
904
 
-
        if(H5O_create(f, H5AC_ind_read_dxpl_id, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc2/*out*/) < 0)
905
 
-
            FAIL_STACK_ERROR
906
 
-
        if(1 != H5O_link(&oh_loc2, 1, H5AC_ind_read_dxpl_id))
907
 
-
            FAIL_STACK_ERROR
908
 
-
909
 
-
        /* Add message to move to object header */
910
 
-
        time_new = 11111111;
911
 
-
        if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
912
 
-
            FAIL_STACK_ERROR
913
 
-
914
 
-
        /* Verify chunk index for message */
915
 
-
        if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5AC_ind_read_dxpl_id)) < 0)
916
 
-
            FAIL_STACK_ERROR
917
 
-
        if(chunkno != 0)
918
 
-
            TEST_ERROR
919
 
-
920
 
-
        /* Lock the message into the chunk */
921
 
-
        if(H5O_msg_lock(&oh_loc, H5O_MTIME_ID, H5AC_ind_read_dxpl_id) < 0)
922
 
-
            FAIL_STACK_ERROR
923
 
-
924
 
-
        /* Fill object header with messages, creating multiple chunks */
925
 
-
        /* (would normally move locked message to new chunk) */
926
 
-
        for(i = 0; i < 10; i++) {
927
 
-
            time_new = (i + 1) * 1000 + 10;
928
 
-
            if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
929
 
-
                FAIL_STACK_ERROR
930
 
-
        } /* end for */
931
 
-
932
 
-
        /* Get # of object header chunks */
933
 
-
        if(H5O_get_hdr_info(&oh_loc, H5AC_ind_read_dxpl_id, &hdr_info) < 0)
934
 
-
            FAIL_STACK_ERROR
935
 
-
        if(hdr_info.nchunks != 2)
936
 
-
            TEST_ERROR
937
 
-
938
 
-
        /* Verify chunk index for message */
939
 
-
        if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5AC_ind_read_dxpl_id)) < 0)
940
 
-
            FAIL_STACK_ERROR
941
 
-
        if(chunkno != 0)
942
 
-
            TEST_ERROR
943
 
-
944
 
-
        /* Unlock the message */
945
 
-
        if(H5O_msg_unlock(&oh_loc, H5O_MTIME_ID, H5AC_ind_read_dxpl_id) < 0)
946
 
-
            FAIL_STACK_ERROR
947
 
-
948
 
-
        /* Close object headers */
949
 
-
        if(H5O_close(&oh_loc2) < 0)
950
 
-
            FAIL_STACK_ERROR
951
 
-
        if(H5O_close(&oh_loc) < 0)
952
 
-
            FAIL_STACK_ERROR
953
 
-
954
 
-
        PASSED();
955
 
-
956
814
 
        /* Close the file we created */
957
815
 
        if(H5Fclose(file) < 0)
958
816
 
            TEST_ERROR
959
817
 
960
818
 
        /* Test reading datasets with undefined object header messages
961
819
 
         * and the various "fail/mark if unknown" object header message flags
962
820
 
         */
963
821
 
        HDputs("Accessing objects with unknown header messages: H5O_BOGUS_VALID_ID");
964
822
 
        if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0)
965
823
 
            TEST_ERROR