CVS commit: src/tests/dev/audio
Module Name:src Committed By: mlelstv Date: Mon Dec 11 09:26:08 UTC 2023 Modified Files: src/tests/dev/audio: audiotest.c Log Message: mmap() fails for size == 0 with EINVAL unless the mapping is anonymous. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.31 src/tests/dev/audio/audiotest.c:1.32 --- src/tests/dev/audio/audiotest.c:1.31 Thu Aug 3 08:36:38 2023 +++ src/tests/dev/audio/audiotest.c Mon Dec 11 09:26:08 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.31 2023/08/03 08:36:38 rin Exp $ */ +/* $NetBSD: audiotest.c,v 1.32 2023/12/11 09:26:08 mlelstv Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.31 2023/08/03 08:36:38 rin Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.32 2023/12/11 09:26:08 mlelstv Exp $"); #include #include @@ -2773,13 +2773,13 @@ test_mmap_len(size_t len, off_t offset, reset_after_mmap(); } #define f(l, o, e) test_mmap_len(l, o, e) -DEF(mmap_len_0) { f(0, 0, 0); } /* len is 0 */ +DEF(mmap_len_0) { f(0, 0, EINVAL); } /* len is 0 */ DEF(mmap_len_1) { f(1, 0, 0); } /* len is smaller than lsize */ DEF(mmap_len_2) { f(LS, 0, 0); } /* len is the same as lsize */ DEF(mmap_len_3) { f(LS1, 0, EOVERFLOW); } /* len is larger */ DEF(mmap_len_4) { f(0, -1, EINVAL); } /* offset is negative */ -DEF(mmap_len_5) { f(0, LS, 0); } /* pointless param but ok */ -DEF(mmap_len_6) { f(0, LS1, EOVERFLOW); } /* exceed */ +DEF(mmap_len_5) { f(0, LS, EINVAL); } /* len is 0 */ +DEF(mmap_len_6) { f(0, LS1, EINVAL); } /* len is 0 */ DEF(mmap_len_7) { f(1, LS, EOVERFLOW); } /* exceed */ /* * When you treat the offset as 32bit, offset will be 0 and thus it
CVS commit: src/tests/dev/audio
Module Name:src Committed By: mlelstv Date: Mon Dec 11 09:26:08 UTC 2023 Modified Files: src/tests/dev/audio: audiotest.c Log Message: mmap() fails for size == 0 with EINVAL unless the mapping is anonymous. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: rin Date: Thu Aug 3 08:36:38 UTC 2023 Modified Files: src/tests/dev/audio: audiotest.c Log Message: audiotest: Appease GCC 12.3.0 -Wmisleading-indentation It does not matter whether this statement is a part of this if-then block or not, anyway. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: rin Date: Thu Aug 3 08:36:38 UTC 2023 Modified Files: src/tests/dev/audio: audiotest.c Log Message: audiotest: Appease GCC 12.3.0 -Wmisleading-indentation It does not matter whether this statement is a part of this if-then block or not, anyway. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.30 src/tests/dev/audio/audiotest.c:1.31 --- src/tests/dev/audio/audiotest.c:1.30 Sat Jun 24 05:27:13 2023 +++ src/tests/dev/audio/audiotest.c Thu Aug 3 08:36:38 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.30 2023/06/24 05:27:13 msaitoh Exp $ */ +/* $NetBSD: audiotest.c,v 1.31 2023/08/03 08:36:38 rin Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.30 2023/06/24 05:27:13 msaitoh Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.31 2023/08/03 08:36:38 rin Exp $"); #include #include @@ -1065,7 +1065,7 @@ void *debug_mmap(int line, void *ptr, si #define ADDFLAG(buf, var, name) do {\ if (((var) & (name))) \ n = strlcat(buf, "|" #name, sizeof(buf)); \ - var &= ~(name); \ + (var) &= ~(name); \ } while (0) n = 0;
CVS commit: src/tests/dev/audio
Module Name:src Committed By: msaitoh Date: Sat Jun 24 05:27:14 UTC 2023 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Fix typo in comment. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.29 src/tests/dev/audio/audiotest.c:1.30 --- src/tests/dev/audio/audiotest.c:1.29 Sun Apr 23 16:49:38 2023 +++ src/tests/dev/audio/audiotest.c Sat Jun 24 05:27:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.29 2023/04/23 16:49:38 mlelstv Exp $ */ +/* $NetBSD: audiotest.c,v 1.30 2023/06/24 05:27:13 msaitoh Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.29 2023/04/23 16:49:38 mlelstv Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.30 2023/06/24 05:27:13 msaitoh Exp $"); #include #include @@ -4655,7 +4655,7 @@ DEF(AUDIO_SETFD_RDWR) XP_SYS_EQ(0, r); } - /* When obtains it, it retuns half/full-duplex as is */ + /* When obtains it, it returns half/full-duplex as is */ n = 0; r = IOCTL(fd, AUDIO_GETFD, , ""); XP_SYS_EQ(0, r);
CVS commit: src/tests/dev/audio
Module Name:src Committed By: msaitoh Date: Sat Jun 24 05:27:14 UTC 2023 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Fix typo in comment. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: mlelstv Date: Sun Apr 23 16:49:38 UTC 2023 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Allow 24bit support. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.28 src/tests/dev/audio/audiotest.c:1.29 --- src/tests/dev/audio/audiotest.c:1.28 Mon Feb 13 22:24:06 2023 +++ src/tests/dev/audio/audiotest.c Sun Apr 23 16:49:38 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.28 2023/02/13 22:24:06 andvar Exp $ */ +/* $NetBSD: audiotest.c,v 1.29 2023/04/23 16:49:38 mlelstv Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.28 2023/02/13 22:24:06 andvar Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.29 2023/04/23 16:49:38 mlelstv Exp $"); #include #include @@ -53,6 +53,9 @@ __RCSID("$NetBSD: audiotest.c,v 1.28 202 #include #endif +/* this internal driver option is not exported to userland */ +#define AUDIO_SUPPORT_LINEAR24 + #if !defined(AUDIO_ENCODING_SLINEAR_NE) #if BYTE_ORDER == LITTLE_ENDIAN #define AUDIO_ENCODING_SLINEAR_NE AUDIO_ENCODING_SLINEAR_LE
CVS commit: src/tests/dev/audio
Module Name:src Committed By: mlelstv Date: Sun Apr 23 16:49:38 UTC 2023 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Allow 24bit support. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: andvar Date: Mon Feb 13 22:24:06 UTC 2023 Modified Files: src/tests/dev/audio: audiotest.c Log Message: s/plyaback/playback/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.27 src/tests/dev/audio/audiotest.c:1.28 --- src/tests/dev/audio/audiotest.c:1.27 Sat Aug 13 07:22:40 2022 +++ src/tests/dev/audio/audiotest.c Mon Feb 13 22:24:06 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.27 2022/08/13 07:22:40 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.28 2023/02/13 22:24:06 andvar Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.27 2022/08/13 07:22:40 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.28 2023/02/13 22:24:06 andvar Exp $"); #include #include @@ -4208,7 +4208,7 @@ DEF(FIOASYNC_reset) } /* - * Whether SIGIO is emitted on plyaback. + * Whether SIGIO is emitted on playback. * XXX I don't understand conditions that NetBSD7 emits signal. */ DEF(FIOASYNC_play_signal)
CVS commit: src/tests/dev/audio
Module Name:src Committed By: andvar Date: Mon Feb 13 22:24:06 UTC 2023 Modified Files: src/tests/dev/audio: audiotest.c Log Message: s/plyaback/playback/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Sat Aug 13 07:22:41 UTC 2022 Modified Files: src/tests/dev/audio: audiotest.c Log Message: audiotest: Add two tests for AUDIO_SETINFO after mmap. These tests affect only standalone test, not atf. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.26 src/tests/dev/audio/audiotest.c:1.27 --- src/tests/dev/audio/audiotest.c:1.26 Sat Aug 13 07:19:15 2022 +++ src/tests/dev/audio/audiotest.c Sat Aug 13 07:22:40 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.26 2022/08/13 07:19:15 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.27 2022/08/13 07:22:40 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.26 2022/08/13 07:19:15 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.27 2022/08/13 07:22:40 isaki Exp $"); #include #include @@ -5870,6 +5870,102 @@ DEF(AUDIO_SETINFO_gain_balance) XP_SYS_EQ(0, r); } +/* + * Changing track formats after mmap should fail. + */ +DEF(AUDIO_SETINFO_mmap_enc) +{ + struct audio_info ai; + void *ptr; + int fd; + int r; + + TEST("AUDIO_SETINFO_mmap"); + +#if !defined(NO_RUMP) + if (use_rump) { + XP_SKIP("rump doesn't support mmap"); + return; + } +#endif + + fd = OPEN(devaudio, O_WRONLY); + REQUIRED_SYS_OK(fd); + + ptr = MMAP(NULL, 1, PROT_WRITE, MAP_FILE, fd, 0); + XP_SYS_PTR(0, ptr); + + /* + * SETINFO after mmap should fail. + * NetBSD9 changes errno. + */ + AUDIO_INITINFO(); + ai.play.channels = 2; + r = IOCTL(fd, AUDIO_SETINFO, , "channels=2"); + if (netbsd < 9) { + XP_SYS_NG(EINVAL, r); + } else { + XP_SYS_NG(EIO, r); + } + + r = CLOSE(fd); + XP_SYS_EQ(0, r); + + reset_after_mmap(); +} + +/* + * Even after mmap, changing pause should succeed. + */ +DEF(AUDIO_SETINFO_mmap_pause) +{ + struct audio_info ai; + void *ptr; + int fd; + int r; + + TEST("AUDIO_SETINFO_mmap"); + +#if !defined(NO_RUMP) + if (use_rump) { + XP_SKIP("rump doesn't support mmap"); + return; + } +#endif + + fd = OPEN(devaudio, O_WRONLY); + REQUIRED_SYS_OK(fd); + + ptr = MMAP(NULL, 1, PROT_WRITE, MAP_FILE, fd, 0); + XP_SYS_PTR(0, ptr); + + /* SETINFO after mmap should fail */ + AUDIO_INITINFO(); + ai.play.pause = 1; + r = IOCTL(fd, AUDIO_SETINFO, , "set pause"); + XP_SYS_EQ(0, r); + + AUDIO_INITINFO(); + r = IOCTL(fd, AUDIO_GETBUFINFO, , "get pause"); + XP_SYS_EQ(0, r); + + XP_EQ(1, ai.play.pause); + + /* + * Unpause before close. Unless, subsequent audioplay(1) which use + * /dev/sound by default will pause... + */ + AUDIO_INITINFO(); + ai.play.pause = 0; + r = IOCTL(fd, AUDIO_SETINFO, , "reset pause"); + XP_SYS_EQ(0, r); + + r = CLOSE(fd); + XP_SYS_EQ(0, r); + + reset_after_mmap(); +} + #define NENC (AUDIO_ENCODING_AC3 + 1) #define NPREC (5) /* @@ -7221,6 +7317,8 @@ struct testentry testtable[] = { ENT(AUDIO_SETINFO_pause_RDWR_3), ENT(AUDIO_SETINFO_gain), ENT(AUDIO_SETINFO_gain_balance), +/**/ ENT(AUDIO_SETINFO_mmap_enc), // XXX rump doesn't support mmap +/**/ ENT(AUDIO_SETINFO_mmap_pause), // XXX rump doesn't support mmap ENT(AUDIO_GETENC_range), ENT(AUDIO_GETENC_error), ENT(AUDIO_ERROR_RDONLY),
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Sat Aug 13 07:22:41 UTC 2022 Modified Files: src/tests/dev/audio: audiotest.c Log Message: audiotest: Add two tests for AUDIO_SETINFO after mmap. These tests affect only standalone test, not atf. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Sat Aug 13 07:19:16 UTC 2022 Modified Files: src/tests/dev/audio: audiotest.c Log Message: audiotest: Fix typo in comments. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Sat Aug 13 07:19:16 UTC 2022 Modified Files: src/tests/dev/audio: audiotest.c Log Message: audiotest: Fix typo in comments. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.25 src/tests/dev/audio/audiotest.c:1.26 --- src/tests/dev/audio/audiotest.c:1.25 Sat Aug 13 07:14:40 2022 +++ src/tests/dev/audio/audiotest.c Sat Aug 13 07:19:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.25 2022/08/13 07:14:40 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.26 2022/08/13 07:19:15 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.25 2022/08/13 07:14:40 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.26 2022/08/13 07:19:15 isaki Exp $"); #include #include @@ -7106,29 +7106,29 @@ struct testentry testtable[] = { ENT(drain_incomplete), ENT(drain_pause), ENT(drain_onrec), -/**/ ENT(mmap_mode_RDONLY_NONE), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_mode_RDONLY_READ), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_mode_RDONLY_WRITE), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_mode_RDONLY_READWRITE),// XXX rump doesn't supprot mmap -/**/ ENT(mmap_mode_WRONLY_NONE), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_mode_WRONLY_READ), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_mode_WRONLY_WRITE), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_mode_WRONLY_READWRITE),// XXX rump doesn't supprot mmap -/**/ ENT(mmap_mode_RDWR_NONE), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_mode_RDWR_READ), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_mode_RDWR_WRITE), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_mode_RDWR_READWRITE), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_len_0), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_len_1), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_len_2), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_len_3), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_len_4), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_len_5), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_len_6), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_len_7), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_len_8), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_twice), // XXX rump doesn't supprot mmap -/**/ ENT(mmap_multi), // XXX rump doesn't supprot mmap +/**/ ENT(mmap_mode_RDONLY_NONE), // XXX rump doesn't support mmap +/**/ ENT(mmap_mode_RDONLY_READ), // XXX rump doesn't support mmap +/**/ ENT(mmap_mode_RDONLY_WRITE), // XXX rump doesn't support mmap +/**/ ENT(mmap_mode_RDONLY_READWRITE),// XXX rump doesn't support mmap +/**/ ENT(mmap_mode_WRONLY_NONE), // XXX rump doesn't support mmap +/**/ ENT(mmap_mode_WRONLY_READ), // XXX rump doesn't support mmap +/**/ ENT(mmap_mode_WRONLY_WRITE), // XXX rump doesn't support mmap +/**/ ENT(mmap_mode_WRONLY_READWRITE),// XXX rump doesn't support mmap +/**/ ENT(mmap_mode_RDWR_NONE), // XXX rump doesn't support mmap +/**/ ENT(mmap_mode_RDWR_READ), // XXX rump doesn't support mmap +/**/ ENT(mmap_mode_RDWR_WRITE), // XXX rump doesn't support mmap +/**/ ENT(mmap_mode_RDWR_READWRITE), // XXX rump doesn't support mmap +/**/ ENT(mmap_len_0), // XXX rump doesn't support mmap +/**/ ENT(mmap_len_1), // XXX rump doesn't support mmap +/**/ ENT(mmap_len_2), // XXX rump doesn't support mmap +/**/ ENT(mmap_len_3), // XXX rump doesn't support mmap +/**/ ENT(mmap_len_4), // XXX rump doesn't support mmap +/**/ ENT(mmap_len_5), // XXX rump doesn't support mmap +/**/ ENT(mmap_len_6), // XXX rump doesn't support mmap +/**/ ENT(mmap_len_7), // XXX rump doesn't support mmap +/**/ ENT(mmap_len_8), // XXX rump doesn't support mmap +/**/ ENT(mmap_twice), // XXX rump doesn't support mmap +/**/ ENT(mmap_multi), // XXX rump doesn't support mmap ENT(poll_mode_RDONLY_IN), ENT(poll_mode_RDONLY_OUT), ENT(poll_mode_RDONLY_INOUT),
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Sat Aug 13 07:14:40 UTC 2022 Modified Files: src/tests/dev/audio: audiotest.c Log Message: audiotest: Separate mmap_len test by parameters. This change affects only standalone test, not atf. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.24 src/tests/dev/audio/audiotest.c:1.25 --- src/tests/dev/audio/audiotest.c:1.24 Sun Aug 7 10:12:19 2022 +++ src/tests/dev/audio/audiotest.c Sat Aug 13 07:14:40 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.24 2022/08/07 10:12:19 andvar Exp $ */ +/* $NetBSD: audiotest.c,v 1.25 2022/08/13 07:14:40 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.24 2022/08/07 10:12:19 andvar Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.25 2022/08/13 07:14:40 isaki Exp $"); #include #include @@ -1382,6 +1382,7 @@ void test_open_multiuser(bool); void test_rdwr_fallback(int, bool, bool); void test_rdwr_two(int, int); void test_mmap_mode(int, int); +void test_mmap_len(size_t, off_t, int); void test_poll_mode(int, int, int); void test_poll_in_open(const char *); void test_kqueue_mode(int, int, int); @@ -2688,20 +2689,25 @@ DEF(mmap_mode_RDWR_READWRITE) { test_mma /* * Check mmap()'s length and offset. + * + * Actual len and offset cannot be determined before open. So that, + * pass pre-defined constant as argument, and convert it after open. */ -DEF(mmap_len) +#define LS (100) /* lsize */ +#define LS1 (101) /* lsize + 1 */ +void +test_mmap_len(size_t len, off_t offset, int exp) { struct audio_info ai; int fd; int r; - size_t len; - off_t offset; + size_t plen; void *ptr; int bufsize; int pagesize; int lsize; - TEST("mmap_len"); + TEST("mmap_len(%zd, %jd, %d)", len, offset, exp); if ((props & AUDIO_PROP_MMAP) == 0) { XP_SKIP("This test is only for mmap-able device"); return; @@ -2713,8 +2719,8 @@ DEF(mmap_len) } #endif - len = sizeof(pagesize); - r = SYSCTLBYNAME("hw.pagesize", , , NULL, 0); + plen = sizeof(pagesize); + r = SYSCTLBYNAME("hw.pagesize", , , NULL, 0); REQUIRED_SYS_EQ(0, r); fd = OPEN(devaudio, O_WRONLY); @@ -2730,49 +2736,32 @@ DEF(mmap_len) * I'm not sure. */ lsize = roundup2(bufsize, pagesize); - struct { - size_t len; - off_t offset; - int exp; - } table[] = { - /* len offset expected */ - - { 0, 0, 0 }, /* len is 0 */ - { 1, 0, 0 }, /* len is smaller than lsize */ - { lsize, 0, 0 }, /* len is the same as lsize */ - { lsize + 1, 0, EOVERFLOW }, /* len is larger */ - - { 0, -1, EINVAL }, /* offset is negative */ - { 0, lsize, 0 }, /* pointless param but ok */ - { 0, lsize + 1, EOVERFLOW }, /* exceed */ - { 1, lsize, EOVERFLOW }, /* exceed */ - /* - * When you treat offset as 32bit, offset will be 0 - * and thus it incorrectly succeeds. - */ - { lsize, 1ULL<<32, EOVERFLOW }, - }; + /* Here, lsize can be assigned */ + if (len == LS) { + len = lsize; + } else if (len == LS1) { + len = lsize + 1; + } + if (offset == LS) { + offset = lsize; + } else if (offset == LS1) { + offset = lsize + 1; + } - for (int i = 0; i < (int)__arraycount(table); i++) { - len = table[i].len; - offset = table[i].offset; - int exp = table[i].exp; - - ptr = MMAP(NULL, len, PROT_WRITE, MAP_FILE, fd, offset); - if (exp == 0) { - XP_SYS_PTR(0, ptr); - } else { - /* NetBSD8 introduces EOVERFLOW */ - if (netbsd < 8 && exp == EOVERFLOW) -exp = EINVAL; - XP_SYS_PTR(exp, ptr); - } + ptr = MMAP(NULL, len, PROT_WRITE, MAP_FILE, fd, offset); + if (exp == 0) { + XP_SYS_PTR(0, ptr); + } else { + /* NetBSD8 introduces EOVERFLOW */ + if (netbsd < 8 && exp == EOVERFLOW) + exp = EINVAL; + XP_SYS_PTR(exp, ptr); + } - if (ptr != MAP_FAILED) { - r = MUNMAP(ptr, len); - XP_SYS_EQ(0, r); - } + if (ptr != MAP_FAILED) { + r = MUNMAP(ptr, len); + XP_SYS_EQ(0, r); } r = CLOSE(fd); @@ -2780,6 +2769,21 @@ DEF(mmap_len) reset_after_mmap(); } +#define f(l, o, e) test_mmap_len(l, o, e) +DEF(mmap_len_0) { f(0, 0, 0); } /* len is 0 */ +DEF(mmap_len_1) { f(1, 0, 0); } /* len is smaller than lsize */ +DEF(mmap_len_2) { f(LS, 0, 0); } /* len is the same as lsize */ +DEF(mmap_len_3) { f(LS1, 0, EOVERFLOW); } /* len is larger */ +DEF(mmap_len_4) { f(0, -1, EINVAL); } /* offset is negative */ +DEF(mmap_len_5) { f(0, LS, 0); } /* pointless param but ok */ +DEF(mmap_len_6) { f(0, LS1, EOVERFLOW); } /* exceed */ +DEF(mmap_len_7) { f(1, LS, EOVERFLOW); } /* exceed */ +/* + * When you treat the offset as 32bit, offset will be 0 and thus it + * incorrectly succeeds. + */ +DEF(mmap_len_8) { f(LS, 1ULL << 32, EOVERFLOW); } +#undef f /* * mmap() the
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Sat Aug 13 07:14:40 UTC 2022 Modified Files: src/tests/dev/audio: audiotest.c Log Message: audiotest: Separate mmap_len test by parameters. This change affects only standalone test, not atf. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Sat Apr 23 07:47:42 UTC 2022 Modified Files: src/tests/dev/audio: audiotest.c Log Message: tests: Add tests for AUDIO_GET[IO]OFFS ioctls. - AUDIO_GETIOFFS_one_{RDONLY,RDWR,WRONLY} - AUDIO_GETOOFFS_one_{RDONLY,RDWR,WRONLY} - AUDIO_GETOOFFS_wrap_{RDONLY,RDWR,WRONLY} - AUDIO_GETOOFFS_flush_{RDONLY,RDWR,WRONLY} - AUDIO_GETOOFFS_set_{RDONLY,RDWR,WRONLY} To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.18 src/tests/dev/audio/audiotest.c:1.19 --- src/tests/dev/audio/audiotest.c:1.18 Fri Dec 10 20:36:05 2021 +++ src/tests/dev/audio/audiotest.c Sat Apr 23 07:47:42 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.18 2021/12/10 20:36:05 andvar Exp $ */ +/* $NetBSD: audiotest.c,v 1.19 2022/04/23 07:47:42 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.18 2021/12/10 20:36:05 andvar Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.19 2022/04/23 07:47:42 isaki Exp $"); #include #include @@ -1395,6 +1395,11 @@ int getenc_make_table(int, int[][5]); void xp_getenc(int[][5], int, int, int, struct audio_prinfo *); void getenc_check_encodings(int, int[][5]); void test_AUDIO_ERROR(int); +void test_AUDIO_GETIOFFS_one(int); +void test_AUDIO_GETOOFFS_one(int); +void test_AUDIO_GETOOFFS_wrap(int); +void test_AUDIO_GETOOFFS_flush(int); +void test_AUDIO_GETOOFFS_set(int); void test_audioctl_open_1(int, int); void test_audioctl_open_2(int, int); void try_audioctl_open_multiuser(const char *, const char *); @@ -6175,6 +6180,553 @@ DEF(AUDIO_ERROR_WRONLY) { test_AUDIO_ERR DEF(AUDIO_ERROR_RDWR) { test_AUDIO_ERROR(O_RDWR); } /* + * AUDIO_GETIOFFS at least one block. + */ +void +test_AUDIO_GETIOFFS_one(int openmode) +{ + struct audio_info ai; + audio_offset_t o; + int fd; + int r; + u_int blocksize; + u_int blk_ms; + + TEST("AUDIO_GETIOFFS_one_%s", openmode_str[openmode] + 2); + if (mode2aumode(openmode) == 0) { + XP_SKIP("Operation not allowed on this hardware property"); + return; + } + + fd = OPEN(devaudio, openmode); + REQUIRED_SYS_OK(fd); + +#if 0 + /* + * On NetBSD7/8, native encodings and emulated encodings behave + * differently. But it's hard to identify which encoding is native. + * If you try other encodings, edit these parameters manually. + */ + AUDIO_INITINFO(); + ai.record.encoding = AUDIO_ENCODING_SLINEAR_NE; + ai.record.precision = 16; + ai.record.channels = 2; + ai.record.sample_rate = 48000; + /* ai.blocksize is shared by play and record, so set both the same. */ + *ai.play = *ai.record; + r = IOCTL(fd, AUDIO_SETINFO, , ""); + REQUIRED_SYS_EQ(0, r); +#endif + + /* Get blocksize to calc blk_ms. */ + r = IOCTL(fd, AUDIO_GETBUFINFO, , ""); + REQUIRED_SYS_EQ(0, r); + blocksize = ai.blocksize; + if (netbsd < 9) { + blk_ms = 0; + } else { + /* On NetBSD9, blocktime can always be calculated. */ + blk_ms = blocksize * 1000 / + (ai.play.precision / 8 * ai.play.channels * + ai.play.sample_rate); + } + if (blk_ms == 0) + blk_ms = 50; + DPRINTF(" > blocksize=%u, estimated blk_ms=%u\n", blocksize, blk_ms); + + /* + * Even when just opened, recording counters will start. + * Wait a moment, about one block time. + */ + usleep(blk_ms * 1000); + + r = IOCTL(fd, AUDIO_GETIOFFS, , ""); + XP_SYS_EQ(0, r); + if (mode2rec(openmode)) { + /* + * It's difficult to know exact values. + * But at least these should not be zero. + */ + DPRINTF(" > %d: samples=%u deltablks=%u offset=%u\n", + __LINE__, o.samples, o.deltablks, o.offset); + XP_NE(0, o.samples); + XP_NE(0, o.deltablks); + XP_NE(0, o.offset); + } else { + /* All are zero on playback track. */ + XP_EQ(0, o.samples); + XP_EQ(0, o.deltablks); + XP_EQ(0, o.offset); + } + + r = CLOSE(fd); + XP_SYS_EQ(0, r); +} +DEF(AUDIO_GETIOFFS_one_RDONLY) { test_AUDIO_GETIOFFS_one(O_RDONLY); } +DEF(AUDIO_GETIOFFS_one_WRONLY) { test_AUDIO_GETIOFFS_one(O_WRONLY); } +DEF(AUDIO_GETIOFFS_one_RDWR) { test_AUDIO_GETIOFFS_one(O_RDWR); } + +/* + * AUDIO_GETOOFFS for one block. + */ +void +test_AUDIO_GETOOFFS_one(int openmode) +{ + struct audio_info ai; + audio_offset_t o; + char *buf; + int fd; + int r; + u_int blocksize; + u_int initial_offset; + u_int blk_ms; + + TEST("AUDIO_GETOOFFS_one_%s", openmode_str[openmode] + 2); + if (mode2aumode(openmode) == 0) { + XP_SKIP("Operation not allowed on this hardware property"); + return; + } + + fd = OPEN(devaudio, openmode); + REQUIRED_SYS_OK(fd); + +#if 0 + /* + * On NetBSD7/8, native encodings and emulated encodings behave + * differently. But it's hard to identify which encoding is native. + * If you try other encodings, edit these parameters manually. + */ + AUDIO_INITINFO(); +
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Sat Apr 23 07:47:42 UTC 2022 Modified Files: src/tests/dev/audio: audiotest.c Log Message: tests: Add tests for AUDIO_GET[IO]OFFS ioctls. - AUDIO_GETIOFFS_one_{RDONLY,RDWR,WRONLY} - AUDIO_GETOOFFS_one_{RDONLY,RDWR,WRONLY} - AUDIO_GETOOFFS_wrap_{RDONLY,RDWR,WRONLY} - AUDIO_GETOOFFS_flush_{RDONLY,RDWR,WRONLY} - AUDIO_GETOOFFS_set_{RDONLY,RDWR,WRONLY} To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: msaitoh Date: Sun Dec 5 07:30:51 UTC 2021 Modified Files: src/tests/dev/audio: audiotest.c Log Message: s/recored/record/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: msaitoh Date: Sun Dec 5 07:30:51 UTC 2021 Modified Files: src/tests/dev/audio: audiotest.c Log Message: s/recored/record/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.15 src/tests/dev/audio/audiotest.c:1.16 --- src/tests/dev/audio/audiotest.c:1.15 Sat Aug 21 09:59:46 2021 +++ src/tests/dev/audio/audiotest.c Sun Dec 5 07:30:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.15 2021/08/21 09:59:46 andvar Exp $ */ +/* $NetBSD: audiotest.c,v 1.16 2021/12/05 07:30:51 msaitoh Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.15 2021/08/21 09:59:46 andvar Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.16 2021/12/05 07:30:51 msaitoh Exp $"); #include #include @@ -2238,7 +2238,7 @@ DEF(rept_read) /* * Opening with O_RDWR on half-duplex hardware falls back to O_WRONLY. * expwrite: expected to be able to play. - * expread : expected to be able to recored. + * expread : expected to be able to record. */ void test_rdwr_fallback(int openmode, bool expwrite, bool expread)
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Wed Jul 21 06:18:32 UTC 2021 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Add AUDIO_SETINFO_gain_balance test. The test checks whether AUDIO_SETINFO can change the gain and the balance at the same time (if MD driver has the capability). See PR kern/56308. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.13 src/tests/dev/audio/audiotest.c:1.14 --- src/tests/dev/audio/audiotest.c:1.13 Tue Oct 13 09:00:17 2020 +++ src/tests/dev/audio/audiotest.c Wed Jul 21 06:18:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.13 2020/10/13 09:00:17 rin Exp $ */ +/* $NetBSD: audiotest.c,v 1.14 2021/07/21 06:18:32 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.13 2020/10/13 09:00:17 rin Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.14 2021/07/21 06:18:32 isaki Exp $"); #include #include @@ -5573,6 +5573,294 @@ DEF(AUDIO_SETINFO_gain) XP_SYS_EQ(0, r); } +/* + * Look if there are any (non-zero) gain values that can be changed. + * If any gain can be set, it is set to gain[0]. + * If another gain can be set, it is set to gain[1], otherwise gain[1] = -1. + * This is for AUDIO_SETINFO_gain_balance. + */ +static void +get_changeable_gain(int fd, int *gain, const char *dir, int offset) +{ + struct audio_info ai; + int *ai_gain; + int hi; + int lo; + int r; + + /* A hack to handle ai.{play,record}.gain in the same code.. */ + ai_gain = (int *)(((char *)) + offset); + + /* Try to set the maximum gain */ + AUDIO_INITINFO(); + *ai_gain = AUDIO_MAX_GAIN; + r = IOCTL(fd, AUDIO_SETINFO, , "%s.gain=%d", dir, *ai_gain); + XP_SYS_EQ(0, r); + /* Get again. The value you set is not always used as is. */ + AUDIO_INITINFO(); + r = IOCTL(fd, AUDIO_GETINFO, , ""); + XP_SYS_EQ(0, r); + hi = *ai_gain; + + /* Look for next configurable value. */ + for (lo = hi - 1; lo >= 0; lo--) { + AUDIO_INITINFO(); + *ai_gain = lo; + r = IOCTL(fd, AUDIO_SETINFO, , "%s.gain=%d", dir, *ai_gain); + XP_SYS_EQ(0, r); + /* Get again */ + r = IOCTL(fd, AUDIO_GETINFO, , ""); + XP_SYS_EQ(0, r); + if (*ai_gain != hi) { + lo = *ai_gain; + break; + } + } + + /* Now gain is lo(=gain[0]). */ + + /* + * hi lo + * --- --- + * <0 <0 : not available. + * >=0 <0 : available but not changeable. + * >=0 >=0 (hi!=lo) : available and changeable. + */ + if (hi < 0) { + gain[0] = -1; + gain[1] = -1; + DPRINTF(" > %s.gain cannot be set\n", dir); + } else if (lo < 0) { + gain[0] = hi; + gain[1] = -1; + DPRINTF(" > %s.gain can only be set %d\n", dir, gain[0]); + } else { + gain[0] = lo; + gain[1] = hi; + DPRINTF(" > %s.gain can be set %d, %d\n", + dir, gain[0], gain[1]); + } +} + +/* + * Look if there are any balance values that can be changed. + * If any balance value can be set, it is set to balance[0]. + * If another balance value can be set, it is set to balance[1], + * otherwise balance[1] = -1. + * This is for AUDIO_SETINFO_gain_balance. + */ +static void +get_changeable_balance(int fd, int *balance, const char *dir, int offset) +{ + struct audio_info ai; + u_char *ai_balance; + u_char left; + u_char right; + int r; + + /* A hack to handle ai.{play,record}.balance in the same code.. */ + ai_balance = ((u_char *)) + offset; + + /* Look for the right side configurable value. */ + AUDIO_INITINFO(); + *ai_balance = AUDIO_RIGHT_BALANCE; + r = IOCTL(fd, AUDIO_SETINFO, , "%s.balance=%d", dir, *ai_balance); + XP_SYS_EQ(0, r); + /* Get again. The value you set is not always used as is. */ + r = IOCTL(fd, AUDIO_GETINFO, , ""); + XP_SYS_EQ(0, r); + right = *ai_balance; + + /* Look for the left side configurable value. */ + AUDIO_INITINFO(); + *ai_balance = AUDIO_LEFT_BALANCE; + r = IOCTL(fd, AUDIO_SETINFO, , "%s.balance=%d", dir, *ai_balance); + XP_SYS_EQ(0, r); + /* Get again */ + r = IOCTL(fd, AUDIO_GETINFO, , ""); + XP_SYS_EQ(0, r); + left = *ai_balance; + + /* Now balance is the left(=balance[0]). */ + + if (left == right) { + /* The driver has no balance feature. */ + balance[0] = left; + balance[1] = -1; + DPRINTF(" > %s.balance can only be set %d\n", + dir, balance[0]); + } else { + balance[0] = left; + balance[1] = right; + DPRINTF(" > %s.balance can be set %d, %d\n", + dir, balance[0], balance[1]); + } +} + +/* + * Check whether gain and balance can be set at the same time. + * PR kern/56308 + */ +DEF(AUDIO_SETINFO_gain_balance) +{ + struct audio_info oai; + struct audio_info ai; + int i; + int mode; + int fd; + int r; + int pgain[2]; + int pbalance[2]; + int rgain[2]; + int rbalance[2]; + bool ptest; + bool rtest; + + TEST("AUDIO_SETINFO_gain_balance"); + +
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Wed Jul 21 06:18:32 UTC 2021 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Add AUDIO_SETINFO_gain_balance test. The test checks whether AUDIO_SETINFO can change the gain and the balance at the same time (if MD driver has the capability). See PR kern/56308. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: rin Date: Tue Oct 13 09:00:17 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Argument for AUDIO_WSEEK ioctl is u_long, not int. Fix false positive for aarch64eb (LP64BE): AUDIO_WSEEK, failed, Line 4467: n expects 4 but 0 To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: rin Date: Tue Oct 13 09:00:17 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Argument for AUDIO_WSEEK ioctl is u_long, not int. Fix false positive for aarch64eb (LP64BE): AUDIO_WSEEK, failed, Line 4467: n expects 4 but 0 To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.12 src/tests/dev/audio/audiotest.c:1.13 --- src/tests/dev/audio/audiotest.c:1.12 Fri Jun 26 07:50:12 2020 +++ src/tests/dev/audio/audiotest.c Tue Oct 13 09:00:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.12 2020/06/26 07:50:12 jruoho Exp $ */ +/* $NetBSD: audiotest.c,v 1.13 2020/10/13 09:00:17 rin Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.12 2020/06/26 07:50:12 jruoho Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.13 2020/10/13 09:00:17 rin Exp $"); #include #include @@ -4430,7 +4430,7 @@ DEF(AUDIO_WSEEK) struct audio_info ai; int r; int fd; - int n; + u_long n; TEST("AUDIO_WSEEK");
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Fri May 1 05:45:57 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Fix two tests. - kqueue_mode_{RDONLY,RDWR}_READ: Fix expected value. This is rest of rev1.9. - AUDIO_SETINFO_params_simul: Fix condition. This happens on full-duplex, not bi-directional. These affect only standalone test, not atf. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Fri May 1 05:45:57 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Fix two tests. - kqueue_mode_{RDONLY,RDWR}_READ: Fix expected value. This is rest of rev1.9. - AUDIO_SETINFO_params_simul: Fix condition. This happens on full-duplex, not bi-directional. These affect only standalone test, not atf. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.10 src/tests/dev/audio/audiotest.c:1.11 --- src/tests/dev/audio/audiotest.c:1.10 Thu Mar 26 13:43:10 2020 +++ src/tests/dev/audio/audiotest.c Fri May 1 05:45:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.10 2020/03/26 13:43:10 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.11 2020/05/01 05:45:57 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.10 2020/03/26 13:43:10 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.11 2020/05/01 05:45:57 isaki Exp $"); #include #include @@ -3582,9 +3582,8 @@ test_kqueue_mode(int openmode, int filt, XP_SYS_EQ(0, r); } DEF(kqueue_mode_RDONLY_READ) { - /* Should not raise yet (NetBSD7 has bugs?) */ - int expected = (netbsd < 8) ? 1 : 0; - test_kqueue_mode(O_RDONLY, EVFILT_READ, expected); + /* Should raise */ + test_kqueue_mode(O_RDONLY, EVFILT_READ, 1); } DEF(kqueue_mode_RDONLY_WRITE) { /* Should never raise (NetBSD7 has bugs) */ @@ -3600,8 +3599,8 @@ DEF(kqueue_mode_WRONLY_WRITE) { test_kqueue_mode(O_WRONLY, EVFILT_WRITE, 1); } DEF(kqueue_mode_RDWR_READ) { - /* Should not raise yet (NetBSD7 is something strange) */ - int expected = (netbsd < 8 && hw_fulldup()) ? 1 : 0; + /* Should raise on fulldup but not on halfdup, on NetBSD9 */ + int expected = hw_fulldup() ? 1 : 0; test_kqueue_mode(O_RDWR, EVFILT_READ, expected); } DEF(kqueue_mode_RDWR_WRITE) { @@ -5149,16 +5148,16 @@ DEF(AUDIO_SETINFO_params_simul) XP_SYS_EQ(0, r); /* - * On bi-directional device, the 2nd one has both track so that + * On full-duplex device, the 2nd one has both track so that * both track are not affected by sticky parameter. - * On uni-directional device, the 2nd one has only playback track - * so that playback track is not affected by sticky parameter. + * Otherwise, the 2nd one has only playback track so that + * playback track is not affected by sticky parameter. */ memset(, 0, sizeof(ai)); r = IOCTL(fd1, AUDIO_GETBUFINFO, , ""); XP_SYS_EQ(0, r); XP_EQ(11025, ai.play.sample_rate); - if (hw_bidir()) { + if (hw_fulldup()) { XP_EQ(11025, ai.record.sample_rate); } else { XP_EQ(16000, ai.record.sample_rate);
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Thu Mar 26 13:43:10 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Add tests for poll(POLLIN) before read(). This affects only standalone test, not atf. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.9 src/tests/dev/audio/audiotest.c:1.10 --- src/tests/dev/audio/audiotest.c:1.9 Thu Mar 26 13:37:44 2020 +++ src/tests/dev/audio/audiotest.c Thu Mar 26 13:43:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.9 2020/03/26 13:37:44 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.10 2020/03/26 13:43:10 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.9 2020/03/26 13:37:44 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.10 2020/03/26 13:43:10 isaki Exp $"); #include #include @@ -1383,6 +1383,7 @@ void test_rdwr_fallback(int, bool, bool) void test_rdwr_two(int, int); void test_mmap_mode(int, int); void test_poll_mode(int, int, int); +void test_poll_in_open(const char *); void test_kqueue_mode(int, int, int); volatile int sigio_caught; void signal_FIOASYNC(int); @@ -3372,6 +3373,81 @@ DEF(poll_out_simul) } /* + * Open with READ mode starts recording immediately. + * Of course, audioctl doesn't start. + */ +void +test_poll_in_open(const char *devname) +{ + struct audio_info ai; + struct pollfd pfd; + char buf[4096]; + char devfile[16]; + int fd; + int r; + bool is_audioctl; + + TEST("poll_in_open_%s", devname); + if (hw_canrec() == 0) { + XP_SKIP("This test is only for recordable device"); + return; + } + + snprintf(devfile, sizeof(devfile), "/dev/%s%d", devname, unit); + is_audioctl = (strcmp(devname, "audioctl") == 0); + + fd = OPEN(devfile, O_RDONLY); + REQUIRED_SYS_OK(fd); + + r = IOCTL(fd, AUDIO_GETBUFINFO, , ""); + REQUIRED_SYS_EQ(0, r); + if (is_audioctl) { + /* opening /dev/audioctl doesn't start recording. */ + XP_EQ(0, ai.record.active); + } else { + /* opening /dev/{audio,sound} starts recording. */ + /* + * On NetBSD7/8, opening /dev/sound doesn't start recording. + * It must be a bug. + */ + XP_EQ(1, ai.record.active); + } + + memset(, 0, sizeof(pfd)); + pfd.fd = fd; + pfd.events = POLLIN; + r = POLL(, 1, 1000); + if (is_audioctl) { + /* + * poll-ing /dev/audioctl always fails. + * XXX Returning error instead of timeout should be better(?). + */ + REQUIRED_SYS_EQ(0, r); + } else { + /* + * poll-ing /dev/{audio,sound} will succeed when recorded + * data is arrived. + */ + /* + * On NetBSD7/8, opening /dev/sound doesn't start recording. + * It must be a bug. + */ + REQUIRED_SYS_EQ(1, r); + + /* In this case, read() should succeed. */ + r = READ(fd, buf, sizeof(buf)); + XP_SYS_OK(r); + XP_NE(0, r); + } + + r = CLOSE(fd); + XP_SYS_EQ(0, r); +} +DEF(poll_in_open_audio) { test_poll_in_open("audio"); } +DEF(poll_in_open_sound) { test_poll_in_open("sound"); } +DEF(poll_in_open_audioctl) { test_poll_in_open("audioctl"); } + +/* * poll(2) must not be affected by other recording descriptors even if * playback descriptor waits with POLLIN (though it's not normal usage). * In other words, two POLLIN must not interfere. @@ -6216,6 +6292,9 @@ struct testentry testtable[] = { ENT(poll_out_hiwat), /**/ ENT(poll_out_unpause), // XXX does not seem to work on rump /**/ ENT(poll_out_simul), // XXX does not seem to work on rump + ENT(poll_in_open_audio), + ENT(poll_in_open_sound), + ENT(poll_in_open_audioctl), ENT(poll_in_simul), ENT(kqueue_mode_RDONLY_READ), ENT(kqueue_mode_RDONLY_WRITE),
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Thu Mar 26 13:43:10 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Add tests for poll(POLLIN) before read(). This affects only standalone test, not atf. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Thu Mar 26 13:37:44 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Sync with sys/dev/audio/audio.c rev1.65. > Fix to start recording immediately when open() with READ mode is called. This affects only standalone test, not atf. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Thu Mar 26 13:37:44 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Sync with sys/dev/audio/audio.c rev1.65. > Fix to start recording immediately when open() with READ mode is called. This affects only standalone test, not atf. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.8 src/tests/dev/audio/audiotest.c:1.9 --- src/tests/dev/audio/audiotest.c:1.8 Wed Mar 25 13:07:04 2020 +++ src/tests/dev/audio/audiotest.c Thu Mar 26 13:37:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.8 2020/03/25 13:07:04 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.9 2020/03/26 13:37:44 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.8 2020/03/25 13:07:04 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.9 2020/03/26 13:37:44 isaki Exp $"); #include #include @@ -1557,14 +1557,14 @@ test_open(const char *devname, int mode) XP_EQ(0, ai.record.waiting); /* balance */ XP_EQ(exp_ropen, ai.record.open); - /* - * NetBSD7,8 (may?) be active when opened in recording mode but - * recording has not started yet. (?) - * NetBSD9 is not active at that time. - */ - if (netbsd < 9) { - } else { + if (netbsd < 9 && strcmp(devname, "sound") == 0) { + /* + * On NetBSD7/8, it doesn't seem to start recording on open + * for /dev/sound. It should be a bug. + */ XP_EQ(0, ai.record.active); + } else { + XP_EQ(exp_ropen, ai.record.active); } /* Save it */ ai0 = ai; @@ -1645,9 +1645,14 @@ test_open(const char *devname, int mode) XP_EQ(0, ai.record.waiting); /* balance */ XP_EQ(exp_ropen, ai.record.open); - if (netbsd < 9) { - } else { + if (netbsd < 9 && strcmp(devname, "sound") == 0) { + /* + * On NetBSD7/8, it doesn't seem to start recording on open + * for /dev/sound. It should be a bug. + */ XP_EQ(0, ai.record.active); + } else { + XP_EQ(exp_ropen, ai.record.active); } r = CLOSE(fd); @@ -2921,6 +2926,9 @@ test_poll_mode(int mode, int events, int fd = OPEN(devaudio, mode); REQUIRED_SYS_OK(fd); + /* Wait a bit to be recorded. */ + usleep(100 * 1000); + memset(, 0, sizeof(pfd)); pfd.fd = fd; pfd.events = events; @@ -2948,15 +2956,23 @@ test_poll_mode(int mode, int events, int r = CLOSE(fd); XP_SYS_EQ(0, r); } -DEF(poll_mode_RDONLY_IN) { test_poll_mode(O_RDONLY, IN, 0); } +DEF(poll_mode_RDONLY_IN) { test_poll_mode(O_RDONLY, IN, IN); } DEF(poll_mode_RDONLY_OUT) { test_poll_mode(O_RDONLY, OUT,0); } -DEF(poll_mode_RDONLY_INOUT) { test_poll_mode(O_RDONLY, IN|OUT, 0); } +DEF(poll_mode_RDONLY_INOUT) { test_poll_mode(O_RDONLY, IN|OUT, IN); } DEF(poll_mode_WRONLY_IN) { test_poll_mode(O_WRONLY, IN, 0); } DEF(poll_mode_WRONLY_OUT) { test_poll_mode(O_WRONLY, OUT, OUT); } DEF(poll_mode_WRONLY_INOUT) { test_poll_mode(O_WRONLY, IN|OUT, OUT); } -DEF(poll_mode_RDWR_IN) { test_poll_mode(O_RDWR, IN, 0); } +DEF(poll_mode_RDWR_IN) { + /* On half-duplex, O_RDWR is the same as O_WRONLY. */ + if (hw_fulldup()) test_poll_mode(O_RDWR, IN, IN); + else test_poll_mode(O_RDWR, IN, 0); +} DEF(poll_mode_RDWR_OUT) { test_poll_mode(O_RDWR, OUT, OUT); } -DEF(poll_mode_RDWR_INOUT) { test_poll_mode(O_RDWR, IN|OUT, OUT); } +DEF(poll_mode_RDWR_INOUT) { + /* On half-duplex, O_RDWR is the same as O_WRONLY. */ + if (hw_fulldup()) test_poll_mode(O_RDWR, IN|OUT, IN|OUT); + else test_poll_mode(O_RDWR, IN|OUT,OUT); +} /* * Poll(OUT) when buffer is empty.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Wed Mar 25 13:07:04 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c t_audio.awk Log Message: Use exact match to search testname. This didn't affect test results. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/dev/audio/audiotest.c cvs rdiff -u -r1.1 -r1.2 src/tests/dev/audio/t_audio.awk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Wed Mar 25 13:07:04 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c t_audio.awk Log Message: Use exact match to search testname. This didn't affect test results. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/dev/audio/audiotest.c cvs rdiff -u -r1.1 -r1.2 src/tests/dev/audio/t_audio.awk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.7 src/tests/dev/audio/audiotest.c:1.8 --- src/tests/dev/audio/audiotest.c:1.7 Wed Mar 4 14:20:44 2020 +++ src/tests/dev/audio/audiotest.c Wed Mar 25 13:07:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.7 2020/03/04 14:20:44 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.8 2020/03/25 13:07:04 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.7 2020/03/04 14:20:44 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.8 2020/03/25 13:07:04 isaki Exp $"); #include #include @@ -75,6 +75,7 @@ struct testentry { void usage(void) __dead; void xp_err(int, int, const char *, ...) __printflike(3, 4) __dead; void xp_errx(int, int, const char *, ...) __printflike(3, 4) __dead; +bool match(const char *, const char *); void xxx_close_wait(void); int mixer_get_outputs_master(int); void do_test(int); @@ -168,6 +169,7 @@ int skipcount; int unit; bool use_rump; bool use_pad; +bool exact_match; int padfd; int maxfd; pthread_t th; @@ -186,6 +188,8 @@ usage(void) fprintf(stderr, "\t-A: make output suitable for ATF\n"); fprintf(stderr, "\t-a: Test all\n"); fprintf(stderr, "\t-d: Increase debug level\n"); + fprintf(stderr, "\t-e: Use exact match for testnames " + "(default is forward match)\n"); fprintf(stderr, "\t-l: List all tests\n"); fprintf(stderr, "\t-p: Open pad\n"); #if !defined(NO_RUMP) @@ -246,8 +250,9 @@ main(int argc, char *argv[]) cmd = CMD_TEST; use_pad = false; padfd = -1; + exact_match = false; - while ((c = getopt(argc, argv, "AadlpRu:")) != -1) { + while ((c = getopt(argc, argv, "AadelpRu:")) != -1) { switch (c) { case 'A': opt_atf = true; @@ -258,6 +263,9 @@ main(int argc, char *argv[]) case 'd': debug++; break; + case 'e': + exact_match = true; + break; case 'l': cmd = CMD_LIST; break; @@ -305,8 +313,7 @@ main(int argc, char *argv[]) found = false; for (j = 0; j < argc; j++) { for (i = 0; testtable[i].name != NULL; i++) { -if (strncmp(argv[j], testtable[i].name, -strlen(argv[j])) == 0) { +if (match(argv[j], testtable[i].name)) { do_test(i); found = true; } @@ -337,6 +344,21 @@ main(int argc, char *argv[]) return 0; } +bool +match(const char *arg, const char *name) +{ + if (exact_match) { + /* Exact match */ + if (strcmp(arg, name) == 0) + return true; + } else { + /* Forward match */ + if (strncmp(arg, name, strlen(arg)) == 0) + return true; + } + return false; +} + /* * XXX * Some hardware drivers (e.g. hdafg(4)) require a little "rest" between Index: src/tests/dev/audio/t_audio.awk diff -u src/tests/dev/audio/t_audio.awk:1.1 src/tests/dev/audio/t_audio.awk:1.2 --- src/tests/dev/audio/t_audio.awk:1.1 Tue Feb 11 07:03:16 2020 +++ src/tests/dev/audio/t_audio.awk Wed Mar 25 13:07:04 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_audio.awk,v 1.1 2020/02/11 07:03:16 isaki Exp $ +# $NetBSD: t_audio.awk,v 1.2 2020/03/25 13:07:04 isaki Exp $ # # Copyright (C) 2019 Tetsuya Isaki. All rights reserved. # @@ -34,7 +34,7 @@ BEGIN { print "h_audio() {" print " local testname=$1" print " local outfile=/tmp/t_audio_$testname.$$" - print " $(atf_get_srcdir)/audiotest -AR $testname > $outfile" + print " $(atf_get_srcdir)/audiotest -ARe $testname > $outfile" print " local retval=$?" print " # Discard rump outputs..." print " outmsg=`cat $outfile | grep -v '^\\['`"
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Wed Mar 4 14:20:44 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Sync with sys/dev/audio/audio.c rev1.62. > Restore backward compatibility with netbsd-7 audio. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Wed Mar 4 14:20:44 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Sync with sys/dev/audio/audio.c rev1.62. > Restore backward compatibility with netbsd-7 audio. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.6 src/tests/dev/audio/audiotest.c:1.7 --- src/tests/dev/audio/audiotest.c:1.6 Sat Feb 22 05:53:19 2020 +++ src/tests/dev/audio/audiotest.c Wed Mar 4 14:20:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.6 2020/02/22 05:53:19 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.7 2020/03/04 14:20:44 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.6 2020/02/22 05:53:19 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.7 2020/03/04 14:20:44 isaki Exp $"); #include #include @@ -106,7 +106,6 @@ bool xp_sys_eq(int, int, int, const char bool xp_sys_ok(int, int, const char *); bool xp_sys_ng(int, int, int, const char *); bool xp_sys_ptr(int, int, void *, const char *); -bool xp_buffsize(int, bool, int, const char *); int debug_open(int, const char *, int); int debug_write(int, int, const void *, size_t); int debug_read(int, int, void *, size_t); @@ -920,29 +919,6 @@ bool xp_sys_ptr(int line, int exp, void return r; } -/* - * Check ai.*.buffer_size. - * If exp == true, it expects that buffer_size is non-zero. - * If exp == false, it expects that buffer_size is zero. - */ -#define XP_BUFFSIZE(exp, act) \ - xp_buffsize(__LINE__, exp, act, #act) -bool xp_buffsize(int line, bool exp, int act, const char *varname) -{ - bool r = true; - - testcount++; - if (exp) { - if (act == 0) - r = xp_fail(line, "%s expects non-zero but %d", - varname, act); - } else { - if (act != 0) - r = xp_fail(line, "%s expects zero but %d", - varname, act); - } - return r; -} /* * REQUIRED_* return immediately if condition does not meet. @@ -1377,9 +1353,7 @@ mixer_get_outputs_master(int mixerfd) */ void test_open_mode(int); -void test_open_audio(int); -void test_open_sound(int); -void test_open_audioctl(int); +void test_open(const char *, int); void test_open_simul(int, int); void try_open_multiuser(bool); void test_open_multiuser(bool); @@ -1435,248 +1409,89 @@ DEF(open_mode_RDONLY) { test_open_mode(O DEF(open_mode_WRONLY) { test_open_mode(O_WRONLY); } DEF(open_mode_RDWR) { test_open_mode(O_RDWR); } - /* - * The initial parameters are always the same whenever you open /dev/audio. + * Check the initial parameters and stickiness. + * /dev/audio + * The initial parameters are always the same whenever you open. + * /dev/sound and /dev/audioctl + * The initial parameters are inherited from the last /dev/sound or + * /dev/audio. */ void -test_open_audio(int mode) +test_open(const char *devname, int mode) { struct audio_info ai; struct audio_info ai0; + char devfile[16]; int fd; int r; int can_play; int can_rec; - bool pbuff; - bool rbuff; + int exp_mode; + int exp_encoding; + int exp_precision; + int exp_channels; + int exp_sample_rate; + int exp_pause; + int exp_popen; + int exp_ropen; - TEST("open_audio_%s", openmode_str[mode] + 2); + TEST("open_%s_%s", devname, openmode_str[mode] + 2); + snprintf(devfile, sizeof(devfile), "/dev/%s%d", devname, unit); can_play = mode2play(mode); can_rec = mode2rec(mode); - if (can_play + can_rec == 0) { - /* Check whether it cannot be opened */ - fd = OPEN(devaudio, mode); - XP_SYS_NG(ENXIO, fd); - return; + if (strcmp(devname, "audioctl") != 0) { + if (can_play + can_rec == 0) { + /* Check whether it cannot be opened */ + fd = OPEN(devaudio, mode); + XP_SYS_NG(ENXIO, fd); + return; + } } - /* - * NetBSD7,8 always has both buffers for playback and recording. - * NetBSD9 only has necessary buffers. - */ - if (netbsd < 9) { - pbuff = true; - rbuff = true; + /* /dev/audio is always initialized */ + if (strcmp(devname, "audio") == 0) { + exp_encoding = AUDIO_ENCODING_ULAW; + exp_precision = 8; + exp_channels = 1; + exp_sample_rate = 8000; + exp_pause = 0; } else { - pbuff = can_play; - rbuff = can_rec; + exp_encoding = AUDIO_ENCODING_SLINEAR_LE; + exp_precision = 16; + exp_channels = 2; + exp_sample_rate = 11025; + exp_pause = 1; } - /* - * Open /dev/audio and check parameters - */ - fd = OPEN(devaudio, mode); - REQUIRED_SYS_OK(fd); - memset(, 0, sizeof(ai)); - r = IOCTL(fd, AUDIO_GETBUFINFO, , ""); - REQUIRED_SYS_EQ(0, r); - - XP_NE(0, ai.blocksize); - /* hiwat/lowat */ - XP_EQ(mode2aumode(mode), ai.mode); - /* ai.play */ - XP_EQ(8000, ai.play.sample_rate); - XP_EQ(1, ai.play.channels); - XP_EQ(AUDIO_ENCODING_ULAW, ai.play.encoding); - /* gain
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Mon Mar 2 04:25:08 UTC 2020 Modified Files: src/tests/dev/audio: Makefile Log Message: Re-add -lrumpdev dropped in the previous commit. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/dev/audio/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/Makefile diff -u src/tests/dev/audio/Makefile:1.8 src/tests/dev/audio/Makefile:1.9 --- src/tests/dev/audio/Makefile:1.8 Sun Mar 1 18:08:12 2020 +++ src/tests/dev/audio/Makefile Mon Mar 2 04:25:08 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.8 2020/03/01 18:08:12 christos Exp $ +# $NetBSD: Makefile,v 1.9 2020/03/02 04:25:08 isaki Exp $ # .include @@ -21,7 +21,7 @@ BINDIR= ${TESTSDIR} MKMAN=no CPPFLAGS+= -D_KERNTYPES -LDADD+= -lrumpdev_pad -lrumpdev_audio ${LIBRUMPBASE} +LDADD+= -lrumpdev_pad -lrumpdev_audio -lrumpdev ${LIBRUMPBASE} WARNS= 4 NOMAN=
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Mon Mar 2 04:25:08 UTC 2020 Modified Files: src/tests/dev/audio: Makefile Log Message: Re-add -lrumpdev dropped in the previous commit. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/dev/audio/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Sat Feb 22 05:53:19 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Update AUDIO_SETINFO_channels test. The kernel limits the number of channels that userland apps can set to the number of channels supported by the hardware or less. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Sat Feb 22 05:53:19 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Update AUDIO_SETINFO_channels test. The kernel limits the number of channels that userland apps can set to the number of channels supported by the hardware or less. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.5 src/tests/dev/audio/audiotest.c:1.6 --- src/tests/dev/audio/audiotest.c:1.5 Tue Feb 18 12:11:26 2020 +++ src/tests/dev/audio/audiotest.c Sat Feb 22 05:53:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.5 2020/02/18 12:11:26 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.6 2020/02/22 05:53:19 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.5 2020/02/18 12:11:26 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.6 2020/02/22 05:53:19 isaki Exp $"); #include #include @@ -5413,11 +5413,13 @@ DEF(AUDIO_SETINFO_params_simul) */ DEF(AUDIO_SETINFO_channels) { + struct audio_info hwinfo; struct audio_info ai; int mode; int r; int fd; int i; + unsigned int ch; struct { int ch; bool expected; @@ -5425,9 +5427,6 @@ DEF(AUDIO_SETINFO_channels) { 0, false }, { 1, true }, /* monaural */ { 2, true }, /* stereo */ - { 3, true }, /* multi channels */ - { 12, true }, /* upper limit */ - { 13, false }, }; TEST("AUDIO_SETINFO_channels"); @@ -5444,8 +5443,12 @@ DEF(AUDIO_SETINFO_channels) fd = OPEN(devaudio, mode); REQUIRED_SYS_OK(fd); + /* + * The audio layer always supports monaural and stereo regardless of + * the hardware capability. + */ for (i = 0; i < (int)__arraycount(table); i++) { - int ch = table[i].ch; + ch = table[i].ch; bool expected = table[i].expected; AUDIO_INITINFO(); @@ -5470,6 +5473,52 @@ DEF(AUDIO_SETINFO_channels) } } + /* + * The maximum number of supported channels depends the hardware. + */ + /* Get the number of channels that the hardware supports */ + r = IOCTL(fd, AUDIO_GETFORMAT, , ""); + REQUIRED_SYS_EQ(0, r); + + if ((hwinfo.mode & AUMODE_PLAY)) { + DPRINTF(" > hwinfo.play.channels = %d\n", + hwinfo.play.channels); + for (ch = 3; ch <= hwinfo.play.channels; ch++) { + AUDIO_INITINFO(); + ai.play.channels = ch; + r = IOCTL(fd, AUDIO_SETINFO, , "channels=%d", ch); + XP_SYS_EQ(0, r); + + r = IOCTL(fd, AUDIO_GETBUFINFO, , ""); + XP_SYS_EQ(0, r); + XP_EQ(ch, ai.play.channels); + } + + AUDIO_INITINFO(); + ai.play.channels = ch; + r = IOCTL(fd, AUDIO_SETINFO, , "channels=%d", ch); + XP_SYS_NG(EINVAL, r); + } + if ((hwinfo.mode & AUMODE_RECORD)) { + DPRINTF(" > hwinfo.record.channels = %d\n", + hwinfo.record.channels); + for (ch = 3; ch <= hwinfo.record.channels; ch++) { + AUDIO_INITINFO(); + ai.record.channels = ch; + r = IOCTL(fd, AUDIO_SETINFO, , "channels=%d", ch); + XP_SYS_EQ(0, r); + + r = IOCTL(fd, AUDIO_GETBUFINFO, , ""); + XP_SYS_EQ(0, r); + XP_EQ(ch, ai.record.channels); + } + + AUDIO_INITINFO(); + ai.record.channels = ch; + r = IOCTL(fd, AUDIO_SETINFO, , "channels=%d", ch); + XP_SYS_NG(EINVAL, r); + } + r = CLOSE(fd); XP_SYS_EQ(0, r); }
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Tue Feb 18 12:11:27 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Add tests. AUDIO_SETINFO_channels AUDIO_SETINFO_sample_rate AUDIO_SETINFO_sample_rate_0 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.4 src/tests/dev/audio/audiotest.c:1.5 --- src/tests/dev/audio/audiotest.c:1.4 Fri Feb 14 13:20:48 2020 +++ src/tests/dev/audio/audiotest.c Tue Feb 18 12:11:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.4 2020/02/14 13:20:48 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.5 2020/02/18 12:11:26 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.4 2020/02/14 13:20:48 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.5 2020/02/18 12:11:26 isaki Exp $"); #include #include @@ -5405,6 +5405,176 @@ DEF(AUDIO_SETINFO_params_simul) } /* + * AUDIO_SETINFO(encoding/precision) is tested in AUDIO_GETENC_range below. + */ + +/* + * Check whether the number of channels can be set. + */ +DEF(AUDIO_SETINFO_channels) +{ + struct audio_info ai; + int mode; + int r; + int fd; + int i; + struct { + int ch; + bool expected; + } table[] = { + { 0, false }, + { 1, true }, /* monaural */ + { 2, true }, /* stereo */ + { 3, true }, /* multi channels */ + { 12, true }, /* upper limit */ + { 13, false }, + }; + + TEST("AUDIO_SETINFO_channels"); + if (netbsd < 8) { + /* + * On NetBSD7, the result depends the hardware and there is + * no way to know it. + */ + XP_SKIP("The test doesn't make sense on NetBSD7"); + return; + } + + mode = openable_mode(); + fd = OPEN(devaudio, mode); + REQUIRED_SYS_OK(fd); + + for (i = 0; i < (int)__arraycount(table); i++) { + int ch = table[i].ch; + bool expected = table[i].expected; + + AUDIO_INITINFO(); + if (mode != O_RDONLY) + ai.play.channels = ch; + if (mode != O_WRONLY) + ai.record.channels = ch; + r = IOCTL(fd, AUDIO_SETINFO, , "channels=%d", ch); + if (expected) { + /* Expects to succeed */ + XP_SYS_EQ(0, r); + + r = IOCTL(fd, AUDIO_GETBUFINFO, , ""); + XP_SYS_EQ(0, r); + if (mode != O_RDONLY) +XP_EQ(ch, ai.play.channels); + if (mode != O_WRONLY) +XP_EQ(ch, ai.record.channels); + } else { + /* Expects to fail */ + XP_SYS_NG(EINVAL, r); + } + } + + r = CLOSE(fd); + XP_SYS_EQ(0, r); +} + +/* + * Check whether the sample rate can be set. + */ +DEF(AUDIO_SETINFO_sample_rate) +{ + struct audio_info ai; + int mode; + int r; + int fd; + int i; + struct { + int freq; + bool expected; + } table[] = { + {999, false }, + { 1000, true }, /* lower limit */ + { 48000, true }, + { 192000, true }, /* upper limit */ + { 192001, false }, + }; + + TEST("AUDIO_SETINFO_sample_rate"); + if (netbsd < 8) { + /* + * On NetBSD7, the result depends the hardware and there is + * no way to know it. + */ + XP_SKIP("The test doesn't make sense on NetBSD7"); + return; + } + + mode = openable_mode(); + fd = OPEN(devaudio, mode); + REQUIRED_SYS_OK(fd); + + for (i = 0; i < (int)__arraycount(table); i++) { + int freq = table[i].freq; + bool expected = table[i].expected; + + AUDIO_INITINFO(); + if (mode != O_RDONLY) + ai.play.sample_rate = freq; + if (mode != O_WRONLY) + ai.record.sample_rate = freq; + r = IOCTL(fd, AUDIO_SETINFO, , "sample_rate=%d", freq); + if (expected) { + /* Expects to succeed */ + XP_SYS_EQ(0, r); + + r = IOCTL(fd, AUDIO_GETBUFINFO, , ""); + XP_SYS_EQ(0, r); + if (mode != O_RDONLY) +XP_EQ(freq, ai.play.sample_rate); + if (mode != O_WRONLY) +XP_EQ(freq, ai.record.sample_rate); + } else { + /* Expects to fail */ + XP_SYS_NG(EINVAL, r); + } + } + + r = CLOSE(fd); + XP_SYS_EQ(0, r); +} + +/* + * SETINFO(sample_rate = 0) should fail correctly. + */ +DEF(AUDIO_SETINFO_sample_rate_0) +{ + struct audio_info ai; + int mode; + int r; + int fd; + + TEST("AUDIO_SETINFO_sample_rate_0"); + if (netbsd < 9) { + /* + * On NetBSD7,8 this will block system call and you will not + * even be able to shutdown... + */ + XP_SKIP("This will cause an infinate loop in the kernel"); + return; + } + + mode = openable_mode(); + fd = OPEN(devaudio, mode); + REQUIRED_SYS_OK(fd); + + AUDIO_INITINFO(); + ai.play.sample_rate = 0; + ai.record.sample_rate = 0; + r = IOCTL(fd, AUDIO_SETINFO, , "sample_rate=0"); + /* Expects to fail */ + XP_SYS_NG(EINVAL, r); + + r = CLOSE(fd); + XP_SYS_EQ(0, r); +} + +/* * Check whether the pause/unpause works. */ void @@ -6385,6 +6555,9 @@ struct testentry testtable[] = { ENT(AUDIO_SETINFO_params_set_RDWR_2), ENT(AUDIO_SETINFO_params_set_RDWR_3), ENT(AUDIO_SETINFO_params_simul), + ENT(AUDIO_SETINFO_channels), +
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Tue Feb 18 12:11:27 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Add tests. AUDIO_SETINFO_channels AUDIO_SETINFO_sample_rate AUDIO_SETINFO_sample_rate_0 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Fri Feb 14 13:20:48 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Improve around {audioctl_,}open_multiuser. - Make multiuser bool and remove newval. - try_audioctl_open_multiuser() doesn't need multiuser argument. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: isaki Date: Fri Feb 14 13:20:48 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Improve around {audioctl_,}open_multiuser. - Make multiuser bool and remove newval. - try_audioctl_open_multiuser() doesn't need multiuser argument. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.3 src/tests/dev/audio/audiotest.c:1.4 --- src/tests/dev/audio/audiotest.c:1.3 Thu Feb 13 18:06:26 2020 +++ src/tests/dev/audio/audiotest.c Fri Feb 14 13:20:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.3 2020/02/13 18:06:26 tnn Exp $ */ +/* $NetBSD: audiotest.c,v 1.4 2020/02/14 13:20:48 isaki Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.3 2020/02/13 18:06:26 tnn Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.4 2020/02/14 13:20:48 isaki Exp $"); #include #include @@ -1381,8 +1381,8 @@ void test_open_audio(int); void test_open_sound(int); void test_open_audioctl(int); void test_open_simul(int, int); -void try_open_multiuser(int); -void test_open_multiuser(int); +void try_open_multiuser(bool); +void test_open_multiuser(bool); void test_rdwr_fallback(int, bool, bool); void test_rdwr_two(int, int); void test_mmap_mode(int, int); @@ -1400,8 +1400,8 @@ void getenc_check_encodings(int, int[][5 void test_AUDIO_ERROR(int); void test_audioctl_open_1(int, int); void test_audioctl_open_2(int, int); -void try_audioctl_open_multiuser(int, const char *, const char *); -void test_audioctl_open_multiuser(int, const char *, const char *); +void try_audioctl_open_multiuser(const char *, const char *); +void test_audioctl_open_multiuser(bool, const char *, const char *); void test_audioctl_rw(int); #define DEF(name) \ @@ -2219,7 +2219,7 @@ DEF(open_simul_RDWR_RDWR) { test_open_si * /dev/audio can be opened by other user who opens /dev/audio. */ void -try_open_multiuser(int multiuser) +try_open_multiuser(bool multiuser) { int fd0; int fd1; @@ -2295,10 +2295,9 @@ try_open_multiuser(int multiuser) * XXX XP_* macros are not compatible with on-error-goto, we need try-catch... */ void -test_open_multiuser(int multiuser) +test_open_multiuser(bool multiuser) { char mibname[32]; - bool newval; bool oldval; size_t oldlen; int r; @@ -2327,26 +2326,24 @@ test_open_multiuser(int multiuser) /* Change if necessary */ if (oldval != multiuser) { - newval = multiuser; - r = SYSCTLBYNAME(mibname, NULL, NULL, , sizeof(newval)); + r = SYSCTLBYNAME(mibname, NULL, NULL, , + sizeof(multiuser)); REQUIRED_SYS_EQ(0, r); DPRINTF(" > new multiuser=%d\n", multiuser); - } else { - newval = oldval; } /* Do test */ try_open_multiuser(multiuser); /* Restore multiuser mode */ - if (oldval != newval) { + if (oldval != multiuser) { DPRINTF(" > restore multiuser to %d\n", oldval); r = SYSCTLBYNAME(mibname, NULL, NULL, , sizeof(oldval)); REQUIRED_SYS_EQ(0, r); } } -DEF(open_multiuser_0) { test_open_multiuser(0); } -DEF(open_multiuser_1) { test_open_multiuser(1); } +DEF(open_multiuser_0) { test_open_multiuser(false); } +DEF(open_multiuser_1) { test_open_multiuser(true); } /* * Normal playback (with PLAY_ALL). @@ -6034,12 +6031,13 @@ DEF(audioctl_open_simul) } /* - * /dev/audioctl can be opened by other user who opens /dev/audioctl. - * /dev/audioctl can be opened by other user who opens /dev/audio. - * /dev/audiocan be opened by other user who opens /dev/audioct. + * /dev/audioctl can be opened by other user who opens /dev/audioctl, + * /dev/audioctl can be opened by other user who opens /dev/audio, + * /dev/audiocan be opened by other user who opens /dev/audioctl, + * regardless of multiuser mode. */ void -try_audioctl_open_multiuser(int multiuser, const char *dev1, const char *dev2) +try_audioctl_open_multiuser(const char *dev1, const char *dev2) { int fd1; int fd2; @@ -6076,10 +6074,10 @@ try_audioctl_open_multiuser(int multiuse * XXX XP_* macros are not compatible with on-error-goto, we need try-catch... */ void -test_audioctl_open_multiuser(int multiuser, const char *dev1, const char *dev2) +test_audioctl_open_multiuser(bool multiuser, + const char *dev1, const char *dev2) { char mibname[32]; - bool newval; bool oldval; size_t oldlen; int r; @@ -6107,19 +6105,17 @@ test_audioctl_open_multiuser(int multius /* Change if necessary */ if (oldval != multiuser) { - newval = multiuser; - r = SYSCTLBYNAME(mibname, NULL, NULL, , sizeof(newval)); + r = SYSCTLBYNAME(mibname, NULL, NULL, , + sizeof(multiuser)); REQUIRED_SYS_EQ(0, r); DPRINTF(" > new multiuser=%d\n", multiuser); - } else { - newval = oldval; } /* Do
CVS commit: src/tests/dev/audio
Module Name:src Committed By: tnn Date: Thu Feb 13 18:06:26 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: don't use variable 'newval' uninitialized when multiuser mode unchanged To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.2 src/tests/dev/audio/audiotest.c:1.3 --- src/tests/dev/audio/audiotest.c:1.2 Wed Feb 12 07:02:21 2020 +++ src/tests/dev/audio/audiotest.c Thu Feb 13 18:06:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.2 2020/02/12 07:02:21 martin Exp $ */ +/* $NetBSD: audiotest.c,v 1.3 2020/02/13 18:06:26 tnn Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.2 2020/02/12 07:02:21 martin Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.3 2020/02/13 18:06:26 tnn Exp $"); #include #include @@ -2331,6 +2331,8 @@ test_open_multiuser(int multiuser) r = SYSCTLBYNAME(mibname, NULL, NULL, , sizeof(newval)); REQUIRED_SYS_EQ(0, r); DPRINTF(" > new multiuser=%d\n", multiuser); + } else { + newval = oldval; } /* Do test */ @@ -6109,6 +6111,8 @@ test_audioctl_open_multiuser(int multius r = SYSCTLBYNAME(mibname, NULL, NULL, , sizeof(newval)); REQUIRED_SYS_EQ(0, r); DPRINTF(" > new multiuser=%d\n", multiuser); + } else { + newval = oldval; } /* Do test */
CVS commit: src/tests/dev/audio
Module Name:src Committed By: tnn Date: Thu Feb 13 18:06:26 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: don't use variable 'newval' uninitialized when multiuser mode unchanged To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: martin Date: Wed Feb 12 07:02:21 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Add sentinel to the testtable[] array. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/audiotest.c diff -u src/tests/dev/audio/audiotest.c:1.1 src/tests/dev/audio/audiotest.c:1.2 --- src/tests/dev/audio/audiotest.c:1.1 Tue Feb 11 07:03:16 2020 +++ src/tests/dev/audio/audiotest.c Wed Feb 12 07:02:21 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiotest.c,v 1.1 2020/02/11 07:03:16 isaki Exp $ */ +/* $NetBSD: audiotest.c,v 1.2 2020/02/12 07:02:21 martin Exp $ */ /* * Copyright (C) 2019 Tetsuya Isaki. All rights reserved. @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: audiotest.c,v 1.1 2020/02/11 07:03:16 isaki Exp $"); +__RCSID("$NetBSD: audiotest.c,v 1.2 2020/02/12 07:02:21 martin Exp $"); #include #include @@ -6431,4 +6431,5 @@ struct testentry testtable[] = { ENT(audioctl_rw_RDWR), ENT(audioctl_poll), ENT(audioctl_kqueue), + {.name = NULL}, };
CVS commit: src/tests/dev/audio
Module Name:src Committed By: martin Date: Wed Feb 12 07:02:21 UTC 2020 Modified Files: src/tests/dev/audio: audiotest.c Log Message: Add sentinel to the testtable[] array. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/dev/audio/audiotest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: nat Date: Fri Jan 27 05:14:54 UTC 2017 Modified Files: src/tests/dev/audio: t_pad_output.bz2.uue Log Message: Revert to previous. Audio passes the test properly again. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/dev/audio/t_pad_output.bz2.uue Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/t_pad_output.bz2.uue diff -u src/tests/dev/audio/t_pad_output.bz2.uue:1.3 src/tests/dev/audio/t_pad_output.bz2.uue:1.4 --- src/tests/dev/audio/t_pad_output.bz2.uue:1.3 Sun Dec 11 08:09:29 2016 +++ src/tests/dev/audio/t_pad_output.bz2.uue Fri Jan 27 05:14:54 2017 @@ -1,1040 +1,1035 @@ begin 644 t_pad_output.bz2 -M0EIH.3%!629360S39`>;SS,K;%2@`2::%N=I -MVR86:*KOO>O99MMM-XP&76N]W/6T=[SW@<[G'3H:Z'K1F?=WON]WO>]S=WN^ -ML]W>^WN[[W;V\VW>[OMN^WW;;3+3/=TK*Y5E4LVE#-E5H:"S530#1IB5LS:V -MJHK6!JVA2M9LR*V:MFUJ55JBM:Q4*EL,5$`50)L6M11:P55:V%+55:U5C!I3 -M1L,BU5-5JV-%F55-5EL;:@5:K+%5:S--;5-;:M5MJVZZ[:V]>[:7NTN>][;> -M[O/MO-M[NYOM]WN^[K69ON\^][WO(Q/N8ZZ![N''=O3VP[V/>RCRX[0VJ7FW -M-FQJ%7-G0R;9MB*N\G'>PTM*5H%``-LF2NKF=-LQFU*50444`446P` -MUE17-HDJB[#--!MBC$-1L#;!MF@JALFIM-IE3-30"JH#2D`$`!,F$R83(830 -M--,AD!H`R#$9`:`Q-`,":8)D8C`3)@FF":8@P"9,$,"&)D#0)@$ -MD$TPF@`)@```-`"8`)@"8F$R8`F3$`)@`:@),R83":8$Q---,"8"8( -M,:1D#!,H--)2:$$VF##`"#329,1A-!,Q$:F)A-#$-3TT4>F4]">IZ0#3:@ -MVC4#`-(/4#3T@#30&@/1/1#0#1D``#$-!HR:-!)I2E$H&3TVPVH\BE/QIHC1 -M3,34T4]IE-I0WD4?IJ33T0`R:`9!IM0(`!HT@`&@`` -M``TI$#1IHIFU,F`T:F*>"G@$F:3TP"-3T9&"*/3"3R,33)I/":(T&(T -M4\T-`GIDR-,$T:GIJ>1B831II/(\C4S(::8F)HU-02:E)*!#5/%/>V,B-H -MB&"-#(TF(Q38BFVE3_48AM!-(]4_*GJ:>4>-4V*'IIE/RFIY-3RFU#$S4WJA -MH](](]::/1/4:>IZFF:0/2!DVIZAH-J9`>4!H:?.1!_\Q4%G*&;V=R9PT='B<1$&>Y2K7;'1 ?;`L!0$`X6":FH$!$6!]N]*1& -M`>)4`P7%5$G@V]E5TZFK&($]>M7]W^OSGV?[[OM^+/=V,U7MZH"`7P^J9Y.4XK0O)T]ML=,$]>C2&`+KJIP7B%-.A(A^%=L6PJT7:EU$"\C_*-.JQ+2^W+*<`+ -M[7C@ULW[I"-T:`@7%]:`B#,.N],:_+:SN\[:H0"]MG;I((-):D9I@ -MEY+M.9\`=/Z'Y5'G)UUBI`$7\=-,6\WB0M^K1(IGM("()_S^%H$,(T:^: -MUJXAFG+?)LZ=2(B>DJ4`+\#0+:GW.!F9[Y0"67\4D'5N=?C<2IH"`B?%D\H0 -MGG&E/!&")G6)];))G]L??MF>!#;?]*:P<1'/-^\77VA0`%Z]R -ME-$,ZC*8W\V[=O*,`"`LNLU]SC!;I4"KG=/S#X!?7Y]N/BU*2;"=,Y6JXJ7( -M\0$Q,LORY367(RS2IZ5>L>\@(%\(7%0'&:-KRF&'2:+-/TMFDH`&<+FRQ] -M 2/+>LL58^19Q"!7L,11[)RREOK.2B(B\T[XU`#;W%RR(G[K(5$X17%G>A! -M5%N-\(U<88J#4CQIX2R!95"Z:FJFOLXD$6)JV@! ^C#B[K7^`23@`L#R4AD93YM`Q3];.J--PN6QM[K)JH -M(O;C-[U@O)%QFS:U:_'AEV+O+ML-FTP(.3(!E'S>H'.(0@#>MJ$"'FJI*?4K -MJ(^8_>2M:QGP"F_OWH5:].!EVM>UB'TW=R@(I#\VT2P%KT]_6]DV]DSX*:$B -M$\P$5TX-N@FLFP9/6Z#(]F)2R!;.(FW!F6.80[RE%T=?O6H/*`%S(]JQ[ -MR7,>5IA__C[WLV",$5K/Y3CA9I<=R)5=2;=$"#3;X4$!A3SS<4MFG&3LO -M(C(AK8$A:MCVU5]2F6(!3!"(X/?9Y:@`ZT))M.B\B78]MY1`BX"?4#9]!56Z -M)(%K(4E%,HP1?M]'( C@/O^H")>Y@?.?#9A!9W#]194/2$B@/0R$+"9F]7%, -M*1BYC`#LQ@*O)X;[/:@Q((+?>_Z#+K*>EX6<1R+?T&:\=DJ!\#0UPA_,^E -MKZ<2Y.D"5H,L:04L5`\;Q^3FH0!$N<-%2!`?/ZS>I:''+V&_V'MP$I)`W;W0 -M<("[Y"-384_['P.#[FK55I#5ZVMM[DH!4-F!?_"G;WQ+<>IO:.A1D`8W/]@0M8>%BW/(+<-+N=9T(HE -M8\P HC>;Y(&31@"8(L>$>5^/YP&:Y@'%$18BM3_NBBG3?7>!ZKL^1-#L?/ -MI`_+Y/!HD`*"]TF31QJ9YV"1#B\R/?U",@5[-@I;.4&_W%90)LS8U+ -M`,#YI0(2X6ML1-K;[$WRF]A\#Y!IMEPB$/?B%:LF@SS8@#$1(96`NH:/6&-` -M!:=-[T<("%]0_N*VT8X/5G4]+'5W>2@57]UECJP$[[:29VK4&^<0`O3I=VF? -MKR@)6"J[:JVG6:T`(X0_F^G'Y[@#IX#*^6`L@0>X[PUGR@1M8?GK+(:KI -M_U,(@U>K55\YIW+R5A#A_I*4^UE*=FQJ$`;GLX^GP`%VFAMHQLA -MVW-FEG)_<:*\3(P705=2"A.U_T1]?;OU(#\LK5$7LA$\:N3_/7'@3_L2$4!K -MJ6$S1,[?R[77H`%;Q,<;P<]WB#C?6PY9\/V7UF*!4\2`M<&]Z=&$0`^[XVX` -MP>#"!:ZO,V=QZ_BB!8WP5-F0XF%^[*`J8WXH"<]L!5-)?B8P\`,YVUF%`M%7EW:-*$+>N64?@;# -M6+FLFTL@'_E2321+T;G=ZYGMTB0'"&+[8**(!6Z&96X#]H(:2NZ%,2"$GFN, -M1!^?3G/A^`L*^I@/+HZ6G:DLBAZ_E30+MJ_"3C6J2\[8"57T0*Q`"%5OI.Y. -M:BNS[E[K4@%]-&1?WDI(=$YDICRZ]&1/M.`*SX?V1W6>I79`5A)E)=C -MC=S#.CUY].X/Z]T\1.%B=8L[(9KD:Y=]^`D`AJ=I:%X(.1-A<7W`!S-]'$IU -M%-,2`BN_0O@K[OJ'6R\VPY5,3$:,BZ"HE]\AB;53X3@H[X^"Q3E2>4%#6-2: -M>^%"
CVS commit: src/tests/dev/audio
Module Name:src Committed By: nat Date: Fri Jan 27 05:14:54 UTC 2017 Modified Files: src/tests/dev/audio: t_pad_output.bz2.uue Log Message: Revert to previous. Audio passes the test properly again. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/dev/audio/t_pad_output.bz2.uue Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: nat Date: Sun Dec 11 08:09:29 UTC 2016 Modified Files: src/tests/dev/audio: t_pad_output.bz2.uue Log Message: Update test output to reflect audio changes. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/dev/audio/t_pad_output.bz2.uue Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/t_pad_output.bz2.uue diff -u src/tests/dev/audio/t_pad_output.bz2.uue:1.2 src/tests/dev/audio/t_pad_output.bz2.uue:1.3 --- src/tests/dev/audio/t_pad_output.bz2.uue:1.2 Fri Feb 26 13:08:28 2016 +++ src/tests/dev/audio/t_pad_output.bz2.uue Sun Dec 11 08:09:29 2016 @@ -1,1035 +1,1040 @@ begin 644 t_pad_output.bz2 -M0EIH.3%!629369%IQ#X`MT#FU'+1O7<;MT;NYNNYW<[N[OO;K>W7+>^Y[M;[LV]??=M] -MYZ[MMMO>WO;6=W.KIOKNUF:EFEJVK5I"+:J;8:B5K1JJIJVUJV,K6IK5MJJ6 -M--%5FJLS55K158M5K:U5FU4RVMJ(K0BK-6Q0-L+6JVLJ6MK559M5556*M54J -MJMIMFS-"U6LJRUBRJJRV;55::M6U[G=0JI5-4W66J=KVZ]LNW=]W=FW=S;YM -MDO<]LW>Z[WW%E@WUOD-[G!SN<'=W$CD8@[KN<36:PVO=W;*I*E%4SC -MV]XE)5!54*"@*JJMH)J0H*`4`!11(``!4BJI27O>Z(]5()`22)**%4``I -M0`!*B5`D(DB*5@:5``AH`"8F3"8`F0#3(Q,FF@#1H&()H-#3330!ID,C`C -M!-,F)IIA`TQ-,!,33$831@@R9&$T`!,`@TD@FC$``&@```:-`3`F$P0T -M,$!@`$``#03T!H-`U,`33$TTQJ-,$P$P%/$R8",!-02FDI"!$QJ>S,`0`$!H -M:!#":$Q-,28$V@0-`34]$:;*:>D]1I[0H'HGDRC:AD&@]0&@/4`]0R`R,AH- -M!H`VHS2`:`(4E)*)>J-^GBGL!2,:::2;48GI$IO%)Y)Y)[3TE/U1^FFC*C -MQ>IZC$T,AIZAZF31H>4``'J!DTTT---```#U```-`9#0T``T!(I((28-)B -M>A3TTF>14]3VT>R,@F$TQ'DT3&@FU3\4GFDT>J>333$T]$-,32 -MGM-4]IDTR)ZI^1I3V332;(93-4_5/R>D#":GDU-D:FIZ>IM3U-HTH)-25)%1 -MM3:3]L/-2$FWD4S4U-B:::FB;4V3"4_4R4>H>U0;4]JGJ&33T]4T`#(T-&0] -M0!HT-`_5`!Z@T9!IH:```_Q$/Z:,D&8X$'B.D00+!M12TQ2"> -MGH4)$$U776'(,NA5T"`@H&+#%`;<'^;2<4$`CK#I>?6\SY]KTOQX,LDD%=#] -M=K=W[.S5.*PD:9EE+#8V,8RRL@"_3]+%\'Y\OE<[XY25)9,(
CVS commit: src/tests/dev/audio
Module Name:src Committed By: nat Date: Sun Dec 11 08:09:29 UTC 2016 Modified Files: src/tests/dev/audio: t_pad_output.bz2.uue Log Message: Update test output to reflect audio changes. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/dev/audio/t_pad_output.bz2.uue Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: pooka Date: Mon Jan 24 08:26:23 UTC 2011 Modified Files: src/tests/dev/audio: h_pad_musa.c Log Message: Represent test data as bytes to make it endian-independent. from martin To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/dev/audio/h_pad_musa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: he Date: Sun Oct 31 13:54:32 UTC 2010 Modified Files: src/tests/dev/audio: Makefile Log Message: There's apparently a circular dependency between -lrump and -lrumpuser. This poses problems when linking statically, as for sun2. Add -lrump also after -lrumpuser, so that this links statically as well. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/dev/audio/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: pooka Date: Wed Aug 4 13:49:48 UTC 2010 Modified Files: src/tests/dev/audio: t_pad.sh Log Message: Update test program to deal with uuencoded golden data. XXX: is it not possible to use a pipeline in atf_check? To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/dev/audio/t_pad.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/t_pad.sh diff -u src/tests/dev/audio/t_pad.sh:1.1 src/tests/dev/audio/t_pad.sh:1.2 --- src/tests/dev/audio/t_pad.sh:1.1 Wed Aug 4 13:15:15 2010 +++ src/tests/dev/audio/t_pad.sh Wed Aug 4 13:49:48 2010 @@ -1,4 +1,4 @@ -# $NetBSD: t_pad.sh,v 1.1 2010/08/04 13:15:15 pooka Exp $ +# $NetBSD: t_pad.sh,v 1.2 2010/08/04 13:49:48 pooka Exp $ # # Copyright (c) 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -36,9 +36,9 @@ pad_output_body() { - atf_check -s exit:0 -o save:expout \ - bunzip2 -c $(atf_get_srcdir)/t_pad_output.bz2 - atf_check -s exit:0 -o file:expout $(atf_get_srcdir)/h_pad + atf_check -s exit:0 uudecode $(atf_get_srcdir)/t_pad_output.bz2.uue + atf_check -s exit:0 bunzip2 t_pad_output.bz2 + atf_check -s exit:0 -o file:t_pad_output $(atf_get_srcdir)/h_pad } atf_init_test_cases()
CVS commit: src/tests/dev/audio
Module Name:src Committed By: pooka Date: Wed Aug 4 14:43:15 UTC 2010 Modified Files: src/tests/dev/audio: Makefile Log Message: need to update install filename too To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/dev/audio/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/audio/Makefile diff -u src/tests/dev/audio/Makefile:1.1 src/tests/dev/audio/Makefile:1.2 --- src/tests/dev/audio/Makefile:1.1 Wed Aug 4 13:15:15 2010 +++ src/tests/dev/audio/Makefile Wed Aug 4 14:43:14 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1 2010/08/04 13:15:15 pooka Exp $ +# $NetBSD: Makefile,v 1.2 2010/08/04 14:43:14 pooka Exp $ # .include bsd.own.mk @@ -15,7 +15,7 @@ LDADD+= -lrump LDADD+= -lrumpuser -lpthread -FILES= t_pad_output.bz2 +FILES= t_pad_output.bz2.uue WARNS= 4 NOMAN=
CVS commit: src/tests/dev/audio
Module Name:src Committed By: pooka Date: Wed Aug 4 13:49:48 UTC 2010 Modified Files: src/tests/dev/audio: t_pad.sh Log Message: Update test program to deal with uuencoded golden data. XXX: is it not possible to use a pipeline in atf_check? To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/dev/audio/t_pad.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev/audio
Module Name:src Committed By: pooka Date: Wed Aug 4 14:43:15 UTC 2010 Modified Files: src/tests/dev/audio: Makefile Log Message: need to update install filename too To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/dev/audio/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.