Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2004-04-13 13:40:03 +0400
committerCorinna Vinschen <corinna@vinschen.de>2004-04-13 13:40:03 +0400
commit7e044afdafa7a37c0c065bb819af0acaf1a7bea1 (patch)
tree7afe0dc6989f7b4ec246b94cd3ddf5597c1e2db4 /winsup/testsuite
parent37194b25f6d1228fef067f0d29e75f77fda3cf4b (diff)
* 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.
Diffstat (limited to 'winsup/testsuite')
-rw-r--r--winsup/testsuite/ChangeLog7
-rw-r--r--winsup/testsuite/winsup.api/devdsp.c47
2 files changed, 47 insertions, 7 deletions
diff --git a/winsup/testsuite/ChangeLog b/winsup/testsuite/ChangeLog
index 37c569d24..d7f2fa04d 100644
--- a/winsup/testsuite/ChangeLog
+++ b/winsup/testsuite/ChangeLog
@@ -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>
* winsup.api/devdsp.c (ioctltest): Add 2 tests for ioctl codes
diff --git a/winsup/testsuite/winsup.api/devdsp.c b/winsup/testsuite/winsup.api/devdsp.c
index 087ff3eaf..02c37b02f 100644
--- a/winsup/testsuite/winsup.api/devdsp.c
+++ b/winsup/testsuite/winsup.api/devdsp.c
@@ -36,7 +36,7 @@ static const char wavfile_okay[] =
/* Globals required by libltp */
const char *TCID = "devdsp"; /* set test case identifier */
-int TST_TOTAL = 34;
+int TST_TOTAL = 35;
/* Prototypes */
void sinegen (void *wave, int rate, int bits, int len, int stride);
@@ -53,6 +53,7 @@ void recordingtest (void);
void playbacktest (void);
void monitortest (void);
void ioctltest (void);
+void abortplaytest (void);
void playwavtest (void);
void syncwithchild (pid_t pid, int expected_exit_status);
void cleanup (void);
@@ -80,6 +81,7 @@ main (int argc, char *argv[])
monitortest ();
forkplaytest ();
forkrectest ();
+ abortplaytest ();
playwavtest ();
tst_exit ();
/* NOTREACHED */
@@ -247,11 +249,10 @@ forkrectest (void)
if (pid)
{
tst_resm (TINFO, "forked, child PID=%d", pid);
- sleep (1);
+ syncwithchild (pid, 0);
tst_resm (TINFO, "parent records..");
rectest (fd, 22050, 1, 16);
tst_resm (TINFO, "parent done");
- syncwithchild (pid, 0);
}
else
{ /* child */
@@ -273,10 +274,10 @@ forkrectest (void)
if (pid)
{
tst_resm (TINFO, "forked, child PID=%d", pid);
+ syncwithchild (pid, TFAIL); /* expecting error exit */
tst_resm (TINFO, "parent records again ..");
rectest (fd, 22050, 1, 16);
tst_resm (TINFO, "parent done");
- syncwithchild (pid, TFAIL); /* expecting error exit */
}
else
{ /* child */
@@ -315,11 +316,10 @@ forkplaytest (void)
if (pid)
{
tst_resm (TINFO, "forked, child PID=%d", pid);
- sleep (1);
+ syncwithchild (pid, 0);
tst_resm (TINFO, "parent plays..");
playtest (fd, 22050, 0, 8);
tst_resm (TINFO, "parent done");
- syncwithchild (pid, 0);
}
else
{ /* child */
@@ -341,10 +341,10 @@ forkplaytest (void)
if (pid)
{
tst_resm (TINFO, "forked, child PID=%d", pid);
+ syncwithchild (pid, TFAIL); /* expected failure */
tst_resm (TINFO, "parent plays again..");
playtest (fd, 22050, 0, 8);
tst_resm (TINFO, "parent done");
- syncwithchild (pid, TFAIL); /* expected failure */
}
else
{ /* child */
@@ -604,6 +604,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
playwavtest (void)
{
int audio;