source: branches/dev-5819/jm_tests.in @ 13909

Last change on this file since 13909 was 13909, checked in by randersson, 5 weeks ago

#5819 Reverted r13092-r13095 because it seems that number of make processes escalates

File size: 19.5 KB
Line 
1#!/bin/bash
2# Script for running JModelica.org test suites.
3# Copy this file to somewhere in your PATH.
4# You may need to change variables below (in the copy) to match your system.
5# Type "tests -h" for usage.
6# Requires Unix-like system with bash, grep, dc, mktemp, uname and sed.
7
8merge_path() {
9  if [ "$1" = "" ]; then
10    if [ "$3" = "" ]; then
11      echo $2
12    else
13      echo $3@SEP@$2
14    fi
15  else
16    echo $1@SEP@$2
17  fi
18}
19
20# ====== Variables to set ======
21
22# Memory allocation for the ant process
23ANT_OPTS="-Xmx4g"
24
25# Default tests - run if no tests are chosen
26# Possible values: modelica, optimica, python or combination (e.g. "modelica optimica")
27DEFAULT_TESTS="optimica python"
28
29# Default arguments - always parse these arguments before command line
30DEFAULT_ARGS=""
31
32# Variables set by configure script
33JMODELICA_HOME="@prefix@"
34JMODELICA_SRC="@abs_top_srcdir@"
35IPOPT_HOME="@IPOPT_HOME@"
36IPOPT32_HOME="@IPOPT_HOME@"
37IPOPT64_HOME="@IPOPT64_HOME@"
38PYTHON64_HOME="@PYTHON64_HOME@"
39PYTHON32_HOME="@PYTHON_HOME@"
40SUNDIALS_HOME="@prefix@/ThirdParty/Sundials"
41CASADI_HOME="@prefix@/ThirdParty/CasADi"
42CASADI64_HOME="@prefix@/ThirdParty/CasADi64"
43CASADI_INTERFACE_HOME="@prefix@/lib/casadi_interface"
44CASADI_INTERFACE_HOME64="@prefix@/lib/casadi_interface64"
45CASADI_INTERFACE_HOME32=${CASADI_INTERFACE_HOME}
46ECLIPSE_HOME="@ECLIPSE_HOME@"
47JPYPE32_JVM="@JVMDLL_HOME@/jvm.dll"
48JPYPE64_JVM="@JVMDLL64_HOME@/jvm.dll"
49ORIG_PATH="@ORIG_PATH@"
50BUILD="@abs_builddir@"
51if [[ "${JAVA_HOME}" == "" ]]; then
52  JAVA_HOME="@_JAVA_HOME_@"
53fi
54
55if [[ "${PYTHON64_HOME}" != "" ]]; then
56DEFAULT_TESTS="${DEFAULT_TESTS} python64"
57fi
58
59# ====== End variables to set ======
60
61# Configure Bash
62set -o pipefail
63
64PYTHONPATH64="${JMODELICA_HOME}/Python_64/"
65PYTHONPATH32="$(merge_path "${PYTHONPATH}" "${JMODELICA_HOME}/Python/")"
66PYTHONPATH="$PYTHONPATH32"
67
68# To know if we are running python 64 tests
69PYTHON64=0
70
71# Default paths to ant files used for unit tests
72if [[ -z "${MC_ANT_ARGS}" ]]; then
73    MC_ANT_ARGS=${JMODELICA_SRC}/Compiler/ModelicaCompiler/build.xml
74fi
75if [[ -z "${OC_ANT_ARGS}" ]]; then
76    OC_ANT_ARGS=${JMODELICA_SRC}/Compiler/OptimicaCompiler/build.xml
77fi
78
79# Find operating system
80SYS="$(uname -s)"
81if [[ "${SYS}" == "Darwin" ]]; then
82  SYS=Mac
83elif [[ "${SYS:0:5}" == "MINGW" ]]; then
84  SYS=Win
85fi
86
87# Update library path
88if [[ "${SUNDIALS_HOME}" != "" ]]; then
89  LIB_PATH="${SUNDIALS_HOME}/lib"
90fi
91if [[ "${IPOPT_HOME}" != "" ]]; then
92  LIB_PATH="$(merge_path "${LIB_PATH}" "${IPOPT_HOME}/lib")"
93fi
94if [[ "${CASADI_HOME}" != "" ]]; then
95  LIB_PATH="$(merge_path "${LIB_PATH}" "${CASADI_HOME}/lib")"
96fi
97if [[ "${LIB_PATH}" != "" ]]; then
98  LD_LIBRARY_PATH="$(merge_path "${LD_LIBRARY_PATH}" "${LIB_PATH}" /lib)"
99fi
100
101# Test sets
102if [[ "${PYTHON64_HOME}" != "" ]]; then
103    test_set_a="modelica optimica python python64"
104    tests="modelica optimica python python64"
105else
106    test_set_a="modelica optimica python"
107    tests="modelica optimica python"
108fi
109test_set_j="modelica optimica"
110test_set_m="modelica"
111test_set_o="optimica"
112test_set_p="python"
113test_set_z="python64"
114
115# Standard set of tags
116TAGS="-a stddist_base -a noncompliantfmi"
117if [[ "${IPOPT_HOME}" != "" ]]; then
118  TAGS="${TAGS} -a ipopt"
119  if [[ "${SYS}" == Win ]]; then
120    TAGS="${TAGS} -a windows_base"
121  fi
122  if [[ -e "${JMODELICA_HOME}/Python/casadi" ]]; then
123    TAGS="${TAGS} -a casadi_base"
124  else
125    echo Skipping casadi tests, since CasADi does not seem to be installed.
126  fi
127fi
128
129# Standard set of tags
130TAGS64="-a stddist_base -a noncompliantfmi"
131if [[ "${IPOPT64_HOME}" != "" ]]; then
132  TAGS64="${TAGS64} -a ipopt"
133  if [[ "${SYS}" == Win ]]; then
134    TAGS64="${TAGS64} -a windows_base"
135  fi
136  if [[ -e "${JMODELICA_HOME}/Python_64/casadi" ]]; then
137    TAGS64="${TAGS64} -a casadi_base"
138  else
139    echo Skipping casadi tests, since CasADi does not seem to be installed.
140  fi
141fi
142
143# Extend with all tests for default version of Python/bitness
144if [[ "${PYTHON64_HOME}" != "" ]]; then
145    TAGS64="${TAGS64} -a stddist_full"
146    if [[ "${IPOPT64_HOME}" != "" ]]; then
147        if [[ "${SYS}" == Win ]]; then
148            TAGS64="${TAGS64} -a windows_full"
149        fi
150        if [[ -e "${JMODELICA_HOME}/Python_64/casadi" ]]; then
151            TAGS64="${TAGS64} -a casadi_full"
152        fi
153    fi 
154else
155    TAGS="${TAGS} -a stddist_full"
156    if [[ "${IPOPT_HOME}" != "" ]]; then
157        if [[ "${SYS}" == Win ]]; then
158            TAGS="${TAGS} -a windows_full"
159        fi
160        if [[ -e "${JMODELICA_HOME}/Python/casadi" ]]; then
161            TAGS="${TAGS} -a casadi_full"
162        else
163            echo Skipping casadi tests, since CasADi does not seem to be installed.
164        fi
165    fi
166fi
167
168# Functions for running specific tests
169function modelica_tests() {
170  junit_test Modelica
171}
172
173function optimica_tests() {
174  echo "in optimica_tests()"
175  junit_test Optimica
176}
177
178TESTS_DIR="${JMODELICA_HOME}/Python/tests_jmodelica"
179function find_python_tests() {
180  if [[ "${TESTS}" == "" ]]; then
181    TESTS="$(find ${TESTS_DIR} -name \*.py | grep test_)"
182  fi
183}
184
185function python_tests() {
186  TEST_DIR="$(pwd)/tests_$(date "+%F_%H-%M-%S")"
187  mkdir ${TEST_DIR}
188  print_name Python
189  res=0
190  echo "in python_tests OUTPUT=${OUTPUT}"
191  echo "in python_tests  TEST_DIR=${TEST_DIR}"
192  case ${OUTPUT} in
193    v)
194      if build_jmodelica 2>&1 | log; then
195        find_python_tests
196        cd ${TEST_DIR}
197        python_tests_v || res=1
198      fi
199      ;;
200    q)
201      if build_jmodelica 2>&1 | log > /dev/null; then
202        find_python_tests
203        cd ${TEST_DIR}
204        python_tests_q | filter_python_separate || res=1
205      else
206        echo BUILD FAILED
207      fi
208      ;;
209    n)
210      if [[ "${NO_BUILD_JMODELICA}" != "1" ]]; then
211        echo "OUTPUT=${OUTPUT}"
212        echo "NO_BUILD_JMODELICA=${NO_BUILD_JMODELICA}"
213        echo Building...
214      fi
215      if build_jmodelica | log > /dev/null; then
216        find_python_tests
217        cd ${TEST_DIR}
218        python_tests_n | filter_python_separate || res=1
219      fi
220      ;;
221  esac
222  if [ ! "${KEEP_PYTHON}" == 1 ]; then
223    cd ..
224    rm -rf ${TEST_DIR}
225  fi
226  return $res
227}
228
229TESTS64_DIR="${JMODELICA_HOME}/Python_64/tests_jmodelica"
230function python64_tests() {
231    # Set necessary paths etc to run 64 bit tests
232    PYTHONPATH=${PYTHONPATH64}
233    PYTHONHOME=${PYTHON64_HOME}
234    JPYPE_JVM=${JPYPE64_JVM}
235    CASADI_LIB_HOME=${CASADI64_HOME}/lib
236    CASADI_INTERFACE_HOME=${CASADI_INTERFACE_HOME64}
237    PATH=${PYTHON64_HOME}:${PYTHON64_HOME}/Scripts:${PYTHON64_HOME}/Lib:${IPOPT64_HOME}/bin:${CASADI_LIB_HOME}:"${PATH}"
238    TESTS32=$TESTS
239    TESTS=$TESTS64
240    TAGS32=$TAGS
241    TAGS=$TAGS64
242    TESTS_DIR=${TESTS64_DIR}
243    PYTHON64=1
244    # Call python_tests
245    res=0
246    python_tests || res=1
247    # Reset to original paths etc that was for original Python
248    TESTS=$TESTS32
249    TAGS=$TAGS32
250    PYTHON64=0
251    PYTHONPATH=${PYTHONPATH32}
252    PYTHONHOME=${PYTHON32_HOME}
253    JPYPE_JVM=${JPYPE32_JVM}
254    CASADI_LIB_HOME=${CASADI_HOME}/lib
255    CASADI_INTERFACE_HOME=${CASADI_INTERFACE_HOME32}
256    PATH="${ORIG_PATH}"
257    TESTS_DIR="${JMODELICA_HOME}/Python/tests_jmodelica"
258    return $res
259}
260
261function python_tests_v() {
262    res=0
263    for TEST in ${TESTS}; do
264      echo ""
265      echo "Running ${TEST}"
266      # echo ${TEST} | sed -e 's!^.*jmodelica.!Running !'
267      nose_test ${TEST} \
268      | log \
269      || res=1
270    done
271    return $res
272}
273
274function python_tests_q() {
275    res=0
276    for TEST in ${TESTS}; do
277      echo "" | log > /dev/null
278      echo ${TEST} | sed -e 's!^.*jmodelica.!Running !' | log > /dev/null
279      nose_test ${TEST} 2>&1 \
280      | log \
281      | sed -n -e 's!^OK$!PASSED!ip' -e 's!^FAILED !TEST FAILED!p' \
282      || (res=1 && echo NOSETESTS_NOT_OK)
283    done
284    return $res
285}
286
287function python_tests_n() {
288    PATTERN="[-=]{40,}"
289    res=0
290    for TEST in ${TESTS}; do
291      echo "" | log
292      echo ${TEST} | sed -e 's!^.*jmodelica.!Running !' | log
293      nose_test ${TEST} 2>&1 \
294      | log \
295      | egrep -v '^Exception .* ignored$' \
296      | egrep -A500 "${PATTERN}" \
297      | sed -e 's!^OK$!PASSED!' -e 's!^FAILED !TEST FAILED!' \
298      || (res=1 && echo NOSETESTS_NOT_OK)
299    done
300    return $res
301}
302
303# Helper functions
304function print_name() {
305  if [[ "${OUTPUT}" == q ]]; then
306    echo -n "$1... "
307  else
308    echo ======= $1 =======
309  fi
310}
311
312function log() {
313  if [ "${LOG}" == 1 ]; then
314      tee -a "${LOGFILE}"
315  else
316      cat
317  fi
318}
319
320function filter_python_separate() {
321  TMP=$(mktemp -q /tmp/jm_tests.XXXXXX 2>/dev/null) 
322  tee ${TMP} | egrep -v "(PASSED|TEST FAILED|NOSETESTS_NOT_OK)"
323  cat ${TMP} \
324  | sed -n \
325        -e '1 i\
326            0 0 0' \
327        -e 's!^TEST FAILED(errors=\([0-9]*\))!\1+!p' \
328        -e 's!^TEST FAILED(failures=\([0-9]*\))!r\1+r!p' \
329        -e 's!^TEST FAILED(errors=\([0-9]*\), failures=\([0-9]*\))!\1+r\2+r!p' \
330        -e 's!^NOSETESTS_NOT_OK!sar1+rla!p' \
331        -e '$ a\
332            n[ ]nn[ ]np' \
333  | dc \
334  | sed \
335    -e 's!0 0 [1-9].*!CRASHED!' \
336    -e 's!0 0 0!PASSED!' \
337    -e 's!\([0-9]\+\) \([0-9]\+\) .*!TEST FAILED (errors=\1, failures=\2)!'
338  rm -f ${TMP}
339}
340 
341function junit_test() {
342  print_name $1
343  cd ${BUILD}/java
344  echo "doing ls..."
345  ls -la
346  res=0
347  case ${OUTPUT} in
348    v) junit_test_v $1 || res=1 ;;
349    q) junit_test_q $1 || res=1 ;;
350    n) junit_test_n $1 || res=1 ;;
351  esac
352  if [ -n "${XML_RES_PATH:-}" ]; then
353    cp "${BUILD}/doc/junit-reports/TESTS-TestSuites.xml" "${XML_RES_PATH}"
354  fi
355  return $res
356}
357
358function junit_test_v() {
359    res=0
360    ant_test $1 2>&1 \
361        | log \
362        || res=1
363    return $res
364}
365
366function junit_test_q() {
367    res=0
368    ant_test $1 2>&1 \
369        | log \
370        | egrep "(\[(jastadd|junit)\]|BUILD FAILED|\[java\] Error when parsing file:)" \
371        | sed -n \
372            -e '1 i\
373                0 0' \
374            -e 's!^.*\[jastadd\] \(Semantic errors\|Syntax error\).*$!BUILD FAILED!' \
375            -e 's!^.*\[java\] Error when parsing file:.*$!BUILD FAILED!' \
376            -e 's!^.*Failures: \([0-9]*\), Errors: \([0-9]*\),.*$!r\1+r\2+!p' \
377            -e 's!^.*\(BUILD FAILED\).*$![\1]pq!p' \
378            -e '$ a\
379                [errors=]nn[, failures=]np' \
380        | dc \
381        | sed \
382            -e 's!errors=0, failures=0!PASSED!' \
383            -e 's!\(errors=.*, failures=.*\)!TEST FAILED (\1)!' \
384        || res=1
385    return $res
386}
387
388function junit_test_n() {
389    echo "in junit_test_n"
390    res=0
391    ant_test $1 \
392        | log \
393        | egrep "(\[junit\]|\[(java|jastadd)\].*([Ee]rror|[A-Za-z.]*:[1-9][0-9]*))" \
394        || res=1
395    return $res
396}
397
398function nose_test() {
399  nosetests `compute_nose_extra_args "${TEST}"` ${TAGS} -v $1
400}
401
402function ant_test() {
403  echo "MC_ANT_ARGS=${MC_ANT_ARGS}"
404  echo "OC_ANT_ARGS=${OC_ANT_ARGS}"
405  echo "BUILD=${BUILD}"
406  echo "CLEAN_JUNIT=${CLEAN_JUNIT}"
407    if [[ "$1" == "Modelica" ]]; then
408        ant -f ${MC_ANT_ARGS} -Dtarget=${BUILD} ${CLEAN_JUNIT} test
409    else
410        ant -f ${OC_ANT_ARGS} -Dtarget=${BUILD} ${CLEAN_JUNIT} test
411    fi
412  echo "about to ls"
413  ls -la ${BUILD}
414}
415
416function build_jmodelica() {
417  if [[ "${NO_BUILD_JMODELICA}" != "1" ]]; then
418    if [[ -d ${BUILD} ]]; then
419      cd ${BUILD}
420      ${CLEAN_BUILD}
421      make && make install
422    else
423      echo Cannot build, build dir does not exist!
424      exit 1
425    fi
426  fi
427}
428
429function switch_test_flags() {
430  STATE=0
431  for a in $*; do
432    if [[ "${test[${!a}]}" != 1 ]]; then
433      STATE=1
434    fi
435  done
436  for a in $*; do
437    test[${!a}]=${STATE}
438  done
439}
440
441function compute_nose_extra_args() { # Argument is test name
442    if [ -n "${XML_RES_PATH:-}" ]; then
443        RES_FILE_NAME=`echo $1 | sed -e 's!^.*jmodelica.!!g' -e 's!/!_!g'`
444        if [[ "$PYTHON64" = 1 ]]; then
445            RES_FILE_NAME="python64_${RES_FILE_NAME}"
446        fi
447        echo --with-xunit --xunit-file=${XML_RES_PATH}/${RES_FILE_NAME}.xml
448    fi
449}
450
451function read_args() {
452  TESTS=
453  TESTS64=
454  ARG_TYPE=flag
455  echo "DEFAULT_ARGS=${DEFAULT_ARGS}"
456  for a in ${DEFAULT_ARGS} "$@"; do
457    echo a=$a
458    if [[ "$(echo $a | head -c1)" == "-" ]]; then
459      ARG_TYPE=flag
460    fi
461    FLAG=0
462    case ${ARG_TYPE} in
463      flag)
464        FLAG=1
465        echo FLAG=$FLAG
466        ;;
467      tag)
468        TAGS="${TAGS} -a ${a}"
469        ;;
470      tag64)
471        TAGS64="${TAGS64} -a ${a}"
472        ;;
473      file)
474        if [[ -f "${a}" ]]; then
475          FILE="$(readlink -f ${a})"
476        else
477          FILE="${TESTS_DIR}/${a}"
478          FILE64="${TESTS64_DIR}/${a}"
479        fi
480        if [[ -f ${FILE} ]]; then
481          TESTS="${TESTS} ${FILE}"
482        else
483          echo "Cannot find test file ${a}"
484          exit
485        fi
486        if [[ "${PYTHON64_HOME}" != "" ]]; then
487         if [[ -f ${FILE64} ]]; then
488          TESTS64="${TESTS64} ${FILE64}"
489         else
490           echo "Cannot find test file ${a}"
491           exit
492         fi
493        fi
494        ;;
495      xmlResPath)
496        XML_RES_PATH=${a}
497        ARG_TYPE=flag
498        ;;
499    esac
500    if [[ ${FLAG} == 1 ]]; then
501      echo "In flag == 1 with a=${a}"
502      a_split=""
503      for ((i=0; i<${#a}; i++)); do a_split="$a_split ${a:$i:1}"; done
504      echo a_split="$a_split"
505      for b in $a_split; do
506        HAVE_READ_ARGS=1
507        echo b=${b}
508        case ${b} in
509          -)
510            ;;
511          v|q|n)
512            OUTPUT=${b}
513            ;;
514          a|j|m|o|p)
515            test_set="test_set_${b}"
516            switch_test_flags ${!test_set}
517            ;;
518          z)
519            if ! [[ "${PYTHON64_HOME}" != "" ]]; then
520                echo "Python 64 bit tests not supported!"
521                exit
522            fi
523            test_set="test_set_${b}"
524            switch_test_flags ${!test_set}
525            ;;
526          c|C)
527            CLEAN_JUNIT=clean
528            if [[ "${b}" == C ]]; then
529              CLEAN_BUILD="make clean"
530            fi
531            ;;
532          i)
533            NO_BUILD_JMODELICA=1
534            ;;
535          k)
536            KEEP_PYTHON=1
537            ;;
538          l)
539            LOG=$((1-LOG))
540            ;;
541          f)
542            ARG_TYPE=file
543            ;;
544          t)
545            TAGS=""
546            ARG_TYPE=tag
547            ;;
548          u)
549            if ! [[ "${PYTHON64_HOME}" != "" ]]; then
550                echo "Python 64 bit tests not supported!"
551                exit
552            fi
553            TAGS64=""
554            ARG_TYPE=tag64
555            ;;
556          g)
557            if ! [[ "${PYTHON64_HOME}" != "" ]]; then
558                echo "Python 64 bit tests not supported!"
559                exit
560            fi
561            ARG_TYPE=tag
562            ;;
563          r)
564            ARG_TYPE=tag64
565            ;;
566          x)
567            ARG_TYPE=xmlResPath
568            ;;
569          e)
570            ERROR_ON_TEST_FAIL=1
571            ;;
572          h)
573            echo "usage: tests [-ajmopzvnqcCh] { [-(t|u|g|r) [tag1 ...]] } [-f file1 ...] [-x path]"
574            echo "The -ajmopz options each control a set of tests, and select all tests in set "
575            echo "for running, or, if all in set are already selected, deselects them. "
576            echo "Thus, \"tests -am\" runs all tests except modelica. If no tests are chosen, "
577            echo "a default set is run (${DEFAULT_TESTS})." 
578            echo "  -a   Select/deselect all tests"
579            echo "  -j   Select/deselect junit tests"
580            echo "  -m   Select/deselect modelica tests"
581            echo "  -o   Select/deselect optimca tests"
582            echo "  -p   Select/deselect python tests"
583            echo "  -z   Select/deselect python 64 bit tests (not always a valid option)"
584            echo "  -v   Verbose output, show everything"
585            echo "  -n   Normal output, only show results and compilation errors"
586            echo "  -q   Quiet output, only show brief results"
587            echo "  -c   Do a clean before junit tests"
588            echo "  -C   Do a clean before each test suite"
589            echo "  -i   Do not re-build before python tests"
590            echo "  -k   Keep generated files from python tests"
591            echo "  -l   Toggle creating log file with the equivalent of the output with -v" 
592            echo "       (on by default)"
593            echo "  -t   When running python tests, only run tests marked with one of the "
594            echo "       listed tags. If given without tags, all tests are run. If -t is "
595            echo "       given several times, only the last one will be used (not always a valid option)"
596            echo "  -u   When running python64 tests, only run tests marked with one of the "
597            echo "       listed tags. If given without tags, all tests are run. If -u is "
598            echo "       given several times, only the last one will be used"
599            echo "  -g   When running python tests, add the listed tags to the tags to use"
600            echo "  -r   When running python 64tests, add the listed tags to the tags to use"
601            echo "  -f   When running python tests, only run tests from the listed files. "
602            echo "       Paths relative to the tests directory are accepted, as well as "
603            echo "       absolute or relative to current directory"
604            echo "  -x   Path to folder where jUnit like xml files are written. The xml files"
605            echo "       contains the results of the tests. Currently doesn't handle spaces"
606            echo "       in the supplied path!"
607            echo "  -e   When enabled, exit with error code (after running all "
608            echo "       tests) if any test suite return with an error code or a test fails"
609            echo "       regular failures or errors). Default behaviour is exit 0.".
610            echo "       Requires -x".
611            echo "  -h   Print this help and exit"
612            exit
613            ;;
614          *)
615            echo "Unknown flag -${b}"
616            exit
617            ;;
618        esac
619      done
620    else
621      HAVE_READ_ARGS=1
622    fi
623  done
624}
625
626# === Main ===
627OUTPUT=n
628LOGFILE="$(pwd)/tests.log"
629LOG=1
630i=0
631for a in ${tests}; do
632    test[${i}]=0
633    (( ${a}=i++ ))
634done
635export JAVA_HOME JMODELICA_HOME IPOPT_HOME PYTHONPATH LD_LIBRARY_PATH ANT_OPTS SUNDIALS_HOME
636TIME=$(date +%s)
637
638echo "TIME = ${TIME}"
639echo "before read_args"
640HAVE_READ_ARGS=0
641echo "PATH=${PATH}"
642echo "args $@"
643read_args "$@"
644if [[ $HAVE_READ_ARGS == 0 ]]; then
645echo "Reading args to jm_tests failed, retrying..."
646read_args "$@"
647fi
648echo "after read_args"
649echo "Writing to LOGFILE=${LOGFILE}"
650if [[ $ERROR_ON_TEST_FAIL == 1 ]]; then
651    if [[ -z $XML_RES_PATH ]]; then
652        echo "-e needs -x"
653        exit 1
654    fi
655fi
656
657if [ "${LOG}" == 1 ]; then
658  echo "Log of jm_tests $(date):" > "${LOGFILE}"
659  echo "Finished writing log..."
660fi
661
662ANY_ON=0
663for a in ${tests}; do
664  if [[ "${test[${!a}]}" == 1 ]]; then
665    ANY_ON=1
666  fi
667done
668
669echo "ANY_ON=${ANY_ON}"
670echo "DEFAULT_TESTS=${DEFAULT_TESTS}"
671if [[ "${ANY_ON}" == 0 ]]; then
672  switch_test_flags ${DEFAULT_TESTS}
673fi
674
675# If on Windows, inform user about bug in ticket #766
676if [[ ${SYS} == Win ]]; then
677  echo Note: If modelica or optimica tests seem to hang, press enter a couple of times.
678fi
679
680res=0
681
682for a in ${tests}; do
683  if [[ "${test[${!a}]}" == 1 ]]; then
684    echo "Printing going with ${a}_tests"
685  fi
686done
687for a in ${tests}; do
688  if [[ "${test[${!a}]}" == 1 ]]; then
689    echo "going with ${a}_tests"
690    ${a}_tests || res=1
691  fi
692done
693
694if [[ "${OUTPUT}" != q ]]; then
695  echo ========================
696fi
697echo $(date +%s) ${TIME}"-[Total time: ]nd60/n[:]n60%[0n]sxd10>xp" | dc
698
699# Rename test names in xml when run with 64 bit python
700if [ -n "${XML_RES_PATH:-}" ]; then
701    for f in ${XML_RES_PATH}/*; do
702        if [[ "${f}" == *"python64_"* ]]; then
703            sed -e 's#classname=\"#classname=\"python64.#g' $f > temp.xml
704            mv -f temp.xml $f
705        fi
706    done
707fi
708
709if [[ "${ERROR_ON_TEST_FAIL}" == 1 ]]; then
710    if [[ $res == 0 ]]; then
711        grep -R testsuite $XML_RES_PATH | sed -n -e "/.*errors=\"[0]*[1-9][0-9]*\".*/ q1" -e "/.*failures=\"[0]*[1-9][0-9]*\".*/ q1"
712        exit $?
713    fi
714    exit $res
715else
716    exit 0
717fi
Note: See TracBrowser for help on using the repository browser.