summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qaudio.py
diff options
context:
space:
mode:
authorHector Fernandez <hector@iatec.biz>2020-07-06 16:01:08 +0200
committerHector Fernandez <hector@iatec.biz>2020-07-06 16:01:08 +0200
commitcd3c8dd78e3bcdd442967583e3814db3701871c0 (patch)
tree48db9571f0c6cf518b6f11dd0c8b238897a0f458 /test-cli/test/tests/qaudio.py
parent0e8e3ecd4b9be71c41008b95950d089819622dff (diff)
downloadboard-cd3c8dd78e3bcdd442967583e3814db3701871c0.zip
board-cd3c8dd78e3bcdd442967583e3814db3701871c0.tar.gz
board-cd3c8dd78e3bcdd442967583e3814db3701871c0.tar.bz2
Solved minor errors with audio and usbloop tests.
Diffstat (limited to 'test-cli/test/tests/qaudio.py')
-rw-r--r--test-cli/test/tests/qaudio.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/test-cli/test/tests/qaudio.py b/test-cli/test/tests/qaudio.py
index acad4a9..f7ae33c 100644
--- a/test-cli/test/tests/qaudio.py
+++ b/test-cli/test/tests/qaudio.py
@@ -2,6 +2,7 @@ import unittest
import sh
import wave
import contextlib
+import time
def calc_audio_duration(fname):
@@ -27,6 +28,8 @@ class Qaudio(unittest.TestCase):
def execute(self):
# analize audio file
recordtime = calc_audio_duration("/var/lib/hwtest-files/dtmf-13579.wav") + 0.15
+ # wait time before playing
+ time.sleep(1)
# play and record
p1 = sh.aplay("/var/lib/hwtest-files/dtmf-13579.wav", _bg=True)
p2 = sh.arecord("-r", 8000, "-d", recordtime, "/tmp/station/recorded.wav", _bg=True)
@@ -42,8 +45,8 @@ class Qaudio(unittest.TestCase):
self.__dtmf_secuence_result.append(li.split(" ")[1])
# compare original and processed dtmf sequence
if len(self.__dtmf_secuence) == len(self.__dtmf_secuence_result):
- for i in range(len(self.__dtmf_secuence)):
- if self.__dtmf_secuence[i] != self.__dtmf_secuence_result[i]:
+ for a, b in zip(self.__dtmf_secuence, self.__dtmf_secuence_result):
+ if a != b:
self.fail("failed: sent and received DTMF sequence don't match.")
else:
self.fail("failed: received DTMF sequence is shorter than expected.")