diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-10-05 21:14:40 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-10-05 21:14:40 (GMT) |
commit | 3bc05bfd2470fb0ae2301d511e48b708493a8e6b (patch) | |
tree | 56b581e31731f31af11ec902242321e8f3dd7c23 /test/ohdr.c | |
parent | b8201120fc7547b912222f22a41193921a0c003a (diff) | |
download | hdf5-3bc05bfd2470fb0ae2301d511e48b708493a8e6b.zip hdf5-3bc05bfd2470fb0ae2301d511e48b708493a8e6b.tar.gz hdf5-3bc05bfd2470fb0ae2301d511e48b708493a8e6b.tar.bz2 |
[svn-r7539] Purpose:
Bug fixes and code cleanup
Description:
Re-worked ohdr test to use modification time messages instead of symbol
table messages, now that the library correctly tries deleting the
local heap and B-trees for the symbol tables (which didn't exist and
caused the test to fail).
Added tests for using named datatypes in attributes to verify that the
reference counts are being tracked correctly, etc.
Platforms tested:
FreeBSD 4.9 (sleipnir)
h5committest
Diffstat (limited to 'test/ohdr.c')
-rw-r--r-- | test/ohdr.c | 94 |
1 files changed, 38 insertions, 56 deletions
diff --git a/test/ohdr.c b/test/ohdr.c index 1e60e2d..c706b4b 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -64,7 +64,7 @@ main(void) H5F_t *f=NULL; char filename[1024]; H5G_entry_t oh_ent; - H5O_stab_t stab, ro; + time_t time_new, ro; int i; /* Reset library */ @@ -100,9 +100,8 @@ main(void) /* create a new message */ TESTING("message creation"); - stab.btree_addr = 11111111; - stab.heap_addr = 22222222; - if (H5O_modify(&oh_ent, H5O_STAB_ID, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + time_new = 11111111; + if (H5O_modify(&oh_ent, H5O_MTIME_ID, H5O_NEW_MESG, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT H5Eprint(stdout); @@ -120,7 +119,7 @@ main(void) #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { + if (NULL==H5O_read(&oh_ent, H5O_MTIME_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT H5Eprint(stdout); @@ -129,13 +128,10 @@ main(void) #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } - if (H5F_addr_ne(ro.btree_addr, stab.btree_addr) || - H5F_addr_ne(ro.heap_addr, stab.heap_addr)) { + if (ro!=time_new) { H5_FAILED(); - HDfprintf(stdout, " got: {%a, %a}\n", - ro.btree_addr, ro.heap_addr); - HDfprintf(stdout, " ans: {%a, %a}\n", - stab.btree_addr, stab.heap_addr); + HDfprintf(stdout, " got: {%ld}\n", (long)ro); + HDfprintf(stdout, " ans: {%ld}\n", (long)time_new); goto error; } PASSED(); @@ -144,9 +140,8 @@ main(void) * Test modification of an existing message. */ TESTING("message modification"); - stab.btree_addr = 33333333; - stab.heap_addr = 44444444; - if (H5O_modify(&oh_ent, H5O_STAB_ID, 0, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + time_new = 33333333; + if (H5O_modify(&oh_ent, H5O_MTIME_ID, 0, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT H5Eprint(stdout); @@ -164,7 +159,7 @@ main(void) #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { + if (NULL==H5O_read(&oh_ent, H5O_MTIME_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT H5Eprint(stdout); @@ -173,13 +168,10 @@ main(void) #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } - if (H5F_addr_ne(ro.btree_addr, stab.btree_addr) || - H5F_addr_ne(ro.heap_addr, stab.heap_addr)) { + if (ro!=time_new) { H5_FAILED(); - HDfprintf(stdout, " got: {%a, %a}\n", - ro.btree_addr, ro.heap_addr); - HDfprintf(stdout, " ans: {%a, %a}\n", - stab.btree_addr, stab.heap_addr); + HDfprintf(stdout, " got: {%ld}\n", (long)ro); + HDfprintf(stdout, " ans: {%ld}\n", (long)time_new); goto error; } PASSED(); @@ -189,9 +181,8 @@ main(void) * Test creation of a second message of the same type. */ TESTING("duplicate message creation"); - stab.btree_addr = 55555555; - stab.heap_addr = 66666666; - if (H5O_modify(&oh_ent, H5O_STAB_ID, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + time_new = 55555555; + if (H5O_modify(&oh_ent, H5O_MTIME_ID, H5O_NEW_MESG, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT H5Eprint(stdout); @@ -209,7 +200,7 @@ main(void) #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB_ID, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { + if (NULL==H5O_read(&oh_ent, H5O_MTIME_ID, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT H5Eprint(stdout); @@ -218,13 +209,10 @@ main(void) #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } - if (H5F_addr_ne(ro.btree_addr, stab.btree_addr) || - H5F_addr_ne(ro.heap_addr, stab.heap_addr)) { + if (ro!=time_new) { H5_FAILED(); - HDfprintf(stdout, " got: {%a, %a}\n", - ro.btree_addr, ro.heap_addr); - HDfprintf(stdout, " ans: {%a, %a}\n", - stab.btree_addr, stab.heap_addr); + HDfprintf(stdout, " got: {%ld}\n", (long)ro); + HDfprintf(stdout, " ans: {%ld}\n", (long)time_new); goto error; } PASSED(); @@ -233,9 +221,8 @@ main(void) * Test modification of the second message with a symbol table. */ TESTING("duplicate message modification"); - stab.btree_addr = 77777777; - stab.heap_addr = 88888888; - if (H5O_modify(&oh_ent, H5O_STAB_ID, 1, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + time_new = 77777777; + if (H5O_modify(&oh_ent, H5O_MTIME_ID, 1, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT H5Eprint(stdout); @@ -253,7 +240,7 @@ main(void) #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } - if (NULL==H5O_read(&oh_ent, H5O_STAB_ID, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { + if (NULL==H5O_read(&oh_ent, H5O_MTIME_ID, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT H5Eprint(stdout); @@ -262,13 +249,10 @@ main(void) #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } - if (H5F_addr_ne(ro.btree_addr, stab.btree_addr) || - H5F_addr_ne(ro.heap_addr, stab.heap_addr)) { + if (ro!=time_new) { H5_FAILED(); - HDfprintf(stdout, " got: {%a, %a}\n", - ro.btree_addr, ro.heap_addr); - HDfprintf(stdout, " ans: {%a, %a}\n", - stab.btree_addr, stab.heap_addr); + HDfprintf(stdout, " got: {%ld}\n", (long)ro); + HDfprintf(stdout, " ans: {%ld}\n", (long)time_new); goto error; } PASSED(); @@ -279,14 +263,13 @@ main(void) */ TESTING("object header overflow in memory"); for (i=0; i<40; i++) { - stab.btree_addr = (i+1)*1000+1; - stab.heap_addr = (i+1)*1000+2; - if (H5O_modify(&oh_ent, H5O_STAB_ID, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + time_new = (i+1)*1000+1; + if (H5O_modify(&oh_ent, H5O_MTIME_ID, H5O_NEW_MESG, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); + H5Eprint(stdout); #else - H5Eprint(H5E_DEFAULT, stdout); + H5Eprint(H5E_DEFAULT, stdout); #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } @@ -308,23 +291,22 @@ main(void) */ TESTING("object header overflow on disk"); for (i=0; i<10; i++) { - stab.btree_addr = (i + 1) * 1000 + 10; - stab.heap_addr = (i + 1) * 1000 + 20; - if (H5O_modify(&oh_ent, H5O_STAB_ID, H5O_NEW_MESG, 0, 1, &stab, H5P_DATASET_XFER_DEFAULT)<0) { + time_new = (i + 1) * 1000 + 10; + if (H5O_modify(&oh_ent, H5O_MTIME_ID, H5O_NEW_MESG, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); + H5Eprint(stdout); #else - H5Eprint(H5E_DEFAULT, stdout); + H5Eprint(H5E_DEFAULT, stdout); #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); + H5Eprint(stdout); #else - H5Eprint(H5E_DEFAULT, stdout); + H5Eprint(H5E_DEFAULT, stdout); #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } @@ -332,10 +314,10 @@ main(void) PASSED(); /* - * Delete all symbol table messages. + * Delete all time messages. */ TESTING("message deletion"); - if (H5O_remove(&oh_ent, H5O_STAB_ID, H5O_ALL, H5P_DATASET_XFER_DEFAULT)<0) { + if (H5O_remove(&oh_ent, H5O_MTIME_ID, H5O_ALL, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); #ifdef H5_WANT_H5_V1_6_COMPAT H5Eprint(stdout); @@ -344,7 +326,7 @@ main(void) #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } - if (H5O_read(&oh_ent, H5O_STAB_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { + if (H5O_read(&oh_ent, H5O_MTIME_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); puts(" H5O_read() should have failed but didn't"); #ifdef H5_WANT_H5_V1_6_COMPAT |