New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
run_tests in vendors/fcm/current/test – NEMO

source: vendors/fcm/current/test/run_tests @ 1980

Last change on this file since 1980 was 1980, checked in by flavoni, 14 years ago

importing fcm vendor

File size: 4.9 KB
Line 
1#!/bin/ksh
2
3while getopts ":c:t:flradgh" opt
4do
5  case $opt in
6    c ) CONTROL_URL=$OPTARG ;;
7    t ) TEST_URL=$OPTARG ;;
8    f ) FUNC_TESTS=true ;;
9    l ) LOCAL_TESTS=true ;;
10    r ) REMOTE_TESTS=true ;;
11    a ) FUNC_TESTS=true
12        LOCAL_TESTS=true
13        REMOTE_TESTS=true ;;
14    d ) DELETE=true ;;
15    g ) DEBUG=true ;;
16    h ) HELP=true ;;
17    \? ) echo "Invalid option"
18        HELP=true
19        break ;;
20  esac
21done
22if [[ $# != $(($OPTIND - 1)) ]]; then
23  echo "Invalid argument"
24  HELP=true
25fi
26
27if [[ $HELP == true ]]; then
28 echo 'Usage: run_tests [options]'
29 echo 'Valid options:'
30 echo '-c URL'
31 echo '   Generate the control results using the version of FCM at "URL"'
32 echo '-t URL'
33 echo '   Generate the test results using the version of FCM at "URL"'
34 echo '-f'
35 echo '   Perform the functional tests'
36 echo '-l'
37 echo '   Perform the local performance tests'
38 echo '-r'
39 echo '   Perform the remote performance tests'
40 echo '-a'
41 echo '   Perform all the tests (equivalent to -flr)'
42 echo '-d'
43 echo '   Remove any previous test results before starting'
44 echo '-g'
45 echo '   Output additional diagnostics'
46 echo '-h'
47 echo '   Print this help message'
48 exit 1
49fi
50
51if [[ -n "$CONTROL_URL" ]]; then
52  TYPES="control"
53fi
54if [[ -n "$TEST_URL" ]]; then
55  TYPES="$TYPES test"
56fi
57if [[ -z "$TYPES" ]]; then
58  echo "Either a control or a test URL must be specified"
59  exit 1
60fi
61
62export HPC=hpc1e
63export BASE_DIR_HPC=$(ssh $HPC 'echo $PWD')/fcm_test_suite
64
65export BASE_DIR=$LOCALTEMP/fcm_test_suite
66if [[ $DELETE == true ]]; then
67  if [[ $DEBUG == true ]]; then
68    echo "Removing any previous test directory ..."
69  fi
70  rm -rf $BASE_DIR
71  ssh $HPC "rm -rf $BASE_DIR_HPC"
72fi
73mkdir -p $BASE_DIR
74
75export REPOS_DIR=$BASE_DIR/test_svn
76export REPOS_URL="file://$REPOS_DIR"
77if [[ ! -d $REPOS_DIR ]]; then
78  echo "$(date): Creating test repository ..."
79  ./create_repos > $BASE_DIR/repos.stdout 2> $BASE_DIR/repos.stderr
80fi
81
82cp compare_results $BASE_DIR
83PATH_BASE=$PWD/wrapper_scripts:$PATH:~opsrc/ops0/mpi/mpich2-1.0.8p1-ukmo-v2/ifort-10/bin
84
85export DEBUG
86export TYPE
87for TYPE in $TYPES
88do
89  if [[ $TYPE == test ]]; then
90    URL=$TEST_URL
91  else
92    URL=$CONTROL_URL
93  fi
94  URL_BASE=${URL%@*}
95  REV=${URL#$URL_BASE}
96  URL=$URL_BASE$REV
97  fcm ls $URL/bin/fcm >/dev/null 2>&1
98  if [[ $? != 0 ]]; then
99    echo 'URL must be a URL or the path to a working copy of the FCM project tree'
100    exit 1
101  fi
102  echo FCM version to be used:
103  fcm info $URL | grep URL
104  fcm info $URL | grep Revision
105
106  export RUN_DIR=$BASE_DIR/$TYPE
107  rm -rf $RUN_DIR
108  mkdir $RUN_DIR
109
110  if [[ $DEBUG == true ]]; then
111    echo "Creating local copy of FCM ..."
112  fi
113  fcm export -q $URL $RUN_DIR/fcm
114  echo "set::url::test_suite $REPOS_URL" >>$RUN_DIR/fcm/etc/fcm.cfg
115  export PATH=$RUN_DIR/fcm/bin:$PATH_BASE
116
117  if [[ $FUNC_TESTS == true ]]; then
118    . ./tests_functional.list
119    export COMPARE_TIMES=false
120    let failed=0
121    for TEST in $TESTS
122    do
123      ./test_scripts/$TEST
124      if [[ $? != 0 ]]; then
125        let failed=failed+1
126      fi
127    done
128
129    echo "$(date): Functional tests finished"
130    if [[ $failed == 0 ]]; then
131      echo "SUMMARY: All functional tests succeeded"
132    else
133      echo "SUMMARY: $failed functional tests failed"
134    fi
135  fi
136
137  if [[ $LOCAL_TESTS == true ]]; then
138    . ./tests_perf_local.list
139    export COMPARE_TIMES=true
140    let failed=0
141    for TEST in $TESTS
142    do
143      ./test_scripts/$TEST
144      if [[ $? != 0 ]]; then
145        let failed=failed+1
146      fi
147    done
148
149    echo "$(date): Local performance tests finished"
150    if [[ $failed == 0 ]]; then
151      echo "SUMMARY: All local performance tests succeeded"
152    else
153      echo "SUMMARY: $failed local performance tests failed"
154    fi
155  fi
156
157  if [[ $REMOTE_TESTS == true ]]; then
158    if [[ $DEBUG == true ]]; then
159      echo "Copying files to HPC platform ..."
160    fi
161    export RUN_DIR_HPC=$BASE_DIR_HPC/$TYPE
162    ssh $HPC "rm -rf $RUN_DIR_HPC"
163    ssh $HPC "mkdir -p $RUN_DIR_HPC"
164    rsync -a --rsh="ssh" $RUN_DIR/fcm $HPC:$RUN_DIR_HPC
165    rsync -a --rsh="ssh" compare_results report_hpc_results $HPC:$BASE_DIR_HPC
166
167    BATCH_SCRIPT_NAME=hpc_batch.sh
168    export BATCH_DIRS_NAME=hpc_dirs.sh
169    export BATCH_SCRIPT=$RUN_DIR/$BATCH_SCRIPT_NAME
170    ./create_hpc_batch_script
171    export BATCH_DIRS=$RUN_DIR/$BATCH_DIRS_NAME
172
173    echo 'TESTS="' >$BATCH_DIRS
174    . ./tests_perf_remote.list
175    let failed=0
176    for TEST in $TESTS
177    do
178      ./test_scripts/$TEST
179      if [[ $? != 0 ]]; then
180        let failed=failed+1
181      else
182        SUBMIT_REMOTE=true
183      fi
184    done
185    echo '"' >>$BATCH_DIRS
186
187    if [[ $SUBMIT_REMOTE == true ]]; then
188      echo "$(date): Submitting HPC build job ..."
189      rsync -a --rsh="ssh" $BATCH_SCRIPT $BATCH_DIRS $HPC:$RUN_DIR_HPC
190      ssh $HPC "llsubmit $RUN_DIR_HPC/$BATCH_SCRIPT_NAME"
191    fi
192
193    echo "$(date): HPC performance tests finished"
194    if [[ $failed == 0 ]]; then
195      echo "SUMMARY: All HPC performance tests succeeded"
196    else
197      echo "SUMMARY: $failed HPC performance tests failed"
198    fi
199  fi
200done
Note: See TracBrowser for help on using the repository browser.