]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: testsuite: Skip devdsp test when no audio devices present
authorJon Turney <jon.turney@dronecode.org.uk>
Sat, 8 Jul 2023 11:50:58 +0000 (12:50 +0100)
committerJon Turney <jon.turney@dronecode.org.uk>
Fri, 14 Jul 2023 13:02:41 +0000 (14:02 +0100)
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
winsup/testsuite/Makefile.am
winsup/testsuite/winsup.api/devdsp.c

index 11332eda2af15c19a4032d87da8a545e2f3a7efd..60111a0aacad91a993a27f45a37bd3c66ef6109b 100644 (file)
@@ -325,6 +325,9 @@ AM_CPPFLAGS = -I$(srcdir)/libltp/include
 AM_LDFLAGS = $(LDFLAGS_FOR_TESTDLL)
 LDADD = $(builddir)/libltp.a $(builddir)/../cygwin/binmode.o $(LDADD_FOR_TESTDLL)
 
+# additional flags for specific test executables
+winsup_api_devdsp_LDADD = -lwinmm $(LDADD)
+
 DEJATOOL = winsup
 
 # Add '-v' to RUNTESTFLAGS if V=1
index 6c8850a7495f2b6aeb9efeb8f52f731914680e2c..0ac76f0855a7f406fcc30f361ac4f83d3e5ea8de 100644 (file)
@@ -27,6 +27,8 @@ details. */
 #include <errno.h>
 #include "test.h" /* use libltp framework */
 
+#include <windows.h>
+
 /* Controls if a child can open the device after the parent */
 #define CHILD_EXPECT 0 /* 0 or 1 */
 
@@ -59,6 +61,7 @@ void playwavtest (void);
 void syncwithchild (pid_t pid, int expected_exit_status);
 void cleanup (void);
 void dup_test (void);
+void devcheck (void);
 
 static int expect_child_failure = 0;
 
@@ -77,6 +80,7 @@ int
 main (int argc, char *argv[])
 {
   /*  tst_brkm(TBROK, cleanup, "see if it breaks all right"); */
+  devcheck ();
   ioctltest ();
   playbacktest ();
   recordingtest ();
@@ -91,6 +95,17 @@ main (int argc, char *argv[])
   return 0;
 }
 
+/* skip test if we don't have any audio devices*/
+void
+devcheck (void)
+{
+  if ((waveInGetNumDevs() == 0) || (waveOutGetNumDevs() == 0))
+    {
+      tst_resm (TINFO, "Skipping, no audio devices present");
+      exit(0);
+    }
+}
+
 /* test some extra ioctls */
 void
 ioctltest (void)
This page took 0.035884 seconds and 5 git commands to generate.