diff mbox series

selftest: alsa: check if user has alsa installed

Message ID 20240922225824.18918-1-abdul.rahim@myyahoo.com (mailing list archive)
State Accepted
Commit 2a94a0898b14f2d5dee10bf36d00ab5e766af94b
Headers show
Series selftest: alsa: check if user has alsa installed | expand

Commit Message

Abdul Rahim Sept. 22, 2024, 10:58 p.m. UTC
Currently, if alsa development package is not installed on the user's
system then the make command would print a `pagefull` of errors. In
particular one error message is repeated 3 times. This error is returned
by `pkg-config` and since it is not being handeled appropriately,
repeated calls to `pkg-config` prints the same message again.

This patch adds check for alsa package installation. If alsa is not
installed, a short and consize error is returned. Also, it does not
affect the compilation of other tests.

Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
---

Current output:
```
make[3]: Entering directory '/mnt/ubuntu/abdul_linux/mainline_dev/tools/testing/selftests/alsa'
Makefile:4: *** Package alsa not found, please install alsa development package or add directory containing `alsa.pc` in PKG_CONFIG_PATH.  Stop.
make[3]: Leaving directory '/mnt/ubuntu/abdul_linux/mainline_dev/tools/testing/selftests/alsa'
make[3]: Entering directory '/mnt/ubuntu/abdul_linux/mainline_dev/tools/testing/selftests/amd-pstate'
```

Previous output:
```
make[3]: Entering directory '/mnt/ubuntu/abdul_linux/mainline_compile/tools/testing/selftests/alsa'
Package alsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `alsa.pc'
to the PKG_CONFIG_PATH environment variable
Package 'alsa', required by 'virtual:world', not found
Package alsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `alsa.pc'
to the PKG_CONFIG_PATH environment variable
Package 'alsa', required by 'virtual:world', not found
Package alsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `alsa.pc'
to the PKG_CONFIG_PATH environment variable
Package 'alsa', required by 'virtual:world', not found
gcc  -isystem /mnt/ubuntu/abdul_linux/mainline_compile/usr/include -L/mnt/ubuntu/abdul_linux/mainline_compile/tools/testing/selftests/alsa       -Wl,-rpath=./ -D_GNU_SOURCE=  -shared -fPIC conf.c  -lasound -lpthread -o /mnt/ubuntu/abdul_linux/mainline_compile/tools/testing/selftests/      alsa/libatest.so
In file included from conf.c:18:
alsa-local.h:11:10: fatal error: alsa/asoundlib.h: No such file or directory
   11 | #include <alsa/asoundlib.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:24: /mnt/ubuntu/abdul_linux/mainline_compile/tools/testing/selftests/alsa/libatest.so] Error 1
```

 tools/testing/selftests/alsa/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Shuah Khan Sept. 23, 2024, 3:59 p.m. UTC | #1
On 9/22/24 16:58, Abdul Rahim wrote:
> Currently, if alsa development package is not installed on the user's
> system then the make command would print a `pagefull` of errors. In
> particular one error message is repeated 3 times. This error is returned
> by `pkg-config` and since it is not being handeled appropriately,
> repeated calls to `pkg-config` prints the same message again.
> 
> This patch adds check for alsa package installation. If alsa is not
> installed, a short and consize error is returned. Also, it does not
> affect the compilation of other tests.
> 
> Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
> ---
> 

[snip]

> ```
> 
>   tools/testing/selftests/alsa/Makefile | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
> index 25be68025290..944279160fed 100644
> --- a/tools/testing/selftests/alsa/Makefile
> +++ b/tools/testing/selftests/alsa/Makefile
> @@ -1,5 +1,9 @@
>   # SPDX-License-Identifier: GPL-2.0
>   #
> +ifneq ($(shell pkg-config --exists alsa && echo 0 || echo 1),0)
> +$(error Package alsa not found, please install alsa development package or \
> +	add directory containing `alsa.pc` in PKG_CONFIG_PATH)
> +endif
>   
>   CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
>   LDLIBS += $(shell pkg-config --libs alsa)


Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah
Takashi Iwai Sept. 30, 2024, 7:48 a.m. UTC | #2
On Mon, 23 Sep 2024 00:58:18 +0200,
Abdul Rahim wrote:
> 
> Currently, if alsa development package is not installed on the user's
> system then the make command would print a `pagefull` of errors. In
> particular one error message is repeated 3 times. This error is returned
> by `pkg-config` and since it is not being handeled appropriately,
> repeated calls to `pkg-config` prints the same message again.
> 
> This patch adds check for alsa package installation. If alsa is not
> installed, a short and consize error is returned. Also, it does not
> affect the compilation of other tests.
> 
> Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>

Sorry for the late reply, as I've been off in the last weeks.

Now applied to for-linus branch.  Thanks.


Takashi
diff mbox series

Patch

diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
index 25be68025290..944279160fed 100644
--- a/tools/testing/selftests/alsa/Makefile
+++ b/tools/testing/selftests/alsa/Makefile
@@ -1,5 +1,9 @@ 
 # SPDX-License-Identifier: GPL-2.0
 #
+ifneq ($(shell pkg-config --exists alsa && echo 0 || echo 1),0)
+$(error Package alsa not found, please install alsa development package or \
+	add directory containing `alsa.pc` in PKG_CONFIG_PATH)
+endif
 
 CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
 LDLIBS += $(shell pkg-config --libs alsa)