Commit graph

17 commits

Author SHA1 Message Date
Khem Raj
4e3843d0ed aplay,axfer: Replace off64_t with off_t
Also replace lseek64 with lseek.

_FILE_OFFSET_BITS=64 is passed to needed platforms since configure uses
AC_SYS_LARGEFILE macro. Therefore off_t is already 64-bit and lseek is
same as lseek64.

Additionally this fixes buils with latest musl where these lfs64
functions are moved out from _GNU_SOURCE and under _LARGEFILE64_SOURCE
macro alone. This makes the builds fail on 32-bit platforms even though
default off_t on musl is 64-bit always.

Fixes: https://github.com/alsa-project/alsa-utils/pull/183
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-01-23 19:04:07 +01:00
Takashi Sakamoto
c2d27acfce axfer: test: reduce test case for maximum number of samples per frame
This commit reduces test case for maximum number of samples per frame so
that overall time is shortened. The count of total iteration is also
reduced by one quarter.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
61c8622de4 Revert "axfer: test - add run-test-in-tmpdir.sh script"
This reverts commit e1551de8dd since tests
run for in-memory files now.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
0a03f06134 axfer: test: reduce test case for maximum number of frame count
This commit reduces test case for maximum number of frame count so that
overall time is shortened. The count of total iteration is still the same.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
92004425fc axfer: test: use memfd_create() for mapper-test
The mapper test program writes audio data frame to files, and read
them from the files, then validate them. For the operations, usage of
any in-memory file is good to shorten time of overall operations.

This commit uses shm by memfd_create().

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
5ab26fbc14 axfer: test: minor code arrangement to use the same file descriptor for mappter-test
In mapper test program, two set of file descriptors open to the same files
for container builder and parser contexts, however the same file descriptor
is available for the case.

This commit arranges to use the same file descriptor for the contexts.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
2314d746b9 axfer: test: use memfd_create() for container-test
The container test program writes audio data frame to file, and read
them from the file, then validate them. For the operations, usage of
any in-memory file is good to shorten time of overall operations.

This commit uses shm via memfd_create(). As a result, overall time to
run is shorten one half of before, depending on machine environment.

I note that we can achieve the same result by using O_TMPFILE flag in
open(2) system call, however the implementation of O_TMPFILE is to add
i-node without name on underling file system, thus it has overhead
depending on implementation in each file system. On the other hand,
memfd_create() is directly relevant to shm and expected to be less
overhead.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:30:02 +01:00
Takashi Sakamoto
c45d994867 axfer: test: minor code arrangement to use the same file descriptor for container-test
In container test program, two file descriptors open to the same file
for builder and parser contexts, however the same file descriptor is
available for the case.

This commit arranges to use the same file descriptor for the contexts.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:29:59 +01:00
Takashi Sakamoto
6b0f1b20ae axfer: maintain lifetime of file descriptor outside of container module
This commit closes file descriptor outside of container module so
that maintenance of lifetime for the descriptor is delegated to container
user.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:28:12 +01:00
Takashi Sakamoto
5cb67b5ab6 axfer: open file descriptor outside of container module
Internal container module operates file descriptor to media file. For
this purpose, the structure has fd member and any file operation is done
internally. However, the case to use special file descriptor such as
memfd requires to maintain file descriptor externally.

This commit opens file descriptor outside of container module. The
internal APIs to initialize container get an argument for the file
descriptor instead of file path.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-11 09:28:12 +01:00
Jaroslav Kysela
e1551de8dd axfer: test - add run-test-in-tmpdir.sh script
BugLink: https://github.com/alsa-project/alsa-utils/issues/19
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-03-06 08:37:16 +01:00
Takashi Sakamoto
fbb222c9bc axfer: test: fix invalid comparison of 64 bit storage in ILP32 data type
In system V ABIs with ILP32 data model, bit shift for '1ul' can brings
undefined behaviour when the calculation result is over 32 bit width.

This commit fixes the bug.

Reported-by: Rolf Eike Beer <eike@sf-mail.de>
Reference: https://bugs.gentoo.org/681652
Reference: https://github.com/alsa-project/alsa-utils/issues/23
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-31 15:58:46 +02:00
Takashi Sakamoto
0b07c560f7 axfer/test: fix uninitialized warning
This commit fixes uninitialized return value from a call of test_mux() and
text_demux() to suppress warnings below:

$ make check
...
gcc -DHAVE_CONFIG_H -I. -I../../include     -O2 -Wall -pipe -g -MT mapper-test.o -MD -MP -MF .deps/mapper-test.Tpo -c -o mapper-test.o mapper-test.c
mapper-test.c: In function ‘test_mapper’:
mapper-test.c:241:9: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return err;
         ^~~
mapper-test.c:231:5: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (err < 0)
     ^

Fixes: 39d1ab8a0c: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-05-07 08:33:01 +02:00
Takashi Sakamoto
0248c29757 axfer/test: fix uninitialized warning
This commit fixes uninitialized return value from a call of test_vector()
to suppress a warning below.

gcc -DHAVE_CONFIG_H -I. -I../../include     -O2 -Wall -pipe -g -MT mapper-test.o -MD -MP -MF .deps/mapper-test.Tpo -c -o mapper-test.o mapper-test.c
mapper-test.c: In function ‘test_vector’:
mapper-test.c:293:6: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int err;
      ^~~

Fixes: 39d1ab8a0c: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2019-05-07 08:32:53 +02:00
Takashi Sakamoto
6fdaa0c524 axfer: add missing header file of unit test to distribution
The file 'axfer/test/generator.h' is missing in distribution and brings
FTBFS for unit tests of axfer.

This commit fixes to add it.

Reported-by: Elimar Riesebieter <riesebie@lxtec.de>
Fixes: b878df1ff0: ('axfer: add unit test for container interface')
Fixes: 39d1ab8a0c: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-29 16:48:00 +01:00
Takashi Sakamoto
39d1ab8a0c axfer: add a unit test for mapper interface
In former commits, mapper module gets supports of muxer/demuxer for
single/multiple targets for playback source or capture destination. This
commit adds a unit test for them. This includes positive test cases only.
The test cases actually generate I/O to file systems for many test cases.
It takes a bit long time to finish.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-13 12:04:28 +01:00
Takashi Sakamoto
b878df1ff0 axfer: add unit test for container interface
In former commits, container module gets supports of parser/builder for
several types of file format. This commit adds a unit test for them.
This includes positive test cases only. The test cases actually generate
I/O to file systems for many test cases. It takes a long time to finish.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-13 12:04:25 +01:00