CVS commit: src/tests/dev/audio

2023-12-11 Thread Michael van Elst
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

2023-12-11 Thread Michael van Elst
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

2023-08-03 Thread Rin Okuyama
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

2023-08-03 Thread Rin Okuyama
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

2023-06-23 Thread SAITOH Masanobu
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

2023-06-23 Thread SAITOH Masanobu
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/fss

2023-05-10 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Thu May 11 01:56:31 UTC 2023

Modified Files:
src/tests/dev/fss: t_fss.sh

Log Message:
t_fss.sh: add missing test case head


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/dev/fss/t_fss.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/fss/t_fss.sh
diff -u src/tests/dev/fss/t_fss.sh:1.5 src/tests/dev/fss/t_fss.sh:1.6
--- src/tests/dev/fss/t_fss.sh:1.5	Wed Nov 30 17:49:59 2022
+++ src/tests/dev/fss/t_fss.sh	Thu May 11 01:56:31 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_fss.sh,v 1.5 2022/11/30 17:49:59 martin Exp $
+# $NetBSD: t_fss.sh,v 1.6 2023/05/11 01:56:31 gutteridge Exp $
 #
 # Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -35,6 +35,11 @@ orig_data="Original data"
 repl_data="Replacement data"
 
 atf_test_case basic cleanup
+basic_head() {
+	atf_set "descr" "Verify basic operation of fss(4) file system " \
+		"snapshot device"
+}
+
 basic_body() {
 
 # verify fss is available (or loadable as a module)
@@ -81,5 +86,5 @@ basic_cleanup() {
 
 atf_init_test_cases()
 {
-atf_add_test_case basic
+	atf_add_test_case basic
 }



CVS commit: src/tests/dev/fss

2023-05-10 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Thu May 11 01:56:31 UTC 2023

Modified Files:
src/tests/dev/fss: t_fss.sh

Log Message:
t_fss.sh: add missing test case head


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/dev/fss/t_fss.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

2023-04-23 Thread Michael van Elst
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

2023-04-23 Thread Michael van Elst
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

2023-02-13 Thread Andrius Varanavicius
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

2023-02-13 Thread Andrius Varanavicius
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

2022-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 30 17:49:09 UTC 2022

Modified Files:
src/tests/dev/cgd: t_cgd.sh
src/tests/dev/md: t_md.sh
src/tests/dev/raidframe: t_raid.sh

Log Message:
Unfortunately rump does not provide the same magic as MAKEDEV does
for native /dev and create an alias for disk devices w/o partition
latter pointing at the raw partition, so for rump based tests we
actually have to calculate the concrete device name.

Use an idiom suggested by kre for this which also works for ports that
have kern.rawpartition > 4.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/dev/cgd/t_cgd.sh
cvs rdiff -u -r1.7 -r1.8 src/tests/dev/md/t_md.sh
cvs rdiff -u -r1.15 -r1.16 src/tests/dev/raidframe/t_raid.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/cgd/t_cgd.sh
diff -u src/tests/dev/cgd/t_cgd.sh:1.13 src/tests/dev/cgd/t_cgd.sh:1.14
--- src/tests/dev/cgd/t_cgd.sh:1.13	Wed Apr 10 06:13:21 2019
+++ src/tests/dev/cgd/t_cgd.sh	Wed Nov 30 17:49:09 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgd.sh,v 1.13 2019/04/10 06:13:21 kre Exp $
+#	$NetBSD: t_cgd.sh,v 1.14 2022/11/30 17:49:09 martin Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -25,7 +25,8 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-rawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'`
+rawpart=$( set -- a b c d e f g h i j k l m n o p q r s t u v w x y z;
+	shift $( sysctl -n kern.rawpartition ); printf %s "$1" )
 rawcgd=/dev/rcgd0${rawpart}
 cgdserver=\
 "rump_server -lrumpvfs -lrumpkern_crypto -lrumpdev -lrumpdev_disk -lrumpdev_cgd"

Index: src/tests/dev/md/t_md.sh
diff -u src/tests/dev/md/t_md.sh:1.7 src/tests/dev/md/t_md.sh:1.8
--- src/tests/dev/md/t_md.sh:1.7	Sat May 14 17:42:28 2011
+++ src/tests/dev/md/t_md.sh	Wed Nov 30 17:49:09 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_md.sh,v 1.7 2011/05/14 17:42:28 jmmv Exp $
+#	$NetBSD: t_md.sh,v 1.8 2022/11/30 17:49:09 martin Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -25,7 +25,8 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-rawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'`
+rawpart=$( set -- a b c d e f g h i j k l m n o p q r s t u v w x y z;
+	shift $( sysctl -n kern.rawpartition ); printf %s "$1" )
 rawmd=/dev/rmd0${rawpart}
 
 atf_test_case basic cleanup
@@ -38,10 +39,6 @@ basic_head()
 basic_body()
 {
 
-	# Scope out raw part.  This is actually the *host* raw partition,
-	# but just let it slide for now, since they *should* be the same.
-	rawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'`
-
 	atf_check -s exit:0 $(atf_get_srcdir)/h_mdserv ${rawmd}
 
 	export RUMP_SERVER=unix://commsock

Index: src/tests/dev/raidframe/t_raid.sh
diff -u src/tests/dev/raidframe/t_raid.sh:1.15 src/tests/dev/raidframe/t_raid.sh:1.16
--- src/tests/dev/raidframe/t_raid.sh:1.15	Mon Nov 30 05:33:32 2020
+++ src/tests/dev/raidframe/t_raid.sh	Wed Nov 30 17:49:09 2022
@@ -1,5 +1,5 @@
 #! /usr/bin/atf-sh
-#	$NetBSD: t_raid.sh,v 1.15 2020/11/30 05:33:32 msaitoh Exp $
+#	$NetBSD: t_raid.sh,v 1.16 2022/11/30 17:49:09 martin Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -26,7 +26,8 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-rawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'`
+rawpart=$( set -- a b c d e f g h i j k l m n o p q r s t u v w x y z;
+	shift $( sysctl -n kern.rawpartition ); printf %s "$1" )
 rawraid=/dev/rraid0${rawpart}
 raidserver="rump_server -lrumpvfs -lrumpdev -lrumpdev_disk -lrumpdev_raidframe"
 



CVS commit: src/tests/dev

2022-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 30 17:49:09 UTC 2022

Modified Files:
src/tests/dev/cgd: t_cgd.sh
src/tests/dev/md: t_md.sh
src/tests/dev/raidframe: t_raid.sh

Log Message:
Unfortunately rump does not provide the same magic as MAKEDEV does
for native /dev and create an alias for disk devices w/o partition
latter pointing at the raw partition, so for rump based tests we
actually have to calculate the concrete device name.

Use an idiom suggested by kre for this which also works for ports that
have kern.rawpartition > 4.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/dev/cgd/t_cgd.sh
cvs rdiff -u -r1.7 -r1.8 src/tests/dev/md/t_md.sh
cvs rdiff -u -r1.15 -r1.16 src/tests/dev/raidframe/t_raid.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/cgd

2022-08-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 13 17:46:26 UTC 2022

Modified Files:
src/tests/dev/cgd: t_cgdconfig.sh

Log Message:
When run from py-anita/amd64 this test fails with:

  cgdconfig: getfsspecname failed: no match for `wd0e'

as the virtual machine has root on dk0, dk0 at wd0 and trying to
open wd0e fails.

This tests runs without a rump kernel and therefore should not
even try to open configured devices on the host.  Replace the
disks "wd0e" and "ld1e" with non-existant disks "dska" and "dskb".


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgdconfig.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/cgd/t_cgdconfig.sh
diff -u src/tests/dev/cgd/t_cgdconfig.sh:1.3 src/tests/dev/cgd/t_cgdconfig.sh:1.4
--- src/tests/dev/cgd/t_cgdconfig.sh:1.3	Fri Aug 12 10:49:17 2022
+++ src/tests/dev/cgd/t_cgdconfig.sh	Sat Aug 13 17:46:26 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgdconfig.sh,v 1.3 2022/08/12 10:49:17 riastradh Exp $
+#	$NetBSD: t_cgdconfig.sh,v 1.4 2022/08/13 17:46:26 hannken Exp $
 #
 # Copyright (c) 2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -53,7 +53,7 @@ storedkeys_head()
 }
 storedkeys_body()
 {
-	cat 

CVS commit: src/tests/dev/cgd

2022-08-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 13 17:46:26 UTC 2022

Modified Files:
src/tests/dev/cgd: t_cgdconfig.sh

Log Message:
When run from py-anita/amd64 this test fails with:

  cgdconfig: getfsspecname failed: no match for `wd0e'

as the virtual machine has root on dk0, dk0 at wd0 and trying to
open wd0e fails.

This tests runs without a rump kernel and therefore should not
even try to open configured devices on the host.  Replace the
disks "wd0e" and "ld1e" with non-existant disks "dska" and "dskb".


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgdconfig.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

2022-08-13 Thread Tetsuya Isaki
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

2022-08-13 Thread Tetsuya Isaki
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

2022-08-13 Thread Tetsuya Isaki
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

2022-08-13 Thread Tetsuya Isaki
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

2022-08-13 Thread Tetsuya Isaki
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

2022-08-13 Thread Tetsuya Isaki
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

2022-04-23 Thread Tetsuya Isaki
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

2022-04-23 Thread Tetsuya Isaki
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

2021-12-04 Thread SAITOH Masanobu
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

2021-12-04 Thread SAITOH Masanobu
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/cgd

2019-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 10 06:21:40 UTC 2019

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
Gracefully skip test if not enough space in temporary directory.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/dev/cgd/t_cgd_aes.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/cgd/t_cgd_aes.c
diff -u src/tests/dev/cgd/t_cgd_aes.c:1.6 src/tests/dev/cgd/t_cgd_aes.c:1.7
--- src/tests/dev/cgd/t_cgd_aes.c:1.6	Fri Jan 13 21:30:39 2017
+++ src/tests/dev/cgd/t_cgd_aes.c	Wed Jul 10 06:21:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_aes.c,v 1.6 2017/01/13 21:30:39 christos Exp $	*/
+/*	$NetBSD: t_cgd_aes.c,v 1.7 2019/07/10 06:21:40 martin Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@@ -3565,7 +3565,12 @@ ATF_TC_BODY(cgd_aes_xts_512, tc)
 
 	rump_init();
 
-	RL(dkfd = open_disk(dkpath, imgpath, dksize));
+	dkfd = open_disk(dkpath, imgpath, dksize);
+	if (dkfd == -1 && errno == ENOSPC) {
+		atf_tc_skip("not enough space");
+	} else {
+		ATF_CHECK_MSG(dkfd != -1, "open_disk: %s", strerror(errno));
+	}
 
 	RL(cgdfd = open_cgd(0));
 	RL(configure_cgd(cgdfd, dkpath, "aes-xts", "encblkno1",



CVS commit: src/tests/dev/cgd

2019-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 10 06:21:40 UTC 2019

Modified Files:
src/tests/dev/cgd: t_cgd_aes.c

Log Message:
Gracefully skip test if not enough space in temporary directory.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/dev/cgd/t_cgd_aes.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/raidframe

2019-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 10 06:10:54 UTC 2019

Modified Files:
src/tests/dev/raidframe: t_raid.sh

Log Message:
Reduce disk image size for tests (PR 44239 has been fixed)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/dev/raidframe/t_raid.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/raidframe/t_raid.sh
diff -u src/tests/dev/raidframe/t_raid.sh:1.13 src/tests/dev/raidframe/t_raid.sh:1.14
--- src/tests/dev/raidframe/t_raid.sh:1.13	Thu Jan 18 00:32:49 2018
+++ src/tests/dev/raidframe/t_raid.sh	Wed Jul 10 06:10:54 2019
@@ -1,5 +1,5 @@
 #! /usr/bin/atf-sh
-#	$NetBSD: t_raid.sh,v 1.13 2018/01/18 00:32:49 mrg Exp $
+#	$NetBSD: t_raid.sh,v 1.14 2019/07/10 06:10:54 martin Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -113,8 +113,7 @@ old_numrows_config_cleanup()
 	rump.halt
 }
 
-# make this smaller once 44239 is fixed
-export RAID_MEDIASIZE=32m
+export RAID_MEDIASIZE=4m
 
 atf_test_case raid1_compfail cleanup
 raid1_compfail_head()



CVS commit: src/tests/dev/raidframe

2019-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul 10 06:10:54 UTC 2019

Modified Files:
src/tests/dev/raidframe: t_raid.sh

Log Message:
Reduce disk image size for tests (PR 44239 has been fixed)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/dev/raidframe/t_raid.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



re: CVS commit: src/tests/dev/fss

2017-03-15 Thread matthew green
"Martin Husemann" writes:
> Module Name:  src
> Committed By: martin
> Date: Wed Mar 15 10:53:15 UTC 2017
> 
> Modified Files:
>   src/tests/dev/fss: t_fss.sh
> 
> Log Message:
> Do not assume an all-zeroes disk label will read back as a disk with
> an 'a'  partition covering the whole disk, instead use the raw partition.
> Also skip this test if the fss device is not available.
> With lots of help from pgoyette.

good idea.  i wonder if picking something much higher than 'vnd0'
would also be safer here?  i tend to always 'reboot and run tests',
but maybe someone might run this when vnd0 already setup, and it
would be nice to have the test not fail in that case.


.mrg.