source: CONFIG/UNIFORM/v5/diff_configurations.ksh @ 2053

Last change on this file since 2053 was 1742, checked in by jgipsl, 13 years ago

Changed name for directory USER_SPEC into EXPERIMENTS.

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