]> rtime.felk.cvut.cz Git - omk/sssa.git/blob - tests/functions.sh
If a single runtest script is executed by hand and sources functions.sh, tester.py...
[omk/sssa.git] / tests / functions.sh
1 # -*-sh-*-
2
3 function findup() {
4     local arg="$1"
5     if test -z "$arg"; then return 1; fi
6
7     local wd=$PWD
8     while ! test -f "$arg"; do
9         cd ..
10         if test "$PWD" = "/"; then
11             cd $wd
12             exit 1
13         fi
14     done
15     
16     echo $PWD/$arg
17     cd $wd
18 }
19
20 function error() {
21     echo $1 > _error
22     exit 1
23 }
24
25 function canttest() {
26     echo $1 > _error
27     exit 2
28 }
29
30 if [ -z "$OMK_TESTSROOT" ]; then
31     # We are not called by tester.py - probably, a single test was
32     # executed by hand.
33
34     tester=$(findup tester.py)
35     python $tester                      # Run tester in the current
36                                         # directory
37     exit
38 fi
39