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

Last change on this file since 13857 was 13857, checked in by randersson, 7 weeks ago

#5819 Added echo of jm_tests

File size: 19.0 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  if [ "${KEEP_PYTHON}" == 1 ]; then
187    TEST_DIR="$(pwd)/tests_$(date "+%F_%H-%M-%S")"
188    mkdir ${TEST_DIR}
189  else
190    TEST_DIR=$(mktemp -dq /tmp/jm_tests.XXXXXX)
191  fi
192  print_name Python
193  res=0
194  case ${OUTPUT} in
195    v)
196      if build_jmodelica 2>&1 | log; then
197        find_python_tests
198        cd ${TEST_DIR}
199        python_tests_v || res=1
200      fi
201      ;;
202    q)
203      if build_jmodelica 2>&1 | log > /dev/null; then
204        find_python_tests
205        cd ${TEST_DIR}
206        python_tests_q | filter_python_separate || res=1
207      else
208        echo BUILD FAILED
209      fi
210      ;;
211    n)
212      if [[ "${NO_BUILD_JMODELICA}" != "1" ]]; then
213        echo "OUTPUT=${OUTPUT}"
214        echo "NO_BUILD_JMODELICA=${NO_BUILD_JMODELICA}"
215        echo Building...
216      fi
217      if build_jmodelica | log > /dev/null; then
218        find_python_tests
219        cd ${TEST_DIR}
220        python_tests_n | filter_python_separate || res=1
221      fi
222      ;;
223  esac
224  if [ ! "${KEEP_PYTHON}" == 1 ]; then
225    cd ..
226    rm -rf ${TEST_DIR}
227  fi
228  return $res
229}
230
231TESTS64_DIR="${JMODELICA_HOME}/Python_64/tests_jmodelica"
232function python64_tests() {
233    # Set necessary paths etc to run 64 bit tests
234    PYTHONPATH=${PYTHONPATH64}
235    PYTHONHOME=${PYTHON64_HOME}
236    JPYPE_JVM=${JPYPE64_JVM}
237    CASADI_LIB_HOME=${CASADI64_HOME}/lib
238    CASADI_INTERFACE_HOME=${CASADI_INTERFACE_HOME64}
239    PATH=${PYTHON64_HOME}:${PYTHON64_HOME}/Scripts:${PYTHON64_HOME}/Lib:${IPOPT64_HOME}/bin:${CASADI_LIB_HOME}:"${PATH}"
240    TESTS32=$TESTS
241    TESTS=$TESTS64
242    TAGS32=$TAGS
243    TAGS=$TAGS64
244    TESTS_DIR=${TESTS64_DIR}
245    PYTHON64=1
246    # Call python_tests
247    res=0
248    python_tests || res=1
249    # Reset to original paths etc that was for original Python
250    TESTS=$TESTS32
251    TAGS=$TAGS32
252    PYTHON64=0
253    PYTHONPATH=${PYTHONPATH32}
254    PYTHONHOME=${PYTHON32_HOME}
255    JPYPE_JVM=${JPYPE32_JVM}
256    CASADI_LIB_HOME=${CASADI_HOME}/lib
257    CASADI_INTERFACE_HOME=${CASADI_INTERFACE_HOME32}
258    PATH="${ORIG_PATH}"
259    TESTS_DIR="${JMODELICA_HOME}/Python/tests_jmodelica"
260    return $res
261}
262
263function python_tests_v() {
264    res=0
265    for TEST in ${TESTS}; do
266      echo ""
267      echo ${TEST} | sed -e 's!^.*jmodelica.!Running !'
268      nose_test ${TEST} \
269      | log \
270      || res=1
271    done
272    return $res
273}
274
275function python_tests_q() {
276    res=0
277    for TEST in ${TESTS}; do
278      echo "" | log > /dev/null
279      echo ${TEST} | sed -e 's!^.*jmodelica.!Running !' | log > /dev/null
280      nose_test ${TEST} 2>&1 \
281      | log \
282      | sed -n -e 's!^OK$!PASSED!ip' -e 's!^FAILED !TEST FAILED!p' \
283      || (res=1 && echo NOSETESTS_NOT_OK)
284    done
285    return $res
286}
287
288function python_tests_n() {
289    PATTERN="[-=]{40,}"
290    res=0
291    for TEST in ${TESTS}; do
292      echo "" | log
293      echo ${TEST} | sed -e 's!^.*jmodelica.!Running !' | log
294      nose_test ${TEST} 2>&1 \
295      | log \
296      | egrep -v '^Exception .* ignored$' \
297      | egrep -A500 "${PATTERN}" \
298      | sed -e 's!^OK$!PASSED!' -e 's!^FAILED !TEST FAILED!' \
299      || (res=1 && echo NOSETESTS_NOT_OK)
300    done
301    return $res
302}
303
304# Helper functions
305function print_name() {
306  if [[ "${OUTPUT}" == q ]]; then
307    echo -n "$1... "
308  else
309    echo ======= $1 =======
310  fi
311}
312
313function log() {
314  if [ "${LOG}" == 1 ]; then
315      tee -a "${LOGFILE}"
316  else
317      cat
318  fi
319}
320
321function filter_python_separate() {
322  TMP=$(mktemp -q /tmp/jm_tests.XXXXXX 2>/dev/null) 
323  tee ${TMP} | egrep -v "(PASSED|TEST FAILED|NOSETESTS_NOT_OK)"
324  cat ${TMP} \
325  | sed -n \
326        -e '1 i\
327            0 0 0' \
328        -e 's!^TEST FAILED(errors=\([0-9]*\))!\1+!p' \
329        -e 's!^TEST FAILED(failures=\([0-9]*\))!r\1+r!p' \
330        -e 's!^TEST FAILED(errors=\([0-9]*\), failures=\([0-9]*\))!\1+r\2+r!p' \
331        -e 's!^NOSETESTS_NOT_OK!sar1+rla!p' \
332        -e '$ a\
333            n[ ]nn[ ]np' \
334  | dc \
335  | sed \
336    -e 's!0 0 [1-9].*!CRASHED!' \
337    -e 's!0 0 0!PASSED!' \
338    -e 's!\([0-9]\+\) \([0-9]\+\) .*!TEST FAILED (errors=\1, failures=\2)!'
339  rm -f ${TMP}
340}
341 
342function junit_test() {
343  print_name $1
344  cd ${BUILD}/java
345  echo "doing ls..."
346  ls -la
347  res=0
348  case ${OUTPUT} in
349    v) junit_test_v $1 || res=1 ;;
350    q) junit_test_q $1 || res=1 ;;
351    n) junit_test_n $1 || res=1 ;;
352  esac
353  if [ -n "${XML_RES_PATH:-}" ]; then
354    cp "${BUILD}/doc/junit-reports/TESTS-TestSuites.xml" "${XML_RES_PATH}"
355  fi
356  return $res
357}
358
359function junit_test_v() {
360    res=0
361    ant_test $1 2>&1 \
362        | log \
363        || res=1
364    return $res
365}
366
367function junit_test_q() {
368    res=0
369    ant_test $1 2>&1 \
370        | log \
371        | egrep "(\[(jastadd|junit)\]|BUILD FAILED|\[java\] Error when parsing file:)" \
372        | sed -n \
373            -e '1 i\
374                0 0' \
375            -e 's!^.*\[jastadd\] \(Semantic errors\|Syntax error\).*$!BUILD FAILED!' \
376            -e 's!^.*\[java\] Error when parsing file:.*$!BUILD FAILED!' \
377            -e 's!^.*Failures: \([0-9]*\), Errors: \([0-9]*\),.*$!r\1+r\2+!p' \
378            -e 's!^.*\(BUILD FAILED\).*$![\1]pq!p' \
379            -e '$ a\
380                [errors=]nn[, failures=]np' \
381        | dc \
382        | sed \
383            -e 's!errors=0, failures=0!PASSED!' \
384            -e 's!\(errors=.*, failures=.*\)!TEST FAILED (\1)!' \
385        || res=1
386    return $res
387}
388
389function junit_test_n() {
390    echo "in junit_test_n"
391    res=0
392    ant_test $1 \
393        | log \
394        | egrep "(\[junit\]|\[(java|jastadd)\].*([Ee]rror|[A-Za-z.]*:[1-9][0-9]*))" \
395        || res=1
396    return $res
397}
398
399function nose_test() {
400  nosetests `compute_nose_extra_args "${TEST}"` ${TAGS} -v $1
401}
402
403function ant_test() {
404  echo "MC_ANT_ARGS=${MC_ANT_ARGS}"
405  echo "OC_ANT_ARGS=${OC_ANT_ARGS}"
406  echo "BUILD=${BUILD}"
407  echo "CLEAN_JUNIT=${CLEAN_JUNIT}"
408    if [[ "$1" == "Modelica" ]]; then
409        ant ${ANT_OPTS} -f ${MC_ANT_ARGS} -Dtarget=${BUILD} ${CLEAN_JUNIT} test
410    else
411        ant ${ANT_OPTS} -f ${OC_ANT_ARGS} -Dtarget=${BUILD} ${CLEAN_JUNIT} test
412    fi
413  echo "about to ls"
414  ls -la ${BUILD}
415}
416
417function build_jmodelica() {
418  if [[ "${NO_BUILD_JMODELICA}" != "1" ]]; then
419    if [[ -d ${BUILD} ]]; then
420      cd ${BUILD}
421      ${CLEAN_BUILD}
422      make && make install
423    else
424      echo Cannot build, build dir does not exist!
425      exit 1
426    fi
427  fi
428}
429
430function switch_test_flags() {
431  STATE=0
432  for a in $*; do
433    if [[ "${test[${!a}]}" != 1 ]]; then
434      STATE=1
435    fi
436  done
437  for a in $*; do
438    test[${!a}]=${STATE}
439  done
440}
441
442function compute_nose_extra_args() { # Argument is test name
443    if [ -n "${XML_RES_PATH:-}" ]; then
444        RES_FILE_NAME=`echo $1 | sed -e 's!^.*jmodelica.!!g' -e 's!/!_!g'`
445        if [[ "$PYTHON64" = 1 ]]; then
446            RES_FILE_NAME="python64_${RES_FILE_NAME}"
447        fi
448        echo --with-xunit --xunit-file=${XML_RES_PATH}/${RES_FILE_NAME}.xml
449    fi
450}
451
452function read_args() {
453  TESTS=
454  TESTS64=
455  ARG_TYPE=flag
456  echo "DEFAULT_ARGS=${DEFAULT_ARGS}"
457  for a in ${DEFAULT_ARGS} "$@"; do
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        ;;
466      tag)
467        TAGS="${TAGS} -a ${a}"
468        ;;
469      tag64)
470        TAGS64="${TAGS64} -a ${a}"
471        ;;
472      file)
473        if [[ -f "${a}" ]]; then
474          FILE="$(readlink -f ${a})"
475        else
476          FILE="${TESTS_DIR}/${a}"
477          FILE64="${TESTS64_DIR}/${a}"
478        fi
479        if [[ -f ${FILE} ]]; then
480          TESTS="${TESTS} ${FILE}"
481        else
482          echo "Cannot find test file ${a}"
483          exit
484        fi
485        if [[ "${PYTHON64_HOME}" != "" ]]; then
486         if [[ -f ${FILE64} ]]; then
487          TESTS64="${TESTS64} ${FILE64}"
488         else
489           echo "Cannot find test file ${a}"
490           exit
491         fi
492        fi
493        ;;
494      xmlResPath)
495        XML_RES_PATH=${a}
496        ARG_TYPE=flag
497        ;;
498    esac
499    if [[ ${FLAG} == 1 ]]; then
500      for b in $(echo "" ${a}|sed 's!\(.\)!\1 !g'); do
501        case ${b} in
502          -)
503            ;;
504          v|q|n)
505            OUTPUT=${b}
506            ;;
507          a|j|m|o|p)
508            test_set="test_set_${b}"
509            switch_test_flags ${!test_set}
510            ;;
511          z)
512            if ! [[ "${PYTHON64_HOME}" != "" ]]; then
513                echo "Python 64 bit tests not supported!"
514                exit
515            fi
516            test_set="test_set_${b}"
517            switch_test_flags ${!test_set}
518            ;;
519          c|C)
520            CLEAN_JUNIT=clean
521            if [[ "${b}" == C ]]; then
522              CLEAN_BUILD="make clean"
523            fi
524            ;;
525          i)
526            NO_BUILD_JMODELICA=1
527            ;;
528          k)
529            KEEP_PYTHON=1
530            ;;
531          l)
532            LOG=$((1-LOG))
533            ;;
534          f)
535            ARG_TYPE=file
536            ;;
537          t)
538            TAGS=""
539            ARG_TYPE=tag
540            ;;
541          u)
542            if ! [[ "${PYTHON64_HOME}" != "" ]]; then
543                echo "Python 64 bit tests not supported!"
544                exit
545            fi
546            TAGS64=""
547            ARG_TYPE=tag64
548            ;;
549          g)
550            if ! [[ "${PYTHON64_HOME}" != "" ]]; then
551                echo "Python 64 bit tests not supported!"
552                exit
553            fi
554            ARG_TYPE=tag
555            ;;
556          r)
557            ARG_TYPE=tag64
558            ;;
559          x)
560            ARG_TYPE=xmlResPath
561            ;;
562          e)
563            ERROR_ON_TEST_FAIL=1
564            ;;
565          h)
566            echo "usage: tests [-ajmopzvnqcCh] { [-(t|u|g|r) [tag1 ...]] } [-f file1 ...] [-x path]"
567            echo "The -ajmopz options each control a set of tests, and select all tests in set "
568            echo "for running, or, if all in set are already selected, deselects them. "
569            echo "Thus, \"tests -am\" runs all tests except modelica. If no tests are chosen, "
570            echo "a default set is run (${DEFAULT_TESTS})." 
571            echo "  -a   Select/deselect all tests"
572            echo "  -j   Select/deselect junit tests"
573            echo "  -m   Select/deselect modelica tests"
574            echo "  -o   Select/deselect optimca tests"
575            echo "  -p   Select/deselect python tests"
576            echo "  -z   Select/deselect python 64 bit tests (not always a valid option)"
577            echo "  -v   Verbose output, show everything"
578            echo "  -n   Normal output, only show results and compilation errors"
579            echo "  -q   Quiet output, only show brief results"
580            echo "  -c   Do a clean before junit tests"
581            echo "  -C   Do a clean before each test suite"
582            echo "  -i   Do not re-build before python tests"
583            echo "  -k   Keep generated files from python tests"
584            echo "  -l   Toggle creating log file with the equivalent of the output with -v" 
585            echo "       (on by default)"
586            echo "  -t   When running python tests, only run tests marked with one of the "
587            echo "       listed tags. If given without tags, all tests are run. If -t is "
588            echo "       given several times, only the last one will be used (not always a valid option)"
589            echo "  -u   When running python64 tests, only run tests marked with one of the "
590            echo "       listed tags. If given without tags, all tests are run. If -u is "
591            echo "       given several times, only the last one will be used"
592            echo "  -g   When running python tests, add the listed tags to the tags to use"
593            echo "  -r   When running python 64tests, add the listed tags to the tags to use"
594            echo "  -f   When running python tests, only run tests from the listed files. "
595            echo "       Paths relative to the tests directory are accepted, as well as "
596            echo "       absolute or relative to current directory"
597            echo "  -x   Path to folder where jUnit like xml files are written. The xml files"
598            echo "       contains the results of the tests. Currently doesn't handle spaces"
599            echo "       in the supplied path!"
600            echo "  -e   When enabled, exit with error code (after running all "
601            echo "       tests) if any test suite return with an error code or a test fails"
602            echo "       regular failures or errors). Default behaviour is exit 0.".
603            echo "       Requires -x".
604            echo "  -h   Print this help and exit"
605            exit
606            ;;
607          *)
608            echo "Unknown flag -${b}"
609            exit
610            ;;
611        esac
612      done
613    fi
614  done
615}
616
617# === Main ===
618OUTPUT=n
619LOGFILE="$(pwd)/tests.log"
620LOG=1
621i=0
622for a in ${tests}; do
623    test[${i}]=0
624    (( ${a}=i++ ))
625done
626export JAVA_HOME JMODELICA_HOME IPOPT_HOME PYTHONPATH LD_LIBRARY_PATH ANT_OPTS SUNDIALS_HOME
627TIME=$(date +%s)
628
629echo "TIME = ${TIME}"
630echo "before read_args"
631echo "PATH=${PATH}"
632echo "args $@"
633read_args "$@"
634echo "after read_args"
635echo "Writing to LOGFILE=${LOGFILE}"
636if [[ $ERROR_ON_TEST_FAIL == 1 ]]; then
637    if [[ -z $XML_RES_PATH ]]; then
638        echo "-e needs -x"
639        exit 1
640    fi
641fi
642
643if [ "${LOG}" == 1 ]; then
644  echo "Log of jm_tests $(date):" > "${LOGFILE}"
645  echo "Finished writing log..."
646fi
647
648ANY_ON=0
649for a in ${tests}; do
650  if [[ "${test[${!a}]}" == 1 ]]; then
651    ANY_ON=1
652  fi
653done
654if [[ "${ANY_ON}" == 0 ]]; then
655  switch_test_flags ${DEFAULT_TESTS}
656fi
657
658# If on Windows, inform user about bug in ticket #766
659if [[ ${SYS} == Win ]]; then
660  echo Note: If modelica or optimica tests seem to hang, press enter a couple of times.
661fi
662
663res=0
664for a in ${tests}; do
665  if [[ "${test[${!a}]}" == 1 ]]; then
666    echo "going with ${a}_tests"
667    ${a}_tests || res=1
668  fi
669done
670
671if [[ "${OUTPUT}" != q ]]; then
672  echo ========================
673fi
674echo $(date +%s) ${TIME}"-[Total time: ]nd60/n[:]n60%[0n]sxd10>xp" | dc
675
676# Rename test names in xml when run with 64 bit python
677if [ -n "${XML_RES_PATH:-}" ]; then
678    for f in ${XML_RES_PATH}/*; do
679        if [[ "${f}" == *"python64_"* ]]; then
680            sed -e 's#classname=\"#classname=\"python64.#g' $f > temp.xml
681            mv -f temp.xml $f
682        fi
683    done
684fi
685
686if [[ "${ERROR_ON_TEST_FAIL}" == 1 ]]; then
687    if [[ $res == 0 ]]; then
688        grep -R testsuite $XML_RES_PATH | sed -n -e "/.*errors=\"[0]*[1-9][0-9]*\".*/ q1" -e "/.*failures=\"[0]*[1-9][0-9]*\".*/ q1"
689        exit $?
690    fi
691    exit $res
692else
693    exit 0
694fi
Note: See TracBrowser for help on using the repository browser.