summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2021-02-19 10:32:36 -0800
committerDmitry Shmidt <dimitrysh@google.com>2021-02-19 10:34:50 -0800
commit8b8f672db0e703f16b65d7e3c6d57410c50ba5eb (patch)
tree914da16e3bd92296b9f7d69392f9420b46bc884f /tests
parentb2456d60df6d9b2e5427bcc30d0ffecdaf4f37b1 (diff)
downloadextras-8b8f672db0e703f16b65d7e3c6d57410c50ba5eb.tar.gz
tests: Use libtinyalsa as not a part of VNDK
Bug: 168890623 Test: make pcmtest -j24 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com> Change-Id: Ib80abfbf08173165e520e611a81ac1e3e34dbf20
Diffstat (limited to 'tests')
-rw-r--r--tests/audio/alsa/Android.bp2
-rw-r--r--tests/audio/alsa/pcmtest.cpp22
2 files changed, 22 insertions, 2 deletions
diff --git a/tests/audio/alsa/Android.bp b/tests/audio/alsa/Android.bp
index 60dbe87e..a5393f1b 100644
--- a/tests/audio/alsa/Android.bp
+++ b/tests/audio/alsa/Android.bp
@@ -27,5 +27,5 @@ cc_test {
"liblog",
"libtinyalsa",
],
- static_libs: ["libtestUtil"],
+ vendor: true,
}
diff --git a/tests/audio/alsa/pcmtest.cpp b/tests/audio/alsa/pcmtest.cpp
index 090334e1..a6e63ddd 100644
--- a/tests/audio/alsa/pcmtest.cpp
+++ b/tests/audio/alsa/pcmtest.cpp
@@ -29,12 +29,17 @@
#define LOG_TAG "pcmtest"
#include <utils/Log.h>
-#include <testUtil.h>
#define PCM_PREFIX "pcm"
#define MIXER_PREFIX "control"
#define TIMER_PREFIX "timer"
+#define MAXSTR 200
+#define testPrintI(...) \
+ do { \
+ testPrint(stdout, __VA_ARGS__); \
+ } while (0)
+
const char kSoundDir[] = "/dev/snd";
typedef struct PCM_NODE {
@@ -50,6 +55,21 @@ static unsigned int cards;
static unsigned int mixers;
static unsigned int timers;
+void testPrint(FILE* stream, const char* fmt, ...) {
+ char line[MAXSTR];
+ va_list args;
+
+ va_start(args, fmt);
+ vsnprintf(line, sizeof(line), fmt, args);
+ if (stream == stderr) {
+ ALOG(LOG_ERROR, LOG_TAG, "%s", line);
+ } else {
+ ALOG(LOG_INFO, LOG_TAG, "%s", line);
+ }
+ vfprintf(stream, fmt, args);
+ fputc('\n', stream);
+}
+
unsigned int getPcmNodes(void)
{
DIR *d;