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.
This commit is contained in:
rocky
2004-12-19 00:02:09 +00:00
parent 8b111096d3
commit 81d0304b7e
7 changed files with 67 additions and 45 deletions

View File

@@ -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

View File

@@ -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<els;i++)p[i]=swap16(p[i]);
for(i=0;i<els;i++)p[i]=UINT16_SWAP_LE_BE_C(p[i]);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
$Id: utils.h,v 1.1 2004/12/18 17:29:32 rocky Exp $
$Id: utils.h,v 1.2 2004/12/19 00:02:09 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1998 Monty xiphmont@mit.edu
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
#include <cdio/types.h>
#include <cdio/bytesex.h>
/* 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));
}

View File

@@ -61,6 +61,7 @@
#include <cdio/cdda_interface.h>
#include <cdio/paranoia.h>
#include <cdio/bytesex.h>
#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<CDIO_CD_FRAMESIZE_RAW/2;i++)readbuf[i]=swap16(readbuf[i]);
for(i=0;i<CDIO_CD_FRAMESIZE_RAW/2;i++)
readbuf[i]=UINT16_SWAP_LE_BE_C(readbuf[i]);
}
callback(cursor*(CD_FRAMEWORDS)-1,-2);
@@ -1250,7 +1252,8 @@ int main(int argc,char *argv[]){
if(output_endian!=bigendianp()){
int i;
for(i=0;i<CDIO_CD_FRAMESIZE_RAW/2;i++)readbuf[i]=swap16(readbuf[i]);
for(i=0;i<CDIO_CD_FRAMESIZE_RAW/2;i++)
readbuf[i]=UINT16_SWAP_LE_BE_C(readbuf[i]);
}
/* One last bit of silliness to deal with sample offsets */
@@ -1279,7 +1282,7 @@ int main(int argc,char *argv[]){
if(output_endian!=bigendianp())
for(i=0;i<CDIO_CD_FRAMESIZE_RAW/2;i++)
offset_buffer[i]=swap16(readbuf[i]);
offset_buffer[i]=UINT16_SWAP_LE_BE_C(readbuf[i]);
else
memcpy(offset_buffer,readbuf,CDIO_CD_FRAMESIZE_RAW);
offset_buffer_used=sample_offset*4;

View File

@@ -1,5 +1,5 @@
/*
$Id: utils.h,v 1.1 2004/12/18 17:29:32 rocky Exp $
$Id: utils.h,v 1.2 2004/12/19 00:02:09 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1998 Monty xiphmont@mit.edu
@@ -24,6 +24,8 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <cdio/types.h>
#include <cdio/bytesex.h>
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));
}

View File

@@ -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 <rocky@panix.com>
#
@@ -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

31
test/check_paranoia.sh.in Normal file
View File

@@ -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: ***