Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with CDs where the start track number is not 1. #20

Merged
merged 7 commits into from Jan 12, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
Test for CDs with start track > 1.
Here we test a CD image with tracks 7, 8 and 9.
  • Loading branch information
vext01 committed Dec 30, 2018
commit 90382a17ad2d1aaccc5a10edaf29c62c12680c5a
4 changes: 4 additions & 0 deletions configure.ac
Expand Up @@ -86,6 +86,9 @@ AC_AIX

AC_PROG_MKDIR_P

AC_PROG_AWK
AC_SUBST(AWK)

if test "x$GCC" != "xyes"
then
AC_MSG_WARN([
Expand Down Expand Up @@ -465,6 +468,7 @@ AC_CONFIG_FILES([
# AC_CONFIG_FILES([po/Makefile])
AC_CONFIG_FILES([test/check_paranoia.sh], [chmod +x test/check_paranoia.sh])
AC_CONFIG_FILES([test/endian.sh], [chmod +x test/endian.sh])
AC_CONFIG_FILES([test/start_track_not_one.sh], [chmod +x test/start_track_not_one.sh])
AC_OUTPUT

AC_MSG_NOTICE([
Expand Down
3 changes: 3 additions & 0 deletions test/.gitignore
Expand Up @@ -50,3 +50,6 @@
/testtoc
/testunconfig
/testutils
/start_track_not_one.sh
/start_track_not_one.cue
/start_track_not_one.bin
2 changes: 1 addition & 1 deletion test/Makefile.am
Expand Up @@ -15,7 +15,7 @@ DATA_DIR = @abs_top_srcdir@/test/data

AM_CPPFLAGS = -I$(top_srcdir) $(LIBCDIO_CFLAGS) $(LIBCDIO_PARANOIA_CFLAGS)

check_SCRIPTS = check_paranoia.sh endian.sh
check_SCRIPTS = check_paranoia.sh endian.sh start_track_not_one.sh
# If we beefed this up so it checked to see if a CD-DA was loaded
# it could be an automatic test. But for now, not so.
# check_paranoia.sh
Expand Down
62 changes: 62 additions & 0 deletions test/start_track_not_one.sh.in
@@ -0,0 +1,62 @@
#/bin/sh
# Check that a digital audio CD with a start track number of >1 works.

if test ! -d "$abs_top_builddir" ; then
abs_top_builddir=@abs_top_builddir@
fi

if test ! -d "$abs_top_srcdir" ; then
abs_top_srcdir=@abs_top_srcdir@
fi

test_dir=$abs_top_srcdir/test

set -e

cd_paranoia=$abs_top_builddir/src/cd-paranoia
base=start_track_not_one
orig_cdda=$test_dir/data/cdda.bin

# First we make a longer CDDA image.
cdda=$test_dir/$base.bin
cat $orig_cdda $orig_cdda $orig_cdda > $cdda

# And a CUE file with a non-one start track.
cue=$test_dir/$base.cue
cat << EOF > $cue
FILE "$cdda" BINARY
TRACK 07 AUDIO
FLAGS DCP
INDEX 01 00:00:00
TRACK 08 AUDIO
FLAGS DCP
INDEX 01 00:04:02
TRACK 09 AUDIO
FLAGS DCP
INDEX 01 00:08:04
EOF

# Use an awk program to parse/verify the TOC.
# We check that we see only tracks 7, 8 and 9.
awk_prog='
BEGIN { expect_track = 7; in_toc = 0; err = 0; num_tracks = 0 }
/^TOTAL/ { in_toc = 0 }
in_toc == 1 {
if ($1 != expect_track ".") {
print "Expected track " expect_track ", got " $1;
err = 1
}
expect_track ++;
num_tracks ++;
}
/^===/ { in_toc = 1 }
END {
if (num_tracks != 3) {
print "Number of tracks was not 3.";
err = 1
}
exit err;
}
'

$cd_paranoia -Q -d $cue 2>&1 | @AWK@ "$awk_prog"