diff mbox series

kselftest/alsa: add silent flag to reduce noise

Message ID 20240915234131.61962-2-abdul.rahim@myyahoo.com (mailing list archive)
State New, archived
Headers show
Series kselftest/alsa: add silent flag to reduce noise | expand

Commit Message

Abdul Rahim Sept. 15, 2024, 11:41 p.m. UTC
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.

Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
---
 tools/testing/selftests/alsa/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Abdul Rahim Sept. 15, 2024, 11:53 p.m. UTC | #1
On Mon, Sep 16, 2024 at 05:11:30AM GMT, Abdul Rahim wrote:
> 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
> 
> 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?
> 
> Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
> ---
>  tools/testing/selftests/alsa/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
> index 25be68025290..cd022fc869fb 100644
> --- a/tools/testing/selftests/alsa/Makefile
> +++ b/tools/testing/selftests/alsa/Makefile
> @@ -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
> -- 
> 2.46.0
>
Shuah Khan Sept. 19, 2024, 3:40 p.m. UTC | #2
On 9/15/24 17:41, Abdul Rahim wrote:
> 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?

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

> 
> Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
> ---
>   tools/testing/selftests/alsa/Makefile | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
> index 25be68025290..cd022fc869fb 100644
> --- a/tools/testing/selftests/alsa/Makefile
> +++ b/tools/testing/selftests/alsa/Makefile
> @@ -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
Abdul Rahim Sept. 19, 2024, 8:09 p.m. UTC | #3
On Thu, Sep 19, 2024 at 09:40:34AM GMT, Shuah Khan wrote:
> On 9/15/24 17:41, Abdul Rahim wrote:
> > 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?
> 
> > 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.

> > Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
> > ---
> >   tools/testing/selftests/alsa/Makefile | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
> > index 25be68025290..cd022fc869fb 100644
> > --- a/tools/testing/selftests/alsa/Makefile
> > +++ b/tools/testing/selftests/alsa/Makefile
> > @@ -2,7 +2,7 @@
> >   #

> > -LDLIBS += $(shell pkg-config --libs alsa)
> > +LDLIBS += $(shell pkg-config --silence-errors --libs alsa)
> >   ifeq ($(LDLIBS),)
> >   LDLIBS += -lasound
> >   endif
Abdul Rahim Sept. 19, 2024, 9:49 p.m. UTC | #4
On Thu, Sep 19, 2024 at 09:40:34AM GMT, Shuah Khan wrote:
> On 9/15/24 17:41, Abdul Rahim wrote:
> > 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?
> 
> > 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?
> 
> > 
> > Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
> > ---
> >   tools/testing/selftests/alsa/Makefile | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
> > index 25be68025290..cd022fc869fb 100644
> > --- a/tools/testing/selftests/alsa/Makefile
> > +++ b/tools/testing/selftests/alsa/Makefile
> > @@ -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
Shuah Khan Sept. 20, 2024, 3:27 p.m. UTC | #5
On 9/19/24 15:49, Abdul Rahim wrote:
> On Thu, Sep 19, 2024 at 09:40:34AM GMT, Shuah Khan wrote:
>> On 9/15/24 17:41, Abdul Rahim wrote:
>>> 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?
>>
>>> 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?
>>
>>>
>>> Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
>>> ---
>>>    tools/testing/selftests/alsa/Makefile | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
>>> index 25be68025290..cd022fc869fb 100644
>>> --- a/tools/testing/selftests/alsa/Makefile
>>> +++ b/tools/testing/selftests/alsa/Makefile
>>> @@ -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
> ---
> 

This is a better solution than suppressing errors.

thanks,
-- Shuah
Shuah Khan Sept. 20, 2024, 4:24 p.m. UTC | #6
On 9/20/24 09:27, Shuah Khan wrote:
> On 9/19/24 15:49, Abdul Rahim wrote:
>> On Thu, Sep 19, 2024 at 09:40:34AM GMT, Shuah Khan wrote:
>>> On 9/15/24 17:41, Abdul Rahim wrote:
>>>> 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?
>>>
>>>> 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?
>>>
>>>>
>>>> Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
>>>> ---
>>>>    tools/testing/selftests/alsa/Makefile | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
>>>> index 25be68025290..cd022fc869fb 100644
>>>> --- a/tools/testing/selftests/alsa/Makefile
>>>> +++ b/tools/testing/selftests/alsa/Makefile
>>>> @@ -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
>> ---
>>
> 
> 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
Abdul Rahim Sept. 20, 2024, 10:31 p.m. UTC | #7
On Fri, Sep 20, 2024 at 09:27:03AM -0600, Shuah Khan wrote:
> On 9/19/24 15:49, Abdul Rahim wrote:
> > On Thu, Sep 19, 2024 at 09:40:34AM GMT, Shuah Khan wrote:
> > > On 9/15/24 17:41, Abdul Rahim wrote:
> > > > 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?
> > > 
> > > > 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?
> > > 
> > > > 
> > > > Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
> > > > ---
> > > >    tools/testing/selftests/alsa/Makefile | 2 +-
> > > >    1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
> > > > index 25be68025290..cd022fc869fb 100644
> > > > --- a/tools/testing/selftests/alsa/Makefile
> > > > +++ b/tools/testing/selftests/alsa/Makefile
> > > > @@ -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
> > ---
> > 
> 
> 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
Abdul Rahim Sept. 20, 2024, 10:35 p.m. UTC | #8
On Fri, Sep 20, 2024 at 10:24:56AM -0600, Shuah Khan wrote:
> On 9/20/24 09:27, Shuah Khan wrote:
> > On 9/19/24 15:49, Abdul Rahim wrote:
> > > On Thu, Sep 19, 2024 at 09:40:34AM GMT, Shuah Khan wrote:
> > > > On 9/15/24 17:41, Abdul Rahim wrote:
> > > > > 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?
> > > > 
> > > > > 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?
> > > > 
> > > > > 
> > > > > Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>
> > > > > ---
> > > > > �� tools/testing/selftests/alsa/Makefile | 2 +-
> > > > > �� 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
> > > > > index 25be68025290..cd022fc869fb 100644
> > > > > --- a/tools/testing/selftests/alsa/Makefile
> > > > > +++ b/tools/testing/selftests/alsa/Makefile
> > > > > @@ -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
> > > ---
> > > 
> > 
> > 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
diff mbox series

Patch

diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
index 25be68025290..cd022fc869fb 100644
--- a/tools/testing/selftests/alsa/Makefile
+++ b/tools/testing/selftests/alsa/Makefile
@@ -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