~ubuntu-branches/ubuntu/raring/ecasound2.2/raring

« back to all changes in this revision

Viewing changes to manual-tests/sh-tests/test-common-sh

  • Committer: Bazaar Package Importer
  • Author(s): Junichi Uekawa
  • Date: 2009-11-02 18:22:35 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091102182235-4ngh7699dmkgonyu
Tags: 2.7.0-1
* New upstream release.
* Depend on libreadline-dev instead of libreadline5-dev by request of
  Mattias Klose. It's now libreadline6-dev. (closes: #553748)
* Update menu file to use section Applications/ instead of Apps/.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ----------------------------------------------------------------------
 
2
# File: ecasound/manual-tests/test-common-sh
 
3
# License: GPL (see ecasound/{AUTHORS,COPYING})
 
4
# ----------------------------------------------------------------------
 
5
 
 
6
function error_exit() {
 
7
  echo "ERROR: Test failure, exiting."
 
8
  exit 1
 
9
}
 
10
 
 
11
function check_ecabin() {
 
12
  if [ ! -e $TESTECASOUND ] ; then
 
13
    echo "Ecasound binary not found."
 
14
    error_exit
 
15
  fi
 
16
}
 
17
 
 
18
function set_ecasound_envvar() {
 
19
  if test "x$TESTECASOUND" = "x"; then
 
20
    if test -e "../../ecasound/ecasound_debug" ; then
 
21
      TESTECASOUND="../../ecasound/ecasound_debug"
 
22
    else
 
23
      TESTECASOUND="../../ecasound/ecasound"
 
24
    fi
 
25
  fi 
 
26
}
 
27
 
 
28
function check_md5sum() {
 
29
  set +x
 
30
  if test "`md5sum $1 |cut -f1 -d' '`" != "$2" ; then
 
31
    echo -e "\n\nWARNING: md5sum did not match (not necessarily an error, but"
 
32
    echo -e "\tneeds to be manually verified).\n"
 
33
    if test "x$SKIP_MD5SUM" != "x1"; then
 
34
      error_exit
 
35
    fi
 
36
  fi
 
37
  set -x
 
38
}
 
39
 
 
40
function check_filesize() {
 
41
  set +x
 
42
  if test "`stat --format=%s $1`" != "$2" ; then
 
43
    echo -e "WARNING: size did not match (not necessarily an error, but"
 
44
    echo -e "\tneeds to be manually verified)."
 
45
    if test "x$SKIP_FILESIZE_CHECK" != "x1"; then
 
46
      error_exit
 
47
    fi
 
48
  fi
 
49
  set -x
 
50
}
 
51
 
 
52
function check_zerosum() {
 
53
  set +x
 
54
  ecasound -a:1 -i $1 -a:2 -i $2 -ea:-100 -a:1,2 -o dst-tmp.wav -x -q || error_exit
 
55
  sigmax=`sndfile-info dst-tmp.wav |grep "Signal Max" |cut -d ':' -f2 |cut -d ' ' -f2 |cut -d ' ' -f2`
 
56
  sndfile-info dst-tmp.wav |grep "Signal Max"
 
57
  if [ $sigmax != "0" -a $sigmax != "1" ] ; then 
 
58
    echo -e "WARNING: zerosum signal left $sigmax, manual verification required."
 
59
    if test "$SKIP_ZEROSUM_CHECK" = "x" ; then
 
60
      error_exit
 
61
    fi
 
62
  fi
 
63
  set -x
 
64
}
 
65
 
 
66
function check_samples() {
 
67
  set +x
 
68
  samples=`sndfile-info $1 |grep Frames |cut -d ':' -f2`
 
69
  if [ $samples != $2 ] ; then 
 
70
    echo -e "WARNING: sample count did not match (not necessarily an error, but"
 
71
    echo -e "\tneeds to be manually verified)."
 
72
    if test "$SKIP_SAMPLECNT_CHECK" = "x" ; then
 
73
      error_exit
 
74
    fi
 
75
  fi
 
76
  set -x
 
77
}
 
78
 
 
79
# a very rough way to check whether newly
 
80
# created audio file has similar content than
 
81
# the orignal: count how many positive samples 
 
82
# went above -1dB
 
83
#
 
84
function check_1dbpeak_count() {
 
85
  set +x
 
86
  count=`ecasound -i $1 -o null -ev |grep "Pos -1.0" |cut -d':' -f2 |cut -d',' -f1 |cut -c4-`
 
87
  if test $count != $2 ; then
 
88
    echo -e "WARNING: peak count samples did not match (not necessarily an error, but"
 
89
    echo -e "\tneeds to be manually verified)."
 
90
    if test "x$SKIP_1DBPEAK_CHECK" = "x"; then
 
91
      error_exit
 
92
    fi
 
93
   fi
 
94
  set -x
 
95
}