Commit graph

277 commits

Author SHA1 Message Date
Takashi Sakamoto
1edc5f5259 ctl: optimize a test for user-defined element set to older kernels
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>
2016-06-30 08:42:17 +02:00
Takashi Sakamoto
5ba71a7b81 ctl: add test program for control element set
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>
2016-06-17 15:12:20 +02:00
Pierre-Louis Bossart
6849d7dc88 test: audio_time: show report validity and accuracy
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>
2015-07-02 17:02:05 +02:00
Pierre-Louis Bossart
7bb3a74c4d test: fix audio_time with new get/set audio_tstamp_config
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-02 17:02:04 +02:00
Christophe Lohr
8551fe2587 test/pcm_min: Fix error messages
Fix the wrongly referred error code for error messages from
snd_pcm_writei() and other calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-01 13:43:36 +02:00
Christophe Lohr
9120f2de86 test/pcm: Fix generated values with float PCM format
The float format should be generated [-1.0..1.0].

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-01 13:42:56 +02:00
Takashi Iwai
52444bd43a test/audio_time: Set timestamp type explicitly
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-14 18:12:49 +02:00
Jordi Mallach
8bdec31570 Add -lm to test programs to fix build failure.
Add -lm to test programs that use sin(), to fix a build failure with recent
binutils.

Signed-off-by: Jordi Mallach <jordi@debian.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2014-06-13 18:46:12 +02:00
Patrick Welche
b669b50de2 autotools: update style
- rename configure.in to configure.ac
- replace INCLUDES with AM_CPPFLAGS
- modernize AM_INIT_AUTOMAKE invocation

Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-26 08:16:22 +01:00
Takashi Iwai
2d6eb4e9ba test/chmap: Add missing usage text for -s option
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-04 14:19:03 +01:00
Pierre-Louis Bossart
cf40ea169a pcm: support for audio timestamps
add new snd_pcm_status_get_audio_htstamp() routine to
query the audio timestamps provided by the kernel.

This change provides applications with better ways
to track elapsed time. Before this patch, applications
would subtract queued samples (delay) from written samples,
resulting in a 1-2 sample error.

Also add snd_pcm_hw_params_supports_audio_wallclock_ts()
to query what the hardware supports.

TODO: check protocol compatibility?

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-10-25 00:13:51 +02:00
Pierre-Louis Bossart
6429a450a3 test: add audio_time
Simple test to create playback and capture streams, and
check elapsed time vs. sample counts reported by driver.
This should be helpful for driver developers and anyone
interested in system/audio time drift.

tested only on HDAudio

[added Makefile.am change by tiwai]

TODO:
- make period configurable
- better output messages
- support for wall clock when it's in the mainline

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-22 09:39:07 +02:00
Takashi Iwai
58c45b3030 test/chmap: Fix wrong malloc size
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-13 08:24:59 +02:00
Takashi Iwai
b4c64e815a PCM: Add string conversion helper functions for chmap
Added a few helper functions between chmap and string.
  snd_pcm_chmap_type_name() -- a string of the given chmap type
  snd_pcm_chmap_name() -- a string of the given channel position
  snd_pcm_chmap_print() -- print channel map on the given buffer
  snd_pcm_chmap_from_string() -- get a channel position from string
  snd_pcm_parse_string() -- parse the whole channel map from string

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-13 08:24:58 +02:00
Takashi Iwai
ec96740d99 Fix duplicated channel entry in test/chmap.c
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-13 08:24:58 +02:00
Takashi Iwai
9c1a0ce72d PCM: Introduce snd_pcm_chmap_t and snd_pcm_chmap_query_t
Instead of passing ambiguous integer array, define snd_pcm_chmap_t and
snd_pcm_chmap_query_t so that user can understand more easily which
element is for what.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-13 08:24:58 +02:00
Takashi Iwai
48c2c90f19 Add SND_CHMAP_NA and bit flag definitions
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-13 08:24:58 +02:00
Takashi Iwai
0f36270dd3 Follow channel position definitions to mixer channel in mixer.h
mixer.h already contains some channel position definitions.
To be more consistent over all systems, better to follow the same
order for the new channel map, too.  But since UNKNOWN channel must be
zero but the definition in mixer.h contains -1 as UNKNOWN, simply
shift the value with 1.

If the conversion is required between SND_CHMAP and SND_MIXER_SCHN,
just increment/decrement 1.  Eventually I'll provide helper functions
for that...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-13 08:24:47 +02:00
Takashi Iwai
3fc13d6f5b Add test/chmap program
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-09-11 11:34:50 +02:00
Mario Domenech Goulart
c34f74c818 test/latency.c: Fix string argument to getopt_long, so now it handles -E and -B
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-08-08 16:29:03 +02:00
John Spencer
1d3f7975f9 Fix invalid long long format specifier
Per POSIX:

       L      Specifies that a following a, A, e, E, f, F, g, or G  conversion
              specifier applies to a long double argument.

L is only intended to be used with long doubles, not long long ints.

the proper way is to use "ll" instead.

Signed-off-by: John Spencer <maillist-alsa@barfooze.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-04-24 15:38:45 +02:00
Takashi Iwai
6bef13e251 Fix printf for size_t
Need to use z prefix for size_t type.

midiloop.c: In function ‘main’:
midiloop.c:172:2: warning: format ‘%i’ expects type ‘int’, but argument 2 has type ‘size_t’
....

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-05-04 09:19:09 +02:00
Raymond Yau
7ed19bbc9a test/latency: print error message when 2 periods per buffer not supported
Print error message when playback/capture does not support 2 periods
per buffer.

Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-04-20 14:11:59 +02:00
Jaroslav Kysela
37c7e2843f ucm: allow bind modifier to specific instances, other fixes
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2011-01-31 14:24:19 +01:00
Jaroslav Kysela
cdc9dd50bf ucm: fix parser for sequences and fix wrong strcmp
The sequences are not parsed correctly. First cfg value is the command
and second value is the command argument.

Also, fix strcmp calls in ucm/main.c (reported by
abraham duenas <aduejazz@gmail.com>).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-11-10 16:06:29 +01:00
Jaroslav Kysela
e4083a1182 ucm: debug parser
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-10-26 14:26:46 +02:00
Jaroslav Kysela
e820866637 ucm: implemented card list feature
- also added some test files to test/ucm tree

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-10-13 11:48:52 +02:00
Jaroslav Kysela
eb3768563a test/latency: fix timediff calculation
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2010-08-04 19:48:00 +02:00
Clemens Ladisch
da19588063 add config tests
Add some test for the snd_config_* functions.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2009-08-03 13:35:01 +02:00
Clemens Ladisch
a7f744888e test/lsb/midi_event.c: check for buffer size check
Add a test to check that snd_midi_event_decode() checks its output
buffer size.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2009-07-08 08:50:54 +02:00
Clemens Ladisch
61f5b8438b test/lsb/midi_event.c: abort on fatal errors
If snd_midi_event_fails(), we cannot use the object and must abort the
current test.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2009-07-08 08:50:19 +02:00
Takashi Iwai
7469306165 Merge branch 'master' of git@git.alsa-project.org:alsa-lib 2009-07-06 12:31:53 +02:00
Takashi Iwai
b8c4fef8bf test/pcm.c: float format support
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-06 12:31:09 +02:00
Clemens Ladisch
7f73f1bb15 add midi event tests
Add some tests for the snd_midi_event_* functions.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2009-07-06 12:00:04 +02:00
Takashi Iwai
184301ae4c test/pcm.c: Generic linear PCM support
- Fix the support of non-native endianness
- Conversion for unsigned formats
- Only allow linear formats

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-06 08:42:18 +02:00
Takashi Iwai
3d0843e8ce test/pcm.c: Fix S24 format
S24 format has different bit width and physical width.
For calculating the byte offset for big-endian packing, the latter value
has to be used.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-06 08:41:00 +02:00
Kenneth Johansson
d23845e563 test/pcm.c: Sample generation on big endian platforms was broken.
Has not worked since commit 3d1fa92490

Signed-off-by: Kenneth Johansson <kenneth@southpole.se>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2009-07-03 22:49:59 +02:00
Jaroslav Kysela
16cc295a3c test/pcm: Fix error messages in async callback and add snd_pcm_start() condition
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2008-09-15 15:14:58 +02:00
Takashi Iwai
d31fd52e74 test/pcm.c: Fix SND_PCM_FORMAT_S24 support
The program uses snd_pcm_format_width() wrongly to calculate the sample
size.  It must be snd_pcm_format_physical_width() instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-07-10 18:45:23 +02:00
Takashi Iwai
af2c3fbe7d Fix type-punning in test/pcm.c
The cast won't work well with strict aliasing.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2008-07-10 18:44:15 +02:00
Jaroslav Kysela
8aaccc9484 Implemented snd_pcm_sw_params_(set|get)_period_event for interrupt wakeup like behaviour
Actually, PCM timer is used as source for poll(). It might be optimized
in the kernel code later.
2008-05-09 16:02:02 +02:00
Aldrin Martoq
83c5a60778 add a test code for snd_seq_client_info_event_filter_*()
Added test code for
snd_seq_client_info_event_filter_{clear,add,del,check}

Signed-off-by: Aldrin Martoq <amartoq@dcc.uchile.cl>
2008-02-22 17:49:01 +01:00
Takashi Iwai
679cea4125 Remove sleep_min and tick
The sleep_min and tick are removed features from the kernel.
This patch cleans the corresponding part in alsa-lib.
2008-01-08 18:36:18 +01:00
Takashi Iwai
cf15e49d84 Remove PCM xfer_align
The PCM xfer_align is a removed feature from the kernel.
This patch cleans up the corresponding part in alsa-lib.
2008-01-08 18:35:29 +01:00
Takashi Iwai
d23669585d Remove obsolete seq event entries in seq-decoder
Removed obsolete seq-devent entries in seq-decoder.
2007-12-21 15:26:17 +01:00
Clemens Ladisch
15e936e277 midiloop: use blocking mode
Busy waiting is evil - use blocking mode when reading the actual test data.
2007-11-12 08:49:10 +01:00
Jaroslav Kysela
d25e281230 Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz 2007-10-15 10:24:55 +02:00
Jaroslav Kysela
03389a444b change iface argument for namehint function to const char *
remove snd_ctl_iface_conf_name function
2006-10-27 13:31:32 +02:00
Jaroslav Kysela
13fdc41785 add snd_device_name_hint() function and initial implementation
- add snd_device_name_hint() and snd_device_name_free_hint() functions
- add snd_ctl_iface_conf_name() functions
- do not accept parameters for the plugin definition without @args section
- add defaults.pcm.dmix.card/device and dsnoop.card/device definitions
- add hints for HDA-Intel.conf, pcm/dmix.conf, pcm/dsnoop.conf and alsa.conf
- add test/namehint test utility
- doxygen related cleanups
2006-10-11 13:18:57 +02:00
Jaroslav Kysela
bc9b4553b4 alsa-lib: test dir: make check: static building doesn't work on PIC architectures
Some architectures, such as AMD64, IA64 and Alpha cannot mix PIC and non-PIC
objects when creating a PIC output. Hardened compilers (which uses SSP and
PIE) creates PIC executables, passing -static in CFLAGS for tests in make
check in alsa-lib makes their linking to fail.

See bug#1541
2006-10-04 10:39:55 +02:00