aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authordvdli <70133153+dvdli@users.noreply.github.com>2020-12-04 09:54:26 +0800
committerGitHub <noreply@github.com>2020-12-04 09:54:26 +0800
commit649c6908706677fab68e3845d5225ede4f52b4fe (patch)
tree8e902ae95c75c7a83428db4f16f4224c1ce2442b /README.md
parent40867609e738919872c88b7716b17c30d96211a4 (diff)
parent69d41f144ad82d652f148c303a168cd07d222d41 (diff)
Merge pull request #191 from dvdli/tinyalsa-tests
Tests for libtinyalsa
Diffstat (limited to 'README.md')
-rw-r--r--README.md38
1 files changed, 38 insertions, 0 deletions
diff --git a/README.md b/README.md
index 5e8fdb6..ed4203a 100644
--- a/README.md
+++ b/README.md
@@ -63,3 +63,41 @@ man libtinyalsa-pcm
man libtinyalsa-mixer
```
+### Test
+
+To test libtinyalsa, please follow the instructions,
+
+#### Setup Bazel build environment
+
+Visit [here](https://docs.bazel.build/versions/3.7.0/install.html) to get more info to setup Bazel environment.
+
+#### Insert loopback devices
+
+The test program does pcm_* operations on loopback devices. You have to insert loopback devices after your system boots up.
+
+```
+sudo modprobe snd-aloop
+sudo chmod 777 /dev/snd/*
+```
+
+#### Run test program
+
+```
+bazel test //:tinyalsa_tests --test_output=all
+```
+
+The default playback device is hw:2,0 and the default capture device is hw:2,1. If your loopback devices are not hw:2,0 and hw:2,1, you can specify the loopback device.
+
+```
+bazel test //:tinyalsa_tests --test_output=all \
+ --copt=-DTEST_LOOPBACK_CARD=[loopback card] \
+ --copt=-DTEST_LOOPBACK_PLAYBACK_DEVICE=[loopback playback device] \
+ --copt=-DTEST_LOOPBACK_CAPTURE_DEVICE=[loopback capture device]
+```
+
+#### Generate coverage report
+
+```
+bazel coverage //:tinyalsa_tests --combined_report=lcov --test_output=all
+genhtml bazel-out/_coverage/_coverage_report.dat -o tinyalsa_tests_coverage
+```