1#!/bin/sh
2# Compare our cd-paranoia with known good results.
3
4if test ! -d "$abs_top_builddir" ; then
5  abs_top_builddir=@abs_top_builddir@
6fi
7
8if test ! -d "$abs_top_srcdir" ; then
9  abs_top_srcdir=@abs_top_srcdir@
10fi
11
12cue_file=$abs_top_srcdir/test/data/cdda.cue
13cue_file2=$abs_top_srcdir/test/data/cdda2.cue
14
15if test "@CMP@" != no ; then
16  cd_paranoia=$abs_top_builddir/src/cd-paranoia@EXEEXT@
17  $cd_paranoia -d $cue_file -v -r -- "1-"
18  if test $? -ne 0 ; then
19    exit 6
20  fi
21  cdda1_file=$abs_top_builddir/test/cdda-1.raw
22  cdda2_file=$abs_top_builddir/test/cdda-2.raw
23  dd bs=16 if=$abs_top_builddir/test/cdda.raw of=$cdda1_file
24  dd bs=16 if=$abs_top_srcdir/test/data/cdda.bin of=$cdda2_file
25  if @CMP@ $cdda1_file $cdda2_file ; then
26    echo "** Raw cdda.bin extraction okay"
27  else
28    echo "** Raw cdda.bin extraction differ"
29    exit 3
30  fi
31  mv cdda.raw cdda-good.raw
32  $cd_paranoia -d $cue_file -x 64 -v -r -- "1-"
33  mv cdda.raw cdda-underrun.raw
34  $cd_paranoia -d $cue_file -r -- "1-"
35  if test $? -ne 0 ; then
36    exit 6
37  fi
38  if @CMP@ cdda-underrun.raw cdda-good.raw ; then
39    echo "** Under-run correction okay"
40  else
41    echo "** Under-run correction problem"
42    exit 3
43  fi
44  # Start out with small jitter
45  $cd_paranoia -l ./cd-paranoia.log -d $cue_file -x 5 -v -r -- "1-"
46  if test $? -ne 0 ; then
47    exit 6
48  fi
49  mv cdda.raw cdda-jitter.raw
50  if @CMP@ cdda-jitter.raw cdda-good.raw ; then
51    echo "** Small jitter correction okay"
52  else
53    echo "** Small jitter correction problem"
54    exit 3
55  fi
56  tail -3 ./cd-paranoia.log | sed -e's/\[.*\]/\[\]/' > ./cd-paranoia-filtered.log
57  if @CMP@ $abs_top_srcdir/test/cd-paranoia-log.right ./cd-paranoia-filtered.log ; then
58    echo "** --log option okay"
59    rm ./cd-paranoia.log ./cd-paranoia-filtered.log
60  else
61    echo "** --log option problem"
62    exit 4
63  fi
64  # A more massive set of failures: underrun + small jitter
65  $cd_paranoia -d $cue_file -x 69 -v -r -- "1-"
66  if test $? -ne 0 ; then
67    exit 6
68  fi
69  mv cdda.raw cdda-jitter.raw
70  if @CMP@ cdda-jitter.raw cdda-good.raw ; then
71    echo "** under-run + jitter correction okay"
72  else
73    echo "** under-run + jitter correction problem"
74    exit 3
75  fi
76  if test -f $abs_top_builddir/test/data/cdda2.bin ; then
77      $cd_paranoia -d $cue_file2 -v -r -- "1-"
78      if test $? -ne 0 ; then
79          exit 6
80      fi
81      mv cdda.raw cdda-matches.raw
82      if @CMP@ cdda-matches.raw $abs_top_builddir/test/data/cdda2.bin ; then
83          echo "** multiple matches okay"
84      else
85          echo "** multiple matches problem"
86          exit 3
87      fi
88  else
89      echo "** multiple matches skipped (data file not present)"
90  fi
91  ### FIXME: medium jitter is known to fail. Investigate.
92  ### FIXME: large jitter is known to fail. Investigate.
93  exit 0
94else
95  if test "@CMP@" != no ; then
96    echo "Don't see 'cmp' program. Test skipped."
97  else
98    echo "Don't see libcdio 'cd-paranoia' program. Test skipped."
99  fi
100  exit 77
101fi
102fi
103#;;; Local Variables: ***
104#;;; mode:shell-script ***
105#;;; eval: (sh-set-shell "bash") ***
106#;;; End: ***
107
108