Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/dev/audio Use exact match to search testname.
details: https://anonhg.NetBSD.org/src/rev/7e3c35b4355f
branches: trunk
changeset: 1008515:7e3c35b4355f
user: isaki <isaki%NetBSD.org@localhost>
date: Wed Mar 25 13:07:04 2020 +0000
description:
Use exact match to search testname.
This didn't affect test results.
diffstat:
tests/dev/audio/audiotest.c | 34 ++++++++++++++++++++++++++++------
tests/dev/audio/t_audio.awk | 4 ++--
2 files changed, 30 insertions(+), 8 deletions(-)
diffs (115 lines):
diff -r 6b437f843f04 -r 7e3c35b4355f tests/dev/audio/audiotest.c
--- a/tests/dev/audio/audiotest.c Wed Mar 25 06:17:23 2020 +0000
+++ b/tests/dev/audio/audiotest.c Wed Mar 25 13:07:04 2020 +0000
@@ -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 <sys/cdefs.h>
-__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 <errno.h>
#include <fcntl.h>
@@ -75,6 +75,7 @@
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 unit;
bool use_rump;
bool use_pad;
+bool exact_match;
int padfd;
int maxfd;
pthread_t th;
@@ -186,6 +188,8 @@
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 @@
cmd = CMD_TEST;
use_pad = false;
padfd = -1;
-
- while ((c = getopt(argc, argv, "AadlpRu:")) != -1) {
+ exact_match = false;
+
+ while ((c = getopt(argc, argv, "AadelpRu:")) != -1) {
switch (c) {
case 'A':
opt_atf = true;
@@ -258,6 +263,9 @@
case 'd':
debug++;
break;
+ case 'e':
+ exact_match = true;
+ break;
case 'l':
cmd = CMD_LIST;
break;
@@ -305,8 +313,7 @@
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 @@
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
diff -r 6b437f843f04 -r 7e3c35b4355f tests/dev/audio/t_audio.awk
--- a/tests/dev/audio/t_audio.awk Wed Mar 25 06:17:23 2020 +0000
+++ b/tests/dev/audio/t_audio.awk Wed Mar 25 13:07:04 2020 +0000
@@ -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 @@
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 '^\\['`"
Home |
Main Index |
Thread Index |
Old Index