From 9f89f02e7d6e2a3208b0b85d2567ebffd2515e09 Mon Sep 17 00:00:00 2001 From: Hector Fernandez Date: Tue, 7 Jul 2020 14:09:59 +0200 Subject: New way to check preivous state before changing to a new one. Solved some problems with audio test. --- test-cli/test/enums/StationStates.py | 1 + test-cli/test/helpers/testsrv_db.py | 4 +++- test-cli/test/tests/qaudio.py | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'test-cli/test') diff --git a/test-cli/test/enums/StationStates.py b/test-cli/test/enums/StationStates.py index 9de5e15..040e6bc 100644 --- a/test-cli/test/enums/StationStates.py +++ b/test-cli/test/enums/StationStates.py @@ -17,4 +17,5 @@ class StationStates(Enum): EXTRATASKS_RUNNING = 100 WAITING_FOR_SCANNER = 50 FINISHED = 60 + STATION_REBOOT = 2001 diff --git a/test-cli/test/helpers/testsrv_db.py b/test-cli/test/helpers/testsrv_db.py index 7eeefb3..9579e7e 100644 --- a/test-cli/test/helpers/testsrv_db.py +++ b/test-cli/test/helpers/testsrv_db.py @@ -197,7 +197,9 @@ class TestSrv_Database(object): sql = "SELECT station.setmystate('{}', '{}', NULL)".format(newstate, station) # print('>>>' + sql) try: - self.__sqlObject.db_execute_query(sql) + res = self.__sqlObject.db_execute_query(sql) + # print(res) + return res[0][0] except Exception as err: r = find_between(str(err), '#', '#') # print(r) diff --git a/test-cli/test/tests/qaudio.py b/test-cli/test/tests/qaudio.py index 364d8b2..3d2113a 100644 --- a/test-cli/test/tests/qaudio.py +++ b/test-cli/test/tests/qaudio.py @@ -28,7 +28,10 @@ class Qaudio(unittest.TestCase): # analize audio file recordtime = calc_audio_duration("/var/lib/hwtest-files/dtmf-13579.wav") + 0.15 # previous play to estabilise audio lines - sh.aplay("/var/lib/hwtest-files/dtmf-13579.wav") + p1 = sh.aplay("/var/lib/hwtest-files/dtmf-13579.wav", _bg=True) + p2 = sh.arecord("-r", 8000, "-d", recordtime, "/mnt/station_ramdisk/recorded.wav", _bg=True) + p1.wait() + p2.wait() # play and record p1 = sh.aplay("/var/lib/hwtest-files/dtmf-13579.wav", _bg=True) p2 = sh.arecord("-r", 8000, "-d", recordtime, "/mnt/station_ramdisk/recorded.wav", _bg=True) -- cgit v1.1