Add regression-test mechanism. Right now we only have underrun testing.
Perhaps more later... cd-paranoia: -x option added to specify what to test.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdda.h,v 1.4 2005/01/10 02:10:46 rocky Exp $
|
$Id: cdda.h,v 1.5 2005/01/15 16:05:44 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 2001 Xiph.org
|
Copyright (C) 2001 Xiph.org
|
||||||
@@ -110,21 +110,37 @@ struct cdrom_drive_s {
|
|||||||
unsigned int orgsize;
|
unsigned int orgsize;
|
||||||
long bigbuff;
|
long bigbuff;
|
||||||
int adjust_ssize;
|
int adjust_ssize;
|
||||||
|
|
||||||
|
int i_test_flags; /**< Normally set 0. But if we are testing
|
||||||
|
paranoia operation this can be set to one of
|
||||||
|
the flag masks to simulate a particular kind of
|
||||||
|
failure. */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define CDDA_TEST_UNDERRUN 1 /**< Define if you want underrun testing */
|
||||||
|
#if TESTING_IS_FINISHED
|
||||||
|
#define CDDA_TEST_JITTER 2 /**< Define if you want jitter testing */
|
||||||
|
#define CDDA_TEST_FRAGMENT 4 /**< Define if you want fragment testing */
|
||||||
|
#define CDDA_TEST_SCRATCH 8 /**< Define if you want scratch testing */
|
||||||
|
#undef CDDA_TEST_BOGUS_BYTES
|
||||||
|
#undef CDDA_TEST_DROPDUPE_BYTES
|
||||||
|
#endif /* TESTING_IS_FINISHED */
|
||||||
|
|
||||||
/** autosense functions */
|
/** autosense functions */
|
||||||
|
|
||||||
|
/** Returns a CD-ROM drive with a CD-DA in it.
|
||||||
|
If mesagedest is 1, then any messages in the process will be stored
|
||||||
|
in message.
|
||||||
|
*/
|
||||||
extern cdrom_drive_t *cdda_find_a_cdrom(int messagedest, char **message);
|
extern cdrom_drive_t *cdda_find_a_cdrom(int messagedest, char **message);
|
||||||
|
|
||||||
|
/** Returns a CD-ROM drive with a CD-DA in it. */
|
||||||
extern cdrom_drive_t *cdda_identify(const char *device, int messagedest,
|
extern cdrom_drive_t *cdda_identify(const char *device, int messagedest,
|
||||||
char **message);
|
char **message);
|
||||||
extern cdrom_drive_t *cdda_identify_cooked(const char *device,int messagedest,
|
extern cdrom_drive_t *cdda_identify_cooked(const char *device,int messagedest,
|
||||||
char **message);
|
char **message);
|
||||||
#ifdef CDDA_TEST
|
/** drive-oriented functions */
|
||||||
extern cdrom_drive_t *cdda_identify_test(const char *filename,
|
|
||||||
int messagedest, char **message);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** oriented functions */
|
|
||||||
|
|
||||||
extern int cdda_speed_set(cdrom_drive_t *d, int speed);
|
extern int cdda_speed_set(cdrom_drive_t *d, int speed);
|
||||||
extern void cdda_verbose_set(cdrom_drive_t *d, int err_action,
|
extern void cdda_verbose_set(cdrom_drive_t *d, int err_action,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# $Id: Makefile.am,v 1.2 2005/01/05 04:16:11 rocky Exp $
|
# $Id: Makefile.am,v 1.3 2005/01/15 16:05:44 rocky Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
# Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -51,8 +51,7 @@ noinst_HEADERS = common_interface.h drive_exceptions.h low_interface.h \
|
|||||||
smallft.h utils.h
|
smallft.h utils.h
|
||||||
|
|
||||||
libcdio_cdda_sources = common_interface.c cooked_interface.c interface.c \
|
libcdio_cdda_sources = common_interface.c cooked_interface.c interface.c \
|
||||||
scan_devices.c smallft.c test_interface.c \
|
scan_devices.c smallft.c toc.c utils.c
|
||||||
toc.c utils.c
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libcdio_cdda.la
|
lib_LTLIBRARIES = libcdio_cdda.la
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cooked_interface.c,v 1.10 2005/01/15 02:23:04 rocky Exp $
|
$Id: cooked_interface.c,v 1.11 2005/01/15 16:05:44 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Original interface.c Copyright (C) 1994-1997
|
Original interface.c Copyright (C) 1994-1997
|
||||||
@@ -74,7 +74,6 @@ cooked_setspeed(cdrom_drive_t *d, int speed)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* read 'SectorBurst' adjacent sectors of audio sectors
|
/* read 'SectorBurst' adjacent sectors of audio sectors
|
||||||
* to Buffer '*p' beginning at sector 'lSector'
|
* to Buffer '*p' beginning at sector 'lSector'
|
||||||
*/
|
*/
|
||||||
@@ -88,6 +87,11 @@ cooked_read (cdrom_drive_t *d, void *p, lsn_t begin, long sectors)
|
|||||||
/* read d->nsectors at a time, max. */
|
/* read d->nsectors at a time, max. */
|
||||||
sectors=( sectors > d->nsectors && d->nsectors > 0 ? d->nsectors : sectors);
|
sectors=( sectors > d->nsectors && d->nsectors > 0 ? d->nsectors : sectors);
|
||||||
|
|
||||||
|
/* If we are testing under-run correction, we will deliberately set
|
||||||
|
what we read a frame short. */
|
||||||
|
if (d->i_test_flags & CDDA_TEST_UNDERRUN )
|
||||||
|
sectors--;
|
||||||
|
|
||||||
retry_count=0;
|
retry_count=0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -138,6 +142,9 @@ verify_read_command(cdrom_drive_t *d)
|
|||||||
int i;
|
int i;
|
||||||
int16_t *buff=malloc(CDIO_CD_FRAMESIZE_RAW);
|
int16_t *buff=malloc(CDIO_CD_FRAMESIZE_RAW);
|
||||||
int audioflag=0;
|
int audioflag=0;
|
||||||
|
int i_test_flags = d->i_test_flags;
|
||||||
|
|
||||||
|
d->i_test_flags = 0;
|
||||||
|
|
||||||
cdmessage(d,"Verifying drive can read CDDA...\n");
|
cdmessage(d,"Verifying drive can read CDDA...\n");
|
||||||
|
|
||||||
@@ -154,6 +161,7 @@ verify_read_command(cdrom_drive_t *d)
|
|||||||
cdmessage(d,"\tExpected command set reads OK.\n");
|
cdmessage(d,"\tExpected command set reads OK.\n");
|
||||||
d->enable_cdda(d,0);
|
d->enable_cdda(d,0);
|
||||||
free(buff);
|
free(buff);
|
||||||
|
d->i_test_flags = i_test_flags;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,16 +271,20 @@ cooked_init_drive (cdrom_drive_t *d){
|
|||||||
#endif /*HAVE_LINUX_MAJOR_H*/
|
#endif /*HAVE_LINUX_MAJOR_H*/
|
||||||
|
|
||||||
d->enable_cdda = Dummy;
|
d->enable_cdda = Dummy;
|
||||||
d->read_audio = cooked_read;
|
d->set_speed = cooked_setspeed;
|
||||||
d->set_speed = cooked_setspeed;
|
d->read_toc = cooked_readtoc;
|
||||||
d->read_toc = cooked_readtoc;
|
d->read_audio = cooked_read;
|
||||||
ret=d->tracks=d->read_toc(d);
|
|
||||||
|
ret = d->tracks = d->read_toc(d);
|
||||||
if(d->tracks<1)
|
if(d->tracks<1)
|
||||||
return(ret);
|
return(ret);
|
||||||
|
|
||||||
d->opened=1;
|
d->opened=1;
|
||||||
if((ret=verify_read_command(d)))return(ret);
|
|
||||||
|
if( (ret=verify_read_command(d)) ) return(ret);
|
||||||
|
|
||||||
d->error_retry=1;
|
d->error_retry=1;
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: interface.c,v 1.12 2005/01/14 04:09:30 rocky Exp $
|
$Id: interface.c,v 1.13 2005/01/15 16:05:44 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||||
@@ -76,12 +76,6 @@ cdda_open(cdrom_drive_t *d)
|
|||||||
if((ret=cooked_init_drive(d)))
|
if((ret=cooked_init_drive(d)))
|
||||||
return(ret);
|
return(ret);
|
||||||
break;
|
break;
|
||||||
#ifdef CDDA_TEST
|
|
||||||
case TEST_INTERFACE:
|
|
||||||
if((ret=test_init_drive(d)))
|
|
||||||
return(ret);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
cderror(d, "100: Interface not supported\n");
|
cderror(d, "100: Interface not supported\n");
|
||||||
return(-100);
|
return(-100);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
$Id: scan_devices.c,v 1.11 2005/01/15 03:22:48 rocky Exp $
|
$Id: scan_devices.c,v 1.12 2005/01/15 16:05:44 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1998 Monty xiphmont@mit.edu
|
Copyright (C) 1998 Monty xiphmont@mit.edu
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
*
|
*
|
||||||
* Autoscan for or verify presence of a cdrom device
|
* Autoscan for or verify presence of a CD-ROM device
|
||||||
*
|
*
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
@@ -127,10 +127,6 @@ cdda_identify(const char *device, int messagedest,char **messages)
|
|||||||
|
|
||||||
d=cdda_identify_cooked(device,messagedest,messages);
|
d=cdda_identify_cooked(device,messagedest,messages);
|
||||||
|
|
||||||
#ifdef CDDA_TEST
|
|
||||||
if(!d)d=cdda_identify_test(device,messagedest,messages);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return(d);
|
return(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,52 +269,3 @@ cdda_identify_cooked(const char *dev, int messagedest, char **messages)
|
|||||||
|
|
||||||
return(d);
|
return(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CDDA_TEST
|
|
||||||
|
|
||||||
cdrom_drive_t *cdda_identify_test(const char *filename, int messagedest,
|
|
||||||
char **messages){
|
|
||||||
|
|
||||||
cdrom_drive_t *d=NULL;
|
|
||||||
struct stat st;
|
|
||||||
int fd=-1;
|
|
||||||
|
|
||||||
idmessage(messagedest,messages,"\tTesting %s for file/test interface",
|
|
||||||
filename);
|
|
||||||
|
|
||||||
if(stat(filename,&st)){
|
|
||||||
idperror(messagedest,messages,"\t\tCould not access file %s",
|
|
||||||
filename);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!S_ISREG(st.st_mode)){
|
|
||||||
idmessage(messagedest,messages,"\t\t%s is not a regular file",
|
|
||||||
filename);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
fd=open(filename,O_RDONLY);
|
|
||||||
|
|
||||||
if(fd==-1){
|
|
||||||
idperror(messagedest,messages,"\t\tCould not open file %s",filename);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
d=calloc(1,sizeof(cdrom_drive_t));
|
|
||||||
|
|
||||||
d->cdda_device_name=strdup(filename);
|
|
||||||
d->ioctl_device_name=strdup(filename);
|
|
||||||
d->drive_type=-1;
|
|
||||||
d->cdda_fd=fd;
|
|
||||||
d->ioctl_fd=fd;
|
|
||||||
d->interface=TEST_INTERFACE;
|
|
||||||
d->bigendianp=-1; /* We don't know yet... */
|
|
||||||
d->nsectors=-1;
|
|
||||||
d->drive_model=strdup("File based test interface");
|
|
||||||
idmessage(messagedest,messages,"\t\tCDROM sensed: %s\n",d->drive_model);
|
|
||||||
|
|
||||||
return(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -541,7 +541,7 @@ callback(long int inpos, paranoia_cb_mode_t function)
|
|||||||
memset(dispcache,' ',graph);
|
memset(dispcache,' ',graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *optstring = "escCn:o:O:d:g:S:prRwafvqVQhZz::YXWBi:Tt:";
|
const char *optstring = "escCn:o:O:d:g:S:prRwafvqVQhZz::YXWBi:Tt:x:";
|
||||||
|
|
||||||
struct option options [] = {
|
struct option options [] = {
|
||||||
{"stderr-progress", no_argument, NULL, 'e'},
|
{"stderr-progress", no_argument, NULL, 'e'},
|
||||||
@@ -571,6 +571,7 @@ struct option options [] = {
|
|||||||
{"disable-paranoia", no_argument, NULL, 'Z'},
|
{"disable-paranoia", no_argument, NULL, 'Z'},
|
||||||
{"disable-extra-paranoia", no_argument, NULL, 'Y'},
|
{"disable-extra-paranoia", no_argument, NULL, 'Y'},
|
||||||
{"abort-on-skip", no_argument, NULL, 'X'},
|
{"abort-on-skip", no_argument, NULL, 'X'},
|
||||||
|
{"test-mode", required_argument, NULL, 'x'},
|
||||||
{"disable-fragmentation", no_argument, NULL, 'F'},
|
{"disable-fragmentation", no_argument, NULL, 'F'},
|
||||||
{"output-info", required_argument, NULL, 'i'},
|
{"output-info", required_argument, NULL, 'i'},
|
||||||
{"never-skip", optional_argument, NULL, 'z'},
|
{"never-skip", optional_argument, NULL, 'z'},
|
||||||
@@ -610,11 +611,12 @@ main(int argc,char *argv[])
|
|||||||
int force_cdrom_sectors = -1;
|
int force_cdrom_sectors = -1;
|
||||||
int force_cdrom_overlap = -1;
|
int force_cdrom_overlap = -1;
|
||||||
int force_cdrom_speed = -1;
|
int force_cdrom_speed = -1;
|
||||||
|
int test_flags = 0;
|
||||||
int max_retries = 20;
|
int max_retries = 20;
|
||||||
int output_type = 1; /* 0=raw, 1=wav, 2=aifc */
|
int output_type = 1; /* 0=raw, 1=wav, 2=aifc */
|
||||||
int output_endian = 0; /* -1=host, 0=little, 1=big */
|
int output_endian = 0; /* -1=host, 0=little, 1=big */
|
||||||
int query_only = 0;
|
int query_only = 0;
|
||||||
int batch = 0;
|
int batch = 0;
|
||||||
|
|
||||||
/* full paranoia, but allow skipping */
|
/* full paranoia, but allow skipping */
|
||||||
int paranoia_mode=PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP;
|
int paranoia_mode=PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP;
|
||||||
@@ -743,6 +745,9 @@ main(int argc,char *argv[])
|
|||||||
case 'O':
|
case 'O':
|
||||||
sample_offset=atoi(optarg);
|
sample_offset=atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'x':
|
||||||
|
test_flags=atoi(optarg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage(stderr);
|
usage(stderr);
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -843,6 +848,7 @@ main(int argc,char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d->i_test_flags = test_flags;
|
||||||
switch( cdda_open(d) ) {
|
switch( cdda_open(d) ) {
|
||||||
case -2:case -3:case -4:case -5:
|
case -2:case -3:case -4:case -5:
|
||||||
report("\nUnable to open disc. Is there an audio CD in the drive?");
|
report("\nUnable to open disc. Is there an audio CD in the drive?");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# $Id: check_paranoia.sh.in,v 1.2 2005/01/15 10:17:17 rocky Exp $
|
# $Id: check_paranoia.sh.in,v 1.3 2005/01/15 16:05:44 rocky Exp $
|
||||||
# Compare our cd-paranoia with an installed cdparanoia
|
# Compare our cd-paranoia with an installed cdparanoia
|
||||||
|
|
||||||
if test "@CMP@" != no -a "@BUILD_CD_PARANOIA_TRUE@"X = X ; then
|
if test "@CMP@" != no -a "@BUILD_CD_PARANOIA_TRUE@"X = X ; then
|
||||||
@@ -12,6 +12,15 @@ if test "@CMP@" != no -a "@BUILD_CD_PARANOIA_TRUE@"X = X ; then
|
|||||||
echo "** Raw cdda.bin extraction differ"
|
echo "** Raw cdda.bin extraction differ"
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
../src/cd-paranoia/cd-paranoia -d ./cdda.cue -x 1 -v -r -- "1-"
|
||||||
|
mv cdda.raw cdda-underrun.raw
|
||||||
|
../src/cd-paranoia/cd-paranoia -d ./cdda.cue -r -- "1-"
|
||||||
|
if @CMP@ ./cdda-underrun.raw ./cdda.raw ; then
|
||||||
|
echo "** Under-run correction okay"
|
||||||
|
else
|
||||||
|
echo "** Under-run correction problem"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "Don't see libcdio cd-paranoia program. Test skipped."
|
echo "Don't see libcdio cd-paranoia program. Test skipped."
|
||||||
|
|||||||
Reference in New Issue
Block a user