alsa_conformance_test.py: Add option to override merge_threshold_sz
Provide an option to manually override the merge_threshold_sz
otherwise auto computed by alsa_conformance_test.
BUG=b:162832609
TEST=alsa_conformance_test.py -P hw:0,0 --merge-thld-size 48
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Change-Id: I25e950d03551067b0cc302caf86dc22c0af00e80
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/audiotest/+/2520221
Tested-by: Uday M Bhat <uday.m.bhat@intel.corp-partner.google.com>
Reviewed-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Commit-Queue: Yu-Hsuan Hsu <yuhsuan@chromium.org>
diff --git a/script/alsa_conformance_test.py b/script/alsa_conformance_test.py
index b4d62fc..27ef7f3 100755
--- a/script/alsa_conformance_test.py
+++ b/script/alsa_conformance_test.py
@@ -360,7 +360,7 @@
class AlsaConformanceTester(object):
"""Object which can set params and run alsa_conformance_test."""
- def __init__(self, name, stream, criteria):
+ def __init__(self, name, stream, criteria, threshold):
"""Initializes an AlsaConformanceTester.
Args:
@@ -374,6 +374,7 @@
self.channels = None
self.rate = None
self.period_size = None
+ self.merge_thld_size = threshold
self.criteria = criteria
output = self.run(['--dev_info_only'])
@@ -443,6 +444,9 @@
cmd += ['-f', str(self.format)]
if self.period_size is not None:
cmd += ['-p', str(self.period_size)]
+ if self.merge_thld_size is not None:
+ cmd += ['--merge_threshold_sz', str(self.merge_thld_size)]
+
logging.info('Execute command: %s', ' '.join(cmd))
p = subprocess.Popen(
cmd,
@@ -734,6 +738,11 @@
help='The pass criteria of rate error. (default: 10)',
type=float, default=10)
parser.add_argument(
+ '--merge-thld-size',
+ help=('Override the auto computed merge_threshold_sz. '
+ 'See the Explaination of point merge in the doc for details.'),
+ type=int)
+ parser.add_argument(
'--json', action='store_true', help='Print result in JSON format')
parser.add_argument('--log-file', help='The file to save logs.')
parser.add_argument(
@@ -759,10 +768,12 @@
exit(1)
if args.input_device:
- tester = AlsaConformanceTester(args.input_device, 'CAPTURE', criteria)
+ tester = AlsaConformanceTester(args.input_device, 'CAPTURE', criteria,
+ args.merge_thld_size)
if args.output_device:
- tester = AlsaConformanceTester(args.output_device, 'PLAYBACK', criteria)
+ tester = AlsaConformanceTester(args.output_device, 'PLAYBACK', criteria,
+ args.merge_thld_size)
tester.test(args.test_suites, args.json)