From e286bafd953803983f19a506c3a0d4d8a0fdd05a Mon Sep 17 00:00:00 2001 From: rocky Date: Fri, 7 May 2004 10:57:50 +0000 Subject: [PATCH] cdrdo TOC parsing regression tests. testdefault.c: more verbose about what's going on. --- test/.cvsignore | 3 +- test/Makefile.am | 9 +++-- test/bad-mode1.toc | 5 +++ test/bad-msf-1.toc | 6 +++ test/bad-msf-2.toc | 6 +++ test/t1.toc | 5 +++ test/t2.toc | 6 +++ test/t3.toc | 11 ++++++ test/t4.toc | 8 ++++ test/t5.toc | 8 ++++ test/t6.toc | 7 ++++ test/t7.toc | 12 ++++++ test/t8.toc | 14 +++++++ test/t9.toc | 31 ++++++++++++++++ test/testdefault.c | 24 +++++++----- test/testtoc.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++ 16 files changed, 233 insertions(+), 13 deletions(-) create mode 100644 test/bad-mode1.toc create mode 100644 test/bad-msf-1.toc create mode 100644 test/bad-msf-2.toc create mode 100644 test/t1.toc create mode 100644 test/t2.toc create mode 100644 test/t3.toc create mode 100644 test/t4.toc create mode 100644 test/t5.toc create mode 100644 test/t6.toc create mode 100644 test/t7.toc create mode 100644 test/t8.toc create mode 100644 test/t9.toc create mode 100644 test/testtoc.c diff --git a/test/.cvsignore b/test/.cvsignore index cb8240a0..9a1de8a2 100644 --- a/test/.cvsignore +++ b/test/.cvsignore @@ -8,9 +8,10 @@ check_iso.sh check_nrg.sh check_sizeof testassert +testdefault testischar testiso9660 -testdefault +testtoc *.dump *.cue *.bin diff --git a/test/Makefile.am b/test/Makefile.am index 4c7f9763..d64919ac 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.20 2004/05/04 11:47:53 rocky Exp $ +# $Id: Makefile.am,v 1.21 2004/05/07 10:57:50 rocky Exp $ # # Copyright (C) 2003, 2004 Rocky Bernstein # @@ -23,16 +23,17 @@ # # There's a problem with doing make distcheck for testdefault. # A reminder of why I hate automake. -hack = testassert testischar testiso9660 check_sizeof +hack = check_sizeof testassert testischar testiso9660 testtoc noinst_PROGRAMS = $(hack) testdefault INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS) +check_sizeof_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) testassert_LDADD = $(LIBCDIO_LIBS) testdefault_LDADD = $(LIBCDIO_LIBS) testischar_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) testiso9660_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) -check_sizeof_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) +testtoc_LDADD = $(LIBCDIO_LIBS) check_SCRIPTS = check_nrg.sh check_cue.sh check_cd_read.sh \ check_iso.sh check_opts.sh @@ -47,6 +48,8 @@ check_DATA = vcd_demo.right \ check_opts3.right check_opts4.right check_opts5.right \ check_opts6.right check_opts7.right \ isofs-m1-read.right cdda-read.right \ + t1.toc t2.toc t3.toc t4.toc t5.toc t6.toc t7.toc t8.toc t9.toc \ + bad-mode1.toc bad-msf-1.toc bad-msf-2.toc \ copying.iso copying.right EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \ diff --git a/test/bad-mode1.toc b/test/bad-mode1.toc new file mode 100644 index 00000000..9dbc6459 --- /dev/null +++ b/test/bad-mode1.toc @@ -0,0 +1,5 @@ +// $Id: bad-mode1.toc,v 1.1 2004/05/07 10:57:50 rocky Exp $ +CD_DA + +TRACK MODE1_FORM45 // "MODE1_FORM45" is not a valid mode. +SILENCE 10:0:0 diff --git a/test/bad-msf-1.toc b/test/bad-msf-1.toc new file mode 100644 index 00000000..2d9f656e --- /dev/null +++ b/test/bad-msf-1.toc @@ -0,0 +1,6 @@ +// $Id: bad-msf-1.toc,v 1.1 2004/05/07 10:57:50 rocky Exp $ +// bad MSF in second field + +TRACK AUDIO +NO COPY // so that all CTL flags are 0 +FILE "cdda.bin" 0:0:75 // frame should be less than 75 diff --git a/test/bad-msf-2.toc b/test/bad-msf-2.toc new file mode 100644 index 00000000..77873486 --- /dev/null +++ b/test/bad-msf-2.toc @@ -0,0 +1,6 @@ +// $Id: bad-msf-2.toc,v 1.1 2004/05/07 10:57:50 rocky Exp $ +// bad MSF in second field + +TRACK AUDIO +NO COPY // so that all CTL flags are 0 +FILE "cdda.bin" 0:60:0 // seconds should be less than 60 diff --git a/test/t1.toc b/test/t1.toc new file mode 100644 index 00000000..1ad10d59 --- /dev/null +++ b/test/t1.toc @@ -0,0 +1,5 @@ +// simplest cue sheet + +TRACK AUDIO +NO COPY // so that all CTL flags are 0 +SILENCE 0:0:74 // frames are just under 75 diff --git a/test/t2.toc b/test/t2.toc new file mode 100644 index 00000000..edd5fedc --- /dev/null +++ b/test/t2.toc @@ -0,0 +1,6 @@ +// additional pre-gap for track 1 + +TRACK AUDIO +NO COPY // so that all CTL flags are 0 +FILE "cdda.bin" 0:59:0 // Seconds are just under 60 +START 0:10:0 // 10 second pre-gap diff --git a/test/t3.toc b/test/t3.toc new file mode 100644 index 00000000..cacce970 --- /dev/null +++ b/test/t3.toc @@ -0,0 +1,11 @@ +// simplest cue sheet for two tracks + +TRACK AUDIO +NO COPY // so that all CTL flags are 0 +FILE "cdda.bin" 180:0:0 // 180 for number of minutes is okay, although + // it is not for a second or a frame value. + +TRACK AUDIO +NO COPY // so that all CTL flags are 0 +FILE "cdda.bin" 1:0:0 + diff --git a/test/t4.toc b/test/t4.toc new file mode 100644 index 00000000..48f3c5f2 --- /dev/null +++ b/test/t4.toc @@ -0,0 +1,8 @@ +// non default CTL flag of track 1 + +TRACK AUDIO +COPY +PRE_EMPHASIS +FOUR_CHANNEL_AUDIO +FILE "cdda.bin" 1:0:0 + diff --git a/test/t5.toc b/test/t5.toc new file mode 100644 index 00000000..b662c0be --- /dev/null +++ b/test/t5.toc @@ -0,0 +1,8 @@ +// test catalog number + +CATALOG "1234567890123" + +TRACK AUDIO +NO COPY +FILE "cdda.bin" 1:0:0 + diff --git a/test/t6.toc b/test/t6.toc new file mode 100644 index 00000000..b959a365 --- /dev/null +++ b/test/t6.toc @@ -0,0 +1,7 @@ +// test ISRC code + + +TRACK AUDIO +NO COPY +ISRC "DEMUA9800001" +FILE "cdda.bin" 1:0:0 diff --git a/test/t7.toc b/test/t7.toc new file mode 100644 index 00000000..d87d3c05 --- /dev/null +++ b/test/t7.toc @@ -0,0 +1,12 @@ +// check two tracks with pre-gap and ISRC + + +TRACK AUDIO +NO COPY +FILE "cdda.bin" 1:0:0 + +TRACK AUDIO +NO COPY +ISRC "DEMUA9800001" +FILE "cdda.bin" 1:0:0 +START 0:5:0 // pre-gap diff --git a/test/t8.toc b/test/t8.toc new file mode 100644 index 00000000..793d423d --- /dev/null +++ b/test/t8.toc @@ -0,0 +1,14 @@ +// check index increments + + +TRACK AUDIO +NO COPY +FILE "cdda.bin" 0:10:0 +INDEX 1:0:0 +INDEX 2:0:0 + + +TRACK AUDIO +NO COPY +FILE "cdda.bin" 0:10:0 +START 0:5:0 // pre-gap diff --git a/test/t9.toc b/test/t9.toc new file mode 100644 index 00000000..9bd3453b --- /dev/null +++ b/test/t9.toc @@ -0,0 +1,31 @@ +CD_DA +// check mulitple tracks +CATALOG "0724385356926" + +TRACK AUDIO +ISRC "USEM39600078" +COPY +FILE "cdda.bin" 0:10:0 +START 0:5:0 + +TRACK AUDIO +NO COPY +ISRC "USEM39600079" +FILE "cdda.bin" 0:10:0 +START 0:2:0 + +TRACK AUDIO +COPY +FILE "cdda.bin" 0:10:0 +START 0:1:30 + +TRACK AUDIO +NO COPY +START 0:0:0 +FILE "cdda.bin" 0:10:0 + +TRACK AUDIO +ISRC "EDUMA9892346" +NO COPY +FILE "cdda.bin" 0:10:0 +START 0:2:1 diff --git a/test/testdefault.c b/test/testdefault.c index 2c99db14..38576e9c 100644 --- a/test/testdefault.c +++ b/test/testdefault.c @@ -1,5 +1,5 @@ /* - $Id: testdefault.c,v 1.4 2004/03/20 22:46:57 rocky Exp $ + $Id: testdefault.c,v 1.5 2004/05/07 10:57:50 rocky Exp $ Copyright (C) 2003, 2004 Rocky Bernstein @@ -74,6 +74,7 @@ main(int argc, const char *argv[]) char **imgs; char **c; unsigned int i; + int ret=0; const char *cue_files[2] = {"cdda.cue", "isofs-m1.cue"}; const char *nrg_files[1] = {"videocd.nrg"}; @@ -92,7 +93,7 @@ main(int argc, const char *argv[]) } if (!is_in(nrg_images, nrg_files[0])) { - return 1; + return 10; } bincue_images = cdio_get_devices(DRIVER_BINCUE); @@ -102,10 +103,15 @@ main(int argc, const char *argv[]) } for (i=0; i<2; i++) { - if (!is_in(bincue_images, cue_files[i])) { - return 2; + if (is_in(bincue_images, cue_files[i])) { + printf("%s parses as a CDRWIN BIN/CUE csheet.\n", cue_files[i]); + } else { + printf("%s doesn't parse as a CDRWIN BIN/CUE csheet.\n", cue_files[i]); + ret = i+1; } } + + if (ret != 0) return ret; printf("-----\n"); printf("ISO 9660 images...\n"); @@ -115,7 +121,7 @@ main(int argc, const char *argv[]) if (NULL == imgs || *imgs == NULL) { printf("Failed to find an ISO 9660 image\n"); - return 3; + return 11; } for( c = imgs; *c != NULL; c++ ) { @@ -134,7 +140,7 @@ main(int argc, const char *argv[]) if (NULL == imgs || *imgs == NULL) { printf("Failed to find CDDA image\n"); - return 4; + return 12; } for( c = imgs; *c != NULL; c++ ) { @@ -154,7 +160,7 @@ main(int argc, const char *argv[]) true); if (NULL == imgs || *imgs == NULL) { printf("Failed to find VCD image\n"); - return 5; + return 13; } for( c = imgs; *c != NULL; c++ ) { @@ -170,7 +176,7 @@ main(int argc, const char *argv[]) if (NULL != imgs && *imgs != NULL) { printf("Found erroneous High Sierra image\n"); - return 5; + return 14; } imgs = NULL; @@ -179,7 +185,7 @@ main(int argc, const char *argv[]) if (NULL != imgs && *imgs != NULL) { printf("Found erroneous UFS image\n"); - return 6; + return 15; } cdio_free_device_list(imgs); diff --git a/test/testtoc.c b/test/testtoc.c new file mode 100644 index 00000000..87586997 --- /dev/null +++ b/test/testtoc.c @@ -0,0 +1,91 @@ +/* + $Id: testtoc.c,v 1.1 2004/05/07 10:57:50 rocky Exp $ + + Copyright (C) 2004 Rocky Bernstein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* + Regression test for cdio_tocfile. +*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include + +#ifdef HAVE_STDIO_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#include + +#define NUM_GOOD_TOCS 9 +#define NUM_BAD_TOCS 3 +int +main(int argc, const char *argv[]) +{ + const char *toc_file[NUM_GOOD_TOCS] = { + "t1.toc", + "t2.toc", + "t3.toc", + "t4.toc", + "t5.toc", + "t6.toc", + "t7.toc", + "t8.toc", + "t9.toc" + }; + + const char *badtoc_file[NUM_BAD_TOCS] = { + "bad-msf-1.toc", + "bad-msf-2.toc", + "bad-mode1.toc" + }; + int ret=0; + unsigned int i; + + cdio_loglevel_default = CDIO_LOG_INFO; + for (i=0; i