BOLD = '\033[1m'
UNDERLINE = '\033[4m'
-PREFIX = {'telemac2d':'t2d',
- 'telemac3d':'t3d',
- 'tomawac':'tom',
- 'sisyphe':'sis',
- 'artemis':'art',
- 'waqtel':'waq'}
+PREFIX = {
+ 't2d':'telemac2d',
+ #'t3d':'telemac3d',
+ #'tom':'tomawac',
+ #'art':'artemis',
+ #'sis':'sisyphe',
+ #'waq':'waqtel',
+ #'stb':'stbtel',
+ 'gai':'gaia',
+ #'p3d':'postel3d',
+ #'ice':'khione',
+ }
def diff_cas(cas1, cas2):
"""
@param eficas_file Name of the steering file written by Eficas
"""
from InterfaceQT4.eficas_go import getEficasSsIhm
- code = 'TELEMAC'
my_eficas = getEficasSsIhm(code='TELEMAC',labelCode=module)
handler = my_eficas.fileOpen(steering_file)
@param root_dir Telemac root path
"""
print(" "*2, "~> For module", module)
- examples_dir = path.join(root_dir, 'examples', module)
+ examples_dirs = path.join(root_dir, 'examples')
output_dir = path.join(root_dir, 'examples', 'eficas')
- telemac_dico = path.join(root_dir, 'sources', module, module+'.dico')
crashed = []
different = []
- for example in sorted(listdir(examples_dir)):
- example_dir = path.join(examples_dir, example)
- chdir(example_dir)
- print(" "*3, "~> In example folder ", example_dir)
- for case in sorted(listdir(example_dir)):
- if case.endswith('.cas') and \
- "_reecrit" not in case and \
- case[0:3] == PREFIX[module] and \
- "_reecrit" not in case and \
- "_ori" not in case:
- # Adding lang extension (.fr for translated french case)
- print(" "*4, "~> For test case ", case)
- root, _ = path.splitext(case)
-
- lang = ''
- eficas_case = root + "_reecrit.cas"
-
- # Import and export in eficas
- try:
- read_write_eficas(module, case, eficas_case)
- except Exception as e:
- print(e)
- crashed.append(case)
- print(" "*8+FAIL+"FAILED"+ENDC)
- print(" "*8+"Crashed in eficas")
- continue
-
- ori_cas = TelemacCas(case, telemac_dico)
- eficas_cas = TelemacCas(eficas_case, telemac_dico)
-
- isdiff = diff_cas(ori_cas, eficas_cas)
-
- if not isdiff:
- different.append(case)
- print(" "*8+FAIL+"FAILED"+ENDC)
- print(" "*8+"Diff in steering case")
- continue
-
- # Clean up of files
- remove(eficas_case)
-
- # Passed the test case
- print(" "*8+OKGREEN+"PASSED"+ENDC)
-
- if crashed != []:
- print("The following test in", module,
- " crashed in eficas:", crashed)
- if different != []:
- print("The following test in", module,
- " have a difference with normal run:", different)
-
-salome.salome_init()
+ for folder in sorted(listdir(examples_dirs)):
+ if folder in ['python3']:
+ continue
+ for example in sorted(listdir(path.join(examples_dirs, folder))):
+ example_dir = path.join(examples_dirs, folder, example)
+ # Skipping files
+ if not path.isdir(example_dir):
+ continue
+ chdir(example_dir)
+ print(" "*3, "~> In example folder ", example_dir)
+ for case in sorted(listdir(example_dir)):
+ if case.endswith('.cas') and \
+ "_reecrit" not in case and \
+ "_reecrit" not in case:
+
+ module = PREFIX.get(case[:3], None)
+ if module is None:
+ print("Skipping (prefix not handled): ", case)
+ continue
+
+ # Adding lang extension (.fr for translated french case)
+ print(" "*4, "~> For test case ", case)
+ root, _ = path.splitext(case)
+
+ lang = ''
+ eficas_case = root + "_reecrit.cas"
+
+
+ # Import and export in eficas
+ try:
+ read_write_eficas(module, case, eficas_case)
+ except Exception as e:
+ print(e)
+ crashed.append(folder+'/'+example_dir+'/'+case)
+ print(" "*8+FAIL+"FAILED"+ENDC)
+ print(" "*8+"Crashed in eficas")
+ continue
+
+ telemac_dico = path.join(root_dir, 'sources', module, module+'.dico')
+ ori_cas = TelemacCas(case, telemac_dico)
+ eficas_cas = TelemacCas(eficas_case, telemac_dico)
+
+ isdiff = diff_cas(ori_cas, eficas_cas)
+
+ if not isdiff:
+ different.append(folder+'/'+example_dir+'/'+case)
+ print(" "*8+FAIL+"FAILED"+ENDC)
+ print(" "*8+"Diff in steering case")
+ continue
+
+ # Clean up of files
+ remove(eficas_case)
+
+ # Passed the test case
+ print(" "*8+OKGREEN+"PASSED"+ENDC)
+
+ return crashed, different
+
#-----------------
#-- Eficas
#-----------------
+crasheds = []
+differents = []
-for module in ['telemac2d', 'telemac3d']:
+#for module in ['telemac2d', 'telemac3d']:
+for module in ['telemac3d']:
# Testing loading of catalog
- validate_catalog(module, environ["HOMETEL"])
-
+ crasheds = []
+ differents = []
+ crashed, different = validate_catalog(module, environ["HOMETEL"])
+ crasheds.extend(crashed)
+ differents.extend(different)
+
+if crasheds != []:
+ print("The following tests "
+ " crashed in eficas:", crashed)
+if differents != []:
+ print("The following tests",
+ " have a difference with normal run:", different)
+
+if crasheds != [] or differents != []:
+ sys.exit(1)