mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-07 15:00:24 +08:00
* winsup.api/devdsp.c (forkrectest): Move synchronization with child
so that test passes also under high CPU load. (forkplaytest): Ditto. (abortplaytest): New function to test ioctl code SNDCTL_DSP_RESET.
This commit is contained in:
parent
37194b25f6
commit
7e044afdaf
@ -1,3 +1,10 @@
|
|||||||
|
2004-04-13 Gerd Spalink <Gerd.Spalink@t-online.de>
|
||||||
|
|
||||||
|
* winsup.api/devdsp.c (forkrectest): Move synchronization with child
|
||||||
|
so that test passes also under high CPU load.
|
||||||
|
(forkplaytest): Ditto.
|
||||||
|
(abortplaytest): New function to test ioctl code SNDCTL_DSP_RESET.
|
||||||
|
|
||||||
2004-04-04 Gerd Spalink <Gerd.Spalink@t-online.de>
|
2004-04-04 Gerd Spalink <Gerd.Spalink@t-online.de>
|
||||||
|
|
||||||
* winsup.api/devdsp.c (ioctltest): Add 2 tests for ioctl codes
|
* winsup.api/devdsp.c (ioctltest): Add 2 tests for ioctl codes
|
||||||
|
@ -36,7 +36,7 @@ static const char wavfile_okay[] =
|
|||||||
|
|
||||||
/* Globals required by libltp */
|
/* Globals required by libltp */
|
||||||
const char *TCID = "devdsp"; /* set test case identifier */
|
const char *TCID = "devdsp"; /* set test case identifier */
|
||||||
int TST_TOTAL = 34;
|
int TST_TOTAL = 35;
|
||||||
|
|
||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
void sinegen (void *wave, int rate, int bits, int len, int stride);
|
void sinegen (void *wave, int rate, int bits, int len, int stride);
|
||||||
@ -53,6 +53,7 @@ void recordingtest (void);
|
|||||||
void playbacktest (void);
|
void playbacktest (void);
|
||||||
void monitortest (void);
|
void monitortest (void);
|
||||||
void ioctltest (void);
|
void ioctltest (void);
|
||||||
|
void abortplaytest (void);
|
||||||
void playwavtest (void);
|
void playwavtest (void);
|
||||||
void syncwithchild (pid_t pid, int expected_exit_status);
|
void syncwithchild (pid_t pid, int expected_exit_status);
|
||||||
void cleanup (void);
|
void cleanup (void);
|
||||||
@ -80,6 +81,7 @@ main (int argc, char *argv[])
|
|||||||
monitortest ();
|
monitortest ();
|
||||||
forkplaytest ();
|
forkplaytest ();
|
||||||
forkrectest ();
|
forkrectest ();
|
||||||
|
abortplaytest ();
|
||||||
playwavtest ();
|
playwavtest ();
|
||||||
tst_exit ();
|
tst_exit ();
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
@ -247,11 +249,10 @@ forkrectest (void)
|
|||||||
if (pid)
|
if (pid)
|
||||||
{
|
{
|
||||||
tst_resm (TINFO, "forked, child PID=%d", pid);
|
tst_resm (TINFO, "forked, child PID=%d", pid);
|
||||||
sleep (1);
|
syncwithchild (pid, 0);
|
||||||
tst_resm (TINFO, "parent records..");
|
tst_resm (TINFO, "parent records..");
|
||||||
rectest (fd, 22050, 1, 16);
|
rectest (fd, 22050, 1, 16);
|
||||||
tst_resm (TINFO, "parent done");
|
tst_resm (TINFO, "parent done");
|
||||||
syncwithchild (pid, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* child */
|
{ /* child */
|
||||||
@ -273,10 +274,10 @@ forkrectest (void)
|
|||||||
if (pid)
|
if (pid)
|
||||||
{
|
{
|
||||||
tst_resm (TINFO, "forked, child PID=%d", pid);
|
tst_resm (TINFO, "forked, child PID=%d", pid);
|
||||||
|
syncwithchild (pid, TFAIL); /* expecting error exit */
|
||||||
tst_resm (TINFO, "parent records again ..");
|
tst_resm (TINFO, "parent records again ..");
|
||||||
rectest (fd, 22050, 1, 16);
|
rectest (fd, 22050, 1, 16);
|
||||||
tst_resm (TINFO, "parent done");
|
tst_resm (TINFO, "parent done");
|
||||||
syncwithchild (pid, TFAIL); /* expecting error exit */
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* child */
|
{ /* child */
|
||||||
@ -315,11 +316,10 @@ forkplaytest (void)
|
|||||||
if (pid)
|
if (pid)
|
||||||
{
|
{
|
||||||
tst_resm (TINFO, "forked, child PID=%d", pid);
|
tst_resm (TINFO, "forked, child PID=%d", pid);
|
||||||
sleep (1);
|
syncwithchild (pid, 0);
|
||||||
tst_resm (TINFO, "parent plays..");
|
tst_resm (TINFO, "parent plays..");
|
||||||
playtest (fd, 22050, 0, 8);
|
playtest (fd, 22050, 0, 8);
|
||||||
tst_resm (TINFO, "parent done");
|
tst_resm (TINFO, "parent done");
|
||||||
syncwithchild (pid, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* child */
|
{ /* child */
|
||||||
@ -341,10 +341,10 @@ forkplaytest (void)
|
|||||||
if (pid)
|
if (pid)
|
||||||
{
|
{
|
||||||
tst_resm (TINFO, "forked, child PID=%d", pid);
|
tst_resm (TINFO, "forked, child PID=%d", pid);
|
||||||
|
syncwithchild (pid, TFAIL); /* expected failure */
|
||||||
tst_resm (TINFO, "parent plays again..");
|
tst_resm (TINFO, "parent plays again..");
|
||||||
playtest (fd, 22050, 0, 8);
|
playtest (fd, 22050, 0, 8);
|
||||||
tst_resm (TINFO, "parent done");
|
tst_resm (TINFO, "parent done");
|
||||||
syncwithchild (pid, TFAIL); /* expected failure */
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* child */
|
{ /* child */
|
||||||
@ -603,6 +603,39 @@ sinegenb (int freq, int samprate, unsigned char *value, int len, int stride)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
abortplaytest (void)
|
||||||
|
{
|
||||||
|
int audio;
|
||||||
|
int size = sizeof (wavfile_okay);
|
||||||
|
int n;
|
||||||
|
int ioctl_par = 0;
|
||||||
|
|
||||||
|
audio = open ("/dev/dsp", O_WRONLY);
|
||||||
|
if (audio < 0)
|
||||||
|
{
|
||||||
|
tst_brkm (TFAIL, cleanup, "Error open /dev/dsp W: %s",
|
||||||
|
strerror (errno));
|
||||||
|
}
|
||||||
|
if ((n = write (audio, wavfile_okay, size)) < 0)
|
||||||
|
{
|
||||||
|
tst_brkm (TFAIL, cleanup, "write: %s", strerror (errno));
|
||||||
|
}
|
||||||
|
if (n != size)
|
||||||
|
{
|
||||||
|
tst_brkm (TFAIL, cleanup, "Wrote %d, expected %d; exit", n, size);
|
||||||
|
}
|
||||||
|
if (ioctl (audio, SNDCTL_DSP_RESET, &ioctl_par) < 0)
|
||||||
|
{
|
||||||
|
tst_brkm (TFAIL, cleanup, "ioctl DSP_RESET: %s", strerror (errno));
|
||||||
|
}
|
||||||
|
if (close (audio) < 0)
|
||||||
|
{
|
||||||
|
tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno));
|
||||||
|
}
|
||||||
|
tst_resm (TPASS, "Playwav + ioctl DSP_RESET=%d", ioctl_par);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playwavtest (void)
|
playwavtest (void)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user