Changed file name limits to adapt to system limits + minor changes

This commit is contained in:
Celine Mercier
2016-09-22 18:05:07 +02:00
parent b083745f56
commit b408a4f6eb
6 changed files with 43 additions and 23 deletions

View File

@ -20,10 +20,8 @@ QUALITY_COLUMN = "QUALITY"
SPECIAL_COLUMNS = [NUC_SEQUENCE_COLUMN, ID_COLUMN, DEFINITION_COLUMN, QUALITY_COLUMN]
NAME_MAX_LEN = 50
NAME_MAX_LEN = 200
COL_COMMENTS_MAX_LEN = 2048
MAX_NB_ELEMENTS_PER_LINE = 20
ELEMENT_NAME_MAX_LEN = int(2048 / MAX_NB_ELEMENTS_PER_LINE)
MAX_INT = 2147483647 # used to generate random float values
@ -78,6 +76,14 @@ def random_unique_name(infos):
return name
def random_unique_element_name(config, infos):
name = ""
while name == "" or name in infos['unique_names'] :
name = random_str_with_max_len(config['test']['elt_name_max_len'])
infos['unique_names'].append(name)
return name
def print_test(config, sentence):
if config['test']['verbose'] :
print(sentence)
@ -180,10 +186,10 @@ def fill_column(config, infos, col) :
def create_random_column(config, infos) :
alias = random.choice(['', random_unique_name(infos)])
nb_elements_per_line=random.randint(1, MAX_NB_ELEMENTS_PER_LINE)
nb_elements_per_line=random.randint(1, config['test']['maxelts'])
elements_names = []
for i in range(nb_elements_per_line) :
elements_names.append(random_unique_name(infos))
elements_names.append(random_unique_element_name(config, infos))
name = random_unique_name(infos)
infos['view'].add_column(name,
alias=alias,
@ -317,6 +323,14 @@ def addOptions(parser):
help="Maximum number of lines in a column."
"Default: 10000")
group.add_argument('--max_elts_per_line','-e',
action="store", dest="test:maxelts",
metavar='<MAX_ELTS_PER_LINE>',
default=20,
type=int,
help="Maximum number of elements per line in a column."
"Default: 20")
group.add_argument('--verbose','-v',
action="store_true", dest="test:verbose",
default=False,
@ -333,8 +347,10 @@ def run(config):
'tests': [test_set_and_get, test_add_col, test_delete_col, test_col_alias, test_new_view]
}
config['test']['elt_name_max_len'] = int((COL_COMMENTS_MAX_LEN - config['test']['maxelts']) / config['test']['maxelts'])
print("Initializing the DMS and the first view...")
ini_dms_and_first_view(config, infos)
i = 0