summaryrefslogtreecommitdiffstats
path: root/test/dtypes.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/dtypes.c')
-rw-r--r--test/dtypes.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index 545a098..51f8f6d 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -3707,10 +3707,30 @@ test_named (hid_t fapl)
if(H5Tclose(t3) < 0) goto error;
if(H5Dclose(dset) < 0) goto error;
- /* Clean up */
+ /* Close */
if(H5Tclose(type) < 0) goto error;
if(H5Sclose(space) < 0) goto error;
if(H5Fclose(file) < 0) goto error;
+
+ /* Reopen file with read only access */
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ goto error;
+
+ /* Verify that H5Tcommit2 returns an error */
+ if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
+ H5E_BEGIN_TRY {
+ status = H5Tcommit2(file, "test_named_3 (should not exist)", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs (" Types should not be committable to a read-only file!");
+ goto error;
+ }
+
+ /* Close */
+ if(H5Tclose(type) < 0) goto error;
+ if(H5Fclose(file) < 0) goto error;
+
PASSED();
return 0;
@@ -6242,10 +6262,29 @@ test_deprec(hid_t fapl)
if(!status)
FAIL_PUTS_ERROR(" Opened named types should be named types!")
- /* Clean up */
+ /* Close */
if(H5Tclose(type) < 0) FAIL_STACK_ERROR
if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+ /* Reopen file with read only access */
+ if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ goto error;
+
+ /* Verify that H5Tcommit2 returns an error */
+ if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error;
+ H5E_BEGIN_TRY {
+ status = H5Tcommit1(file, "test_named_3 (should not exist)", type);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs (" Types should not be committable to a read-only file!");
+ goto error;
+ }
+
+ /* Close */
+ if(H5Tclose(type) < 0) goto error;
+ if(H5Fclose(file) < 0) goto error;
+
PASSED();
return 0;