source: XIOS/tools/FCM/test/perform_test @ 1293

Last change on this file since 1293 was 81, checked in by ymipsl, 11 years ago

ajout FCM 1.5

File size: 4.8 KB
Line 
1echo "$(date): Running $test_name ..."
2THIS_RUN_DIR=$RUN_DIR/$test_name
3rm -rf $THIS_RUN_DIR
4mkdir $THIS_RUN_DIR
5cd $THIS_RUN_DIR
6if [[ $mirror == remote ]]; then
7  export THIS_RUN_DIR_HPC=$RUN_DIR_HPC/$test_name
8fi
9
10NPROC=${NPROC:-1}
11let count=1
12for this_cfg in $cfg_name
13do
14  extract=$(eval "echo \$extract_$count")
15  build=$(eval "echo \$build_$count")
16  run=$(eval "echo \$run_$count")
17  if [[ $DEBUG == true ]]; then
18    echo "Running extract ($count) ..."
19  fi
20  fcm extract -v 2 $REPOS_URL/trunk/cfg/$this_cfg.cfg >../$test_name.extract.stdout.$count 2>../$test_name.extract.stderr.$count
21  RC=$?
22  if [[ $extract == fail ]]; then
23    if [[ $RC == 0 ]]; then
24      echo "FAILED: $test_name ($count) extract did not fail"
25      exit 1
26    fi
27  elif [[ $extract == fail_known ]]; then
28    if [[ $RC == 0 ]]; then
29      echo "FAILED: $test_name ($count) extract did not fail as expected (known problem fixed?)"
30      exit 1
31    else
32      if [[ $DEBUG == true ]]; then
33        echo "Known problem: $test_name ($count) extract failed"
34      fi
35      break
36    fi
37  elif [[ $extract == succeed_known ]]; then
38    if [[ $RC == 0 ]]; then
39      if [[ $DEBUG == true ]]; then
40        echo "Known problem: $test_name ($count) extract did not fail"
41      fi
42      break
43    else
44      echo "FAILED: $test_name ($count) extract did not succeed as expected (known problem fixed?)"
45      exit 1
46    fi
47  else
48    if [[ $RC != 0 ]]; then
49      echo "FAILED: $test_name ($count) extract failed"
50      exit 1
51    else
52      if [[ $mirror == local ]]; then
53        cd ${THIS_RUN_DIR}_mirror
54      elif [[ $mirror == remote ]]; then
55        echo "$test_name" >> $BATCH_DIRS
56        break
57      fi
58      if [[ $DEBUG == true ]]; then
59        echo "Running build ($count) ..."
60      fi
61      export command_file=$RUN_DIR/$test_name.build.commands.$count
62      fcm build -v 2 -j $NPROC >../$test_name.build.stdout.$count 2>../$test_name.build.stderr.$count
63      RC=$?
64      if [[ $build == fail ]]; then
65        if [[ $RC == 0 ]]; then
66          echo "FAILED: $test_name ($count) build did not fail"
67          exit 1
68        fi
69      elif [[ $build == fail_known ]]; then
70        if [[ $RC == 0 ]]; then
71          echo "FAILED: $test_name ($count) build did not fail as expected (known problem fixed?)"
72          exit 1
73        else
74          if [[ $DEBUG == true ]]; then
75            echo "Known problem: $test_name ($count) build failed"
76          fi
77          break
78        fi
79      elif [[ $build == succeed_known ]]; then
80        if [[ $RC == 0 ]]; then
81          if [[ $DEBUG == true ]]; then
82            echo "Known problem: $test_name ($count) build did not fail"
83          fi
84          break
85        else
86          echo "FAILED: $test_name ($count) build did not succeed as expected (known problem fixed?)"
87          exit 1
88        fi
89      else
90        if [[ $RC != 0 ]]; then
91          echo "FAILED: $test_name ($count) build failed"
92          exit 1
93        else
94          if [[ $run != no ]]; then
95            exe_name=hello.sh
96            env_file=fcm_env.sh
97            if [[ ! -a $env_file ]]; then
98              echo "FAILED: $test_name ($count) env file does not exist"
99              exit 1
100            else
101              . $env_file
102              if [[ $DEBUG == true ]]; then
103                echo "Running executable ($count) ..."
104              fi
105              $exe_name >../$test_name.exe.stdout.$count 2>../$test_name.exe.stderr.$count
106              RC=$?
107              if [[ $run == fail ]]; then
108                if [[ $RC == 0 ]]; then
109                  echo "FAILED: $test_name ($count) run did not fail"
110                  exit 1
111                fi
112              elif [[ $run == fail_known ]]; then
113                if [[ $RC == 0 ]]; then
114                  echo "FAILED: $test_name ($count) run did not fail as expected (known problem fixed?)"
115                  exit 1
116                else
117                  if [[ $DEBUG == true ]]; then
118                    echo "Known problem: $test_name ($count) run failed"
119                  fi
120                  break
121                fi
122              elif [[ $run == succeed_known ]]; then
123                if [[ $RC == 0 ]]; then
124                  if [[ $DEBUG == true ]]; then
125                    echo "Known problem: $test_name ($count) run did not fail"
126                  fi
127                  break
128                else
129                  echo "FAILED: $test_name ($count) run did not succeed as expected (known problem fixed?)"
130                  exit 1
131                fi
132              else
133                if [[ $RC != 0 ]]; then
134                  echo "FAILED: $test_name ($count) run failed"
135                  exit 1
136                fi
137              fi
138            fi
139          fi
140        fi
141      fi
142    fi
143  fi
144  let count=count+1
145done
146
147if [[ $TYPE == control ]]; then
148  touch $THIS_RUN_DIR/.tests.complete
149else
150  cd $BASE_DIR
151  ./compare_results $test_name
152fi
Note: See TracBrowser for help on using the repository browser.