public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jon Turney <jturney@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: testsuite: Skip devdsp test when no audio devices present
Date: Sun,  9 Jul 2023 16:01:29 +0000 (GMT)	[thread overview]
Message-ID: <20230709160129.A13B93857710@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=15d71e496187c7c38a7a207c7d0e45f0bb81f93b

commit 15d71e496187c7c38a7a207c7d0e45f0bb81f93b
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sat Jul 8 12:50:58 2023 +0100

    Cygwin: testsuite: Skip devdsp test when no audio devices present

Diff:
---
 winsup/testsuite/Makefile.am         |  3 +++
 winsup/testsuite/winsup.api/devdsp.c | 15 +++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/winsup/testsuite/Makefile.am b/winsup/testsuite/Makefile.am
index 577c32370..824bf3361 100644
--- a/winsup/testsuite/Makefile.am
+++ b/winsup/testsuite/Makefile.am
@@ -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
diff --git a/winsup/testsuite/winsup.api/devdsp.c b/winsup/testsuite/winsup.api/devdsp.c
index 6c8850a74..0ac76f085 100644
--- a/winsup/testsuite/winsup.api/devdsp.c
+++ b/winsup/testsuite/winsup.api/devdsp.c
@@ -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)

             reply	other threads:[~2023-07-09 16:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-09 16:01 Jon Turney [this message]
2023-07-14 15:28 Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230709160129.A13B93857710@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).