Skip to contentSkip to conversation

kselftest/alsa: add silent flag to reduce noise

PATCH In review Abdul Rahim 2 participants 9 messages Sep 15, 2024 – Sep 20, 2024 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 kselftest/alsa: add silent flag to reduce noise

When ALSA is not installed on the users system, the error:

"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"

is printed 3 times, which generates unnecessary noise. Hence, Remove unnecessary noise using --silence-errors on LDLIBS assignment, so the message is printed only once.

---
 tools/testing/selftests/alsa/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/alsa/Makefile +1 -1
index 25be68025290..cd022fc869fb 100644
@@ -2,7 +2,7 @@
 #
 
 CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
-LDLIBS += $(shell pkg-config --libs alsa)
+LDLIBS += $(shell pkg-config --silence-errors --libs alsa)
 ifeq ($(LDLIBS),)
 LDLIBS += -lasound
 endif
Signature · 1 line
2.46.0
#2 lore raw
Quoted 6 lines · Abdul Rahim

When ALSA is not installed on the users system, the error:

"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"

these errors are being printed by pkg-config and the last line is irrelevant in our context

Quoted 4 lines

is printed 3 times, which generates unnecessary noise. Hence, Remove unnecessary noise using --silence-errors on LDLIBS assignment, so the message is printed only once.

or should we return error if user does'nt have alsa and move to the next test?

Quoted 22 lines
---
 tools/testing/selftests/alsa/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/alsa/Makefile +1 -1
index 25be68025290..cd022fc869fb 100644
@@ -2,7 +2,7 @@
 #
 
 CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
-LDLIBS += $(shell pkg-config --libs alsa)
+LDLIBS += $(shell pkg-config --silence-errors --libs alsa)
 ifeq ($(LDLIBS),)
 LDLIBS += -lasound
 endif
Signature · 1 line
2.46.0
maintainer
#3 lore raw
In reply to Abdul Rahim
Quoted 7 lines · Abdul Rahim

When ALSA is not installed on the users system, the error:

"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"

extra line?

Quoted 3 lines

is printed 3 times, which generates unnecessary noise. Hence, Remove unnecessary noise using --silence-errors on LDLIBS assignment, so the message is printed only once.

I would say this message is alerting the user that the package is missing. Why would you want to delete it?

Quoted 11 lines
---
  tools/testing/selftests/alsa/Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/alsa/Makefile +0 -0
index 25be68025290..cd022fc869fb 100644

tools/testing/selftests/alsa/Makefile line 8

Quoted 8 lines
tools/testing/selftests/alsa/Makefile +1 -1
@@ -2,7 +2,7 @@
  #
 
  CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
-LDLIBS += $(shell pkg-config --libs alsa)
+LDLIBS += $(shell pkg-config --silence-errors --libs alsa)
  ifeq ($(LDLIBS),)
  LDLIBS += -lasound
  endif

thanks,
-- Shuah

#4 lore raw
Quoted 9 lines · Shuah Khan
Quoted 7 lines · Abdul Rahim

When ALSA is not installed on the users system, the error:

"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"

Quoted 8 lines

extra line?

Quoted 3 lines

is printed 3 times, which generates unnecessary noise. Hence, Remove unnecessary noise using --silence-errors on LDLIBS assignment, so the message is printed only once.

I would say this message is alerting the user that the package is missing. Why would you want to delete it?

I agree, but the same message is being printed 3 times

This patch makes it print only *once* !

Here's the output i'm currently seeing:

```
   CC       acct_syscall
 make[3]: Entering directory '/mnt/ubuntu/abdul_linux/mainline_dev/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_dev/usr/include -L/mnt/ubuntu/abdul_linux/mainline_dev/tools/testing/selftests/alsa -Wl,-rpa      th=./ -D_GNU_SOURCE=  -shared -fPIC conf.c  -lasound -lpthread -o /mnt/ubuntu/abdul_linux/mainline_dev/tools/testing/selftests/alsa/libates      t.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_dev/tools/testing/selftests/alsa/libatest.so] Error 1
 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'
 make[3]: Nothing to be done for 'all'.
 make[3]: Leaving directory '/mnt/ubuntu/abdul_linux/mainline_dev/tools/testing/selftests/amd-pstate'
```

These are errors are being returned from here
(tools/testing/seftests/alsa/Makefile):

CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES) <----1st
LDLIBS += $(shell pkg-config --libs alsa) <----2nd
ifeq ($(LDLIBS),) <----3rd

and the same error would be returned by all, if user does not have ALSA

so i put a --silence-errors on the second assignment.

Quoted 17 lines
Quoted 17 lines
---
  tools/testing/selftests/alsa/Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/alsa/Makefile +1 -1
index 25be68025290..cd022fc869fb 100644
@@ -2,7 +2,7 @@
  #
 
-LDLIBS += $(shell pkg-config --libs alsa)
+LDLIBS += $(shell pkg-config --silence-errors --libs alsa)
  ifeq ($(LDLIBS),)
  LDLIBS += -lasound
  endif
#5 lore raw
In reply to Shuah Khan
Quoted 24 lines · Shuah Khan
Quoted 7 lines · Abdul Rahim

When ALSA is not installed on the users system, the error:

"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"

extra line?

Quoted 3 lines

is printed 3 times, which generates unnecessary noise. Hence, Remove unnecessary noise using --silence-errors on LDLIBS assignment, so the message is printed only once.

I would say this message is alerting the user that the package is missing. Why would you want to delete it?

Quoted 6 lines
---
  tools/testing/selftests/alsa/Makefile | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines

tools/testing/selftests/alsa/Makefile line 7

Quoted 12 lines
tools/testing/selftests/alsa/Makefile +1 -1
index 25be68025290..cd022fc869fb 100644
@@ -2,7 +2,7 @@
  #
  CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
-LDLIBS += $(shell pkg-config --libs alsa)
+LDLIBS += $(shell pkg-config --silence-errors --libs alsa)
  ifeq ($(LDLIBS),)
  LDLIBS += -lasound
  endif

thanks,
-- Shuah

This can also be handled like this:
---
CHECK := $(shell pkg-config --exists alsa; echo $?)
ifneq ($(CHECK),0)
$(error Package alsa not found! Add directory containing alsa.pc in PKG_CONFIG_PATH) endif
---

Benefits:
- save computation, by not attempting compilation that is sure to fail
- reduce clutter in output;

Regards,
Abdul

maintainer
#6 lore raw
Quoted 43 lines · Abdul Rahim
Quoted 24 lines · Shuah Khan
Quoted 7 lines · Abdul Rahim

When ALSA is not installed on the users system, the error:

"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"

extra line?

Quoted 3 lines

is printed 3 times, which generates unnecessary noise. Hence, Remove unnecessary noise using --silence-errors on LDLIBS assignment, so the message is printed only once.

I would say this message is alerting the user that the package is missing. Why would you want to delete it?

Quoted 6 lines
---
   tools/testing/selftests/alsa/Makefile | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines

tools/testing/selftests/alsa/Makefile line 7

Quoted 12 lines
tools/testing/selftests/alsa/Makefile +1 -1
index 25be68025290..cd022fc869fb 100644
@@ -2,7 +2,7 @@
   #
   CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
-LDLIBS += $(shell pkg-config --libs alsa)
+LDLIBS += $(shell pkg-config --silence-errors --libs alsa)
   ifeq ($(LDLIBS),)
   LDLIBS += -lasound
   endif

thanks,
-- Shuah

Quoted 8 lines

This can also be handled like this:
---
CHECK := $(shell pkg-config --exists alsa; echo $?)
ifneq ($(CHECK),0)
$(error Package alsa not found! Add directory containing alsa.pc in PKG_CONFIG_PATH) endif
---

This is a better solution than suppressing errors.

thanks,
-- Shuah

maintainer
#7 lore raw
Quoted 53 lines · Shuah Khan
Quoted 43 lines · Abdul Rahim
Quoted 24 lines · Shuah Khan
Quoted 7 lines · Abdul Rahim

When ALSA is not installed on the users system, the error:

"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"

extra line?

Quoted 3 lines

is printed 3 times, which generates unnecessary noise. Hence, Remove unnecessary noise using --silence-errors on LDLIBS assignment, so the message is printed only once.

I would say this message is alerting the user that the package is missing. Why would you want to delete it?

Quoted 6 lines

---
   tools/testing/selftests/alsa/Makefile | 2 +-

   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
Quoted 10 lines
tools/testing/selftests/alsa/Makefile +1 -1
index 25be68025290..cd022fc869fb 100644
@@ -2,7 +2,7 @@
    #
    CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
-LDLIBS += $(shell pkg-config --libs alsa)
+LDLIBS += $(shell pkg-config --silence-errors --libs alsa)
    ifeq ($(LDLIBS),)
Quoted 2 lines

   LDLIBS += -lasound
   endif

thanks,
-- Shuah

Quoted 8 lines

This can also be handled like this:
---
CHECK := $(shell pkg-config --exists alsa; echo $?)
ifneq ($(CHECK),0)
$(error Package alsa not found! Add directory containing alsa.pc in PKG_CONFIG_PATH) endif
---

Quoted 2 lines

This is a better solution than suppressing errors.

One more thing. "make kselftest-all" has to continue even if this error causes alsa compile to fail.

thanks,
-- Shuah

#8 lore raw
Quoted 54 lines · Shuah Khan
Quoted 53 lines · Shuah Khan
Quoted 51 lines · Abdul Rahim
Quoted 24 lines · Shuah Khan
Quoted 7 lines · Abdul Rahim

When ALSA is not installed on the users system, the error:

"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"

extra line?

Quoted 3 lines

is printed 3 times, which generates unnecessary noise. Hence, Remove unnecessary noise using --silence-errors on LDLIBS assignment, so the message is printed only once.

I would say this message is alerting the user that the package is missing. Why would you want to delete it?

Quoted 6 lines

---
�� tools/testing/selftests/alsa/Makefile | 2 +- �� 1 file changed, 1 insertion(+), 1 deletion(-)

Quoted 17 lines
Quoted 9 lines
tools/testing/selftests/alsa/Makefile +0 -0
index 25be68025290..cd022fc869fb 100644
@@ -2,7 +2,7 @@

�� #
�� CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)

tools/testing/selftests/alsa/Makefile +1 -1
-LDLIBS += $(shell pkg-config --libs alsa)
+LDLIBS += $(shell pkg-config --silence-errors --libs alsa)
Quoted 3 lines

�� ifeq ($(LDLIBS),)
�� LDLIBS += -lasound
�� endif

thanks,
-- Shuah

This can also be handled like this:
---
CHECK := $(shell pkg-config --exists alsa; echo $?)
ifneq ($(CHECK),0)
$(error Package alsa not found! Add directory containing alsa.pc in PKG_CONFIG_PATH) endif
---

Quoted 9 lines
Quoted 2 lines

This is a better solution than suppressing errors.

One more thing. "make kselftest-all" has to continue even if this error causes alsa compile to fail.

thanks,
-- Shuah

sure

#9 lore raw
In reply to Shuah Khan
Quoted 53 lines · Shuah Khan
Quoted 43 lines · Abdul Rahim
Quoted 24 lines · Shuah Khan
Quoted 7 lines · Abdul Rahim

When ALSA is not installed on the users system, the error:

"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"

extra line?

Quoted 3 lines

is printed 3 times, which generates unnecessary noise. Hence, Remove unnecessary noise using --silence-errors on LDLIBS assignment, so the message is printed only once.

I would say this message is alerting the user that the package is missing. Why would you want to delete it?

Quoted 6 lines
---
   tools/testing/selftests/alsa/Makefile | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines

tools/testing/selftests/alsa/Makefile line 7

Quoted 12 lines
tools/testing/selftests/alsa/Makefile +1 -1
index 25be68025290..cd022fc869fb 100644
@@ -2,7 +2,7 @@
   #
   CFLAGS += $(shell pkg-config --cflags alsa) $(KHDR_INCLUDES)
-LDLIBS += $(shell pkg-config --libs alsa)
+LDLIBS += $(shell pkg-config --silence-errors --libs alsa)
   ifeq ($(LDLIBS),)
   LDLIBS += -lasound
   endif

thanks,
-- Shuah

Quoted 8 lines

This can also be handled like this:
---
CHECK := $(shell pkg-config --exists alsa; echo $?)
ifneq ($(CHECK),0)
$(error Package alsa not found! Add directory containing alsa.pc in PKG_CONFIG_PATH) endif
---

Quoted 5 lines

This is a better solution than suppressing errors.

thanks,
-- Shuah

Yes, i see. Because other errors can also be silenced. I'll resend this one

Thanks mam