source: trunk/WRF.COMMON/WRFV2/tools/DOMAIN_TIME_TEST/DOMAIN_TIME_TEST.csh @ 3547

Last change on this file since 3547 was 11, checked in by aslmd, 14 years ago

spiga@svn-planeto:ajoute le modele meso-echelle martien

  • Property svn:executable set to *
File size: 2.8 KB
Line 
1#!/bin/csh
2#
3#  DOMAIN_TIME_TEST.csh wrf_ascii_output test_case
4#
5#  Extract domain self-test results from WRF ASCII output file
6#  "wrf_ascii_output" and compare with known-good results, echoing
7#  "PASS" iff results match.  Note that these tests are normally turned off
8#  but may be enabled by setting namelist variable self_test_domain to .true.
9#  in namelist /time_control/ .  This script looks in the directory in which
10#  it resides to locate files that contain known-good test output.  Second
11#  argument "test_case" is used to determine which known-good file to compare
12#  against via the naming convention: 
13#    DOMAIN_TIME_TEST.${test_case}.correct
14#
15#  If the test passes, the following string is echoed by itself: 
16#    "PASS   DOMAIN_TIME_TEST.csh $test_case"
17#
18#  If the test fails, the following string is echoed along with other
19#  diagnostics: 
20#    "FAIL   DOMAIN_TIME_TEST.csh $test_case"
21#
22#  In the event of an error (file not found, etc.) the following string is
23#  echoed along with other diagnostics:
24#    "ERROR  DOMAIN_TIME_TEST.csh $test_case"
25#  Note that in this case, $test_case is left off if not specified as an
26#  argument. 
27#
28#  This script must be run using a fully-qualified path as it deduces the
29#  location of correct test results from this path. 
30#
31#  EXAMPLE (running from test/em_real):
32#   >> ../../tools/DOMAIN_TIME_TEST/DOMAIN_TIME_TEST.csh rsl.out.0000 jan00_12hr
33#   PASS   DOMAIN_TIME_TEST.csh jan00_12hr
34#
35#
36#  AUTHOR:
37#    Tom Henderson    NCAR/MMM
38#
39#  DATE:
40#    20060316
41#
42
43set selflong = $0
44set self = $selflong:t
45set scriptdir = $selflong:h
46
47if ( $#argv != 2 ) then
48  echo "ERROR  ${self}"
49  echo "ERROR:  Must specify a WRF ASCII output file as first argument and "
50  echo "ERROR:  name of test case as second argument."
51  echo "USAGE:  ${self} wrf_ascii_output test_case"
52  echo "EXAMPLE:  ${selflong} rsl.out.0000 jan00_12hr"
53  exit 10
54endif
55
56set ascii_file = $1
57set test_case = $2
58set pid = $$
59set correct_file = "${scriptdir}/DOMAIN_TIME_TEST.${test_case}.correct"
60set tmp_file = "DOMAIN_TIME_TEST.${test_case}.${pid}.tmp"
61
62if ( ! -f $ascii_file ) then
63  echo "ERROR  ${self} ${test_case}"
64  echo "ERROR:  could not find WRF ASCII output file ${ascii_file}"
65  exit 20
66endif
67if ( ! -f $correct_file ) then
68  echo "ERROR  ${self} ${test_case}"
69  echo "ERROR:  could not find correct test results file ${correct_file}"
70  exit 30
71endif
72
73\rm -f ${tmp_file}
74grep DOMAIN_TIME_TEST $ascii_file >! ${tmp_file} || echo "ERROR  ${self} ${test_case}:  could not grep file ${ascii_file}" && exit 40
75
76if ( ! `diff ${correct_file} ${tmp_file} | wc -c` ) then
77  echo "PASS   ${self} ${test_case}"
78  \rm -f ${tmp_file}
79else
80  echo "FAIL   ${self} ${test_case}"
81  echo "FAIL:  Differences follow:"
82  echo "diff ${correct_file} ${tmp_file}"
83  diff ${correct_file} ${tmp_file}
84  \rm -f ${tmp_file}
85  exit 50
86endif
87
88exit 0
89
Note: See TracBrowser for help on using the repository browser.