summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* test: BSD-like fixesSASANO Takayoshi2023-02-036-13/+26
| | | | | | | | | | | | - rename devname -> pcmdev, it conflicts *BSD <stdlib.h> function - replace <values.h> -> <limits.h> and fix K&R style related warning - use config.h to determine include <malloc.h> - add OpenBSD support and fix printf() warning - fix warning Fixes: https://github.com/alsa-project/alsa-lib/pull/298 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* type_compat.h: use ESPIPE instead of EPIPE when ESTRPIPE not definedSASANO Takayoshi2023-02-031-0/+4
| | | | | | Fixes: https://github.com/alsa-project/alsa-lib/pull/298 Signed-off-by: SASANO Takayoshi <uaa@uaa.org.uk> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test: latency - --policy option - allow using SCHED_OTHERJaroslav Kysela2022-11-241-1/+4
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test: latency - add --policy option to allow using SCHED_FIFOJaroslav Kysela2022-11-241-5/+17
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test: latency - usleep should not be used in the block modeJaroslav Kysela2022-11-231-2/+2
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test: latency - add -y option (I/O usleep)Jaroslav Kysela2022-11-231-1/+12
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* latency: add timestamps to the POS linesJaroslav Kysela2022-11-141-11/+6
| | | | | | | - remove first capture pos line - measure the snd_pcm_start() call, too Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test: latency - add more realtime testsJaroslav Kysela2022-11-141-12/+151
| | | | | | | | | | | | | Add '-x' and '-X' tests and '-U' - I/O update mode based on the system timing. It may be required to check the position updates for the specific hardware. Print the real time / stream time differences. Also include code to make valgrind happy (including the wrong memory llocation for the stream buffer). Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test: latency - use snd_pcm_format_physical_width()Jaroslav Kysela2022-11-141-3/+3
| | | | | | | We need to allocate frames using the physical size not the sample bit size. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* conf: introduce snd_config_load_string()Jaroslav Kysela2021-12-011-0/+17
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* conf: fix test/lsb/config.cJaroslav Kysela2021-11-301-1/+0
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* conf: improve simple integer math expressions - bracketsJaroslav Kysela2021-11-301-0/+2
| | | | | | | | Add brackets to the simple math expressions like: $[($a+($val+100))/2] Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* conf: add possibility to evaluate simple integer math expressionsJaroslav Kysela2021-11-301-0/+50
| | | | | | | | | | | | | | | | | | It is useful to use the math expressions for the values in configuration. This patch adds a simple expression evaluation routines (integer only). The syntax is simplified unix shell (bash) style. Examples: $[1 + 1] $[$[2 + 2] / $var1] $[0xa0 | 0x05] As a bonus, the variable substitutions were more abstracted. The function snd_config_expand_custom() was introduced to be used for example in the topology pre-precessor. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* rawmidi: rename enum snd_rawmidi_framing to snd_rawmidi_read_modeJaroslav Kysela2021-10-281-2/+2
| | | | | | | | We hide the internal data transfers using the data frames. Rename the snd_rawmidi_framing enum to snd_rawmidi_read_mode to make API more straight and understandable. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* rawmidi: define more abstract API for the timestamp readsJaroslav Kysela2021-10-281-17/+17
| | | | | | | | | | | | | | | | | | | The frame structure is a bit internal thing for the kernel data transfer implementation. Introduce snd_rawmidi_tread() function which is straight for the application usage and hides the framing data transfers (kernel space API). The current code implements the read cache and does the merging of the frame reads with the similar timestamps (opposite to the kernel data split for big chunks). If the application wants to use super-duper-lighting-fast reads, the snd_rawmidi_read() may be used, but the structure must be defined on it's own, because this mechanism is not preferred and unsupported. BugLink: https://github.com/alsa-project/alsa-lib/issues/172 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test: rawmidi: Add test for rawmidi framing APIDavid Henningsson2021-08-201-6/+59
| | | | | | | | | Adds a "clock type" parameter to the "rawmidi" test program, that when used and combined with -i (and -v to be useful), activates tstamp type framing with the specified clock type. Signed-off-by: David Henningsson <coding@diwic.se> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: audio_time - fix timestamp2ns() and usage()Jaroslav Kysela2021-04-131-3/+2
| | | | | BugLink: https://github.com/alsa-project/alsa-lib/issues/132 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test/audio_time: Make use of SND_PCM_AUDIO_TSTAMP_TYPE constantsDavid Henningsson2020-12-171-13/+13
| | | | | | | Also fixup the usage row which seemed wrong to me. Signed-off-by: David Henningsson <diwic@ubuntu.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: pcm_min - add snd_pcm_drain() call and indentation fixesJaroslav Kysela2020-05-031-24/+26
| | | | | Fixes: https://github.com/alsa-project/alsa-lib/issues/46 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* Printf unsigned longs with %lu instead of %ld (playmidi1.c)Quipyowert22019-04-091-8/+8
| | | | | Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* Printf unsigned ints with %u instead of %i (pcm.c)Quipyowert22019-04-091-8/+8
| | | | | Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* Printf unsigned long longs with %llu (mixtest.c)Quipyowert22019-04-091-10/+10
| | | | | Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* Printf unsigned longs with %lu instead of %li (midifile.c)Quipyowert22019-04-091-6/+6
| | | | | Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* Printf unsigned long with %lu instead of %li (latency.c)Quipyowert22019-04-091-1/+1
| | | | | Signed-off-by: Nathan Mills <the.true.nathan.mills@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test/latency: use frame bytes correctly in writebuf()Jaroslav Kysela2019-03-011-1/+2
| | | | | Reported-by: Alessandro Lapini <alessandro.lapini@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test/audio_time: remove unused variablesJaroslav Kysela2018-10-241-2/+0
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test: rename code to more approriate mixtestJaroslav Kysela2018-10-242-1/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test/code: make it work againJaroslav Kysela2018-10-241-19/+21
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test/latecy: fix typo in tstamp compareJaroslav Kysela2018-10-241-1/+1
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test: use position offset macro of TLV dataTakashi Sakamoto2018-05-151-1/+1
| | | | | | | | A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset of TLV data. This commit applies a code optimization. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: correct emulation for channel-map TLVTakashi Sakamoto2017-11-241-9/+15
| | | | | | | | | | Current implementation of channel-map TLV on test program is not valid. Furthermore, it brings buffer-over-run due to byte counting. This commit fixes it. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Change FSF address (Franklin Street)Jaroslav Kysela2017-11-143-3/+3
| | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* test: obsolete usage of APIs of dimensional informationTakashi Sakamoto2017-11-131-31/+0
| | | | | | | | | APIs of dimensional information are deprecated for future removal. This commit removes test codes for user-defined element set in an aspect of the feature. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test/seq-decoder: enable timestamping for external subscribersAntonio Ospite2017-10-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Events sent by external clients subscribed to the input port are not timestamped. This inconsistent behavior may surprise newbies who look at seq-decoder as a reference example. See the example below using "vkeybd --addr 128:0" to connect to seq-decoder, the events sent by vkeybd are on a different queue with no timestamps: ... EVENT>>> Type = 66, flags = 0x0, time = 0 ticks Source = 0.1, dest = 128.0, queue = 253 Event = Port Subscribed; 129:0 -> 128:0 EVENT>>> Type = 66, flags = 0x1, time = 4.829712627 Source = 0.1, dest = 128.0, queue = 0 Event = Port Subscribed; 129:0 -> 128:0 EVENT>>> Type = 10, flags = 0x0, time = 0 ticks Source = 129.0, dest = 128.0, queue = 253 Event = Controller; ch=0, param=0, value=0 EVENT>>> Type = 11, flags = 0x0, time = 0 ticks Source = 129.0, dest = 128.0, queue = 253 Event = Program Change; ch=0, program=0 ... After the change events are on the main queue and are timestamped: ... EVENT>>> Type = 66, flags = 0x1, time = 4.280907223 Source = 0.1, dest = 128.0, queue = 0 Event = Port Subscribed; 129:0 -> 128:0 EVENT>>> Type = 66, flags = 0x1, time = 4.280912063 Source = 0.1, dest = 128.0, queue = 0 Event = Port Subscribed; 129:0 -> 128:0 EVENT>>> Type = 10, flags = 0x1, time = 4.280990702 Source = 129.0, dest = 128.0, queue = 0 Event = Controller; ch=0, param=0, value=0 EVENT>>> Type = 11, flags = 0x1, time = 4.280994862 Source = 129.0, dest = 128.0, queue = 0 Event = Program Change; ch=0, program=0 ... Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: apply optimization for v4.14 kernel about changes for TLV data ↵Takashi Sakamoto2017-08-241-11/+73
| | | | | | | | | | | | | handling on user-defined element set At kernel v4.14, in initial state, elements on user-defined sets have write-only flag. When applications write TLV data, then the elements get readable flag and the TLV data is available. Originally TLV data is shared by elements in the same set, thus events are generated for all of elements in the set by the write operation. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: add a test for list operation to user-defined element setsTakashi Sakamoto2017-05-251-0/+80
| | | | | | | | Current implementation of test for user-defined element doesn't perform list operation. This commit adds easy test for the operation. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: use actual information for TLV operationTakashi Sakamoto2016-09-301-36/+178
| | | | | | | | | | | Currently, this test program uses undefined type of TLV data. This can bring confusions to userspace applications. This commit replaces the array with valid information, constructed by newly exported TLV macros from kernel land. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: rename APIs to add an element set so that their names are appropriateTakashi Sakamoto2016-07-171-5/+5
| | | | | | | | | | | In this development period, some APIs have already been added. Most of them are to add an element set, while their names are not so appropriate against their feature. This is due to following to names of old APIs. This commit renames them. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: add linker flag with pthread for pcm-multi-thread stress testTakashi Sakamoto2016-07-071-1/+1
| | | | | | | | | | | | | | | | | | | This test program is a pthread application, while Makefile has no flags for linker about pthread library. This can cause below error. $ make pcm-multi-thread CCLD pcm-multi-thread /usr/bin/ld: pcm-multi-thread.o: undefined reference to symbol 'pthread_cancel@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Makefile:523: recipe for target 'pcm-multi-thread' failed make: *** [pcm-multi-thread] Error 1 This commit fixes the bug by adding a corresponding flag. Fixes: 147093ac5b8d('test: Add pcm-multi-thread program') Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: Add pcm-multi-thread programTakashi Iwai2016-07-072-1/+265
| | | | | | | | | | | A simple multi-thread stress test for PCM is added to test subdirectory. It can perform various PCM update function in the worker threads while reading/writing the data in the main thread. It can help catching the unexpected error or blockage. For example, running the capture test with a softvol plugin will lead to the assert due to the races. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: fix a test for user-defined element set in a point of dimensionTakashi Sakamoto2016-07-071-1/+1
| | | | | | | | | | | | | | | Currently, this test program has a bug related to dimension information. When testing an element set with byte type, the program adds 512 members to an element. This is a maximum number permitted for this type. On the other hand, dimension information of the elements consists of [8, 4, 8, 4]. Calculated members in the multi-dimensional matrix is 1024. This should be less than 512. This commit fixes the bug. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: support dimension test for user-defined element setTakashi Sakamoto2016-06-301-1/+38
| | | | | | | | | | | In former commits, APIs to add an element set are extended to support extra fields to information structure. Currently, the fields are mainly used to describe dimension level. This commit adds tests to check the dimension level. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: optimize a test for user-defined element set to changes of APIsTakashi Sakamoto2016-06-301-17/+37
| | | | | | | | | | In former commits, APIs to add an element set are changed, while a test program for user-defined element set doesn't follow them. This commit add support the change. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: optimize a test for user-defined element set to older kernelsTakashi Sakamoto2016-06-301-11/+20
| | | | | | | | | | | | | In Linux 4.0 or former, call of ioctl(2) with SNDRV_CTL_IOCTL_ELEM_ADD doesn't fill all of identical information in an argument; i.e. numid. With the kernel, a test of user-defined element set fails. This commit fixes the bug. The 'numid' field in identical information is always zero when adding an element set, therefore zero check has an effect. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ctl: add test program for control element setTakashi Sakamoto2016-06-172-1/+577
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The feature of control element set has been abandoned for a long time since firstly introduced in 2003. Furthermore, there's few applications to utilize this feature. These situations bring a hard work to persons who need the feature. Especially, a lack of test program make it harder to fix much bugs in this feature. This commit adds a test program as a sample of the feature. This program adds element sets of each element type to 'hw:0' in this order; boolean, integer, enumerated, bytes, IEC958 and integer64. Each iteration includes below scheme: 1. add an element set with 900 elements. Each of them has maximum number of members allowed by ALSA ctl core. 2. check all of events generated by above operation. 3. retrieve information of each element, then validate it. 4. unlock each member of all elements because they're initially locked. 5. write to all of members in all elements and read. 6. check all of events generated by above operation. 7. write information for threshold level to the element set and read it. 8. check all of events generated by above operation. 9. remove the element set. 10.check all of events generated by above operation. When any of these operations fail, it means regression occurs. Then, added elements still remain in a certain sound card. In this case, unloading drivers corresponding to the card is an easy way to recover. Besides, this program doesn't perform below element operations of ALSA ctl feature: - list - lock - replace Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: audio_time: show report validity and accuracyPierre-Louis Bossart2015-07-021-5/+25
| | | | | | | | Add checks to show if driver reports valid report and resolution information. disabled by default Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test: fix audio_time with new get/set audio_tstamp_configPierre-Louis Bossart2015-07-021-178/+313
| | | | | Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test/pcm_min: Fix error messagesChristophe Lohr2015-06-011-1/+1
| | | | | | | Fix the wrongly referred error code for error messages from snd_pcm_writei() and other calls. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test/pcm: Fix generated values with float PCM formatChristophe Lohr2015-06-011-1/+1
| | | | | | The float format should be generated [-1.0..1.0]. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* test/audio_time: Set timestamp type explicitlyTakashi Iwai2014-07-141-0/+13
| | | | Signed-off-by: Takashi Iwai <tiwai@suse.de>