From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2201) id A13B93857710; Sun, 9 Jul 2023 16:01:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A13B93857710 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688918489; bh=+KGVZJkeZ4fIUmJD/+hNTsXzo/ydtq1i1gWbqyo0MSw=; h=From:To:Subject:Date:From; b=FOr+i4v07Yh+HYC7J53sCz1ArTOH2wrhA9MmdL8vUoVZbdu43Z70ts0zFyt00heYH sr5nkZOPzuNV6ugLkRWlgojdXVXSn4ETemVQqdwoVA2nLemrsCOTNkeWE4eSbqkAs9 agSgyO4ya6VNOMbUtPZ4zN6DOhxMkM9PU/8NDVLU= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jon Turney To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: testsuite: Skip devdsp test when no audio devices present X-Act-Checkin: newlib-cygwin X-Git-Author: Jon Turney X-Git-Refname: refs/heads/master X-Git-Oldrev: 4f0676a6981e84272ef22be889d9cbf66fdbef89 X-Git-Newrev: 15d71e496187c7c38a7a207c7d0e45f0bb81f93b Message-Id: <20230709160129.A13B93857710@sourceware.org> Date: Sun, 9 Jul 2023 16:01:29 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D15d71e49618= 7c7c38a7a207c7d0e45f0bb81f93b commit 15d71e496187c7c38a7a207c7d0e45f0bb81f93b Author: Jon Turney 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 =3D -I$(srcdir)/libltp/include AM_LDFLAGS =3D $(LDFLAGS_FOR_TESTDLL) LDADD =3D $(builddir)/libltp.a $(builddir)/../cygwin/binmode.o $(LDADD_FOR= _TESTDLL) =20 +# additional flags for specific test executables +winsup_api_devdsp_LDADD =3D -lwinmm $(LDADD) + DEJATOOL =3D winsup =20 # Add '-v' to RUNTESTFLAGS if V=3D1 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 #include "test.h" /* use libltp framework */ =20 +#include + /* Controls if a child can open the device after the parent */ #define CHILD_EXPECT 0 /* 0 or 1 */ =20 @@ -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); =20 static int expect_child_failure =3D 0; =20 @@ -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; } =20 +/* skip test if we don't have any audio devices*/ +void +devcheck (void) +{ + if ((waveInGetNumDevs() =3D=3D 0) || (waveOutGetNumDevs() =3D=3D 0)) + { + tst_resm (TINFO, "Skipping, no audio devices present"); + exit(0); + } +} + /* test some extra ioctls */ void ioctltest (void)