OSDN Git Service

* winsup.api/devdsp.c (ioctltest): Add 2 tests for ioctl codes
authorcorinna <corinna>
Mon, 5 Apr 2004 08:30:11 +0000 (08:30 +0000)
committercorinna <corinna>
Mon, 5 Apr 2004 08:30:11 +0000 (08:30 +0000)
SNDCTL_DSP_CHANNELS and SNDCTL_DSP_GETCAPS.

winsup/testsuite/ChangeLog
winsup/testsuite/winsup.api/devdsp.c

index fa53a2f..37c569d 100644 (file)
@@ -1,3 +1,8 @@
+2004-04-04  Gerd Spalink  <Gerd.Spalink@t-online.de>
+
+       * winsup.api/devdsp.c (ioctltest): Add 2 tests for ioctl codes
+       SNDCTL_DSP_CHANNELS and SNDCTL_DSP_GETCAPS.
+
 2004-03-24  Gerd Spalink  <Gerd.Spalink@t-online.de>
 
        * winsup.api/devdsp.c: New file, testing fhandler_dev_dsp code.
index 81d664a..087ff3e 100644 (file)
@@ -35,8 +35,8 @@ static const char wavfile_okay[] =
   };
 
 /* Globals required by libltp */
-const char *TCID = "devdsp";   /* set test case identifier */
-int TST_TOTAL = 32;
+const char *TCID = "devdsp";   /* set test case identifier */
+int TST_TOTAL = 34;
 
 /* Prototypes */
 void sinegen (void *wave, int rate, int bits, int len, int stride);
@@ -92,6 +92,7 @@ ioctltest (void)
 {
   int audio1;
   int ioctl_par;
+  int channels;
 
   audio1 = open ("/dev/dsp", O_WRONLY);
   if (audio1 < 0)
@@ -99,6 +100,18 @@ ioctltest (void)
       tst_brkm (TFAIL, cleanup, "open W: %s", strerror (errno));
     }
   setpars (audio1, 44100, 1, 16);
+
+  channels = ioctl_par = 1;
+  while (ioctl (audio1, SNDCTL_DSP_CHANNELS, &ioctl_par) == 0)
+    {
+      channels++;
+      ioctl_par = channels;
+    }
+  if (channels == ioctl_par)
+    tst_resm (TFAIL, "Max channels=%d failed", ioctl_par);
+  else
+    tst_resm (TPASS, "Max channels=%d failed, OK=%d", channels, ioctl_par);
+
   /* Note: block size may depend on parameters */
   if (ioctl (audio1, SNDCTL_DSP_GETBLKSIZE, &ioctl_par) < 0)
     {
@@ -110,6 +123,11 @@ ioctltest (void)
       tst_brkm (TFAIL, cleanup, "ioctl GETFMTS: %s", strerror (errno));
     }
   tst_resm (TPASS, "ioctl get formats=%08x", ioctl_par);
+  if (ioctl (audio1, SNDCTL_DSP_GETCAPS, &ioctl_par) < 0)
+    {
+      tst_brkm (TFAIL, cleanup, "ioctl GETCAPS: %s", strerror (errno));
+    }
+  tst_resm (TPASS, "ioctl get caps=%08x", ioctl_par);
   if (close (audio1) < 0)
     {
       tst_brkm (TFAIL, cleanup, "Close audio: %s", strerror (errno));