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:
rocky
2005-01-15 16:05:44 +00:00
parent a1e6e4f5d2
commit aa50f5e09a
7 changed files with 70 additions and 87 deletions

View File

@@ -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
# 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
libcdio_cdda_sources = common_interface.c cooked_interface.c interface.c \
scan_devices.c smallft.c test_interface.c \
toc.c utils.c
scan_devices.c smallft.c toc.c utils.c
lib_LTLIBRARIES = libcdio_cdda.la

View File

@@ -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>
Original interface.c Copyright (C) 1994-1997
@@ -74,7 +74,6 @@ cooked_setspeed(cdrom_drive_t *d, int speed)
return 0;
}
/* read 'SectorBurst' adjacent sectors of audio sectors
* 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. */
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;
do {
@@ -138,6 +142,9 @@ verify_read_command(cdrom_drive_t *d)
int i;
int16_t *buff=malloc(CDIO_CD_FRAMESIZE_RAW);
int audioflag=0;
int i_test_flags = d->i_test_flags;
d->i_test_flags = 0;
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");
d->enable_cdda(d,0);
free(buff);
d->i_test_flags = i_test_flags;
return(0);
}
}
@@ -263,16 +271,20 @@ cooked_init_drive (cdrom_drive_t *d){
#endif /*HAVE_LINUX_MAJOR_H*/
d->enable_cdda = Dummy;
d->read_audio = cooked_read;
d->set_speed = cooked_setspeed;
d->read_toc = cooked_readtoc;
ret=d->tracks=d->read_toc(d);
d->set_speed = cooked_setspeed;
d->read_toc = cooked_readtoc;
d->read_audio = cooked_read;
ret = d->tracks = d->read_toc(d);
if(d->tracks<1)
return(ret);
d->opened=1;
if((ret=verify_read_command(d)))return(ret);
if( (ret=verify_read_command(d)) ) return(ret);
d->error_retry=1;
return(0);
}

View File

@@ -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) 1998 Monty xiphmont@mit.edu
@@ -76,12 +76,6 @@ cdda_open(cdrom_drive_t *d)
if((ret=cooked_init_drive(d)))
return(ret);
break;
#ifdef CDDA_TEST
case TEST_INTERFACE:
if((ret=test_init_drive(d)))
return(ret);
break;
#endif
default:
cderror(d, "100: Interface not supported\n");
return(-100);

View File

@@ -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
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);
#ifdef CDDA_TEST
if(!d)d=cdda_identify_test(device,messagedest,messages);
#endif
return(d);
}
@@ -273,52 +269,3 @@ cdda_identify_cooked(const char *dev, int messagedest, char **messages)
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