diff options
author | Muqun Yang <myang6@hdfgroup.org> | 2021-04-28 19:45:04 (GMT) |
---|---|---|
committer | Muqun Yang <myang6@hdfgroup.org> | 2021-04-28 19:45:04 (GMT) |
commit | ebb87d410590caf01e07a6f6e371722e4d09e018 (patch) | |
tree | 7797ce966a9738f055866d14002f2b87704a5958 /test | |
parent | e70444ccd2ccc474f221114e6dc74dfa0695063d (diff) | |
download | hdf5-ebb87d410590caf01e07a6f6e371722e4d09e018.zip hdf5-ebb87d410590caf01e07a6f6e371722e4d09e018.tar.gz hdf5-ebb87d410590caf01e07a6f6e371722e4d09e018.tar.bz2 |
Add skeleton of group operation test.
The group operations include create/delete/move/add links/delete links/link storage.
Diffstat (limited to 'test')
-rw-r--r-- | test/vfd_swmr_group_writer.c | 288 |
1 files changed, 285 insertions, 3 deletions
diff --git a/test/vfd_swmr_group_writer.c b/test/vfd_swmr_group_writer.c index 2477c2e..f9146e9 100644 --- a/test/vfd_swmr_group_writer.c +++ b/test/vfd_swmr_group_writer.c @@ -37,6 +37,7 @@ typedef struct { bool use_vfd_swmr; bool old_style_grp; bool use_named_pipes; + char grp_op_pattern; char at_pattern; bool attr_test; uint32_t max_lag; @@ -55,6 +56,7 @@ typedef struct { .use_vfd_swmr = true, \ .old_style_grp = false, \ .use_named_pipes = true \ + , .grp_op_pattern = ' ' \ , .at_pattern = ' ' \ , .attr_test = false \ , .tick_len = 4 \ @@ -173,6 +175,27 @@ state_init(state_t *s, int argc, char **argv) case 'N': s->use_named_pipes = false; break; + case 'O': + if (strcmp(optarg, "grp-creation") == 0) + s->grp_op_pattern = 'c'; + else if (strcmp(optarg, "grp-deletion") == 0) + s->grp_op_pattern = 'd'; + else if (strcmp(optarg, "grp-move") == 0) + s->grp_op_pattern = 'm'; + else if (strcmp(optarg, "grp-insertion-links") == 0) + s->grp_op_pattern = 'i'; + else if (strcmp(optarg, "grp-deletion-links") == 0) + s->grp_op_pattern = 'D'; + else if (strcmp(optarg, "grp-compact-t-dense") == 0) + s->grp_op_pattern = 't'; + else if (strcmp(optarg, "grp-dense-t-compact") == 0) + s->grp_op_pattern = 'T'; + else { + H5_FAILED(); AT(); + printf("Invalid -O argument \"%s\"", optarg); + goto error; + } + break; case 'A': if (strcmp(optarg, "compact") == 0) s->at_pattern = 'c'; @@ -2821,6 +2844,265 @@ error2: return false; } +/*------------------------------------------------------------------------- + * Function: create_group + * + * Purpose: Create a group and carry out attribute operations(add,delete etc.) + * according to the attribute test pattern. + * + * Parameters: state_t *s + * The struct that stores information of HDF5 file, named pipe + * and some VFD SWMR configuration parameters + * + * unsigned int which + * The number of iterations for group creation + * + * + * Return: Success: true + * Failure: false + * + * Note: This is called by the main() function. + *------------------------------------------------------------------------- +*/ + +static bool +create_group(state_t *s, unsigned int which) { + + + + return false; +} + +static bool +delete_group(state_t *s, unsigned int which) { + + + + return false; +} + +static bool +move_group(state_t *s, unsigned int which) { + + + + return false; +} + +static bool +insert_link(state_t *s, unsigned int which) { + + + + + return false; +} + +static bool +delete_link(state_t *s, unsigned int which) { + + + + + return false; +} + +static bool +transit_storage_compact_to_dense(state_t *s, unsigned int which) { + + + + + return false; +} + +static bool +transit_storage_dense_to_compact(state_t *s, unsigned int which) { + + + + + return false; +} + +/*------------------------------------------------------------------------- + * Function: group_operations + * + * Purpose: Create a group and carry out attribute operations(add,delete etc.) + * according to the attribute test pattern. + * + * Parameters: state_t *s + * The struct that stores information of HDF5 file, named pipe + * and some VFD SWMR configuration parameters + * + * unsigned int which + * The number of iterations for group creation + * + * + * Return: Success: true + * Failure: false + * + * Note: This is called by the main() function. + *------------------------------------------------------------------------- +*/ +static bool +group_operations(state_t *s, unsigned int which) +{ + + bool ret_value = false; + char test_pattern = s->grp_op_pattern; + + switch (test_pattern) { + case 'c': + ret_value = create_group(s, which); + break; + case 'd': + ret_value = delete_group(s, which); + break; + case 'm': + ret_value = move_group(s, which); + break; + case 'i': + ret_value = insert_link(s, which); + break; + case 'D': + ret_value = delete_link(s, which); + break; + case 't': + ret_value = transit_storage_compact_to_dense(s, which); + break; + case 'T': + ret_value = transit_storage_dense_to_compact(s, which); + break; + case ' ': + default: + ret_value = write_group(s, which); + break; + } + return ret_value; + +} + +static bool +vrfy_create_group(state_t *s, unsigned int which){ + + + + return false; +} + +static bool +vrfy_delete_group(state_t *s, unsigned int which){ + + + + return false; +} + +static bool +vrfy_move_group(state_t *s, unsigned int which){ + + + + return false; +} + +static bool +vrfy_insert_link(state_t *s, unsigned int which){ + + + + return false; +} + +static bool +vrfy_delete_link(state_t *s, unsigned int which){ + + + + return false; +} + + +static bool +vrfy_transit_storage_compact_to_dense(state_t *s, unsigned int which){ + + + + return false; +} + +static bool +vrfy_transit_storage_dense_to_compact(state_t *s, unsigned int which){ + + + + return false; +} + +/*------------------------------------------------------------------------- + * Function: verify_group_operations + * + * Purpose: verify the success of group creation and + * carry out the test for attribute operations(add,delete etc.) + * according to the attribute test pattern. + * + * Parameters: state_t *s + * The struct that stores information of HDF5 file, named pipe + * and some VFD SWMR configuration parameters + * + * unsigned int which + * The number of iterations for group creation + * + * + * Return: Success: true + * Failure: false + * + * Note: This is called by the main() function. + *------------------------------------------------------------------------- +*/ + + +static bool +verify_group_operations(state_t *s, unsigned int which) +{ + bool ret_value = false; + char test_pattern = s->grp_op_pattern; + + switch (test_pattern) { + case 'c': + ret_value = vrfy_create_group(s, which); + break; + case 'd': + ret_value = vrfy_delete_group(s, which); + break; + case 'm': + ret_value = vrfy_move_group(s, which); + break; + case 'i': + ret_value = vrfy_insert_link(s, which); + break; + case 'D': + ret_value = vrfy_delete_link(s, which); + break; + case 't': + ret_value = vrfy_transit_storage_compact_to_dense(s, which); + break; + case 'T': + ret_value = vrfy_transit_storage_dense_to_compact(s, which); + break; + case ' ': + default: + ret_value = verify_group(s, which); + break; + } + return ret_value; + + +} + + + int main(int argc, char **argv) @@ -2949,7 +3231,7 @@ main(int argc, char **argv) for (step = 0; step < s.nsteps; step++) { dbgf(2, "writer: step %d\n", step); - wg_ret = write_group(&s, step); + wg_ret = group_operations(&s, step); if(wg_ret == false) { H5_FAILED(); AT(); @@ -2989,11 +3271,11 @@ main(int argc, char **argv) if(s.use_named_pipes && s.attr_test== false) decisleep(config.tick_len * s.update_interval); - vg_ret = verify_group(&s, step); + vg_ret = verify_group_operations(&s, step); if (vg_ret == false) { - printf("verify_group failed\n"); + printf("verify_group_operations failed\n"); H5_FAILED(); AT(); /* At communication interval, tell the writer about the failure and exit */ |