From 81d0304b7e26e3d1138d7fe5c34efc556cebb285 Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 19 Dec 2004 00:02:09 +0000 Subject: [PATCH] test/*, configure.ac: First paranoia regression test. It's run automatically as it assumes that you have a *flawless* CD-DA in a drive. *.{c,h}: more integration toward libcdio routines. In particular remove swap16 and swap32. --- configure.ac | 11 ++++++++++- lib/cdda_interface/interface.c | 2 +- lib/cdda_interface/utils.h | 27 ++++++++------------------- src/cd-paranoia/cd-paranoia.c | 9 ++++++--- src/cd-paranoia/utils.h | 24 +++++++----------------- test/Makefile.am | 8 ++++---- test/check_paranoia.sh.in | 31 +++++++++++++++++++++++++++++++ 7 files changed, 67 insertions(+), 45 deletions(-) create mode 100644 test/check_paranoia.sh.in diff --git a/configure.ac b/configure.ac index b6dad625..afd57693 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ define(RELEASE_NUM, 72) define(CDIO_VERSION_STR, 0.$1cvs) AC_PREREQ(2.52) -AC_REVISION([$Id: configure.ac,v 1.120 2004/12/18 21:24:25 rocky Exp $])dnl +AC_REVISION([$Id: configure.ac,v 1.121 2004/12/19 00:02:09 rocky Exp $])dnl AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM)) AC_CONFIG_SRCDIR(src/cd-info.c) AM_INIT_AUTOMAKE @@ -127,6 +127,13 @@ fi AC_SUBST(DIFF) AC_SUBST(DIFF_OPTS) +# We use cmp and cdparanoia in cd-paranoia regression testing +AC_PATH_PROG(CMP, cmp, no) +AC_SUBST(CMP) + +AC_PATH_PROG(OLD_CDPARANOIA, cdparanoia, no) +AC_SUBST(OLD_CDPARANOIA) + AM_PATH_LIBPOPT(, [AC_MSG_WARN([Diagnostic programs cd-drive, cd-info, cd-read, iso-info, and is-read will not get built.]) enable_cd_info=no; @@ -493,6 +500,7 @@ AC_CONFIG_FILES([ \ test/check_nrg.sh \ test/check_cue.sh \ test/check_iso.sh \ + test/check_paranoia.sh \ test/check_common_fn \ test/Makefile \ ]) @@ -502,6 +510,7 @@ AC_CONFIG_COMMANDS([default],[[ chmod +x test/check_nrg.sh chmod +x test/check_cue.sh chmod +x test/check_iso.sh +chmod +x test/check_paranoia.sh ]],[[]]) AC_OUTPUT diff --git a/lib/cdda_interface/interface.c b/lib/cdda_interface/interface.c index 3f63b30a..d63f9973 100644 --- a/lib/cdda_interface/interface.c +++ b/lib/cdda_interface/interface.c @@ -115,7 +115,7 @@ long cdda_read(cdrom_drive_t *d, void *buffer, long beginsector, long sectors) u_int16_t *p=(u_int16_t *)buffer; long els=sectors*CD_FRAMESIZE_RAW/2; - for(i=0;i Copyright (C) 1998 Monty xiphmont@mit.edu @@ -24,6 +24,7 @@ #include #include #include +#include /* I wonder how many alignment issues this is gonna trip in the future... it shouldn't trip any... I guess we'll find out :) */ @@ -35,26 +36,14 @@ static inline int bigendianp(void){ return(1); } -static inline int32_t swap32(int32_t x){ - return((((u_int32_t)x & 0x000000ffU) << 24) | - (((u_int32_t)x & 0x0000ff00U) << 8) | - (((u_int32_t)x & 0x00ff0000U) >> 8) | - (((u_int32_t)x & 0xff000000U) >> 24)); -} - -static inline int16_t swap16(int16_t x){ - return((((u_int16_t)x & 0x00ffU) << 8) | - (((u_int16_t)x & 0xff00U) >> 8)); -} - #if BYTE_ORDER == LITTLE_ENDIAN static inline int32_t be32_to_cpu(int32_t x){ - return(swap32(x)); + return(UINT32_SWAP_LE_BE_C(x)); } static inline int16_t be16_to_cpu(int16_t x){ - return(swap16(x)); + return(UINT16_SWAP_LE_BE_C(x)); } static inline int32_t le32_to_cpu(int32_t x){ @@ -76,11 +65,11 @@ static inline int16_t be16_to_cpu(int16_t x){ } static inline int32_t le32_to_cpu(int32_t x){ - return(swap32(x)); + return(UINT32_SWAP_LE_BE_C(x)); } static inline int16_t le16_to_cpu(int16_t x){ - return(swap16(x)); + return(UINT16_SWAP_LE_BE_C(x)); } @@ -127,7 +116,7 @@ void cderror(cdrom_drive_t *d, const char *s); void cdmessage(cdrom_drive_t *d,const char *s); -void idperror(int messagedest,char **messages,const char *f, const char *s); +void idperror(int messagedest, char **messages, const char *f, const char *s); -void idmessage(int messagedest,char **messages,const char *f, const char *s); +void idmessage(int messagedest, char **messages, const char *f, const char *s); diff --git a/src/cd-paranoia/cd-paranoia.c b/src/cd-paranoia/cd-paranoia.c index 3145c2af..612c6f5c 100644 --- a/src/cd-paranoia/cd-paranoia.c +++ b/src/cd-paranoia/cd-paranoia.c @@ -61,6 +61,7 @@ #include #include +#include #include "utils.h" #include "report.h" #include "version.h" @@ -1236,7 +1237,8 @@ int main(int argc,char *argv[]){ if(output_endian!=bigendianp()){ int i; - for(i=0;i Copyright (C) 1998 Monty xiphmont@mit.edu @@ -24,6 +24,8 @@ #include #include #include +#include +#include extern long buffering_write(int outf, char *buffer, long num); extern int buffering_close(int fd); @@ -39,26 +41,14 @@ static inline int bigendianp(void){ return(1); } -static inline int32_t swap32(int32_t x){ - return((((u_int32_t)x & 0x000000ffU) << 24) | - (((u_int32_t)x & 0x0000ff00U) << 8) | - (((u_int32_t)x & 0x00ff0000U) >> 8) | - (((u_int32_t)x & 0xff000000U) >> 24)); -} - -static inline int16_t swap16(int16_t x){ - return((((u_int16_t)x & 0x00ffU) << 8) | - (((u_int16_t)x & 0xff00U) >> 8)); -} - #if BYTE_ORDER == LITTLE_ENDIAN static inline int32_t be32_to_cpu(int32_t x){ - return(swap32(x)); + return(UINT32_SWAP_LE_BE_C(x)); } static inline int16_t be16_to_cpu(int16_t x){ - return(swap16(x)); + return(UINT16_SWAP_LE_BE_C(x)); } static inline int32_t le32_to_cpu(int32_t x){ @@ -80,11 +70,11 @@ static inline int16_t be16_to_cpu(int16_t x){ } static inline int32_t le32_to_cpu(int32_t x){ - return(swap32(x)); + return(UINT32_SWAP_LE_BE_C(x)); } static inline int16_t le16_to_cpu(int16_t x){ - return(swap16(x)); + return(UINT16_SWAP_LE_BE_C(x)); } diff --git a/test/Makefile.am b/test/Makefile.am index 7b4a809e..7c6bd4db 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.35 2004/12/18 17:29:32 rocky Exp $ +# $Id: Makefile.am,v 1.36 2004/12/19 00:02:09 rocky Exp $ # # Copyright (C) 2003, 2004 Rocky Bernstein # @@ -41,7 +41,7 @@ testbincue_LDADD = $(LIBCDIO_LIBS) testbincue_CFLAGS = -DTEST_DIR=\"$(srcdir)\" check_SCRIPTS = check_nrg.sh check_cue.sh check_cd_read.sh \ - check_iso.sh check_opts.sh + check_iso.sh check_opts.sh check_paranoia.sh check_PROGRAMS = $(hack) @@ -68,7 +68,7 @@ EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \ TESTS = $(check_PROGRAMS) $(check_SCRIPTS) XFAIL_TESTS = testassert -MOSTLYCLEANFILES = core core.* *.dump +MOSTLYCLEANFILES = core core.* *.dump cdda-orig.wav cdda-try.wav test: check @@ -81,7 +81,7 @@ test: check # life the crappy automess system that I've really lost interest in # learning any more of this awful system than I need to. check-am: make-executable -make-executable: check_nrg.sh check_cue.sh +make-executable: check_nrg.sh check_cue.sh check_paranoia.sh chmod +x *.sh if test ! -f cdda.bin ; then $(LN_S) $(srcdir)/cdda.bin cdda.bin ; fi if test ! -f isofs-m1.bin ; then $(LN_S) $(srcdir)/isofs-m1.bin isofs-m1.bin ; fi diff --git a/test/check_paranoia.sh.in b/test/check_paranoia.sh.in new file mode 100644 index 00000000..05fc8ee1 --- /dev/null +++ b/test/check_paranoia.sh.in @@ -0,0 +1,31 @@ +#!/bin/sh +# $Id: check_paranoia.sh.in,v 1.1 2004/12/19 00:02:09 rocky Exp $ +# Compare our cd-paranoia with an installed cdparanoia + +if test "@OLD_CDPARANOIA@" != no -a -x @OLD_CDPARANOIA@ ; then + if test "@CMP@" != no -a -x @OLD_CDPARANOIA@ ; then + for opt in '' '-r' '-p' '-f' '-a' ; do + frames='"1[:130]-1[:134]"' + ../src/cd-paranoia/cd-paranoia $frames cdda-try.wav + @OLD_CDPARANOIA@ $frames cdda-orig.wav + if @CMP@ cdda-try.wav cdda-orig.wav ; then + echo "** New and old paranoia output are identical using option '$opt'" + else + echo "** New and old paranoia output differ using option $opt" + exit 3 + fi + done + exit 0 + else + echo "Don't see libcdio cd-paranoia program. Test skipped." + exit 77 + fi +else + echo "Don't see non-libcdio cdparanoia program. Test skipped." + exit 77 +fi +#;;; Local Variables: *** +#;;; mode:shell-script *** +#;;; eval: (sh-set-shell "bash") *** +#;;; End: *** +