python-audio-autotest-3.10 1.5.12rc0__py3-none-any.whl → 1.5.12rc3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyaatlibs/__init__.py +3 -2
- pyaatlibs/aatapp.py +92 -26
- pyaatlibs/activitystatemachine.py +4 -1
- pyaatlibs/adbutils.py +63 -35
- pyaatlibs/apk/audioworker.apk +0 -0
- pyaatlibs/appinterface.py +57 -22
- pyaatlibs/argutils.py +2 -0
- pyaatlibs/audiofunction.py +59 -27
- pyaatlibs/audiosignalframelogger.py +10 -9
- pyaatlibs/audiothread.py +32 -25
- pyaatlibs/audioworker.py +193 -88
- pyaatlibs/logcatlistener.py +19 -8
- pyaatlibs/logger.py +21 -8
- pyaatlibs/signalanalyzer.py +3 -1
- pyaatlibs/signalmatcher.py +14 -9
- pyaatlibs/tests/audioworker_test.py +168 -162
- pyaatlibs/timeutils.py +14 -5
- pyaatlibs/trials.py +9 -3
- {python_audio_autotest_3_10-1.5.12rc0.dist-info → python_audio_autotest_3_10-1.5.12rc3.dist-info}/METADATA +1 -1
- python_audio_autotest_3_10-1.5.12rc3.dist-info/RECORD +25 -0
- python_audio_autotest_3_10-1.5.12rc0.dist-info/RECORD +0 -25
- {python_audio_autotest_3_10-1.5.12rc0.dist-info → python_audio_autotest_3_10-1.5.12rc3.dist-info}/WHEEL +0 -0
- {python_audio_autotest_3_10-1.5.12rc0.dist-info → python_audio_autotest_3_10-1.5.12rc3.dist-info}/licenses/LICENSE +0 -0
- {python_audio_autotest_3_10-1.5.12rc0.dist-info → python_audio_autotest_3_10-1.5.12rc3.dist-info}/top_level.txt +0 -0
@@ -7,46 +7,54 @@ import packaging.version
|
|
7
7
|
|
8
8
|
import pyaatlibs
|
9
9
|
from pyaatlibs.audioworker import AudioWorkerApp, RecordPerf, RecordApi, RecordInputSrc
|
10
|
+
|
10
11
|
try:
|
11
12
|
from pyaatlibs.audioworker import TaskIndex
|
12
13
|
except:
|
14
|
+
|
13
15
|
class TaskIndex:
|
14
16
|
ALL = -1
|
15
17
|
|
18
|
+
|
16
19
|
from pyaatlibs.adbutils import Adb
|
17
20
|
|
18
21
|
SHORT_SHA_FMT = "[0-9a-f]{7,40}"
|
19
22
|
VERSION_FMT = "\\d+(\\.\\d+)*"
|
20
23
|
|
24
|
+
|
21
25
|
@pytest.fixture(scope="session")
|
22
26
|
def apk_path(pytestconfig):
|
23
27
|
return pytestconfig.getoption("apk_path")
|
24
28
|
|
29
|
+
|
25
30
|
@pytest.fixture(scope="session")
|
26
31
|
def serialno(pytestconfig):
|
27
32
|
return pytestconfig.getoption("serialno")
|
28
33
|
|
34
|
+
|
29
35
|
@pytest.fixture(scope="session")
|
30
36
|
def target_version():
|
31
37
|
return AudioWorkerApp.get_apk_version()
|
32
38
|
|
39
|
+
|
33
40
|
@pytest.fixture(scope="session")
|
34
41
|
def skip_version_check(pytestconfig):
|
35
42
|
return pytestconfig.getoption("skip_version_check")
|
36
43
|
|
44
|
+
|
37
45
|
@pytest.fixture(scope="session")
|
38
46
|
def skip_function_check(pytestconfig):
|
39
47
|
return pytestconfig.getoption("skip_function_check")
|
40
48
|
|
49
|
+
|
41
50
|
@pytest.fixture(scope="session")
|
42
51
|
def dut_info_provided(serialno):
|
43
52
|
return all([serialno])
|
44
53
|
|
54
|
+
|
45
55
|
@pytest.fixture(scope="session")
|
46
56
|
def check_options(pytestconfig):
|
47
|
-
required_options = [
|
48
|
-
"serialno"
|
49
|
-
]
|
57
|
+
required_options = ["serialno"]
|
50
58
|
|
51
59
|
# It only allows that all required parameters being specified or kept empty
|
52
60
|
if not any(map(pytestconfig.getoption, required_options)):
|
@@ -55,6 +63,7 @@ def check_options(pytestconfig):
|
|
55
63
|
for ropt in required_options:
|
56
64
|
assert pytestconfig.getoption(ropt) is not None
|
57
65
|
|
66
|
+
|
58
67
|
def intersect_dict(d1, d2):
|
59
68
|
intersection = {}
|
60
69
|
for k in d1.keys() & d2.keys():
|
@@ -71,62 +80,26 @@ def intersect_dict(d1, d2):
|
|
71
80
|
|
72
81
|
return intersection
|
73
82
|
|
83
|
+
|
74
84
|
def test_intersect_dict():
|
75
85
|
assert intersect_dict({"a": 1}, {"b": 1}) == {}
|
76
86
|
assert intersect_dict({"a": 1, "c": 3}, {"b": 1}) == {}
|
77
87
|
assert intersect_dict({"a": 1, "c": 3}, {"b": 1, "c": 3}) == {"c": 3}
|
78
88
|
assert intersect_dict({"a": 1, "c": 3}, {"b": 1, "c": 3}) == {"c": 3}
|
79
89
|
assert intersect_dict({"a": 1, "c": 3}, {"b": 1, "c": 2}) == {}
|
80
|
-
assert intersect_dict(
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
"a": 1
|
85
|
-
}
|
86
|
-
},
|
87
|
-
{
|
88
|
-
"b": 1,
|
89
|
-
"c": 3
|
90
|
-
}) == {}
|
91
|
-
assert intersect_dict(
|
92
|
-
{
|
93
|
-
"a": 1,
|
94
|
-
"c": {
|
95
|
-
"a": 1
|
96
|
-
}
|
97
|
-
},
|
98
|
-
{
|
99
|
-
"b": 1,
|
100
|
-
"c": {
|
101
|
-
"a": 1
|
102
|
-
}
|
103
|
-
}) == {
|
104
|
-
"c": {
|
105
|
-
"a": 1
|
106
|
-
}
|
107
|
-
}
|
108
|
-
assert intersect_dict(
|
109
|
-
{
|
110
|
-
"a": 1,
|
111
|
-
"c": {
|
112
|
-
"a": 1
|
113
|
-
}
|
114
|
-
},
|
115
|
-
{
|
116
|
-
"b": 1,
|
117
|
-
"c": {
|
118
|
-
"a": 2
|
119
|
-
}
|
120
|
-
}) == {
|
121
|
-
"c": {}
|
122
|
-
}
|
90
|
+
assert intersect_dict({"a": 1, "c": {"a": 1}}, {"b": 1, "c": 3}) == {}
|
91
|
+
assert intersect_dict({"a": 1, "c": {"a": 1}}, {"b": 1, "c": {"a": 1}}) == {"c": {"a": 1}}
|
92
|
+
assert intersect_dict({"a": 1, "c": {"a": 1}}, {"b": 1, "c": {"a": 2}}) == {"c": {}}
|
93
|
+
|
123
94
|
|
124
95
|
def is_subdict(smaller, larger):
|
125
96
|
return intersect_dict(smaller, larger) == smaller
|
126
97
|
|
98
|
+
|
127
99
|
def assert_if_not_subdict(smaller, larger):
|
128
100
|
assert intersect_dict(smaller, larger) == smaller
|
129
101
|
|
102
|
+
|
130
103
|
def test_is_subdict():
|
131
104
|
assert is_subdict({}, {})
|
132
105
|
assert is_subdict({}, {"a": 1})
|
@@ -136,6 +109,7 @@ def test_is_subdict():
|
|
136
109
|
assert not is_subdict({"b": {"a": 1}}, {"a": 1, "b": {}})
|
137
110
|
assert not is_subdict({"b": {"a": 1}}, {"a": 1, "b": {"a": 2}})
|
138
111
|
|
112
|
+
|
139
113
|
def test_install(check_options, serialno, apk_path):
|
140
114
|
if not any([serialno, apk_path]):
|
141
115
|
pytest.skip("The information of DuT is not provided.")
|
@@ -149,6 +123,7 @@ def test_install(check_options, serialno, apk_path):
|
|
149
123
|
AudioWorkerApp.install(serialno=serialno, grant=True)
|
150
124
|
assert AudioWorkerApp.installed(serialno=serialno)
|
151
125
|
|
126
|
+
|
152
127
|
def test_apk_version(check_options, target_version, serialno, skip_version_check):
|
153
128
|
if not any([target_version, serialno]):
|
154
129
|
pytest.skip("The information of DuT is not provided.")
|
@@ -160,12 +135,14 @@ def test_apk_version(check_options, target_version, serialno, skip_version_check
|
|
160
135
|
assert len(apk_version) > 0
|
161
136
|
|
162
137
|
vname_fmt = "(?P<commit_sha>{})\\-python\\-audio\\-autotest\\-v(?P<pyaat_version>{})$".format(
|
163
|
-
SHORT_SHA_FMT, VERSION_FMT
|
138
|
+
SHORT_SHA_FMT, VERSION_FMT
|
139
|
+
)
|
164
140
|
|
165
141
|
m = re.match(vname_fmt, apk_version)
|
166
142
|
assert m is not None, "The version name '{}' is not valid.".format(out.strip())
|
167
143
|
assert apk_version == target_version
|
168
144
|
|
145
|
+
|
169
146
|
def wait_for_activities(serialno, func, onset=True):
|
170
147
|
retry = 10
|
171
148
|
while retry > 0:
|
@@ -177,23 +154,26 @@ def wait_for_activities(serialno, func, onset=True):
|
|
177
154
|
|
178
155
|
return False
|
179
156
|
|
157
|
+
|
180
158
|
def wait_for_playback_activities(serialno, onset=True):
|
181
159
|
return wait_for_activities(serialno, AudioWorkerApp.playback_info, onset)
|
182
160
|
|
161
|
+
|
183
162
|
def wait_for_record_activities(serialno, onset=True, task_index=TaskIndex.ALL):
|
184
163
|
try:
|
185
164
|
pyaatlibs.__version__
|
186
|
-
func = lambda serialno: AudioWorkerApp.record_info(
|
187
|
-
serialno=serialno, task_index=task_index)
|
165
|
+
func = lambda serialno: AudioWorkerApp.record_info(serialno=serialno, task_index=task_index)
|
188
166
|
except:
|
189
167
|
func = AudioWorkerApp.record_info
|
190
168
|
|
191
169
|
return wait_for_activities(serialno, func, onset)
|
192
170
|
|
171
|
+
|
193
172
|
def prepare_app(serialno):
|
194
173
|
AudioWorkerApp.relaunch_app(serialno=serialno)
|
195
174
|
time.sleep(3)
|
196
175
|
|
176
|
+
|
197
177
|
def run_general_single_playback(serialno, playback_type):
|
198
178
|
prepare_app(serialno=serialno)
|
199
179
|
|
@@ -213,7 +193,7 @@ def run_general_single_playback(serialno, playback_type):
|
|
213
193
|
"low-latency": {
|
214
194
|
"serialno": serialno,
|
215
195
|
"low_latency_mode": True,
|
216
|
-
}
|
196
|
+
},
|
217
197
|
}
|
218
198
|
|
219
199
|
playback_func = FUNCTIONS[playback_type]
|
@@ -225,24 +205,29 @@ def run_general_single_playback(serialno, playback_type):
|
|
225
205
|
# Default test
|
226
206
|
playback_func(**cfg)
|
227
207
|
assert wait_for_playback_activities(serialno=serialno)
|
228
|
-
assert_if_not_subdict(
|
229
|
-
|
230
|
-
|
231
|
-
"
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
"
|
236
|
-
"
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
208
|
+
assert_if_not_subdict(
|
209
|
+
{
|
210
|
+
playback_type: {
|
211
|
+
"0": {
|
212
|
+
"class": (
|
213
|
+
"com.google.audioworker.functions.audio.playback.PlaybackStartFunction"
|
214
|
+
),
|
215
|
+
"has-ack": False,
|
216
|
+
"params": {
|
217
|
+
"type": playback_type,
|
218
|
+
"target-freqs": "440.0",
|
219
|
+
"playback-id": 0,
|
220
|
+
"low-latency-mode": "low_latency_mode" in cfg and cfg["low_latency_mode"],
|
221
|
+
"amplitude": 0.6,
|
222
|
+
"sampling-freq": 16000,
|
223
|
+
"num-channels": 2,
|
224
|
+
"pcm-bit-width": 16,
|
225
|
+
},
|
242
226
|
}
|
243
227
|
}
|
244
|
-
}
|
245
|
-
|
228
|
+
},
|
229
|
+
AudioWorkerApp.playback_info(serialno=serialno),
|
230
|
+
)
|
246
231
|
|
247
232
|
AudioWorkerApp.playback_stop(serialno=serialno)
|
248
233
|
assert wait_for_playback_activities(serialno=serialno, onset=False)
|
@@ -250,24 +235,29 @@ def run_general_single_playback(serialno, playback_type):
|
|
250
235
|
# Specifying playback id
|
251
236
|
playback_func(**cfg, playback_id=1)
|
252
237
|
assert wait_for_playback_activities(serialno=serialno)
|
253
|
-
assert_if_not_subdict(
|
254
|
-
|
255
|
-
|
256
|
-
"
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
"
|
261
|
-
"
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
238
|
+
assert_if_not_subdict(
|
239
|
+
{
|
240
|
+
playback_type: {
|
241
|
+
"1": {
|
242
|
+
"class": (
|
243
|
+
"com.google.audioworker.functions.audio.playback.PlaybackStartFunction"
|
244
|
+
),
|
245
|
+
"has-ack": False,
|
246
|
+
"params": {
|
247
|
+
"type": playback_type,
|
248
|
+
"target-freqs": "440.0",
|
249
|
+
"playback-id": 1,
|
250
|
+
"low-latency-mode": "low_latency_mode" in cfg and cfg["low_latency_mode"],
|
251
|
+
"amplitude": 0.6,
|
252
|
+
"sampling-freq": 16000,
|
253
|
+
"num-channels": 2,
|
254
|
+
"pcm-bit-width": 16,
|
255
|
+
},
|
267
256
|
}
|
268
257
|
}
|
269
|
-
}
|
270
|
-
|
258
|
+
},
|
259
|
+
AudioWorkerApp.playback_info(serialno=serialno),
|
260
|
+
)
|
271
261
|
|
272
262
|
AudioWorkerApp.playback_stop(serialno=serialno)
|
273
263
|
assert wait_for_playback_activities(serialno=serialno, onset=False)
|
@@ -275,29 +265,35 @@ def run_general_single_playback(serialno, playback_type):
|
|
275
265
|
# Dual frequencies playback
|
276
266
|
playback_func(**cfg, freqs=[440, 442])
|
277
267
|
assert wait_for_playback_activities(serialno=serialno)
|
278
|
-
assert_if_not_subdict(
|
279
|
-
|
280
|
-
|
281
|
-
"
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
"
|
286
|
-
"
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
268
|
+
assert_if_not_subdict(
|
269
|
+
{
|
270
|
+
playback_type: {
|
271
|
+
"0": {
|
272
|
+
"class": (
|
273
|
+
"com.google.audioworker.functions.audio.playback.PlaybackStartFunction"
|
274
|
+
),
|
275
|
+
"has-ack": False,
|
276
|
+
"params": {
|
277
|
+
"type": playback_type,
|
278
|
+
"target-freqs": "440,442",
|
279
|
+
"playback-id": 0,
|
280
|
+
"low-latency-mode": "low_latency_mode" in cfg and cfg["low_latency_mode"],
|
281
|
+
"amplitude": 0.6,
|
282
|
+
"sampling-freq": 16000,
|
283
|
+
"num-channels": 2,
|
284
|
+
"pcm-bit-width": 16,
|
285
|
+
},
|
292
286
|
}
|
293
287
|
}
|
294
|
-
}
|
295
|
-
|
288
|
+
},
|
289
|
+
AudioWorkerApp.playback_info(serialno=serialno),
|
290
|
+
)
|
296
291
|
|
297
292
|
# Stop
|
298
293
|
AudioWorkerApp.playback_stop(serialno=serialno)
|
299
294
|
assert wait_for_playback_activities(serialno=serialno, onset=False)
|
300
295
|
|
296
|
+
|
301
297
|
def test_single_nonoffload_playback(check_options, target_version, skip_function_check, serialno):
|
302
298
|
if not any([target_version, serialno]):
|
303
299
|
pytest.skip("The information of DuT is not provided.")
|
@@ -307,6 +303,7 @@ def test_single_nonoffload_playback(check_options, target_version, skip_function
|
|
307
303
|
|
308
304
|
run_general_single_playback(serialno=serialno, playback_type="non-offload")
|
309
305
|
|
306
|
+
|
310
307
|
def test_single_offload_playback(check_options, target_version, skip_function_check, serialno):
|
311
308
|
if not any([target_version, serialno]):
|
312
309
|
pytest.skip("The information of DuT is not provided.")
|
@@ -316,6 +313,7 @@ def test_single_offload_playback(check_options, target_version, skip_function_ch
|
|
316
313
|
|
317
314
|
run_general_single_playback(serialno=serialno, playback_type="offload")
|
318
315
|
|
316
|
+
|
319
317
|
def test_single_low_latency_playback(check_options, target_version, skip_function_check, serialno):
|
320
318
|
if not any([target_version, serialno]):
|
321
319
|
pytest.skip("The information of DuT is not provided.")
|
@@ -325,6 +323,7 @@ def test_single_low_latency_playback(check_options, target_version, skip_functio
|
|
325
323
|
|
326
324
|
run_general_single_playback(serialno=serialno, playback_type="low-latency")
|
327
325
|
|
326
|
+
|
328
327
|
def manipulate_detector_handle_names(detectors_dict):
|
329
328
|
keys = sorted(list(detectors_dict))
|
330
329
|
idx = 0
|
@@ -337,10 +336,10 @@ def manipulate_detector_handle_names(detectors_dict):
|
|
337
336
|
for k in keys:
|
338
337
|
del detectors_dict[k]
|
339
338
|
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
339
|
+
|
340
|
+
DEFAULT_DUMP_MS = {"default": 1000, "1.4.3": 0}
|
341
|
+
|
342
|
+
|
344
343
|
def test_single_record(check_options, target_version, skip_function_check, serialno):
|
345
344
|
if not any([target_version, serialno]):
|
346
345
|
pytest.skip("The information of DuT is not provided.")
|
@@ -348,8 +347,11 @@ def test_single_record(check_options, target_version, skip_function_check, seria
|
|
348
347
|
if skip_function_check:
|
349
348
|
pytest.skip("The function check is skipped.")
|
350
349
|
|
351
|
-
dump_buffer_ms =
|
352
|
-
|
350
|
+
dump_buffer_ms = (
|
351
|
+
DEFAULT_DUMP_MS["default"]
|
352
|
+
if not target_version in DEFAULT_DUMP_MS
|
353
|
+
else DEFAULT_DUMP_MS[target_version]
|
354
|
+
)
|
353
355
|
|
354
356
|
prepare_app(serialno=serialno)
|
355
357
|
|
@@ -369,14 +371,15 @@ def test_single_record(check_options, target_version, skip_function_check, seria
|
|
369
371
|
"btsco-on": True,
|
370
372
|
"input-src": 1,
|
371
373
|
"audio-api": 0,
|
372
|
-
"audio-perf": 10
|
373
|
-
}
|
374
|
+
"audio-perf": 10,
|
375
|
+
},
|
374
376
|
},
|
375
377
|
# The detectors' information
|
376
|
-
{}
|
378
|
+
{},
|
377
379
|
]
|
378
380
|
for a, b in zip(ans, AudioWorkerApp.record_info(serialno=serialno)):
|
379
381
|
import json
|
382
|
+
|
380
383
|
print(json.dumps(a, indent=2))
|
381
384
|
print(json.dumps(b, indent=2))
|
382
385
|
assert_if_not_subdict(a, b)
|
@@ -385,26 +388,30 @@ def test_single_record(check_options, target_version, skip_function_check, seria
|
|
385
388
|
|
386
389
|
# Detector registration
|
387
390
|
AudioWorkerApp.record_detector_register(
|
388
|
-
serialno=serialno, dclass="ToneDetector", params={"target-freq": [440]}
|
391
|
+
serialno=serialno, dclass="ToneDetector", params={"target-freq": [440]}
|
392
|
+
)
|
389
393
|
info = AudioWorkerApp.record_info(serialno=serialno)
|
390
394
|
|
391
395
|
# It's composed of the track's and its detectors' information packed in dicts
|
392
396
|
assert len(info) == 2 and all(map(lambda x: isinstance(x, dict), info))
|
393
397
|
|
394
|
-
assert_if_not_subdict(
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
"
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
398
|
+
assert_if_not_subdict(
|
399
|
+
{
|
400
|
+
"class": "com.google.audioworker.functions.audio.record.RecordStartFunction",
|
401
|
+
"has-ack": False,
|
402
|
+
"params": {
|
403
|
+
"sampling-freq": 16000,
|
404
|
+
"num-channels": 2,
|
405
|
+
"pcm-bit-width": 16,
|
406
|
+
"dump-buffer-ms": dump_buffer_ms,
|
407
|
+
"btsco-on": True,
|
408
|
+
"input-src": 1,
|
409
|
+
"audio-api": 0,
|
410
|
+
"audio-perf": 10,
|
411
|
+
},
|
412
|
+
},
|
413
|
+
info[0],
|
414
|
+
)
|
408
415
|
|
409
416
|
# It should contain exactly 1 detector and the handle name should be in the form like:
|
410
417
|
# com.google.audioworker.functions.audio.record.detectors.ToneDetector@18fad39
|
@@ -425,8 +432,8 @@ def test_single_record(check_options, target_version, skip_function_check, seria
|
|
425
432
|
"btsco-on": True,
|
426
433
|
"input-src": 1,
|
427
434
|
"audio-api": 0,
|
428
|
-
"audio-perf": 10
|
429
|
-
}
|
435
|
+
"audio-perf": 10,
|
436
|
+
},
|
430
437
|
},
|
431
438
|
{
|
432
439
|
"detector#0": {
|
@@ -437,22 +444,19 @@ def test_single_record(check_options, target_version, skip_function_check, seria
|
|
437
444
|
"unit": {
|
438
445
|
"Sampling Frequency": "Hz",
|
439
446
|
"Process Frame Size": "ms",
|
440
|
-
"Tolerance (semitone)": "keys"
|
447
|
+
"Tolerance (semitone)": "keys",
|
441
448
|
},
|
442
|
-
"Targets": [
|
443
|
-
{
|
444
|
-
"target-freq": 440
|
445
|
-
}
|
446
|
-
]
|
449
|
+
"Targets": [{"target-freq": 440}],
|
447
450
|
}
|
448
|
-
}
|
451
|
+
},
|
449
452
|
]
|
450
453
|
for a, b in zip(ans, info):
|
451
454
|
assert_if_not_subdict(a, b)
|
452
455
|
|
453
456
|
# Multiple detectors registration
|
454
457
|
AudioWorkerApp.record_detector_register(
|
455
|
-
serialno=serialno, dclass="ToneDetector", params={"target-freq": [442]}
|
458
|
+
serialno=serialno, dclass="ToneDetector", params={"target-freq": [442]}
|
459
|
+
)
|
456
460
|
info = AudioWorkerApp.record_info(serialno=serialno)
|
457
461
|
|
458
462
|
# It's composed of the track's and its detectors' information packed in dicts
|
@@ -477,8 +481,8 @@ def test_single_record(check_options, target_version, skip_function_check, seria
|
|
477
481
|
"btsco-on": True,
|
478
482
|
"input-src": 1,
|
479
483
|
"audio-api": 0,
|
480
|
-
"audio-perf": 10
|
481
|
-
}
|
484
|
+
"audio-perf": 10,
|
485
|
+
},
|
482
486
|
},
|
483
487
|
{
|
484
488
|
"detector#0": {
|
@@ -489,13 +493,9 @@ def test_single_record(check_options, target_version, skip_function_check, seria
|
|
489
493
|
"unit": {
|
490
494
|
"Sampling Frequency": "Hz",
|
491
495
|
"Process Frame Size": "ms",
|
492
|
-
"Tolerance (semitone)": "keys"
|
496
|
+
"Tolerance (semitone)": "keys",
|
493
497
|
},
|
494
|
-
"Targets": [
|
495
|
-
{
|
496
|
-
"target-freq": 442
|
497
|
-
}
|
498
|
-
]
|
498
|
+
"Targets": [{"target-freq": 442}],
|
499
499
|
},
|
500
500
|
"detector#1": {
|
501
501
|
"Handle": "detector#1",
|
@@ -505,15 +505,11 @@ def test_single_record(check_options, target_version, skip_function_check, seria
|
|
505
505
|
"unit": {
|
506
506
|
"Sampling Frequency": "Hz",
|
507
507
|
"Process Frame Size": "ms",
|
508
|
-
"Tolerance (semitone)": "keys"
|
508
|
+
"Tolerance (semitone)": "keys",
|
509
509
|
},
|
510
|
-
"Targets": [
|
511
|
-
|
512
|
-
|
513
|
-
}
|
514
|
-
]
|
515
|
-
}
|
516
|
-
}
|
510
|
+
"Targets": [{"target-freq": 440}],
|
511
|
+
},
|
512
|
+
},
|
517
513
|
]
|
518
514
|
for a, b in zip(ans, info):
|
519
515
|
assert_if_not_subdict(a, b)
|
@@ -522,6 +518,7 @@ def test_single_record(check_options, target_version, skip_function_check, seria
|
|
522
518
|
AudioWorkerApp.record_stop(serialno=serialno)
|
523
519
|
assert wait_for_record_activities(serialno=serialno, onset=False)
|
524
520
|
|
521
|
+
|
525
522
|
def test_concurrent_record(check_options, target_version, skip_function_check, serialno):
|
526
523
|
if packaging.version.parse(target_version.split("-")[-1]) < packaging.version.parse("1.5"):
|
527
524
|
pytest.skip("This is only for PyAAT later than v1.5")
|
@@ -548,8 +545,8 @@ def test_concurrent_record(check_options, target_version, skip_function_check, s
|
|
548
545
|
"input-src": 1,
|
549
546
|
"audio-api": 0,
|
550
547
|
"audio-perf": 10,
|
551
|
-
"task-index": 0
|
552
|
-
}
|
548
|
+
"task-index": 0,
|
549
|
+
},
|
553
550
|
},
|
554
551
|
{},
|
555
552
|
{
|
@@ -564,10 +561,10 @@ def test_concurrent_record(check_options, target_version, skip_function_check, s
|
|
564
561
|
"input-src": 1,
|
565
562
|
"audio-api": 0,
|
566
563
|
"audio-perf": 10,
|
567
|
-
"task-index": 1
|
568
|
-
}
|
564
|
+
"task-index": 1,
|
565
|
+
},
|
569
566
|
},
|
570
|
-
{}
|
567
|
+
{},
|
571
568
|
]
|
572
569
|
for a, b in zip(ans, AudioWorkerApp.record_info(serialno=serialno)):
|
573
570
|
assert_if_not_subdict(a, b)
|
@@ -578,11 +575,19 @@ def test_concurrent_record(check_options, target_version, skip_function_check, s
|
|
578
575
|
|
579
576
|
# Different configurations
|
580
577
|
AudioWorkerApp.record_start(
|
581
|
-
serialno=serialno,
|
582
|
-
|
578
|
+
serialno=serialno,
|
579
|
+
task_index=0,
|
580
|
+
input_src=RecordInputSrc.MIC,
|
581
|
+
api=RecordApi.OPENSLES,
|
582
|
+
perf=RecordPerf.POWER_SAVING,
|
583
|
+
)
|
583
584
|
AudioWorkerApp.record_start(
|
584
|
-
serialno=serialno,
|
585
|
-
|
585
|
+
serialno=serialno,
|
586
|
+
task_index=1,
|
587
|
+
input_src=RecordInputSrc.CAMCORDER,
|
588
|
+
api=RecordApi.AAUDIO,
|
589
|
+
perf=RecordPerf.LOW_LATENCY,
|
590
|
+
)
|
586
591
|
assert wait_for_record_activities(serialno=serialno, task_index=0)
|
587
592
|
assert wait_for_record_activities(serialno=serialno, task_index=1)
|
588
593
|
|
@@ -599,8 +604,8 @@ def test_concurrent_record(check_options, target_version, skip_function_check, s
|
|
599
604
|
"input-src": 1,
|
600
605
|
"audio-api": 1,
|
601
606
|
"audio-perf": 11,
|
602
|
-
"task-index": 0
|
603
|
-
}
|
607
|
+
"task-index": 0,
|
608
|
+
},
|
604
609
|
},
|
605
610
|
{},
|
606
611
|
{
|
@@ -615,14 +620,15 @@ def test_concurrent_record(check_options, target_version, skip_function_check, s
|
|
615
620
|
"input-src": 5,
|
616
621
|
"audio-api": 2,
|
617
622
|
"audio-perf": 12,
|
618
|
-
"task-index": 1
|
619
|
-
}
|
623
|
+
"task-index": 1,
|
624
|
+
},
|
620
625
|
},
|
621
|
-
{}
|
626
|
+
{},
|
622
627
|
]
|
623
628
|
for a, b in zip(ans, AudioWorkerApp.record_info(serialno=serialno)):
|
624
629
|
assert_if_not_subdict(a, b)
|
625
630
|
|
631
|
+
|
626
632
|
def test_uninstall(check_options, serialno):
|
627
633
|
if not any([serialno]):
|
628
634
|
pytest.skip("The information of DuT is not provided.")
|