[1691] | 1 | #!/bin/ksh |
---|
| 2 | # |
---|
[1742] | 3 | # Use this script to test if files are the same in all configurations in this directory. All files in the GENERAL, POST and EXPERIMENTS |
---|
[1691] | 4 | # directories with the same name and path should be the identic before commit to svn. The difference between configurations are the |
---|
| 5 | # scripts for compiling and which files are available. |
---|
| 6 | # |
---|
| 7 | # Syntax |
---|
| 8 | # To test all files in all configurations : |
---|
| 9 | # ./diff_configuration.ksh |
---|
| 10 | # To test the files file1 and file2 in all configurations : |
---|
| 11 | # ./diff_configuration.ksh file1 file2 |
---|
| 12 | # |
---|
| 13 | # Josefine Ghattas IPSL |
---|
| 14 | |
---|
| 15 | BaseDir=`pwd` |
---|
[2210] | 16 | ConfigFamily=v6 |
---|
[1691] | 17 | ConfigList=`ls |grep ${ConfigFamily} |grep -v out` |
---|
[2954] | 18 | #ConfigList=$ConfigList" IPSLCM6 IPSLCM6CHT" |
---|
[3110] | 19 | ConfigList="LMDZOR_v6 LMDZORSTRATAER_v6" |
---|
[1691] | 20 | verbose=no |
---|
| 21 | echo All configurations to tests : $ConfigList |
---|
| 22 | |
---|
| 23 | if [ $# == 0 ] ; then |
---|
| 24 | TestAll="yes" |
---|
| 25 | echo "Test all files." |
---|
| 26 | else |
---|
| 27 | TestAll="no" |
---|
| 28 | FileList0=$* |
---|
| 29 | echo "Test only following files : $FileList0" |
---|
| 30 | fi |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | for conf in $ConfigList ; do |
---|
| 34 | # Construct list of files to test |
---|
| 35 | if [ $TestAll = "yes" ] ; then |
---|
[1742] | 36 | FileList=`ls -d ${conf}/GENERAL/DRIVER/* ${conf}/GENERAL/PARAM/* ${conf}/GENERAL/POST/* ${conf}/EXPERIMENTS/*/*/* ${conf}/EXPERIMENTS/*/*/*/*` |
---|
[1691] | 37 | else |
---|
| 38 | FileList="" |
---|
| 39 | for file in $FileList0 ; do |
---|
| 40 | FileList=$( echo $FileList `ls ${conf}/GENERAL/*/$file`) |
---|
| 41 | done |
---|
| 42 | fi |
---|
| 43 | |
---|
| 44 | for conf2 in $ConfigList ; do |
---|
| 45 | if [ $conf2 != $conf ] ; then |
---|
| 46 | for file in $FileList ; do |
---|
| 47 | # Remove conf from path |
---|
| 48 | file=$( echo $file | awk -F"${conf}/" '{print $2}' ) |
---|
| 49 | |
---|
| 50 | # Test if the file exists also in second directory, if yes test difference |
---|
| 51 | if [ -f ${conf2}/${file} ] ; then |
---|
| 52 | # Test if files are different |
---|
| 53 | cmp -s ${conf}/${file} ${conf2}/${file} |
---|
| 54 | if [ $? -ne 0 ] ; then |
---|
| 55 | diff --brief ${conf}/${file} ${conf2}/${file} |
---|
| 56 | if [ $verbose == yes ] ; then |
---|
| 57 | diff ${conf}/${file} ${conf2}/${file} |
---|
| 58 | echo |
---|
| 59 | fi |
---|
| 60 | fi |
---|
| 61 | fi |
---|
| 62 | done |
---|
| 63 | fi |
---|
| 64 | done |
---|
| 65 | |
---|
| 66 | done |
---|