~ubuntu-branches/ubuntu/natty/pd-zexy/natty

« back to all changes in this revision

Viewing changes to tests/runtests.sh

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard, IOhannes m zmölnig, Jonas Smedegaard
  • Date: 2010-08-20 12:17:41 UTC
  • mfrom: (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100820121741-4kxozn8b9rhee9fr
Tags: 2.2.3-1
* New upstream version

[ IOhannes m zmölnig ]
* Adopt package, on behalf of Multimedia Team.
  Closes: #546964
* Simply debian/rules with CDBS, and don't unconditionally strip
  binaries.
  Closes: #437763
* Install into /usr/lib/pd/extra/zexy/. Document usage in REAME.Debian
  and warn about change in NEWS.
* git'ify package. Add Vcs-* stanzas to control file.
* Use dpkg source format 3.0 (quilt). Drop build-dependency on quilt.

[ Jonas Smedegaard ]
* Enable CDBS copyright-check routine.
* Add copyright and licensing header to debian/rules.
* Add myself as uploader.
* Rewrite debian/copyright using rev. 135 of draft DEP5 format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
## TODO:
 
4
##  find zexy (either in ../src or ../)
 
5
##  if it is not there, assume it is split into externals
 
6
 
 
7
if [ "x${PD}" = "x" ]
 
8
then
 
9
 PD=pd
 
10
fi
 
11
 
 
12
 
 
13
#SUFFIX="$$"
 
14
SUFFIX=$(date +%y%m%d-%H%M%S)
 
15
 
 
16
RUNTESTS_TXT=runtests.txt
 
17
RUNTESTS_LOG=log-runtests.${SUFFIX}
 
18
 
 
19
LIBFLAGS="-path ../src:../ -lib zexy -path ../abs/"
 
20
 
 
21
function list_tests() {
 
22
#  find . -mindepth 2  -name "*.pd" | sed 's|\.pd$|;|' 
 
23
 ls -1 */*.pd | sed 's|\.pd$|;|'
 
24
}
 
25
 
 
26
function debug() {
 
27
 :
 
28
if [ "x${DEBUG}" = "xyes" ]; then echo $@; fi
 
29
}
 
30
 
 
31
 
 
32
function evaluate_tests() {
 
33
 local logfile
 
34
 local testfile
 
35
 local numtests
 
36
 
 
37
 testfile=$1
 
38
 logfile=$2
 
39
 
 
40
 debug "now evaluating results in ${logfile} (${testfile}"
 
41
 
 
42
 numtests=$(grep -c . ${testfile})
 
43
 numpass=$(egrep -c "regression-test: (.*/fail.*: failed|.*: OK)$" ${logfile})
 
44
 let numfail=0
 
45
 failtests=""
 
46
 for t in $(egrep "regression-test: .*: (failed|OK)$" ${logfile} | egrep -v "regression-test: (.*/fail.*: failed|.*: OK)$" | awk '{print $2}')
 
47
 do
 
48
  failtests="${failtests} ${t%:}"
 
49
  let numfail=numfail+1
 
50
 done
 
51
 debug "number of tests = ${numtests}"
 
52
 echo "regression-test: ======================================" >>  ${logfile}
 
53
 echo "regression-test: ${numtests} regression-tests total" >>  ${logfile}
 
54
 echo "regression-test: ${numpass} regression-tests passed" >>  ${logfile}
 
55
 echo "regression-test: ${numfail} regression-tests failed" >>  ${logfile}
 
56
 echo "regression-test: ======================================" >>  ${logfile}
 
57
 echo "regression-test: failed tests: ${failtests}" >> ${logfile}
 
58
 debug "show results"
 
59
 cat ${logfile} | egrep "^regression-test: " | sed -e 's/^regression-test: //'
 
60
}
 
61
 
 
62
 
 
63
function run_nogui() {
 
64
 debug "running test without gui"
 
65
 ${PD} ${LIBFLAGS} -nogui runtests_nogui.pd > ${RUNTESTS_LOG} 2>&1 
 
66
 debug "testing done"
 
67
 evaluate_tests ${RUNTESTS_TXT} ${RUNTESTS_LOG}
 
68
 debug "testing finished"
 
69
}
 
70
 
 
71
function run_withgui() {
 
72
 debug "running test with gui"
 
73
 ${PD} ${LIBFLAGS} -stderr runtests.pd 2>&1 | tee ${RUNTESTS_LOG}
 
74
 echo "testing completed, no evaluation will be done; see ${RUNTESTS_LOG} for results"
 
75
}
 
76
 
 
77
list_tests > ${RUNTESTS_TXT}
 
78
 
 
79
USEGUI=""
 
80
DEBUG=""
 
81
 
 
82
while [ "$@" ]
 
83
do
 
84
 if test "x$1" = "x-gui"; then
 
85
  USEGUI="yes"
 
86
 fi
 
87
 if test "x$1" = "x-debug"; then
 
88
  DEBUG="yes"
 
89
 fi
 
90
 if test "x$1" = "x-d"; then
 
91
  DEBUG="yes"
 
92
 fi
 
93
 shift
 
94
done
 
95
 
 
96
if [ "x${USEGUI}" = "xyes" ]; then
 
97
 run_withgui
 
98
else
 
99
 run_nogui
 
100
fi
 
101
 
 
102
echo $@