Changeset 1734


Ignore:
Timestamp:
10/04/19 17:36:51 (5 years ago)
Author:
yushan
Message:

GENERIC_TESTCASE : check all .nc files by default. Generate Cmake files from python scripts (user_config.py, setup.py). Add scripts for copy to/from compressed reference stored in /gpfswork/rech/psl/rpsl954 (Jean-Zay and Irene).

Location:
XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE
Files:
3 added
5 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/CMakeLists.txt

    r1729 r1734  
    1010enable_testing() 
    1111 
    12 add_subdirectory(test_config) 
    1312add_subdirectory(test_domain_algo) 
    1413add_subdirectory(test_scalar_algo) 
     
    2322                   COMMAND rm -f report.txt 
    2423                   COMMAND rm -f report.html 
    25                    COMMAND cat test_config/report.txt >> report.txt 
    26                    COMMAND cat test_config/report.html >> report.html 
    2724                   COMMAND cat test_domain_algo/report.txt >> report.txt 
    2825                   COMMAND cat test_domain_algo/report.html >> report.html 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/check.py

    r1726 r1734  
    11import os 
    22import sys 
     3import subprocess 
    34 
    45 
    56from user_param import * 
     7 
     8 
     9def OSinfo(runthis): 
     10        osstdout = subprocess.Popen(runthis, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True) 
     11        theInfo = osstdout.communicate()[0].strip() 
     12        # print(theInfo) 
     13        # print(osstdout.returncode) 
     14        # return (osstdout.returncode) 
     15 
     16        if osstdout.returncode!=0: 
     17                print >> sys.stderr, osstdout.returncode 
     18                sys.exit() 
     19        else: 
     20                print(runthis+" OK") 
     21 
    622 
    723def main(): 
     
    5773                configName = "config_default" 
    5874 
     75        check_result=False 
     76 
    5977 
    6078        if not os.path.exists(configName): 
     
    6583                print blue("    ****************************************************************\n") 
    6684 
    67                 os.mkdir(configName+'/setup') 
     85                # os.mkdir(configName+'/setup') 
     86                os.system("mkdir "+configName+'/setup') 
    6887                os.mkdir(configName+'/tmp_reference') 
    6988                os.mkdir(configName+'/xios_output') 
     
    85104                h.write("Config : "+configName+"\n")             
    86105                l.write("<p>Config : "+configName+"</p>")        
     106                endloop=False 
    87107                for line in f: 
    88108                        line=line.strip() 
    89109                        line=line.rstrip() 
     110 
     111                        if line.startswith("all"): 
     112                                allfiles = os.listdir(os.getcwd()) 
     113                                for thisfile in allfiles: 
     114                                        if thisfile.endswith(".nc") and thisfile!="dynamico_grid.nc": 
     115                                                cmd = 'mv '+thisfile + ' '+configName+'/tmp_reference/' 
     116                                                os.system(cmd)   
     117                                 
     118                                h.write("test for "+lpurple("all NC files")+"     \t"+yellow('INITIALIZED')+"\n")                
     119                                l.write("<p>test for <font color=\"purple\">"+"all NC files"+"</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=\"darkorange\">INITIALIZED</font></p>") 
     120                                print yellow("\n        ****************************************") 
     121                                print yellow("        ** "+"all NC files"+" is stored as temporal reference !!! **") 
     122                                print yellow("\n        ****************************************") 
     123 
     124                                break 
     125 
    90126                        if not line.startswith("#") and len(line) != 0: 
    91127                                cmd = 'mv '+line + ' '+configName+'/tmp_reference/' 
     
    107143                print blue("\n    ********************************************************") 
    108144                print blue("    * Directory " + repr(configName) + " already exists") 
    109                 print blue("    * Start comparing results with (tmp) references") 
     145                print blue("    * Start comparing results with references") 
    110146                print blue("    ********************************************************\n") 
    111147 
    112148                tmp_ref = os.path.isdir(configName+'/tmp_reference') 
    113                 ref = os.path.isdir(configName+'/reference') 
     149                ref = os.path.isdir(configName+'/reference') and not tmp_ref 
    114150 
    115151                if ref: 
     
    117153                        print blue("    | Comparing results with references |") 
    118154                        print blue("    =====================================\n") 
    119                         os.system('rm -rf '+configName+'/tmp_reference/') 
    120                         tmp_ref = False 
    121155                        path = configName+'/reference/' 
    122156                elif tmp_ref: 
     
    124158                        print blue("    | Comparing results with NON-Validated references |") 
    125159                        print blue("    ===================================================\n") 
    126                         path = ' '+configName+'/tmp_reference/' 
     160                        path = configName+'/tmp_reference/' 
    127161                 
    128162                f=open("checkfile.def", "r") 
     
    138172                        line=line.rstrip() 
    139173                         
    140                         if not line.startswith("#") and len(line) != 0: 
    141                                 cmd = 'cdo diffn '+ line + path + line + ' | tail -1 > diff.txt' 
    142                                 os.system(cmd) 
     174                        if line.startswith("all") : 
     175                                for thisfile in os.listdir(path): 
     176                                        if thisfile.endswith(".nc"): 
     177                                                cmd = 'cdo -W diffn '+ thisfile +' '+ path + thisfile + ' | tail -1 > diff.txt' 
     178                                                 
     179                                                OSinfo(cmd) 
     180                                                 
     181                                                if os.stat("diff.txt").st_size==0: 
     182                                                        h.write("test for "+lpurple(thisfile)+"     \t"+green('PASSED')+"\n")            
     183                                                        l.write("<p>test for <font color=\"purple\">"+thisfile+"</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=\"green\">PASSED</font></p>")           
     184                                                        print green("\n        ****************************************") 
     185                                                        print green("        ** "+thisfile+" is valid !!! **") 
     186                                                        print green("\n        ****************************************") 
     187 
     188                                                else:    
     189                                                        g=open("diff.txt", "r") 
     190                                                        for gline in g: 
     191                                                                if gline.strip().startswith("0") or ":" in gline : 
     192                                                                        h.write("test for "+lpurple(thisfile)+"      \t"+green('PASSED')+"\n")           
     193                                                                        l.write("<p>test for <font color=\"purple\">"+thisfile+"</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=\"green\">PASSED</font></p>")           
     194                                                                        print green("\n        ****************************************") 
     195                                                                        print green("        ** "+thisfile+" is valid !!! **") 
     196                                                                        print green("\n        ****************************************") 
     197                                                                else: 
     198                                                                        h.write("test for "+lpurple(thisfile)+"     \t"+red('FAILED')+"\n")              
     199                                                                        l.write("<p>test for <font color=\"purple\">"+thisfile+"</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color=\"red\">FAILED</font></p>")             
     200                                                                        print red("\n        **************************************************") 
     201                                                                        print red("        ** "+thisfile+" is NOT valid. Please debugging.. **") 
     202                                                                        print red("\n        **************************************************") 
     203                                                        g.close() 
     204                                break 
     205 
     206 
     207                        elif not line.startswith("#") and len(line) != 0: 
     208                                cmd = 'cdo -W diffn '+ line +' '+ path + line + ' | tail -1 > diff.txt' 
     209                                 
     210                                OSinfo(cmd) 
    143211 
    144212                                if os.stat("diff.txt").st_size==0: 
     
    187255 
    188256 
     257 
     258 
    189259if __name__== "__main__": 
    190260  main() 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/clean_config.sh

    r1725 r1734  
    1 bash -c "cd test_function/test_average && rm -rf config_*" 
    2 bash -c "cd test_function/test_maximum && rm -rf config_*" 
    3 bash -c "cd test_function/test_minimum && rm -rf config_*" 
    4 bash -c "cd test_function/test_sum && rm -rf config_*" 
     1bash -c "cd test_function && rm -rf config_*" 
    52bash -c "cd test_scalar_algo && rm -rf config_*" 
    63bash -c "cd test_axis_algo && rm -rf config_*" 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/config.py

    r1729 r1734  
    3434        nb_proc = NumberClients+NumberServers 
    3535 
    36         # os.rename("iodef.xml", "iodef.xml.bkp") 
    37  
    38         filein = open("iodef.xml.bkp", "r") 
    39         fileout = open("iodef.xml.tmp", "w") 
     36        filein = open("../iodef.xml.template", "r") 
     37        fileout = open("iodef.xml", "w") #this iodef.xml has defined variables, it is not the template 
    4038        for line in filein: 
    4139                if 'xios::nbplSrv2' in line:    line = line.replace("xios::nbplSrv2", repr(NumberPoolsServer2)) 
     
    4846        filein.close() 
    4947        fileout.close() 
    50         os.rename("iodef.xml.tmp", "iodef.xml") 
    5148 
    5249 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/job_irene.sh

    r1729 r1734  
    5050 
    5151export machine_name=irene 
     52 
    5253python user_config.py 
    5354cmake . 
    54 make test 
     55ctest -V 
     56 
    5557make report 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/job_jz.sh

    r1729 r1734  
    3333export machine_name=jeanzay 
    3434 
    35 python user_config.py 
     35# python user_config.py 
     36export output=$(python user_config.py 2>&1 >/dev/null) 
     37 
     38if [ "$output" -ne 0 ] 
     39then 
     40        echo "user_config.py failed" 
     41        exit 
     42else 
     43        echo "user_config.py OK" 
     44fi 
     45 
    3646cmake . 
    3747ctest -V  
    3848make report 
    39 #./run_sub_test.sh 
    4049 
    4150#srun --mpi=pmi2 -K1 --multi-prog -m cyclic ./srun.conf 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/test_axis_algo/checkfile.def

    r1725 r1734  
    1  
     1all 
    22atm_output_zoom.nc 
    33#atm_output_inverse.nc 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/test_axis_algo/context_atm.xml

    r1725 r1734  
    3535    </axis> 
    3636 
     37    <axis id="domain_Y_inverse" axis_ref="domain_Y"> 
     38        <inverse_axis /> 
     39    </axis> 
     40 
    3741  </axis_definition> 
    3842 
     
    6872    <grid id="grid_Y"> 
    6973      <axis axis_ref="domain_Y" /> 
     74    </grid> 
     75 
     76    <grid id="grid_Y_inverse"> 
     77      <axis axis_ref="domain_Y_inverse" /> 
    7078    </grid> 
    7179 
     
    391399     <file id="atm_output_zoom" output_freq="1ts" enabled="true"> 
    392400       <field field_ref="field_XY" grid_ref="grid_XY_zoom_Y" operation="instant" enabled="true"/> 
     401       <!-- <field field_ref="field_Y" grid_ref="grid_Y_inverse" operation="instant" enabled="true"/> --> 
    393402     </file> 
    394403 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/test_axis_algo/run_sub_test.sh

    r1729 r1734  
    1111cp ../default_param.py default_param.py 
    1212 
    13 cp ../iodef.xml iodef.xml 
    1413 
    1514# Black        0;30     Dark Gray     1;30 
     
    2322 
    2423 
    25 mv iodef.xml iodef.xml.bkp 
    2624 
    2725nb_proc=$(python sub_config.py 2>&1)  
     
    2927machine_name=jeanzay 
    3028 
    31 echo $nb_proc 
     29# echo $nb_proc 
    3230if [[ ($machine_name == irene) ]] 
    3331then 
     
    4644            echo "execution failed" 
    4745            rm -f iodef.xml 
    48             mv iodef.xml.bkp iodef.xml 
    4946            rm -f user_param.py 
    5047            rm -f default_param.py 
    5148            rm -f sub_config.py 
     49            rm -f sub_check.py 
    5250            exit 1234 
    5351    fi 
     
    5755fi 
    5856 
    59 python sub_check.py 
     57check_output=$(python sub_check.py 2>&1 >/dev/null) 
     58if [[ "$check_output" -ne 0 ]] 
     59then 
     60    echo "check.py failed" 
     61    rm -f iodef.xml 
     62    rm -f user_param.py 
     63    rm -f default_param.py 
     64    rm -f sub_config.py 
     65    rm -f sub_check.py 
     66    exit 1 
     67else 
     68    echo "check.py OK" 
     69fi 
     70 
    6071 
    6172rm -f iodef.xml 
    62 mv iodef.xml.bkp iodef.xml 
    6373rm -f user_param.py 
    6474rm -f default_param.py 
    6575rm -f sub_config.py 
     76rm -f sub_check.py 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/test_axis_algo/setup.py

    r1729 r1734  
    121121        dirpath = os.getcwd() 
    122122        foldername = os.path.basename(os.getcwd()) 
    123         print(foldername) 
    124123 
    125124 
     
    137136                g.write("import os\n") 
    138137                g.write("import sys\n") 
     138                g.write("import subprocess\n") 
    139139                g.write("def main():\n") 
    140140                g.write("       os.system(\'rm -f user_param.py\')\n") 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/test_domain_algo/checkfile.def

    r1725 r1734  
     1#all 
    12 
    23atm_output.nc 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/test_domain_algo/run_sub_test.sh

    r1729 r1734  
    1212 
    1313 
    14 cp ../iodef.xml iodef.xml 
    1514 
    1615# Black        0;30     Dark Gray     1;30 
     
    2423 
    2524 
    26 mv iodef.xml iodef.xml.bkp 
    2725 
    2826nb_proc=$(python sub_config.py 2>&1)  
     
    3028machine_name=jeanzay 
    3129 
    32 echo $nb_proc 
     30# echo $nb_proc 
    3331if [[ ($machine_name == irene) ]] 
    3432then 
     
    4745            echo "execution failed" 
    4846            rm -f iodef.xml 
    49             mv iodef.xml.bkp iodef.xml 
    5047            rm -f user_param.py 
    5148            rm -f default_param.py 
    5249            rm -f sub_config.py 
     50            rm -f sub_check.py 
    5351            exit 1234 
    5452    fi 
     
    6159 
    6260rm -f iodef.xml 
    63 mv iodef.xml.bkp iodef.xml 
    6461rm -f user_param.py 
    6562rm -f default_param.py 
    6663rm -f sub_config.py 
     64rm -f sub_check.py 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/test_function/run_sub_test.sh

    r1729 r1734  
    1111cp ../default_param.py default_param.py 
    1212 
    13 cp ../iodef.xml iodef.xml 
    1413 
    1514# Black        0;30     Dark Gray     1;30 
     
    2322 
    2423 
    25 mv iodef.xml iodef.xml.bkp 
    2624 
    2725nb_proc=$(python sub_config.py 2>&1)  
     
    2927machine_name=jeanzay 
    3028 
    31 echo $nb_proc 
     29# echo $nb_proc 
    3230if [[ ($machine_name == irene) ]] 
    3331then 
     
    4644            echo "execution failed" 
    4745            rm -f iodef.xml 
    48             mv iodef.xml.bkp iodef.xml 
    4946            rm -f user_param.py 
    5047            rm -f default_param.py 
    5148            rm -f sub_config.py 
     49            rm -f sub_check.py 
    5250            exit 1234 
    5351    fi 
     
    6058 
    6159rm -f iodef.xml 
    62 mv iodef.xml.bkp iodef.xml 
    6360rm -f user_param.py 
    6461rm -f default_param.py 
    6562rm -f sub_config.py 
     63rm -f sub_check.py 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/test_grid_algo/run_sub_test.sh

    r1729 r1734  
    1212 
    1313 
    14 cp ../iodef.xml iodef.xml 
    1514 
    1615# Black        0;30     Dark Gray     1;30 
     
    2423 
    2524 
    26 mv iodef.xml iodef.xml.bkp 
    2725 
    2826nb_proc=$(python sub_config.py 2>&1)  
     
    3028machine_name=jeanzay 
    3129 
    32 echo $nb_proc 
     30# echo $nb_proc 
    3331if [[ ($machine_name == irene) ]] 
    3432then 
     
    4745            echo "execution failed" 
    4846            rm -f iodef.xml 
    49             mv iodef.xml.bkp iodef.xml 
    5047            rm -f user_param.py 
    5148            rm -f default_param.py 
    5249            rm -f sub_config.py 
     50            rm -f sub_check.py 
    5351            exit 1234 
    5452    fi 
     
    6159 
    6260rm -f iodef.xml 
    63 mv iodef.xml.bkp iodef.xml 
    6461rm -f user_param.py 
    6562rm -f default_param.py 
    6663rm -f sub_config.py 
     64rm -f sub_check.py 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/test_scalar_algo/run_sub_test.sh

    r1729 r1734  
    1212 
    1313 
    14 cp ../iodef.xml iodef.xml 
    1514 
    1615# Black        0;30     Dark Gray     1;30 
     
    2423 
    2524 
    26 mv iodef.xml iodef.xml.bkp 
    2725 
    2826nb_proc=$(python sub_config.py 2>&1)  
     
    3028machine_name=jeanzay 
    3129 
    32 echo $nb_proc 
     30# echo $nb_proc 
    3331if [[ ($machine_name == irene) ]] 
    3432then 
     
    4745            echo "execution failed" 
    4846            rm -f iodef.xml 
    49             mv iodef.xml.bkp iodef.xml 
    5047            rm -f user_param.py 
    5148            rm -f default_param.py 
    5249            rm -f sub_config.py 
     50            rm -f sub_check.py 
    5351            exit 1234 
    5452    fi 
     
    6159 
    6260rm -f iodef.xml 
    63 mv iodef.xml.bkp iodef.xml 
    6461rm -f user_param.py 
    6562rm -f default_param.py 
    6663rm -f sub_config.py 
     64rm -f sub_check.py 
  • XIOS/dev/dev_trunk_omp/GENERIC_TESTCASE/user_config.py

    r1729 r1734  
    11import os 
    22import sys 
     3import subprocess 
    34 
    45def main(): 
     
    1213                if folder.startswith("test_"): 
    1314                        test_list.append(folder) 
    14                         os.system('cd '+folder+' && python setup.py') 
     15                        # os.system('cd '+folder+' && python setup.py') 
     16                        FNULL = open(os.devnull, 'w') 
     17                        retcode = subprocess.call(['cd', folder, ' && python setup.py'], 
     18                          stdout=FNULL, 
     19                          stderr=subprocess.STDOUT) 
     20                         
     21                        if retcode!=0:   
     22                                print >> sys.stderr, retcode 
     23                                sys.exit() 
    1524         
    1625 
     
    4251        f.close 
    4352         
     53        print >> sys.stderr, 0 
     54        sys.exit() 
    4455 
    4556if __name__== "__main__": 
Note: See TracChangeset for help on using the changeset viewer.