From cd3c8dd78e3bcdd442967583e3814db3701871c0 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Mon, 6 Jul 2020 16:01:08 +0200 Subject: Solved minor errors with audio and usbloop tests. --- test-cli/test/tests/qaudio.py | 7 +++++-- test-cli/test/tests/qusbdual.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'test-cli/test/tests') 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.") diff --git a/test-cli/test/tests/qusbdual.py b/test-cli/test/tests/qusbdual.py index ad95b84..842d514 100644 --- a/test-cli/test/tests/qusbdual.py +++ b/test-cli/test/tests/qusbdual.py @@ -60,7 +60,7 @@ class Qusbdual(unittest.TestCase): self.fail("failed: Unable to calculate MD5 of the copied file.") newmd5 = p.stdout.decode().split(" ")[0] with open('/tmp/station/hdd_gadget/usb-test.bin.md5', 'r') as outfile: - oldmd5 = outfile.read() + oldmd5 = outfile.read().rstrip("\n") outfile.close() if newmd5 != oldmd5: sh.umount("/tmp/station/hdd_gadget") -- cgit v1.1