From f66e8ad17c3f1d27c6c19be4538ec296161e181b Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Sun, 9 Feb 2020 12:20:53 +0900 Subject: [PATCH] timer: add test script for ALSATimer enumerations Signed-off-by: Takashi Sakamoto --- tests/alsatimer-enums | 67 +++++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 3 ++ 2 files changed, 70 insertions(+) create mode 100644 tests/alsatimer-enums diff --git a/tests/alsatimer-enums b/tests/alsatimer-enums new file mode 100644 index 0000000..b5dd331 --- /dev/null +++ b/tests/alsatimer-enums @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 + +from sys import exit +import gi +gi.require_version('ALSATimer', '0.0') +from gi.repository import ALSATimer + +class_types = ( + 'NONE', + 'GLOBAL', + 'CARD', + 'PCM', +) + +slave_class_types = ( + 'NONE', + 'APPLICATION', + 'SEQUENCER', +) + +specific_global_devices = ( + 'SYSTEM', + 'HRTIMER', +) + +device_info_flags = ( + 'SLAVE', +) + +instance_param_flags = ( + 'AUTO', + 'EXCLUSIVE', + 'EARLY_EVENT', +) + +event_types = ( + 'RESOLUTION', + 'TICK', + 'START', + 'STOP', + 'CONTINUE', + 'PAUSE', + 'EARLY', + 'SUSPEND', + 'RESUME', + 'MSTART', + 'MSTOP', + 'MCONTINUE', + 'MPAUSE', + 'MSUSPEND', + 'MRESUME', +) + +types = { + ALSATimer.Class: class_types, + ALSATimer.SlaveClass: slave_class_types, + ALSATimer.SpecificGlobalDevice: specific_global_devices, + ALSATimer.DeviceInfoFlag: device_info_flags, + ALSATimer.InstanceParamFlag: instance_param_flags, + ALSATimer.EventType: event_types, +} + +for obj, types in types.items(): + for t in types: + if not hasattr(obj, t): + print('Enumerator {0} is not produced.'.format(t)) + exit(1) diff --git a/tests/meson.build b/tests/meson.build index ac3518f..fb1e8b1 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -15,6 +15,9 @@ tests = { 'alsactl-elem-info-int64', 'alsactl-elem-value', ], + 'timer': [ + 'alsatimer-enums', + ], } foreach path, scripts: tests -- 2.47.3