source: CONFIG/UNIFORM/v6/diff_configurations.ksh @ 2642

Last change on this file since 2642 was 2509, checked in by jgipsl, 7 years ago

Copied modifications done in LMDZOR_v6 into the other configurations. These modifications are related to cosp and time series.

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/bin/ksh
2#
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
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
15BaseDir=`pwd`
16ConfigFamily=v6
17ConfigList=`ls |grep ${ConfigFamily} |grep -v out`
18ConfigList=$ConfigList" IPSLCM6 IPSLCM6CHT"
19verbose=no
20echo All configurations to tests : $ConfigList
21
22if [ $# == 0 ] ; then
23    TestAll="yes"
24    echo "Test all files."
25else
26    TestAll="no"
27    FileList0=$*
28    echo "Test only following files : $FileList0"
29fi
30
31
32for conf in $ConfigList ; do
33    # Construct list of files to test
34    if [ $TestAll = "yes" ] ; then
35        FileList=`ls -d ${conf}/GENERAL/DRIVER/* ${conf}/GENERAL/PARAM/* ${conf}/GENERAL/POST/* ${conf}/EXPERIMENTS/*/*/* ${conf}/EXPERIMENTS/*/*/*/*`
36    else
37        FileList=""
38        for file in $FileList0 ; do
39            FileList=$( echo $FileList `ls ${conf}/GENERAL/*/$file`)
40        done
41    fi
42
43    for conf2 in $ConfigList ; do
44        if [ $conf2 != $conf ] ; then
45            for file in $FileList ; do
46                # Remove conf from path
47                file=$( echo $file | awk -F"${conf}/" '{print $2}' )
48               
49                # Test if the file exists also in second directory, if yes test difference
50                if [ -f ${conf2}/${file} ] ; then 
51                    # Test if files are different
52                    cmp -s ${conf}/${file}  ${conf2}/${file}
53                    if [ $? -ne 0 ] ; then
54                        diff --brief ${conf}/${file}  ${conf2}/${file}
55                        if [ $verbose == yes ] ; then
56                            diff  ${conf}/${file}  ${conf2}/${file}
57                            echo
58                        fi
59                    fi
60                fi
61            done
62        fi
63    done
64   
65done
Note: See TracBrowser for help on using the repository browser.