Extracted check function into aiori. #24. #177

master
Julian M. Kunkel 2019-09-01 15:59:52 +01:00
parent e3db1759b2
commit c83edfe39b
4 changed files with 32 additions and 10 deletions

View File

@ -143,6 +143,10 @@ static int DUMMY_stat (const char *path, struct stat *buf, IOR_param_t * param){
return 0;
}
static int DUMMY_check_params(IOR_param_t * test){
return 1;
}
ior_aiori_t dummy_aiori = {
.name = "DUMMY",
.name_legacy = NULL,
@ -163,4 +167,5 @@ ior_aiori_t dummy_aiori = {
.finalize = NULL,
.get_options = DUMMY_options,
.enable_mdtest = true,
.check_params = DUMMY_check_params
};

View File

@ -159,6 +159,8 @@ static void S3_Fsync(void*, IOR_param_t*);
static IOR_offset_t S3_GetFileSize(IOR_param_t*, MPI_Comm, char*);
static void S3_init();
static void S3_finalize();
static int S3_check_params(IOR_param_t *);
/************************** D E C L A R A T I O N S ***************************/
@ -177,7 +179,8 @@ ior_aiori_t s3_aiori = {
.fsync = S3_Fsync,
.get_file_size = S3_GetFileSize,
.initialize = S3_init,
.finalize = S3_finalize
.finalize = S3_finalize,
.check_params = S3_check_params
};
// "S3", plus EMC-extensions enabled
@ -228,6 +231,22 @@ static void S3_finalize(){
aws_cleanup();
}
static int S3_check_params(IOR_param_t * test){
/* N:1 and N:N */
IOR_offset_t NtoN = test->filePerProc;
IOR_offset_t Nto1 = ! NtoN;
IOR_offset_t s = test->segmentCount;
IOR_offset_t t = test->transferSize;
IOR_offset_t b = test->blockSize;
if (Nto1 && (s != 1) && (b != t)) {
ERR("N:1 (strided) requires xfer-size == block-size");
return 0;
}
return 1;
}
/* modelled on similar macros in iordef.h */
#define CURL_ERR(MSG, CURL_ERRNO, PARAM) \
do { \

View File

@ -86,6 +86,7 @@ typedef struct ior_aiori {
void (*finalize)(); /* called once per program after MPI is shutdown */
option_help * (*get_options)(void ** init_backend_options, void* init_values); /* initializes the backend options as well and returns the pointer to the option help structure */
bool enable_mdtest;
int (*check_params)(IOR_param_t *); /* check if the provided parameters for the given test and the module options are correct, if they aren't print a message and exit(1) or return 1*/
void (*sync)(IOR_param_t * ); /* synchronize every pending operation for this storage */
} ior_aiori_t;

View File

@ -1677,15 +1677,12 @@ static void ValidateTests(IOR_param_t * test)
if (test->useExistingTestFile && test->lustre_set_striping)
ERR("Lustre stripe options are incompatible with useExistingTestFile");
/* N:1 and N:N */
IOR_offset_t NtoN = test->filePerProc;
IOR_offset_t Nto1 = ! NtoN;
IOR_offset_t s = test->segmentCount;
IOR_offset_t t = test->transferSize;
IOR_offset_t b = test->blockSize;
if (Nto1 && (s != 1) && (b != t)) {
ERR("N:1 (strided) requires xfer-size == block-size");
/* allow the backend to validate the options */
if(test->backend->check_params){
int check = test->backend->check_params(test);
if (check == 0){
ERR("The backend returned that the test parameters are invalid.");
}
}
}