diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-04-29 11:39:38 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-04-29 11:39:38 (GMT) |
commit | cb0c04e1d4d3a5be3b3b07bb81ab647a3adccd43 (patch) | |
tree | f3cd78e4130f6d78a758c3c4d1d8f5864b1d4cdf /test | |
parent | 08677fc32a3f2139614ad5dec54ef1755a24d3b1 (diff) | |
download | hdf5-cb0c04e1d4d3a5be3b3b07bb81ab647a3adccd43.zip hdf5-cb0c04e1d4d3a5be3b3b07bb81ab647a3adccd43.tar.gz hdf5-cb0c04e1d4d3a5be3b3b07bb81ab647a3adccd43.tar.bz2 |
[svn-r16888] Description:
Bring r16821:16875 back from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.5.6 (amazon) in debug mode
Mac OS X/32 10.5.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'test')
-rw-r--r-- | test/cache.c | 201 | ||||
-rw-r--r-- | test/cache_common.c | 131 | ||||
-rw-r--r-- | test/cache_common.h | 25 | ||||
-rw-r--r-- | test/error_test.c | 31 | ||||
-rw-r--r-- | test/testfiles/error_test_1 | 13 |
5 files changed, 378 insertions, 23 deletions
diff --git a/test/cache.c b/test/cache.c index bacd559..a5b5f3a 100644 --- a/test/cache.c +++ b/test/cache.c @@ -126,6 +126,7 @@ static unsigned check_metadata_blizzard_absence(hbool_t fill_via_insertion); static unsigned check_flush_deps(void); static unsigned check_flush_deps_err(void); static unsigned check_flush_deps_order(void); +static unsigned check_notify_cb(void); /**************************************************************************/ @@ -33789,6 +33790,205 @@ done: /*------------------------------------------------------------------------- + * Function: check_notify_cb() + * + * Purpose: Exercise the client 'notify' callback. + * + * Return: 0 on success, non-zero on failure + * + * Programmer: Quincey Koziol + * 4/28/09 + * + *------------------------------------------------------------------------- + */ + +static unsigned +check_notify_cb(void) +{ + H5C_t * cache_ptr = NULL; /* Metadata cache for this test */ + test_entry_t *base_addr; /* Base address of entries for test */ + test_entry_t * entry_ptr; /* Cache entry to examine/manipulate */ + int entry_type = NOTIFY_ENTRY_TYPE; /* Use entry w/notify callback (size of entries doesn't matter) */ + size_t entry_size = NOTIFY_ENTRY_SIZE; /* 1 byte */ + unsigned u; /* Local index variable */ + struct expected_entry_status expected[5] = + { + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: loaded: clrd: flshd: dest: par type: par idx: dep ref.count: dep height: order: */ + { entry_type, 0, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0}, 0, -1 }, + { entry_type, 1, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0}, 0, -1 }, + { entry_type, 2, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0}, 0, -1 }, + { entry_type, 3, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0}, 0, -1 }, + { entry_type, 4, entry_size, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, -1, -1, {0,0,0,0}, 0, -1 } + }; + + TESTING("'notify' callback"); + + pass = TRUE; + + /* Allocate a cache, insert & remove entries, triggering 'notify' callback. + * Verify that all performs as expected. + */ + + reset_entries(); + cache_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + base_addr = entries[entry_type]; + + if ( !pass ) CACHE_ERROR("setup_cache failed") + + /* Insert entries to work with into the cache */ + for(u = 0; u < 5; u++) { + insert_entry(cache_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); + if ( !pass ) CACHE_ERROR("insert_entry failed") + + /* Change expected values, and verify the status of the entries + * after each insertion + */ + expected[u].in_cache = TRUE; + expected[u].is_dirty = TRUE; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)u, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + /* Check the entry's 'after insert' count */ + entry_ptr = &(base_addr[u]); + if(1 != entry_ptr->notify_after_insert_count) + CACHE_ERROR("invalid notify after insert count") + if(0 != entry_ptr->notify_before_evict_count) + CACHE_ERROR("invalid notify before evict count") + } /* end for */ + + /* Remove entries from the cache */ + for(u = 0; u < 5; u++) { + expunge_entry(cache_ptr, entry_type, (int32_t)u); + if ( !pass ) CACHE_ERROR("expunge_entry failed") + + /* Change expected values, and verify the status of the entries + * after each insertion + */ + expected[u].in_cache = FALSE; + expected[u].is_dirty = FALSE; + expected[u].cleared = TRUE; + expected[u].destroyed = TRUE; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)u, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + /* Check the entry's 'before evict' count */ + entry_ptr = &(base_addr[u]); + if(1 != entry_ptr->notify_after_insert_count) + CACHE_ERROR("invalid notify after insert count") + if(1 != entry_ptr->notify_before_evict_count) + CACHE_ERROR("invalid notify before evict count") + } /* end for */ + + /* Protect entries to bring them into the cache */ + for(u = 0; u < 5; u++) { + protect_entry(cache_ptr, entry_type, (int32_t)u); + if ( !pass ) CACHE_ERROR("protect_entry failed") + + /* Change expected values, and verify the status of the entries + * after each insertion + */ + expected[u].in_cache = TRUE; + expected[u].is_dirty = FALSE; + expected[u].is_protected = TRUE; + expected[u].loaded = TRUE; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)u, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + /* Check the entry's 'after insert' count */ + entry_ptr = &(base_addr[u]); + if(2 != entry_ptr->notify_after_insert_count) + CACHE_ERROR("invalid notify after insert count") + if(1 != entry_ptr->notify_before_evict_count) + CACHE_ERROR("invalid notify before evict count") + } /* end for */ + + /* Unprotect entries, evicting them from the cache */ + for(u = 0; u < 5; u++) { + unprotect_entry(cache_ptr, entry_type, (int32_t)u, TRUE, H5C__NO_FLAGS_SET); + if ( !pass ) CACHE_ERROR("unprotect_entry failed") + + /* Change expected values, and verify the status of the entries + * after each insertion + */ + expected[u].in_cache = TRUE; + expected[u].is_dirty = TRUE; + expected[u].is_protected = FALSE; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)u, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + /* Check the entry's 'after insert' count */ + entry_ptr = &(base_addr[u]); + if(2 != entry_ptr->notify_after_insert_count) + CACHE_ERROR("invalid notify after insert count") + if(1 != entry_ptr->notify_before_evict_count) + CACHE_ERROR("invalid notify before evict count") + } /* end for */ + + /* Remove entries from the cache */ + for(u = 0; u < 5; u++) { + expunge_entry(cache_ptr, entry_type, (int32_t)u); + if ( !pass ) CACHE_ERROR("expunge_entry failed") + + /* Change expected values, and verify the status of the entries + * after each insertion + */ + expected[u].in_cache = FALSE; + expected[u].is_dirty = FALSE; + expected[u].cleared = TRUE; + expected[u].destroyed = TRUE; + + /* Verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + (int)u, /* int tag */ + (int)5, /* int num_entries */ + expected); /* struct expected_entry_staus[] */ + if ( !pass ) CACHE_ERROR("verify_entry_status failed") + + /* Check the entry's 'before evict' count */ + entry_ptr = &(base_addr[u]); + if(2 != entry_ptr->notify_after_insert_count) + CACHE_ERROR("invalid notify after insert count") + if(2 != entry_ptr->notify_before_evict_count) + CACHE_ERROR("invalid notify before evict count") + } /* end for */ + +done: + if(cache_ptr) + takedown_cache(cache_ptr, FALSE, FALSE); + + if ( pass ) + PASSED() + else { + H5_FAILED(); + HDfprintf(stdout, "%s.\n", failure_mssg); + } /* end else */ + + return (unsigned)!pass; +} /* check_notify_cb() */ + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Run tests on the cache code contained in H5C.c @@ -33867,6 +34067,7 @@ main(void) nerrs += check_flush_deps(); nerrs += check_flush_deps_err(); nerrs += check_flush_deps_order(); + nerrs += check_notify_cb(); return(nerrs > 0); } diff --git a/test/cache_common.c b/test/cache_common.c index 6a9c7e5..4768f53 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -43,6 +43,7 @@ test_entry_t large_entries[NUM_LARGE_ENTRIES], orig_large_entries[NUM_LARGE_ENTR test_entry_t huge_entries[NUM_HUGE_ENTRIES], orig_huge_entries[NUM_HUGE_ENTRIES]; test_entry_t monster_entries[NUM_MONSTER_ENTRIES], orig_monster_entries[NUM_MONSTER_ENTRIES]; test_entry_t variable_entries[NUM_VARIABLE_ENTRIES], orig_variable_entries[NUM_VARIABLE_ENTRIES]; +test_entry_t notify_entries[NUM_NOTIFY_ENTRIES], orig_notify_entries[NUM_NOTIFY_ENTRIES]; hbool_t orig_entry_arrays_init = FALSE; @@ -57,7 +58,8 @@ test_entry_t * entries[NUMBER_OF_ENTRY_TYPES] = large_entries, huge_entries, monster_entries, - variable_entries + variable_entries, + notify_entries }; test_entry_t * orig_entries[NUMBER_OF_ENTRY_TYPES] = @@ -71,7 +73,8 @@ test_entry_t * orig_entries[NUMBER_OF_ENTRY_TYPES] = orig_large_entries, orig_huge_entries, orig_monster_entries, - orig_variable_entries + orig_variable_entries, + orig_notify_entries }; const int32_t max_indices[NUMBER_OF_ENTRY_TYPES] = @@ -85,7 +88,8 @@ const int32_t max_indices[NUMBER_OF_ENTRY_TYPES] = NUM_LARGE_ENTRIES - 1, NUM_HUGE_ENTRIES - 1, NUM_MONSTER_ENTRIES - 1, - NUM_VARIABLE_ENTRIES - 1 + NUM_VARIABLE_ENTRIES - 1, + NUM_NOTIFY_ENTRIES - 1 }; const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES] = @@ -99,7 +103,8 @@ const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES] = LARGE_ENTRY_SIZE, HUGE_ENTRY_SIZE, MONSTER_ENTRY_SIZE, - VARIABLE_ENTRY_SIZE + VARIABLE_ENTRY_SIZE, + NOTIFY_ENTRY_SIZE }; const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES] = @@ -113,7 +118,8 @@ const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES] = LARGE_BASE_ADDR, HUGE_BASE_ADDR, MONSTER_BASE_ADDR, - VARIABLE_BASE_ADDR + VARIABLE_BASE_ADDR, + NOTIFY_BASE_ADDR }; const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES] = @@ -127,7 +133,8 @@ const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES] = LARGE_ALT_BASE_ADDR, HUGE_ALT_BASE_ADDR, MONSTER_ALT_BASE_ADDR, - VARIABLE_ALT_BASE_ADDR + VARIABLE_ALT_BASE_ADDR, + NOTIFY_ALT_BASE_ADDR }; const char * entry_type_names[NUMBER_OF_ENTRY_TYPES] = @@ -141,7 +148,8 @@ const char * entry_type_names[NUMBER_OF_ENTRY_TYPES] = "large entries -- 4 KB", "huge entries -- 16 KB", "monster entries -- 64 KB", - "variable entries -- 1B - 10KB" + "variable entries -- 1B - 10KB", + "notify entries -- 1B" }; @@ -238,6 +246,15 @@ const H5C_class_t types[NUMBER_OF_ENTRY_TYPES] = (H5C_clear_func_t)variable_clear, (H5C_notify_func_t)NULL, (H5C_size_func_t)variable_size + }, + { + NOTIFY_ENTRY_TYPE, + (H5C_load_func_t)notify_load, + (H5C_flush_func_t)notify_flush, + (H5C_dest_func_t)notify_dest, + (H5C_clear_func_t)notify_clear, + (H5C_notify_func_t)notify_notify, + (H5C_size_func_t)notify_size } }; @@ -248,6 +265,7 @@ static herr_t flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, static void * load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, void *udata2); static herr_t size(H5F_t * f, void * thing, size_t * size_ptr); +static herr_t notify(H5C_notify_action_t action, void *thing); @@ -542,6 +560,13 @@ variable_clear(H5F_t * f, void * thing, hbool_t dest) return(clear(f, thing, dest)); } +herr_t +notify_clear(H5F_t * f, void * thing, hbool_t dest) +{ + HDassert ( ((test_entry_t *)thing)->type == NOTIFY_ENTRY_TYPE ); + return(clear(f, thing, dest)); +} + /*------------------------------------------------------------------------- @@ -710,6 +735,13 @@ variable_dest(H5F_t * f, void * thing) return(destroy(f, thing)); } +herr_t +notify_dest(H5F_t * f, void * thing) +{ + HDassert ( ((test_entry_t *)thing)->type == NOTIFY_ENTRY_TYPE ); + return(destroy(f, thing)); +} + /*------------------------------------------------------------------------- * Function: flush & friends @@ -888,6 +920,14 @@ variable_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, return(flush(f, dxpl_id, dest, addr, thing, flags_ptr)); } +herr_t +notify_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, + void *thing, unsigned * flags_ptr) +{ + HDassert ( ((test_entry_t *)thing)->type == NOTIFY_ENTRY_TYPE ); + return(flush(f, dxpl_id, dest, addr, thing, flags_ptr)); +} + /*------------------------------------------------------------------------- @@ -1029,6 +1069,13 @@ variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, return(load(f, dxpl_id, addr, udata1, udata2)); } +void * +notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, + const void *udata1, void *udata2) +{ + return(load(f, dxpl_id, addr, udata1, udata2)); +} + /*------------------------------------------------------------------------- * Function: size & friends @@ -1148,6 +1195,73 @@ variable_size(H5F_t * f, void * thing, size_t * size_ptr) return(size(f, thing, size_ptr)); } +herr_t +notify_size(H5F_t * f, void * thing, size_t * size_ptr) +{ + HDassert ( ((test_entry_t *)thing)->type == NOTIFY_ENTRY_TYPE ); + return(size(f, thing, size_ptr)); +} + + +/*------------------------------------------------------------------------- + * Function: notify & friends + * + * Purpose: Record notifications of cache events for the entry. + * The helper functions verify that the correct version of notify + * is being called, and then call notify proper. + * + * Return: SUCCEED + * + * Programmer: Quincey Koziol + * 4/28/09 + * + *------------------------------------------------------------------------- + */ + +static herr_t +notify(H5C_notify_action_t action, void *thing) +{ + test_entry_t * entry_ptr; + test_entry_t * base_addr; + + HDassert( thing ); + + entry_ptr = (test_entry_t *)thing; + base_addr = entries[entry_ptr->type]; + + HDassert( entry_ptr->index >= 0 ); + HDassert( entry_ptr->index <= max_indices[entry_ptr->type] ); + HDassert( entry_ptr == &(base_addr[entry_ptr->index]) ); + HDassert( entry_ptr == entry_ptr->self ); + HDassert( entry_ptr->header.addr == entry_ptr->addr ); + HDassert( ( entry_ptr->type == VARIABLE_ENTRY_TYPE ) || \ + ( entry_ptr->size == entry_sizes[entry_ptr->type] ) ); + + /* Increment count for appropriate action */ + switch(action) { + case H5C_NOTIFY_ACTION_AFTER_INSERT: /* Entry has been added to the cache */ + entry_ptr->notify_after_insert_count++; + break; + + case H5C_NOTIFY_ACTION_BEFORE_EVICT: /* Entry is about to be evicted from cache */ + entry_ptr->notify_before_evict_count++; + break; + + default: + HDassert(0 && "Unknown notify action!?!"); + } /* end switch */ + + return(SUCCEED); +} /* notify() */ + +herr_t +notify_notify(H5C_notify_action_t action, void *thing) +{ + HDassert ( ((test_entry_t *)thing)->type == NOTIFY_ENTRY_TYPE ); + return(notify(action, thing)); +} + + /**************************************************************************/ @@ -1678,6 +1792,9 @@ reset_entries(void) base_addr[j].flush_order = 0; + base_addr[j].notify_after_insert_count = 0; + base_addr[j].notify_before_evict_count = 0; + addr += (haddr_t)entry_size; alt_addr += (haddr_t)entry_size; } /* end for */ diff --git a/test/cache_common.h b/test/cache_common.h index 37e9e0c..d150f2a 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -51,8 +51,9 @@ #define HUGE_ENTRY_TYPE 7 #define MONSTER_ENTRY_TYPE 8 #define VARIABLE_ENTRY_TYPE 9 +#define NOTIFY_ENTRY_TYPE 10 -#define NUMBER_OF_ENTRY_TYPES 10 +#define NUMBER_OF_ENTRY_TYPES 11 #define PICO_ENTRY_SIZE (size_t)1 #define NANO_ENTRY_SIZE (size_t)4 @@ -64,6 +65,7 @@ #define HUGE_ENTRY_SIZE (size_t)(16 * 1024) #define MONSTER_ENTRY_SIZE (size_t)(64 * 1024) #define VARIABLE_ENTRY_SIZE (size_t)(10 * 1024) +#define NOTIFY_ENTRY_SIZE (size_t)1 #define NUM_PICO_ENTRIES (10 * 1024) #define NUM_NANO_ENTRIES (10 * 1024) @@ -75,6 +77,7 @@ #define NUM_HUGE_ENTRIES (10 * 1024) #define NUM_MONSTER_ENTRIES (10 * 1024) #define NUM_VARIABLE_ENTRIES (10 * 1024) +#define NUM_NOTIFY_ENTRIES (10 * 1024) #define MAX_ENTRIES (10 * 1024) @@ -97,9 +100,11 @@ (HUGE_ENTRY_SIZE * NUM_HUGE_ENTRIES)) #define VARIABLE_BASE_ADDR (haddr_t)(MONSTER_BASE_ADDR + \ (MONSTER_ENTRY_SIZE * NUM_MONSTER_ENTRIES)) +#define NOTIFY_BASE_ADDR (haddr_t)(VARIABLE_BASE_ADDR + \ + (VARIABLE_ENTRY_SIZE * NUM_VARIABLE_ENTRIES)) -#define PICO_ALT_BASE_ADDR (haddr_t)(VARIABLE_BASE_ADDR + \ - (VARIABLE_ENTRY_SIZE * NUM_VARIABLE_ENTRIES)) +#define PICO_ALT_BASE_ADDR (haddr_t)(NOTIFY_BASE_ADDR + \ + (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES)) #define NANO_ALT_BASE_ADDR (haddr_t)(PICO_ALT_BASE_ADDR + \ (PICO_ENTRY_SIZE * NUM_PICO_ENTRIES)) #define MICRO_ALT_BASE_ADDR (haddr_t)(NANO_ALT_BASE_ADDR + \ @@ -118,6 +123,8 @@ (HUGE_ENTRY_SIZE * NUM_HUGE_ENTRIES)) #define VARIABLE_ALT_BASE_ADDR (haddr_t)(MONSTER_ALT_BASE_ADDR + \ (MONSTER_ENTRY_SIZE * NUM_MONSTER_ENTRIES)) +#define NOTIFY_ALT_BASE_ADDR (haddr_t)(VARIABLE_ALT_BASE_ADDR + \ + (VARIABLE_ENTRY_SIZE * NUM_VARIABLE_ENTRIES)) #define MAX_PINS 8 /* Maximum number of entries that can be * directly pinned by a single entry. @@ -309,6 +316,9 @@ typedef struct test_entry_t hbool_t pinned_from_client; /* entry was pinned by client call */ hbool_t pinned_from_cache; /* entry was pinned by cache internally */ unsigned flush_order; /* Order that entry was flushed in */ + + unsigned notify_after_insert_count; /* Count of times that entry was inserted in cache */ + unsigned notify_before_evict_count; /* Count of times that entry was removed in cache */ } test_entry_t; /* The following is a cut down copy of the hash table manipulation @@ -530,6 +540,7 @@ herr_t large_clear(H5F_t * f, void * thing, hbool_t dest); herr_t huge_clear(H5F_t * f, void * thing, hbool_t dest); herr_t monster_clear(H5F_t * f, void * thing, hbool_t dest); herr_t variable_clear(H5F_t * f, void * thing, hbool_t dest); +herr_t notify_clear(H5F_t * f, void * thing, hbool_t dest); herr_t pico_dest(H5F_t * f, void * thing); @@ -542,6 +553,7 @@ herr_t large_dest(H5F_t * f, void * thing); herr_t huge_dest(H5F_t * f, void * thing); herr_t monster_dest(H5F_t * f, void * thing); herr_t variable_dest(H5F_t * f, void * thing); +herr_t notify_dest(H5F_t * f, void * thing); herr_t pico_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, @@ -564,6 +576,8 @@ herr_t monster_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing, unsigned * flags_ptr); herr_t variable_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing, unsigned * flags_ptr); +herr_t notify_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, + haddr_t addr, void *thing, unsigned * flags_ptr); void * pico_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, @@ -586,6 +600,8 @@ void * monster_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, void *udata2); void * variable_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, void *udata2); +void * notify_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, + const void *udata1, void *udata2); herr_t pico_size(H5F_t * f, void * thing, size_t * size_ptr); @@ -598,6 +614,9 @@ herr_t large_size(H5F_t * f, void * thing, size_t * size_ptr); herr_t huge_size(H5F_t * f, void * thing, size_t * size_ptr); herr_t monster_size(H5F_t * f, void * thing, size_t * size_ptr); herr_t variable_size(H5F_t * f, void * thing, size_t * size_ptr); +herr_t notify_size(H5F_t * f, void * thing, size_t * size_ptr); + +herr_t notify_notify(H5C_notify_action_t action, void *thing); /* callback table extern */ diff --git a/test/error_test.c b/test/error_test.c index a5afcfc..89a81a3 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -40,6 +40,7 @@ const char *FILENAME[] = { int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; hid_t ERR_CLS; +hid_t ERR_CLS2; hid_t ERR_STACK; hid_t ERR_MAJ_TEST; @@ -56,7 +57,9 @@ hid_t ERR_MIN_GETNUM; #define FAKE_ID 0 #define ERR_CLS_NAME "Error Test" +#define ERR_CLS2_NAME "Second Test" #define PROG_NAME "Error Program" +#define PROG2_NAME "Second Program" #define PROG_VERS "1.0" #define ERR_MAJ_TEST_MSG "Error in test" @@ -69,12 +72,6 @@ hid_t ERR_MIN_GETNUM; #define ERR_MIN_GETNUM_MSG "Error in H5Eget_num" #define MSG_SIZE 64 -#define SPACE1_DIM1 4 -#define SPACE1_RANK 1 -#define SPACE2_RANK 2 -#define SPACE2_DIM1 10 -#define SPACE2_DIM2 10 - #define LONG_DESC_SIZE 8192 static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc, @@ -106,6 +103,7 @@ test_error(hid_t file) void *old_data; TESTING("error API based on data I/O"); + printf("\n"); /* Create the data space */ dims[0] = DIM0; @@ -189,10 +187,10 @@ static herr_t init_error(void) { ssize_t cls_size = (ssize_t)HDstrlen(ERR_CLS_NAME)+1; - char *cls_name = HDmalloc(HDstrlen(ERR_CLS_NAME)+1); + char *cls_name = (char*)HDmalloc(HDstrlen(ERR_CLS_NAME)+1); ssize_t msg_size = (ssize_t)HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1; - char *msg = HDmalloc(HDstrlen(ERR_MIN_SUBROUTINE_MSG)+1); - H5E_type_t *msg_type= HDmalloc(sizeof(H5E_type_t)); + char *msg = (char*)HDmalloc(HDstrlen(ERR_MIN_SUBROUTINE_MSG)+1); + H5E_type_t *msg_type= (H5E_type_t *)HDmalloc(sizeof(H5E_type_t)); if((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS)) < 0) TEST_ERROR; @@ -231,6 +229,10 @@ init_error(void) HDfree(msg); HDfree(msg_type); + /* Register another class for later testing. */ + if((ERR_CLS2 = H5Eregister_class(ERR_CLS2_NAME, PROG2_NAME, PROG_VERS)) < 0) + TEST_ERROR; + return 0; error: @@ -334,8 +336,8 @@ test_long_desc(void) const char *test_FUNC = "test_long_desc"; /* Allocate space for the error description info */ - if(NULL == (long_desc = HDmalloc(LONG_DESC_SIZE))) TEST_ERROR; - if(NULL == (full_desc = HDmalloc(LONG_DESC_SIZE + 128))) TEST_ERROR; + if(NULL == (long_desc = (char*)HDmalloc(LONG_DESC_SIZE))) TEST_ERROR; + if(NULL == (full_desc = (char*)HDmalloc(LONG_DESC_SIZE + 128))) TEST_ERROR; /* Create the long part of the error description */ for(u = 0; u < LONG_DESC_SIZE; u++) @@ -535,6 +537,9 @@ close_error(void) if(H5Eunregister_class(ERR_CLS) < 0) TEST_ERROR; + if(H5Eunregister_class(ERR_CLS2) < 0) + TEST_ERROR; + return 0; error: @@ -581,6 +586,10 @@ main(void) /* Delete an error from the top of error stack */ H5Epop(ERR_STACK, 1); + /* Make sure we can use other class's major or minor errors. */ + H5Epush(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS2, ERR_MAJ_TEST, ERR_MIN_ERRSTACK, + "Error stack test failed"); + /* Print out the errors on stack */ dump_error(ERR_STACK); diff --git a/test/testfiles/error_test_1 b/test/testfiles/error_test_1 index 20f669d..308ca07 100644 --- a/test/testfiles/error_test_1 +++ b/test/testfiles/error_test_1 @@ -1,11 +1,16 @@ ############################# Expected output for error_test ############################# -Testing error API based on data I/O All error API tests passed. +Testing error API based on data I/O +All error API tests passed. This program tests the Error API. There're supposed to be some error messages ********* Print error stack in HDF5 default way ********* +Second Test-DIAG: Error detected in Second Program (1.0) thread (IDs): + #000: (file name) line (number) in main(): Error stack test failed + major: Error in test + minor: Error in error stack Error Test-DIAG: Error detected in Error Program (1.0) thread (IDs): - #000: (file name) line (number) in error_stack(): Get number test failed, returned 0 + #001: (file name) line (number) in error_stack(): Get number test failed, returned 0 major: Error in API minor: Error in H5Eget_num @@ -14,6 +19,10 @@ Error Test-DIAG: Error detected in Error Program (1.0) thread (IDs): class: Error Test major: Error in API minor: Error in H5Eget_num + error #001: (file name) in main(): line (number) + class: Second Test + major: Error in test + minor: Error in error stack HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dwrite(): not a dataset major: Invalid arguments to routine |