Changes between Initial Version and Version 1 of TestProgram


Ignore:
Timestamp:
Mar 20, 2012, 4:18:57 PM (13 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TestProgram

    v1 v1  
     1
     2
     3
     4
     5== Where is the test code? ==
     6
     7   1. The code is on cp3wks05 in the directory /Users/madgraph/TestMG
     8   1. He is also available via CVS: ''cvs co !TestMG'' . He is suppose to be place on same directory as MG_ME
     9
     10== How do you execute the test? ==
     11
     12you can run two different types of tests: "fast" and "full" (see next section for details).
     13The main script that controls the various tests is a Python script called test.py.
     14Here are some examples of commands you can type to perform the tests:
     15
     16   *    $>./test.py fast all         (to do all available checks in the "fast" mode)
     17   *    $>./test.py fast MW      (to check only MadWeight in the "fast" mode)
     18   *    $>./test.py full all          (to do all available checks in the "full" mode)   
     19   *    $>./test.py fast MW      (to check MadWeight MadWeight in the "full" mode)
     20   *    $>./test.py MW/NAME  (to launch only the fast test  NAME in MW)
     21
     22
     23== What is the difference between the "fast" mode and the "full" mode? ==
     24
     25These are two different levels of test, for each module in MadGraph:
     26   * the "FAST" mode is intended to be rapid. It should not last much more than 10 minutes or so. You can use it to check whether
     27     some modifications in a specific module (e.g. MadOnia) do not interfere with the good-working of other modules (e.g. MadDipol).
     28   * the "FULL" mode is intended to check that ''all the results''  you can produce with a specific updated  module is in agreement with the results from the previous version of this module.
     29
     30Essentially, if you update a specific module ''mymod'', you can run the test script in "fast" mode to test all the modules,
     31
     32 $>./test.py fast all
     33
     34and in "full" mode to test specifically ''mymod''
     35
     36 $>./test.py full mymod
     37
     38NOTE: for the moment only madonia has is own full test.
     39
     40== Structure of the code ==
     41
     42All required information to test a specific module is contained in one given
     43directory located in   /Users/madgraph/TEST. This directory should be named
     44as '''test_????'''. For a specific test in this module, the relevant files are recorded
     45in a sub-directory '''fast_???''' or '''full_???'''. Each of these test directories contains
     46
     47   1. all input Cards or files required to perform the test,
     48   1. the file '''move_files_level1'''
     49       which specifies which input files should be copied at level 1 (i.e. before the execution of any script)
     50       and in which directory they must be copied in,
     51   1. the file '''routine_level1''' specifies which scripts should be executed first (usually ./bin/newprocess)
     52   1. the file '''move_files_level2'''
     53       which specifies which input files should be copied at level 2 (i.e. after the execution of the scripts mentioned in the file routine_level1)
     54       and in which directory they must be copied in,
     55   1. the file '''routine_level2''' specifies which scripts should be executed at level 2 (such as ./bin/generate_events)
     56   1. the file '''dir_test.py''' which specifies how to extract the results to be compared with the expected one (see section [http://cp3wks05.fynu.ucl.ac.be/twiki/bin/view/Software/TestProgram#How_to_write_dir_test_py how define dir_test.py])
     57   1. the file '''expected_results.txt''' which contains the reference results.
     58
     59Note: the above files can also be placed in the directory '''test_????'''. They are then used in case there is no such file in the '''fast_????''' (or '''full_????''') directory.
     60
     61== How does it work? ==
     62   1. The script test.py copies the directory "Template" into "Auto_test_???"
     63   1. It copies the input files according to the prescription given in '''move_files_level1'''
     64   1. It launches executables (such as new_process) according to the prescription given in '''routine_level1'''.
     65       The paths are expected to be given from the main directory of the Template copy.
     66   1. It copies the input files according to the prescription given in '''move_files_level2'''
     67   1. It launches executables (such as generate_events) according to the prescription given in '''routine_level2'''.
     68       The paths are expected to be given from the main directory of the Template copy.
     69   1. A python code collects the results.
     70   1. These results are compared to the expected one written in '''expected_results.txt'''
     71
     72
     73== How to implement a new test?  ==
     74
     75
     76   1. First create a new directory in TEST for your module: $>mkdir test_MYMOD
     77   1. $>cd test_MYMOD
     78   1. Create a directory for a specific test $> mkdir fast_NAME or $>mkdir full_NAME
     79   1. $> cd fast_NAME
     80   1. Define the six files  '''move_files_level1''',  '''move_files_level2''', '''routine_level1''' ,  '''routine_level2''', 
     81 '''dir_test.py''', '''expected_results.txt''' and import a copy of  all input cards (or files) in this directory.
     82
     83
     84=== A practical way to develop all those things... ===
     85
     86This is only a proposition of the different step used to devellop a new step
     87   1. Create your new test directory
     88   1. The defines the four files  '''move_files_level1''',  '''move_files_level2''', '''routine_level1''' ,  '''routine_level2''' (this should be easy)
     89   1. Copy the default files /Users/madgraph/TEST/Python_lib/dir_test_default.py in your directory '''fast_????''' (respectively '''full_????''')
     90   1. Change his name in dir_test.py
     91   1. Launch the test: (in TEST)$> ./test.py test_????/fast_????  (respectively for full)
     92   1. Edit the value of actif and put this value to zero (avoid the overwriting of the Template copy and the execution of the different test script)
     93   1. Implement your python (or external) routine and test this one with  (in TEST)$> ./test.py test_MYMOD/fast_MYTEST
     94   1. When the last step  works correctly, remove the line actif=0 of the file dir_test.py
     95   1. Copy the file test_result.dat in 'expected_result.dat': (in fast_???) $> cp test_results.dat expected_results.dat
     96   1. add the third column (precision requirment) in the file expected_results.dat
     97   1. launch completly your test to be sure that everithing is fine. (in TEST)$> ./test.py test_MYMOD/fast_MYTEST
     98   1. store your module on the cvs
     99
     100=== How to write input files? ===
     101==== How to write  "move_files_level1" and  "move_files_level2" ? ====
     102
     103 This files contains two columns.
     104   1. The first one indicates the name of the files to copy (path starting from directory '''fast_????''' (or '''full_????''')
     105   1. The second indicates where to copy the files (path starting from the main directory of the Template copy)
     106All lines begining with a # not taking into account
     107
     108==== How to write "routine_level1" and "routine_level2"? ====
     109
     110Those files are simply batch files. They will be executed from the main directory of the Template copy.
     111A good way to code those files will be to redirect all the output.
     112
     113==== How to write "dir_test.py" ? ====
     114
     115   1. First copy the file /Users/madgraph/TEST/Python_lib/dir_test_default.py in your fast_???? (or full_????) directory
     116   1. Change his name in dir_test.py
     117   1. Then follows the instruction inside (All the line starting with '#>>' indicates an action to perform).
     118
     119This files indicates how to use an external programs and what you have to do if you choose to implement your python code.
     120
     121==== How to write "expected_results.txt" ?  ====
     122This files must contains three columns
     123   1. the first one is of string symbolizing the result (this string must be unique)
     124   1. The second one is the expected value
     125   1. The third one is the difference pourcentage authorize without warning.
     126      a. if you want to compare string put 's'
     127      a. if you want to have exact value put '0'
     128
     129==== How to write "test_results.txt" ?  ====
     130If you choose to develop your own code to collect data, you have to write explicitly the file 'test_result.txt' (in the directory '''fast_????''' or '''full_????''')
     131This files must contains two columns
     132   1. The first one is of string symbolizing the result (this string must be unique)
     133   1. The second one is the related value
     134
     135
     136== Discussion/Idea?  ==
     137
     138
     139
     140
     141-- Main.OlivierMattelaer - 18 Nov 2008