- Timestamp:
- 09/11/19 16:39:35 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/test_function/Check.py
r1701 r1706 1 1 import os 2 import sys 2 3 3 4 … … 6 7 def main(): 7 8 8 9 configName='config'10 9 configNamePattern=[0, 0, 0, 0, 0, 0] 11 10 12 11 f=open("user_param.py", "r") 13 12 for line in f: 14 if not line.startswith("#"): 15 if len(line.strip()) != 0: 16 n = line.split(None, 1)[0] 17 if n == 'UsingServer2': 18 configNamePattern[0] = '_UsingSrv2=' + UsingServer2 19 elif n=='RatioServer2': 20 configNamePattern[1] = '_RatioSrv2=' + repr(RatioServer2) 21 elif n=='NumberPoolsServer2': 22 configNamePattern[2] = '_NbPoolsSrv2=' + repr(NumberPoolsServer2) 23 elif n=='NumberClients': 24 configNamePattern[3] = '_NbClients=' + repr(NumberClients) 25 elif n=='NumberServers': 26 configNamePattern[4] = '_NbServers=' + repr(NumberServers) 27 else: 28 configNamePattern[5] = '_Duration=' + Duration 29 30 13 line = line.strip() 14 if line.startswith("UsingServer2"): 15 configNamePattern[0] = '_UsingSrv2=' + UsingServer2 16 elif line.startswith("RatioServer2"): 17 configNamePattern[1] = '_RatioSrv2=' + repr(RatioServer2) 18 elif line.startswith("NumberPoolsServer2"): 19 configNamePattern[2] = '_NbPoolsSrv2=' + repr(NumberPoolsServer2) 20 elif line.startswith("NumberClients"): 21 configNamePattern[3] = '_NbClients=' + repr(NumberClients) 22 elif line.startswith("NumberServers"): 23 configNamePattern[4] = '_NbServers=' + repr(NumberServers) 24 elif line.startswith("Duration"): 25 configNamePattern[5] = '_Duration=' + Duration 31 26 f.close() 32 27 … … 35 30 defaultConfig = True 36 31 37 for i in range( 6):32 for i in range(len(configNamePattern)): 38 33 if configNamePattern[i] != 0: 39 34 configName = configName + configNamePattern[i] … … 43 38 configName = "config_default" 44 39 45 print(configName)46 47 # os.system('rm -rf config_*')48 40 49 41 if not os.path.exists(configName): 50 42 os.mkdir(configName) 51 print(" ********************************************************")52 print(" * Directory " + repr(configName) + " Created ")53 print(" * Copy results to \'not_validated_reference\' folder")54 print(" ********************************************************")43 print("\n ****************************************************************") 44 print(" * Directory " + repr(configName) + " Created ") 45 print(" * Copy results to \'not_validated_reference\' folder") 46 print(" ****************************************************************\n") 55 47 56 48 os.mkdir(configName+'/setup') … … 64 56 65 57 os.system('cp atm_output.nc '+configName+'/tmp_reference/') 66 os.system('cp -r '+configName+'/tmp_reference/ ' + configName+'/reference/')58 # os.system('cp -r '+configName+'/tmp_reference/ ' + configName+'/reference/') 67 59 68 60 else: 69 print(" ********************************************************")70 print(" * Directory " + repr(configName) + " already exists")71 print(" * Start comparing results with (tmp) references")72 print(" ********************************************************")61 print("\n ********************************************************") 62 print(" * Directory " + repr(configName) + " already exists") 63 print(" * Start comparing results with (tmp) references") 64 print(" ********************************************************\n") 73 65 74 66 tmp_ref = os.path.isdir(configName+'/tmp_reference') 75 67 ref = os.path.isdir(configName+'/reference') 76 68 77 path=078 79 69 if ref: 80 print("* Comparing results with references") 70 print("\n =====================================") 71 print(" | Comparing results with references |") 72 print(" =====================================\n") 81 73 os.system('rm -rf '+configName+'/tmp_reference/') 82 74 tmp_ref = False 83 75 path = configName+'/reference/' 84 76 elif tmp_ref: 85 print("* Comparing results with non-validated references") 77 print("\n ===================================================") 78 print(" | Comparing results with NON-Validated references |") 79 print(" ===================================================\n") 86 80 path = configName+'/tmp_reference/' 87 88 print(path)89 81 90 82 os.system('cdo diffn atm_output.nc '+path+'/atm_output.nc | tail -1 > diff.txt') … … 92 84 f=open("diff.txt", "r") 93 85 for line in f: 94 # line = line.strip()95 86 if line.strip().startswith("0"): 96 print " *******************" 97 print " ** Test is valid **" 98 print " *******************" 87 print "\n ***********************" 88 print " ** Test is valid !!! **" 89 print " ***********************\n" 90 valid = True 91 99 92 else: 100 print " *******************************************" 101 print " ** Test is NOT valid. Please debuging... **" 102 print " *******************************************" 93 print "\n *******************************************" 94 print " ** Test is NOT valid. Please debuging... **" 95 print " *******************************************\n" 96 valid = False 103 97 98 f.close() 99 100 f=open("report.txt", "a+") 101 if valid: 102 f.write("test for "+configName+" passed.\n") 103 else: 104 f.write("test for "+configName+" failed.\n") 104 105 f.close() 105 106
Note: See TracChangeset
for help on using the changeset viewer.