• Ivan Orlov's avatar
    selftests: ALSA: Cover userspace-driven timers with test · 1026392d
    Ivan Orlov authored
    
    
    Add a test for the new functionality of userspace-driven timers and the
    tool which allows us to count timer ticks in a certain time period. The
    test:
    
    1. Creates a userspace-driven timer with ioctl to /dev/snd/timer
    2. Starts the `global-timer` application to count the ticks of the timer
    from step 1.
    3. Asynchronously triggers the timer multiple times with some interval
    4. Compares the amount of caught ticks with the amount of trigger calls.
    
    Since we can't include <alsa/asoundlib.h> and <sound/asound.h> in one
    file due to overlapping declarations, I have to split the test into two
    applications: one of them counts the amount of timer ticks in the
    defined time period, and another one is the actual test which creates
    the timer, triggers it periodically and starts the first app to count
    the amount of ticks in a separate thread.
    
    Besides from testing the functionality itself, the test represents a
    sample application showing userspace-driven ALSA timers API.
    
    Also, the timer test includes a test case which tries to create a timer
    with invalid resolution (=0), and NULL as a timer info structure.
    Signed-off-by: default avatarIvan Orlov <ivan.orlov0322@gmail.com>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    Link: https://patch.msgid.link/20240813120701.171743-5-ivan.orlov0322@gmail.com
    1026392d
Makefile 636 Bytes