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/scsipi/libscsitest

2021-08-07 Thread Chris Pinnock
Module Name:src
Committed By:   cjep
Date:   Sat Aug  7 22:05:26 UTC 2021

Modified Files:
src/tests/dev/scsipi/libscsitest: scsitest.c

Log Message:
Convert the test to cfargs. OK @thorpej.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/scsipi/libscsitest/scsitest.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/scsipi/libscsitest/scsitest.c
diff -u src/tests/dev/scsipi/libscsitest/scsitest.c:1.4 src/tests/dev/scsipi/libscsitest/scsitest.c:1.5
--- src/tests/dev/scsipi/libscsitest/scsitest.c:1.4	Sun Apr 25 05:33:20 2021
+++ src/tests/dev/scsipi/libscsitest/scsitest.c	Sat Aug  7 22:05:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsitest.c,v 1.4 2021/04/25 05:33:20 thorpej Exp $	*/
+/*	$NetBSD: scsitest.c,v 1.5 2021/08/07 22:05:26 cjep Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsitest.c,v 1.4 2021/04/25 05:33:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsitest.c,v 1.5 2021/08/07 22:05:26 cjep Exp $");
 
 #include 
 #include 
@@ -256,6 +256,5 @@ scsitest_attach(device_t parent, device_
 	sc->sc_channel.chan_adapter = >sc_adapter;
 
 	config_found(self, >sc_channel, scsiprint,
-	CFARG_IATTR, "scsi",
-	CFARG_EOL);
+		CFARGS(.iattr = "scsi"));
 }



CVS commit: src/tests/dev/scsipi/libscsitest

2021-08-07 Thread Chris Pinnock
Module Name:src
Committed By:   cjep
Date:   Sat Aug  7 22:05:26 UTC 2021

Modified Files:
src/tests/dev/scsipi/libscsitest: scsitest.c

Log Message:
Convert the test to cfargs. OK @thorpej.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/scsipi/libscsitest/scsitest.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-07-21 Thread Tetsuya Isaki
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

2021-07-21 Thread Tetsuya Isaki
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/sysmon

2021-06-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 13 14:45:36 UTC 2021

Modified Files:
src/tests/dev/sysmon: t_swsensor.sh

Log Message:
tests/dev/sysmon: Query bits of data, not bits of entropy.

Fixes PR kern/47661.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/dev/sysmon/t_swsensor.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/sysmon/t_swsensor.sh
diff -u src/tests/dev/sysmon/t_swsensor.sh:1.11 src/tests/dev/sysmon/t_swsensor.sh:1.12
--- src/tests/dev/sysmon/t_swsensor.sh:1.11	Sat Mar 21 04:50:21 2020
+++ src/tests/dev/sysmon/t_swsensor.sh	Sun Jun 13 14:45:36 2021
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.11 2020/03/21 04:50:21 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.12 2021/06/13 14:45:36 riastradh Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -24,7 +24,7 @@ get_rnd_bits_count() {
 	RUMP_SERVER=unix://t_swsensor_socket	\
 	LD_PRELOAD=/usr/lib/librumphijack.so	  rndctl -l | \
 	grep "swsensor-sensor" | \
-	awk '{print $2}'
+	awk '{print $3}'
 }
 
 check_powerd_event() {
@@ -296,19 +296,16 @@ common_body() {
 	sleep 5
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -le $rnd_bits ] ; then
-		atf_expect_fail "PR kern/47661"
 		atf_fail "14a: entropy bits did not increase after polling"
 	fi
 	rnd_bits=$new_rnd_bits
 	sleep 5
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -gt $rnd_bits ] ; then
-		atf_expect_fail "PR kern/47661"
 		atf_fail "14b: entropy bits increased after poll with no value change"
 	fi
 
 	# Step 15 - make sure entropy collected when device is interrogated
-	# 
 	rump.envstat -c env0.conf
 	rump.sysctl -w hw.swsensor.cur_value=$3
 	get_sensor_key cur-value
@@ -317,14 +314,12 @@ common_body() {
 	get_sensor_key cur-value
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -le $rnd_bits ] ; then
-		atf_expect_fail "PR kern/47661"
 		atf_fail "15a: entropy bits did not increase after interrogation"
 	fi
 	rnd_bits=$new_rnd_bits
 	get_sensor_key cur-value
 	new_rnd_bits=$( get_rnd_bits_count )
 	if [ $new_rnd_bits -gt $rnd_bits ] ; then
-		atf_expect_fail "PR kern/47661"
 		atf_fail "15b: entropy bits increased after interrogation with no value change"
 	fi
 }



CVS commit: src/tests/dev/sysmon

2021-06-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jun 13 14:45:36 UTC 2021

Modified Files:
src/tests/dev/sysmon: t_swsensor.sh

Log Message:
tests/dev/sysmon: Query bits of data, not bits of entropy.

Fixes PR kern/47661.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/dev/sysmon/t_swsensor.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/scsipi/libscsitest

2021-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Apr 25 05:33:20 UTC 2021

Modified Files:
src/tests/dev/scsipi/libscsitest: scsitest.c

Log Message:
config_found_ia() -> config_found().


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

2021-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Apr 25 05:33:20 UTC 2021

Modified Files:
src/tests/dev/scsipi/libscsitest: scsitest.c

Log Message:
config_found_ia() -> config_found().


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/scsipi/libscsitest/scsitest.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/scsipi/libscsitest/scsitest.c
diff -u src/tests/dev/scsipi/libscsitest/scsitest.c:1.3 src/tests/dev/scsipi/libscsitest/scsitest.c:1.4
--- src/tests/dev/scsipi/libscsitest/scsitest.c:1.3	Wed Feb  6 09:16:49 2019
+++ src/tests/dev/scsipi/libscsitest/scsitest.c	Sun Apr 25 05:33:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsitest.c,v 1.3 2019/02/06 09:16:49 mrg Exp $	*/
+/*	$NetBSD: scsitest.c,v 1.4 2021/04/25 05:33:20 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsitest.c,v 1.3 2019/02/06 09:16:49 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsitest.c,v 1.4 2021/04/25 05:33:20 thorpej Exp $");
 
 #include 
 #include 
@@ -255,5 +255,7 @@ scsitest_attach(device_t parent, device_
 	sc->sc_channel.chan_flags = SCSIPI_CHAN_NOSETTLE;
 	sc->sc_channel.chan_adapter = >sc_adapter;
 
-	config_found_ia(self, "scsi", >sc_channel, scsiprint);
+	config_found(self, >sc_channel, scsiprint,
+	CFARG_IATTR, "scsi",
+	CFARG_EOL);
 }



CVS commit: src/tests/dev/fss

2021-01-13 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Jan 14 04:30:40 UTC 2021

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

Log Message:
Unmount and unconfigure in the reverse order that they were done.  Fixes
problem with leaving a dangling snapshot configured.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.3 src/tests/dev/fss/t_fss.sh:1.4
--- src/tests/dev/fss/t_fss.sh:1.3	Wed Mar 15 10:53:15 2017
+++ src/tests/dev/fss/t_fss.sh	Thu Jan 14 04:30:40 2021
@@ -1,4 +1,4 @@
-# $NetBSD: t_fss.sh,v 1.3 2017/03/15 10:53:15 martin Exp $
+# $NetBSD: t_fss.sh,v 1.4 2021/01/14 04:30:40 simonb Exp $
 #
 # Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -74,9 +74,9 @@ basic_body() {
 
 basic_cleanup() {
 # Unmount our temporary stuff
-	umount ${vnd}		|| true
-	fssconfig -u fss0	|| true
 	umount /dev/fss0	|| true
+	fssconfig -u fss0	|| true
+	umount ${vnd}		|| true
 	vndconfig -u ${vnddev}	|| true
 }
 



CVS commit: src/tests/dev/fss

2021-01-13 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Jan 14 04:30:40 UTC 2021

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

Log Message:
Unmount and unconfigure in the reverse order that they were done.  Fixes
problem with leaving a dangling snapshot configured.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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

2020-10-13 Thread Rin Okuyama
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

2020-10-13 Thread Rin Okuyama
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/cgd

2020-08-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Aug 20 13:33:54 UTC 2020

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

Log Message:
clang can't handle __aligned on anonymous structure initializers.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/cgd/t_cgd_adiantum.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_adiantum.c
diff -u src/tests/dev/cgd/t_cgd_adiantum.c:1.4 src/tests/dev/cgd/t_cgd_adiantum.c:1.5
--- src/tests/dev/cgd/t_cgd_adiantum.c:1.4	Sat Aug 15 10:03:10 2020
+++ src/tests/dev/cgd/t_cgd_adiantum.c	Thu Aug 20 13:33:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_adiantum.c,v 1.4 2020/08/15 10:03:10 mlelstv Exp $	*/
+/*	$NetBSD: t_cgd_adiantum.c,v 1.5 2020/08/20 13:33:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -47,6 +47,9 @@
 #define	MAXSECSIZE	512	/* for now; should be cgd parameter */
 #define	IMGSIZE		0x101*512
 
+/* Used as buffer for cgd device I/O, must be at least 32-bit aligned.  */
+static const uint8_t zerosector[512] __aligned(4);
+
 static const struct {
 	uint8_t		key[32];
 	uint64_t	blkno;
@@ -58,7 +61,7 @@ static const struct {
 		.key = {0},
 		.blkno = 0,
 		.secsize = 512,
-		.ptxt = (const __aligned(4) uint8_t[512]) {0},
+		.ptxt = zerosector,
 		.ctxt = (const uint8_t[512]) {
 			0x51,0x6d,0xe2,0x81, 0x26,0xd5,0xc8,0xd7,
 			0xff,0xc6,0xc2,0xff, 0x39,0xbf,0x15,0x15,
@@ -130,7 +133,7 @@ static const struct {
 		.key = {0},
 		.blkno = 1,
 		.secsize = 512,
-		.ptxt = (const __aligned(4) uint8_t[512]) {0},
+		.ptxt = zerosector,
 		.ctxt = (const uint8_t[512]) {
 			0xf2,0x23,0x68,0x5a, 0x15,0x11,0x56,0xa1,
 			0x71,0x57,0x5c,0x5e, 0x32,0xd4,0xdd,0xbb,
@@ -202,7 +205,7 @@ static const struct {
 		.key = {0},
 		.blkno = 0x100,
 		.secsize = 512,
-		.ptxt = (const __aligned(4) uint8_t[512]) {0},
+		.ptxt = zerosector,
 		.ctxt = (const uint8_t[512]) {
 			0x32,0x26,0xaf,0x56, 0xbc,0x43,0xac,0x37,
 			0xb2,0x8d,0xa4,0xfb, 0x32,0xdc,0x09,0x03,



CVS commit: src/tests/dev/cgd

2020-08-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Aug 20 13:33:54 UTC 2020

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

Log Message:
clang can't handle __aligned on anonymous structure initializers.


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

2020-08-15 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 15 10:03:10 UTC 2020

Modified Files:
src/tests/dev/cgd: t_cgd_3des.c t_cgd_adiantum.c t_cgd_aes.c
t_cgd_blowfish.c

Log Message:
Plaintext buffers are used directly for write() operations to the raw device.
Align them to the needs of cgd(4).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/cgd/t_cgd_3des.c \
src/tests/dev/cgd/t_cgd_blowfish.c
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgd_adiantum.c
cvs rdiff -u -r1.7 -r1.8 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/cgd

2020-08-15 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Aug 15 10:03:10 UTC 2020

Modified Files:
src/tests/dev/cgd: t_cgd_3des.c t_cgd_adiantum.c t_cgd_aes.c
t_cgd_blowfish.c

Log Message:
Plaintext buffers are used directly for write() operations to the raw device.
Align them to the needs of cgd(4).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/cgd/t_cgd_3des.c \
src/tests/dev/cgd/t_cgd_blowfish.c
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgd_adiantum.c
cvs rdiff -u -r1.7 -r1.8 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_3des.c
diff -u src/tests/dev/cgd/t_cgd_3des.c:1.2 src/tests/dev/cgd/t_cgd_3des.c:1.3
--- src/tests/dev/cgd/t_cgd_3des.c:1.2	Fri Jan 13 21:30:39 2017
+++ src/tests/dev/cgd/t_cgd_3des.c	Sat Aug 15 10:03:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_3des.c,v 1.2 2017/01/13 21:30:39 christos Exp $	*/
+/*	$NetBSD: t_cgd_3des.c,v 1.3 2020/08/15 10:03:10 mlelstv Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -68,7 +68,7 @@ static const char c3des_cbc_192_key[25] 
 	0
 };
 
-static const uint8_t c3des_cbc_ptxt[SECSIZE] =
+static const uint8_t c3des_cbc_ptxt[SECSIZE] __aligned(4) =
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"
Index: src/tests/dev/cgd/t_cgd_blowfish.c
diff -u src/tests/dev/cgd/t_cgd_blowfish.c:1.2 src/tests/dev/cgd/t_cgd_blowfish.c:1.3
--- src/tests/dev/cgd/t_cgd_blowfish.c:1.2	Fri Jan 13 21:30:39 2017
+++ src/tests/dev/cgd/t_cgd_blowfish.c	Sat Aug 15 10:03:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_blowfish.c,v 1.2 2017/01/13 21:30:39 christos Exp $	*/
+/*	$NetBSD: t_cgd_blowfish.c,v 1.3 2020/08/15 10:03:10 mlelstv Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -92,7 +92,7 @@ static const char bf_cbc_448_key[57] = {
 	0
 };
 
-static const uint8_t bf_cbc_ptxt[SECSIZE] =
+static const uint8_t bf_cbc_ptxt[SECSIZE] __aligned(4) =
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"

Index: src/tests/dev/cgd/t_cgd_adiantum.c
diff -u src/tests/dev/cgd/t_cgd_adiantum.c:1.3 src/tests/dev/cgd/t_cgd_adiantum.c:1.4
--- src/tests/dev/cgd/t_cgd_adiantum.c:1.3	Tue Jun 30 04:17:31 2020
+++ src/tests/dev/cgd/t_cgd_adiantum.c	Sat Aug 15 10:03:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_adiantum.c,v 1.3 2020/06/30 04:17:31 riastradh Exp $	*/
+/*	$NetBSD: t_cgd_adiantum.c,v 1.4 2020/08/15 10:03:10 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@ static const struct {
 		.key = {0},
 		.blkno = 0,
 		.secsize = 512,
-		.ptxt = (const uint8_t[512]) {0},
+		.ptxt = (const __aligned(4) uint8_t[512]) {0},
 		.ctxt = (const uint8_t[512]) {
 			0x51,0x6d,0xe2,0x81, 0x26,0xd5,0xc8,0xd7,
 			0xff,0xc6,0xc2,0xff, 0x39,0xbf,0x15,0x15,
@@ -130,7 +130,7 @@ static const struct {
 		.key = {0},
 		.blkno = 1,
 		.secsize = 512,
-		.ptxt = (const uint8_t[512]) {0},
+		.ptxt = (const __aligned(4) uint8_t[512]) {0},
 		.ctxt = (const uint8_t[512]) {
 			0xf2,0x23,0x68,0x5a, 0x15,0x11,0x56,0xa1,
 			0x71,0x57,0x5c,0x5e, 0x32,0xd4,0xdd,0xbb,
@@ -202,7 +202,7 @@ static const struct {
 		.key = {0},
 		.blkno = 0x100,
 		.secsize = 512,
-		.ptxt = (const uint8_t[512]) {0},
+		.ptxt = (const __aligned(4) uint8_t[512]) {0},
 		.ctxt = (const uint8_t[512]) {
 			0x32,0x26,0xaf,0x56, 0xbc,0x43,0xac,0x37,
 			0xb2,0x8d,0xa4,0xfb, 0x32,0xdc,0x09,0x03,

Index: src/tests/dev/cgd/t_cgd_aes.c
diff -u src/tests/dev/cgd/t_cgd_aes.c:1.7 src/tests/dev/cgd/t_cgd_aes.c:1.8
--- src/tests/dev/cgd/t_cgd_aes.c:1.7	Wed Jul 10 06:21:40 2019
+++ src/tests/dev/cgd/t_cgd_aes.c	Sat Aug 15 10:03:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_aes.c,v 1.7 2019/07/10 06:21:40 martin Exp $	*/
+/*	$NetBSD: t_cgd_aes.c,v 1.8 2020/08/15 10:03:10 mlelstv Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@@ -89,7 +89,7 @@ static const char aes_cbc_256_key[33] = 
 	0
 };
 
-static const uint8_t aes_cbc_ptxt[SECSIZE] =
+static const uint8_t aes_cbc_ptxt[SECSIZE] __aligned(4) =
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"
 	"abcdefghijklmnop"
@@ -1954,7 +1954,7 @@ static const char aes_xts_512_key[65] = 
 /*
  * Vector 4 from IEEE 1619/D16, blkno 0.
  */
-static const uint8_t aes_xts_256_vec4_ptxt[SECSIZE] = {
+static const uint8_t aes_xts_256_vec4_ptxt[SECSIZE] __aligned(4) = {
 	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
 	0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
 	0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -2091,7 +2091,7 @@ static const uint8_t aes_xts_256_vec4_ct
 /*
  * Vector 5 from IEEE 1619/D16, blkno 1.
  */
-static const uint8_t 

CVS commit: src/tests/dev/cgd

2020-06-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 30 04:17:31 UTC 2020

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

Log Message:
Missed a spot -- one more 32-bit sign-compare issue.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/cgd/t_cgd_adiantum.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_adiantum.c
diff -u src/tests/dev/cgd/t_cgd_adiantum.c:1.2 src/tests/dev/cgd/t_cgd_adiantum.c:1.3
--- src/tests/dev/cgd/t_cgd_adiantum.c:1.2	Tue Jun 30 04:15:46 2020
+++ src/tests/dev/cgd/t_cgd_adiantum.c	Tue Jun 30 04:17:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_adiantum.c,v 1.2 2020/06/30 04:15:46 riastradh Exp $	*/
+/*	$NetBSD: t_cgd_adiantum.c,v 1.3 2020/06/30 04:17:31 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -348,7 +348,7 @@ ATF_TC_BODY(cgd_adiantum, tc)
 		RL(nwrit = rump_sys_pwrite(cgdfd, C[i].ptxt, C[i].secsize,
 			C[i].blkno * C[i].secsize));
 		RL(unconfigure_cgd(cgdfd));
-		if (nwrit != C[i].secsize) {
+		if ((size_t)nwrit != C[i].secsize) {
 			atf_tc_fail_nonfatal("truncated write: %zd != %u",
 			nwrit, C[i].secsize);
 			continue;



CVS commit: src/tests/dev/cgd

2020-06-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 30 04:17:31 UTC 2020

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

Log Message:
Missed a spot -- one more 32-bit sign-compare issue.


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

2020-06-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 30 04:15:46 UTC 2020

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

Log Message:
Fix sign-compare issue on 32-bit systems.

Built fine on amd64, where all unsigned values are representable in
ssize_t, but I didn't try building on i386, where they're not.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/cgd/t_cgd_adiantum.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_adiantum.c
diff -u src/tests/dev/cgd/t_cgd_adiantum.c:1.1 src/tests/dev/cgd/t_cgd_adiantum.c:1.2
--- src/tests/dev/cgd/t_cgd_adiantum.c:1.1	Mon Jun 29 23:44:01 2020
+++ src/tests/dev/cgd/t_cgd_adiantum.c	Tue Jun 30 04:15:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_adiantum.c,v 1.1 2020/06/29 23:44:01 riastradh Exp $	*/
+/*	$NetBSD: t_cgd_adiantum.c,v 1.2 2020/06/30 04:15:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -357,7 +357,7 @@ ATF_TC_BODY(cgd_adiantum, tc)
 		/* read the ciphertext out from the underlying file */
 		RL(nread = pread(dkfd, buf, C[i].secsize,
 			C[i].blkno * C[i].secsize));
-		if (nread != C[i].secsize) {
+		if ((size_t)nread != C[i].secsize) {
 			atf_tc_fail_nonfatal("truncated read: %zd != %u",
 			nread, C[i].secsize);
 			continue;
@@ -375,7 +375,7 @@ ATF_TC_BODY(cgd_adiantum, tc)
 		RL(nread = rump_sys_pread(cgdfd, buf, C[i].secsize,
 			C[i].blkno * C[i].secsize));
 		RL(unconfigure_cgd(cgdfd));
-		if (nread != C[i].secsize) {
+		if ((size_t)nread != C[i].secsize) {
 			atf_tc_fail_nonfatal("truncated read: %zd != %u",
 			nread, C[i].secsize);
 			continue;



CVS commit: src/tests/dev/cgd

2020-06-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 30 04:15:46 UTC 2020

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

Log Message:
Fix sign-compare issue on 32-bit systems.

Built fine on amd64, where all unsigned values are representable in
ssize_t, but I didn't try building on i386, where they're not.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/dev/cgd/t_cgd_adiantum.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/scsipi/libscsitest

2020-06-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun  1 14:42:53 UTC 2020

Modified Files:
src/tests/dev/scsipi/libscsitest: Makefile

Log Message:
LIBISPRIVATE=yes


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/scsipi/libscsitest/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/scsipi/libscsitest/Makefile
diff -u src/tests/dev/scsipi/libscsitest/Makefile:1.3 src/tests/dev/scsipi/libscsitest/Makefile:1.4
--- src/tests/dev/scsipi/libscsitest/Makefile:1.3	Sat Apr 26 14:53:21 2014
+++ src/tests/dev/scsipi/libscsitest/Makefile	Mon Jun  1 10:42:53 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2014/04/26 18:53:21 christos Exp $
+#	$NetBSD: Makefile,v 1.4 2020/06/01 14:42:53 christos Exp $
 #
 
 .include 
@@ -7,7 +7,7 @@ RUMPTOP= ${NETBSDSRCDIR}/sys/rump
 
 LIB=	rumpdev_scsitest
 IOCONF=	SCSITEST.ioconf
-LIBISPRIVATE= #defined
+LIBISPRIVATE=	yes
 
 SRCS=	scsitest.c
 SRCS+=	scsitest_component.c



CVS commit: src/tests/dev/scsipi/libscsitest

2020-06-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun  1 14:42:53 UTC 2020

Modified Files:
src/tests/dev/scsipi/libscsitest: Makefile

Log Message:
LIBISPRIVATE=yes


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

2020-06-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun  1 14:41:25 UTC 2020

Modified Files:
src/tests/dev/usb/libhid: Makefile

Log Message:
Set LIBISPRIVATE=yes


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

2020-06-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun  1 14:41:25 UTC 2020

Modified Files:
src/tests/dev/usb/libhid: Makefile

Log Message:
Set LIBISPRIVATE=yes


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/usb/libhid/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/usb/libhid/Makefile
diff -u src/tests/dev/usb/libhid/Makefile:1.2 src/tests/dev/usb/libhid/Makefile:1.3
--- src/tests/dev/usb/libhid/Makefile:1.2	Sun Dec 10 15:38:14 2017
+++ src/tests/dev/usb/libhid/Makefile	Mon Jun  1 10:41:25 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2017/12/10 20:38:14 bouyer Exp $
+#	$NetBSD: Makefile,v 1.3 2020/06/01 14:41:25 christos Exp $
 #
 
 .include 
@@ -7,7 +7,7 @@ RUMPTOP= ${NETBSDSRCDIR}/sys/rump
 .PATH:	${.CURDIR}/../../../../sys/dev/hid
 
 LIB=	rumpdev_hid
-LIBISPRIVATE= #defined
+LIBISPRIVATE= yes
 
 SRCS=	hid.c
 



CVS commit: src/tests/dev/audio

2020-04-30 Thread Tetsuya Isaki
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

2020-04-30 Thread Tetsuya Isaki
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

2020-03-26 Thread Tetsuya Isaki
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

2020-03-26 Thread Tetsuya Isaki
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

2020-03-26 Thread Tetsuya Isaki
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

2020-03-26 Thread Tetsuya Isaki
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

2020-03-25 Thread Tetsuya Isaki
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

2020-03-25 Thread Tetsuya Isaki
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/sysmon

2020-03-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 21 04:50:22 UTC 2020

Modified Files:
src/tests/dev/sysmon: t_swsensor.sh

Log Message:
These test cases should now succeed, after fixing rump kernel to handle
modules that establish their sysctls via SYSCTL_SETUP()


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/dev/sysmon/t_swsensor.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/sysmon/t_swsensor.sh
diff -u src/tests/dev/sysmon/t_swsensor.sh:1.10 src/tests/dev/sysmon/t_swsensor.sh:1.11
--- src/tests/dev/sysmon/t_swsensor.sh:1.10	Thu Mar 19 20:10:49 2020
+++ src/tests/dev/sysmon/t_swsensor.sh	Sat Mar 21 04:50:21 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.10 2020/03/19 20:10:49 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.11 2020/03/21 04:50:21 pgoyette Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -145,7 +145,6 @@ common_body() {
 	# Step 3 - verify that changes in sensor value are seen
 	rump.sysctl -w hw.swsensor.cur_value=$(( $2 + 1 ))
 	if [ $( get_sensor_key cur-value ) -ne $(( $2 + 1 )) ] ; then
-		atf_expect_fail "PR kern/55088"
 		atf_fail "3: Value not updated"
 	fi
 



CVS commit: src/tests/dev/sysmon

2020-03-20 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar 21 04:50:22 UTC 2020

Modified Files:
src/tests/dev/sysmon: t_swsensor.sh

Log Message:
These test cases should now succeed, after fixing rump kernel to handle
modules that establish their sysctls via SYSCTL_SETUP()


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/dev/sysmon/t_swsensor.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/sysmon

2020-03-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 19 20:10:49 UTC 2020

Modified Files:
src/tests/dev/sysmon: t_swsensor.sh

Log Message:
Mark the swsensor tests "expected failure" since the rump world doesn't
seem to handle the SYSCTL_SETUP stuff.  PR kern/55088


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/dev/sysmon/t_swsensor.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/sysmon

2020-03-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 19 20:10:49 UTC 2020

Modified Files:
src/tests/dev/sysmon: t_swsensor.sh

Log Message:
Mark the swsensor tests "expected failure" since the rump world doesn't
seem to handle the SYSCTL_SETUP stuff.  PR kern/55088


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/dev/sysmon/t_swsensor.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/sysmon/t_swsensor.sh
diff -u src/tests/dev/sysmon/t_swsensor.sh:1.9 src/tests/dev/sysmon/t_swsensor.sh:1.10
--- src/tests/dev/sysmon/t_swsensor.sh:1.9	Thu Apr 23 23:23:28 2015
+++ src/tests/dev/sysmon/t_swsensor.sh	Thu Mar 19 20:10:49 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_swsensor.sh,v 1.9 2015/04/23 23:23:28 pgoyette Exp $
+# $NetBSD: t_swsensor.sh,v 1.10 2020/03/19 20:10:49 pgoyette Exp $
 
 get_sensor_info() {
 	rump.envstat -x | \
@@ -145,6 +145,7 @@ common_body() {
 	# Step 3 - verify that changes in sensor value are seen
 	rump.sysctl -w hw.swsensor.cur_value=$(( $2 + 1 ))
 	if [ $( get_sensor_key cur-value ) -ne $(( $2 + 1 )) ] ; then
+		atf_expect_fail "PR kern/55088"
 		atf_fail "3: Value not updated"
 	fi
 



CVS commit: src/tests/dev/audio

2020-03-04 Thread Tetsuya Isaki
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

2020-03-04 Thread Tetsuya Isaki
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

2020-03-01 Thread Tetsuya Isaki
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

2020-03-01 Thread Tetsuya Isaki
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/usb

2020-03-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  1 20:19:55 UTC 2020

Modified Files:
src/tests/dev/usb/t_hid: Makefile
Added Files:
src/tests/dev/usb: Makefile.inc

Log Message:
fix build by adding a Makefile.inc that chains up.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/dev/usb/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/usb/t_hid/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/usb/t_hid/Makefile
diff -u src/tests/dev/usb/t_hid/Makefile:1.4 src/tests/dev/usb/t_hid/Makefile:1.5
--- src/tests/dev/usb/t_hid/Makefile:1.4	Sun Mar  1 13:08:13 2020
+++ src/tests/dev/usb/t_hid/Makefile	Sun Mar  1 15:19:54 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2020/03/01 18:08:13 christos Exp $
+#	$NetBSD: Makefile,v 1.5 2020/03/01 20:19:54 christos Exp $
 #
 
 NOMAN=
@@ -18,8 +18,8 @@ LIBHIDDIR!= cd ${.CURDIR}/../libhid && $
 LDFLAGS+= -L${LIBHIDDIR}
 LDADD+= -Wl,--whole-archive -lrumpdev_hid -Wl,--no-whole-archive
 DPADD+= ${LIBHIDDIR}/librumpdev_hid.a
-DPADD+= ${ATF_C}
+DPADD+= ${ATF_C} 
 
-LDADD+= -latf-c ${LIBRUMPBASE}
+LDADD+= ${LIBRUMPBASE} -latf-c
 
 .include 

Added files:

Index: src/tests/dev/usb/Makefile.inc
diff -u /dev/null src/tests/dev/usb/Makefile.inc:1.1
--- /dev/null	Sun Mar  1 15:19:55 2020
+++ src/tests/dev/usb/Makefile.inc	Sun Mar  1 15:19:54 2020
@@ -0,0 +1,2 @@
+# $NetBSD: Makefile.inc,v 1.1 2020/03/01 20:19:54 christos Exp $
+.include "../Makefile.inc"



CVS commit: src/tests/dev/usb

2020-03-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  1 20:19:55 UTC 2020

Modified Files:
src/tests/dev/usb/t_hid: Makefile
Added Files:
src/tests/dev/usb: Makefile.inc

Log Message:
fix build by adding a Makefile.inc that chains up.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/dev/usb/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/usb/t_hid/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/cgd

2020-03-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  1 17:06:26 UTC 2020

Modified Files:
src/tests/dev/cgd: Makefile

Log Message:
librump depends on vfs so add a dependency on for sun2.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/dev/cgd/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/cgd/Makefile
diff -u src/tests/dev/cgd/Makefile:1.8 src/tests/dev/cgd/Makefile:1.9
--- src/tests/dev/cgd/Makefile:1.8	Sun May 21 11:28:42 2017
+++ src/tests/dev/cgd/Makefile	Sun Mar  1 12:06:26 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2017/05/21 15:28:42 riastradh Exp $
+#	$NetBSD: Makefile,v 1.9 2020/03/01 17:06:26 christos Exp $
 #
 
 .include 
@@ -15,7 +15,7 @@ TESTS_C=	t_cgd_3des t_cgd_aes t_cgd_blow
 WARNS=	4
 CPPFLAGS+=	-D_KERNTYPES
 LDADD+=	-lrumpdev -lrumpdev_disk -lrumpdev_cgd -lrumpkern_crypto -lrumpvfs
-LDADD+=	-lrump
+LDADD+=	-lrump -lrumpvfs
 LDADD+=	-lrumpuser
 LDADD+=	-lrump -lutil
 LDADD+=	-lpthread



CVS commit: src/tests/dev/cgd

2020-03-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  1 17:06:26 UTC 2020

Modified Files:
src/tests/dev/cgd: Makefile

Log Message:
librump depends on vfs so add a dependency on for sun2.


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

2020-02-21 Thread Tetsuya Isaki
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

2020-02-21 Thread Tetsuya Isaki
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

2020-02-18 Thread Tetsuya Isaki
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

2020-02-18 Thread Tetsuya Isaki
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

2020-02-14 Thread Tetsuya Isaki
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

2020-02-14 Thread Tetsuya Isaki
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

2020-02-13 Thread Tobias Nygren
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

2020-02-13 Thread Tobias Nygren
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

2020-02-11 Thread Martin Husemann
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

2020-02-11 Thread Martin Husemann
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/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.



CVS commit: src/tests/dev/cgd

2019-04-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Apr 10 06:13:21 UTC 2019

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

Log Message:
Fix quoting (quotes really do not nest...) and remove a bunch of it
that is harmless, but also pointless (in sh, quotes do not make strings,
everything is a string, rather they hide characters which would have
some other meaning unquoted (like spaces) - quotes are not needed around
strings like "descr" so remove them...

Be more consistent with line wrap style, try to avoid wrapping in the
middle of a (sh) word where possible.   Avoid \ use when it is not needed.

Un-KNF (C style) - sh has no declarations, there is no need to leave
blank lines at the head of a function to mark the end of the declarations.

This should be a NFC - but the quoting really was broken before, just
was probably harmless breakage.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/dev/cgd/t_cgd.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.12 src/tests/dev/cgd/t_cgd.sh:1.13
--- src/tests/dev/cgd/t_cgd.sh:1.12	Wed Apr 10 06:09:39 2019
+++ src/tests/dev/cgd/t_cgd.sh	Wed Apr 10 06:13:21 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgd.sh,v 1.12 2019/04/10 06:09:39 kre Exp $
+#	$NetBSD: t_cgd.sh,v 1.13 2019/04/10 06:13:21 kre Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -34,13 +34,12 @@ atf_test_case basic cleanup
 basic_head()
 {
 
-	atf_set "descr" "Tests that encrypt/decrypt works"
-	atf_set "require.progs" "rump_server"
+	atf_set descr "Tests that encrypt/decrypt works"
+	atf_set require.progs rump_server
 }
 
 basic_body()
 {
-
 	d=$(atf_get_srcdir)
 	atf_check -s exit:0 \
 	${cgdserver} -d key=/dev/dk,hostpath=dk.img,size=1m unix://csock
@@ -57,7 +56,6 @@ basic_body()
 
 basic_cleanup()
 {
-
 	env RUMP_SERVER=unix://csock rump.halt || true
 }
 
@@ -65,28 +63,27 @@ atf_test_case wrongpass cleanup
 wrongpass_head()
 {
 
-	atf_set "descr" "Tests that wrong password does not give original " \
-	"plaintext"
-	atf_set "require.progs" "rump_server"
+	atf_set descr \
+	"Tests that wrong password does not give original plaintext"
+	atf_set require.progs rump_server
 }
 
 wrongpass_body()
 {
-
 	d=$(atf_get_srcdir)
 	atf_check -s exit:0 \
 	${cgdserver} -d key=/dev/dk,hostpath=dk.img,size=1m unix://csock
 
 	export RUMP_SERVER=unix://csock
-	atf_check -s exit:0 -x "echo 12345 | \
-	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
+	atf_check -s exit:0 -x \
+	"echo 12345 | rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
 	atf_check -s exit:0 -e ignore -x \
 	"dd if=${d}/t_cgd | rump.dd of=${rawcgd} count=2"
 
 	# unconfig and reconfig cgd
 	atf_check -s exit:0 rump.cgdconfig -u cgd0
-	atf_check -s exit:0 -x "echo 54321 | \
-	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
+	atf_check -s exit:0 -x \
+	"echo 54321 | rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
 
 	atf_check -s exit:0 -e ignore dd if=${d}/t_cgd of=testfile count=2
 	atf_check -s exit:0 -e ignore -o not-file:testfile \
@@ -95,7 +92,6 @@ wrongpass_body()
 
 wrongpass_cleanup()
 {
-
 	env RUMP_SERVER=unix://csock rump.halt || true
 }
 
@@ -103,9 +99,8 @@ wrongpass_cleanup()
 atf_test_case unaligned_write cleanup
 unaligned_write_head()
 {
-
-	atf_set "descr" "Attempt unaligned writes to a raw cgd device"
-	atf_set "require.progs" "rump_server"
+	atf_set descr "Attempt unaligned writes to a raw cgd device"
+	atf_set require.progs rump_server
 }
 
 unaligned_write_body()
@@ -115,8 +110,8 @@ unaligned_write_body()
 	${cgdserver} -d key=/dev/dk,hostpath=dk.img,size=1m unix://csock
 
 	export RUMP_SERVER=unix://csock
-	atf_check -s exit:0 -x "echo 12345 | \
-	rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
+	atf_check -s exit:0 -x \
+	"echo 12345 | rump.cgdconfig -p cgd0 /dev/dk ${d}/paramsfile"
 
 	# Check that cgd rejects writes of totally bogus lengths.
 	atf_check -s not-exit:0 -e ignore -x \
@@ -133,8 +128,8 @@ unaligned_write_body()
 	# packetizing the input on bogus boundaries and using the
 	# bizarre behaviour of `bs=N' in dd.
 	atf_check -s not-exit:0 -e ignore -x \
-	"(echo -n x && sleep 1 && head -c 511 /dev/null ; \
-		env RUMP_SERVER=unix://csock rump.halt || true ; \
+	eval "${name}_cleanup() {
+		rump.cgdconfig -u cgd0 2>/dev/null
+		env RUMP_SERVER=unix://csock rump.halt || true
 	}"
 }
 
@@ -191,7 +186,6 @@ test_case_vmeth_failure mbr
 
 atf_init_test_cases()
 {
-
 	atf_add_test_case basic
 	atf_add_test_case wrongpass
 	atf_add_test_case unaligned_write



CVS commit: src/tests/dev/cgd

2019-04-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Apr 10 06:13:21 UTC 2019

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

Log Message:
Fix quoting (quotes really do not nest...) and remove a bunch of it
that is harmless, but also pointless (in sh, quotes do not make strings,
everything is a string, rather they hide characters which would have
some other meaning unquoted (like spaces) - quotes are not needed around
strings like "descr" so remove them...

Be more consistent with line wrap style, try to avoid wrapping in the
middle of a (sh) word where possible.   Avoid \ use when it is not needed.

Un-KNF (C style) - sh has no declarations, there is no need to leave
blank lines at the head of a function to mark the end of the declarations.

This should be a NFC - but the quoting really was broken before, just
was probably harmless breakage.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/dev/cgd/t_cgd.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/scsipi/libscsitest

2019-02-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Feb  6 09:16:49 UTC 2019

Modified Files:
src/tests/dev/scsipi/libscsitest: scsitest.c

Log Message:
use strncpy() into a buffer that may not be nul terminated.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/scsipi/libscsitest/scsitest.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/scsipi/libscsitest/scsitest.c
diff -u src/tests/dev/scsipi/libscsitest/scsitest.c:1.2 src/tests/dev/scsipi/libscsitest/scsitest.c:1.3
--- src/tests/dev/scsipi/libscsitest/scsitest.c:1.2	Fri Apr 25 00:24:39 2014
+++ src/tests/dev/scsipi/libscsitest/scsitest.c	Wed Feb  6 09:16:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsitest.c,v 1.2 2014/04/25 00:24:39 pooka Exp $	*/
+/*	$NetBSD: scsitest.c,v 1.3 2019/02/06 09:16:49 mrg Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsitest.c,v 1.2 2014/04/25 00:24:39 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsitest.c,v 1.3 2019/02/06 09:16:49 mrg Exp $");
 
 #include 
 #include 
@@ -123,9 +123,9 @@ scsitest_request(struct scsipi_channel *
 		memset(inqbuf, 0, sizeof(*inqbuf));
 		inqbuf->device = T_CDROM;
 		inqbuf->dev_qual2 = SID_REMOVABLE;
-		strcpy(inqbuf->vendor, "RUMPHOBO");
-		strcpy(inqbuf->product, "It's a LIE");
-		strcpy(inqbuf->revision, "0.00");
+		strncpy(inqbuf->vendor, "RUMPHOBO", sizeof inqbuf->vendor);
+		strncpy(inqbuf->product, "It's a LIE", sizeof inqbuf->product);
+		strncpy(inqbuf->revision, "0.00", sizeof inqbuf->revision);
 		break;
 	}
 	case READ_CD_CAPACITY: {



CVS commit: src/tests/dev/scsipi/libscsitest

2019-02-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Feb  6 09:16:49 UTC 2019

Modified Files:
src/tests/dev/scsipi/libscsitest: scsitest.c

Log Message:
use strncpy() into a buffer that may not be nul terminated.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/scsipi/libscsitest/scsitest.c

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.


CVS commit: src/tests/dev/fss

2017-03-15 Thread Martin Husemann
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.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.2 src/tests/dev/fss/t_fss.sh:1.3
--- src/tests/dev/fss/t_fss.sh:1.2	Fri Jul 29 20:27:37 2016
+++ src/tests/dev/fss/t_fss.sh	Wed Mar 15 10:53:15 2017
@@ -1,4 +1,4 @@
-# $NetBSD: t_fss.sh,v 1.2 2016/07/29 20:27:37 pgoyette Exp $
+# $NetBSD: t_fss.sh,v 1.3 2017/03/15 10:53:15 martin Exp $
 #
 # Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -28,12 +28,20 @@
 # Verify basic operation of fss(4) file system snapshot device
 #
 
+vnddev=vnd0
+rawpart=$( sysctl -n kern.rawpartition | tr '01234' 'abcde' )
+vnd=/dev/${vnddev}${rawpart}
+
 orig_data="Original data"
 repl_data="Replacement data"
 
 atf_test_case basic cleanup
 basic_body() {
 
+# verify fss is available (or loadable as a module)
+
+	fssconfig -l /dev/fss0 > /dev/null || atf_skip "FSS not available"
+
 # create of mount-points for the file system and snapshot
 
 	mkdir ./m1
@@ -43,9 +51,9 @@ basic_body() {
 # and mount it
 
 	dd if=/dev/zero of=./image bs=32k count=64
-	vndconfig -c vnd0 ./image
-	newfs /dev/vnd0a
-	mount /dev/vnd0a ./m1
+	vndconfig -c ${vnddev} ./image
+	newfs -I ${vnd}
+	mount ${vnd} ./m1
 
 	echo "${orig_data}" > ./m1/text
 
@@ -62,20 +70,14 @@ basic_body() {
 
 	read test_data < ./m2/text
 	atf_check_equal "${orig_data}" "${test_data}"
-
-# Unmount our temporary stuff
-
-	umount /dev/fss0	|| true
-	fssconfig -u fss0	|| true
-	umount /dev/vnd0a	|| true
-	vndconfig -u vnd0	|| true
 }
 
 basic_cleanup() {
-	umount /dev/vnd0a	|| true
+# Unmount our temporary stuff
+	umount ${vnd}		|| true
 	fssconfig -u fss0	|| true
 	umount /dev/fss0	|| true
-	vndconfig -u vnd0	|| true
+	vndconfig -u ${vnddev}	|| true
 }
 
 atf_init_test_cases()



CVS commit: src/tests/dev/fss

2017-03-15 Thread Martin Husemann
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.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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

2017-01-26 Thread Nathanial Sloss
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]
-M2/+>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\PHC>;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

2017-01-26 Thread Nathanial Sloss
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

2016-12-11 Thread Nathanial Sloss
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

2016-12-11 Thread Nathanial Sloss
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/cgd

2016-12-10 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sun Dec 11 00:23:44 UTC 2016

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

Log Message:
AES XTS unit tests should now pass.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/tests/dev/cgd/t_cgd_aes.c:1.5
--- src/tests/dev/cgd/t_cgd_aes.c:1.4	Thu Nov 24 22:42:16 2016
+++ src/tests/dev/cgd/t_cgd_aes.c	Sun Dec 11 00:23:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_aes.c,v 1.4 2016/11/24 22:42:16 alnsn Exp $	*/
+/*	$NetBSD: t_cgd_aes.c,v 1.5 2016/12/11 00:23:44 alnsn Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@@ -3511,8 +3511,6 @@ ATF_TC_BODY(cgd_aes_xts_256, tc)
 	const size_t dksize = 256 * SECSIZE; /* Last blkno is 0xff. */
 	int dkfd, cgdfd;
 
-	atf_tc_expect_fail("aes-xts implementation not committed yet");
-
 	rump_init();
 
 	RL(dkfd = open_disk(dkpath, imgpath, dksize));
@@ -3565,8 +3563,6 @@ ATF_TC_BODY(cgd_aes_xts_512, tc)
 	const size_t dksize = 65536 * SECSIZE; /* Last blkno is 0x. */
 	int dkfd, cgdfd;
 
-	atf_tc_expect_fail("aes-xts implementation not committed yet");
-
 	rump_init();
 
 	RL(dkfd = open_disk(dkpath, imgpath, dksize));



CVS commit: src/tests/dev/cgd

2016-12-10 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sun Dec 11 00:23:44 UTC 2016

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

Log Message:
AES XTS unit tests should now pass.


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

2016-11-24 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Thu Nov 24 22:42:16 UTC 2016

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

Log Message:
Switch to CHECK_LIBC for writing.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 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.3 src/tests/dev/cgd/t_cgd_aes.c:1.4
--- src/tests/dev/cgd/t_cgd_aes.c:1.3	Wed Nov  9 22:01:15 2016
+++ src/tests/dev/cgd/t_cgd_aes.c	Thu Nov 24 22:42:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_cgd_aes.c,v 1.3 2016/11/09 22:01:15 alnsn Exp $	*/
+/*	$NetBSD: t_cgd_aes.c,v 1.4 2016/11/24 22:42:16 alnsn Exp $	*/
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
  * Copyright (c) 2007 The Institute of Electrical and Electronics Engineers, Inc
@@ -3156,12 +3156,18 @@ unconfigure_cgd(int fd)
 static int
 write_testvec(int cgdfd, const struct testvec *tv)
 {
+	ssize_t written;
 
 	if (rump_sys_lseek(cgdfd, tv->blkno * SECSIZE, SEEK_SET) < 0)
 		return -1;
 
-	if (rump_sys_write(cgdfd, tv->ptxt, SECSIZE) != SECSIZE)
+	written = rump_sys_write(cgdfd, tv->ptxt, SECSIZE);
+	if (written < 0)
 		return -1;
+	if (written != SECSIZE) {
+		errno = EDOM; /* Something distinct. */
+		return -1;
+	}
 
 	return 0;
 }
@@ -3232,10 +3238,10 @@ ATF_TC_BODY(cgd_aes_cbc_128_encblkno1, t
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1",
 	aes_cbc_128_key, sizeof(aes_cbc_128_key)));
 
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_1_vectors[0]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_1_vectors[1]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_1_vectors[2]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_1_vectors[3]), 0);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_1_vectors[0]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_1_vectors[1]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_1_vectors[2]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_1_vectors[3]), -1);
 
 	RL(unconfigure_cgd(cgdfd));
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1",
@@ -3279,10 +3285,10 @@ ATF_TC_BODY(cgd_aes_cbc_128_encblkno8, t
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8",
 	aes_cbc_128_key, sizeof(aes_cbc_128_key)));
 
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_8_vectors[0]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_8_vectors[1]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_8_vectors[2]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_128_8_vectors[3]), 0);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_8_vectors[0]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_8_vectors[1]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_8_vectors[2]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_128_8_vectors[3]), -1);
 
 	RL(unconfigure_cgd(cgdfd));
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8",
@@ -3326,10 +3332,10 @@ ATF_TC_BODY(cgd_aes_cbc_192_encblkno1, t
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1",
 	aes_cbc_192_key, sizeof(aes_cbc_192_key)));
 
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_1_vectors[0]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_1_vectors[1]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_1_vectors[2]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_1_vectors[3]), 0);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_1_vectors[0]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_1_vectors[1]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_1_vectors[2]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_1_vectors[3]), -1);
 
 	RL(unconfigure_cgd(cgdfd));
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1",
@@ -3373,10 +3379,10 @@ ATF_TC_BODY(cgd_aes_cbc_192_encblkno8, t
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8",
 	aes_cbc_192_key, sizeof(aes_cbc_192_key)));
 
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_8_vectors[0]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_8_vectors[1]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_8_vectors[2]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_192_8_vectors[3]), 0);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_8_vectors[0]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_8_vectors[1]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_8_vectors[2]), -1);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_192_8_vectors[3]), -1);
 
 	RL(unconfigure_cgd(cgdfd));
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno8",
@@ -3420,10 +3426,10 @@ ATF_TC_BODY(cgd_aes_cbc_256_encblkno1, t
 	RL(configure_cgd(cgdfd, dkpath, "aes-cbc", "encblkno1",
 	aes_cbc_256_key, sizeof(aes_cbc_256_key)));
 
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_256_1_vectors[0]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_256_1_vectors[1]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_256_1_vectors[2]), 0);
-	ATF_CHECK_EQ(write_testvec(cgdfd, _cbc_256_1_vectors[3]), 0);
+	CHECK_LIBC(write_testvec(cgdfd, _cbc_256_1_vectors[0]), -1);
+	

CVS commit: src/tests/dev/cgd

2016-11-24 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Thu Nov 24 22:42:16 UTC 2016

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

Log Message:
Switch to CHECK_LIBC for writing.


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

2016-11-09 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Wed Nov  9 22:01:15 UTC 2016

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

Log Message:
Add aes-cbc tests.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 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.



  1   2   3   >