public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH dwarves 0/2] flexible_arrays tests fixes
@ 2024-10-24 11:26 Alan Maguire
  2024-10-24 11:26 ` [PATCH dwarves 1/2] tests/flexible_arrays: redirect stderr to avoid warnings Alan Maguire
  2024-10-24 11:26 ` [PATCH dwarves 2/2] tests/flexible_arrays: print flex array struct from same vmlinux Alan Maguire
  0 siblings, 2 replies; 5+ messages in thread
From: Alan Maguire @ 2024-10-24 11:26 UTC (permalink / raw)
  To: acme; +Cc: dwarves, Alan Maguire

Two small fixes for the flex arrays tests; redirect stderr
to avoid seeing warnings during tests (patch 1), and ensure
we are printing flex arrays from the same vmlinux (patch 2).

Alan Maguire (2):
  tests/flexible_arrays: redirect stderr to avoid warnings
  tests/flexible_arrays: print flex array struct from same vmlinux

 tests/flexible_arrays.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.43.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH dwarves 1/2] tests/flexible_arrays: redirect stderr to avoid warnings
  2024-10-24 11:26 [PATCH dwarves 0/2] flexible_arrays tests fixes Alan Maguire
@ 2024-10-24 11:26 ` Alan Maguire
       [not found]   ` <CA+JHD923mvOrr9JoKeVkeB1k2PTGSHsi7=6HPrV4tVNF1R=GWA@mail.gmail.com>
  2024-10-24 11:26 ` [PATCH dwarves 2/2] tests/flexible_arrays: print flex array struct from same vmlinux Alan Maguire
  1 sibling, 1 reply; 5+ messages in thread
From: Alan Maguire @ 2024-10-24 11:26 UTC (permalink / raw)
  To: acme; +Cc: dwarves, Alan Maguire

With recent kernel, saw

  2: Flexible arrays accounting: WARNING: still unsuported BTF_KIND_DECL_TAG(bpf_fastcall) for bpf_cast_to_kern_ctx already with attribute (bpf_kfunc), ignoring
WARNING: still unsuported BTF_KIND_DECL_TAG(bpf_fastcall) for bpf_rdonly_cast already with attribute (bpf_kfunc), ignoring
Ok

Redirect pahole output to avoid seeing the stderr messaging.

Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
 tests/flexible_arrays.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/flexible_arrays.sh b/tests/flexible_arrays.sh
index 7c21253..e9e3cb0 100755
--- a/tests/flexible_arrays.sh
+++ b/tests/flexible_arrays.sh
@@ -20,7 +20,7 @@ pretty=$(mktemp /tmp/flexible_arrays.data.sh.XXXXXX.c)
 
 echo -n "Flexible arrays accounting: "
 
-for struct in $(pahole -F btf --sizes --with_embedded_flexible_array $vmlinux | cut -f1) ; do
+for struct in $(pahole -F btf --sizes --with_embedded_flexible_array $vmlinux 2>/dev/null| cut -f1) ; do
 	pahole $struct > $pretty
 
 	# We need to check for just one tab before the comment as when expanding unnamed
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH dwarves 2/2] tests/flexible_arrays: print flex array struct from same vmlinux
  2024-10-24 11:26 [PATCH dwarves 0/2] flexible_arrays tests fixes Alan Maguire
  2024-10-24 11:26 ` [PATCH dwarves 1/2] tests/flexible_arrays: redirect stderr to avoid warnings Alan Maguire
@ 2024-10-24 11:26 ` Alan Maguire
  1 sibling, 0 replies; 5+ messages in thread
From: Alan Maguire @ 2024-10-24 11:26 UTC (permalink / raw)
  To: acme; +Cc: dwarves, Alan Maguire

We get a list of flexible array structs from $vmlinux; use the
same $vmlinux to print each struct.

Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
 tests/flexible_arrays.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/flexible_arrays.sh b/tests/flexible_arrays.sh
index e9e3cb0..086db22 100755
--- a/tests/flexible_arrays.sh
+++ b/tests/flexible_arrays.sh
@@ -21,7 +21,7 @@ pretty=$(mktemp /tmp/flexible_arrays.data.sh.XXXXXX.c)
 echo -n "Flexible arrays accounting: "
 
 for struct in $(pahole -F btf --sizes --with_embedded_flexible_array $vmlinux 2>/dev/null| cut -f1) ; do
-	pahole $struct > $pretty
+	pahole $struct $vmlinux > $pretty
 
 	# We need to check for just one tab before the comment as when expanding unnamed
 	# structs with members with flexible arrays inside another struct we would mess
@@ -54,14 +54,14 @@ for struct in $(pahole -F btf --sizes --with_embedded_flexible_array $vmlinux 2>
 	if [ "$nr_embedded_flexible_arrays" != "$stat_nr_embedded_flexible_arrays" ] ; then
 		test -n "$VERBOSE" && printf "struct %s: The number of embedded flexible arrays (%s) doesn't match the number of members marked as such (%s)\n" \
 			"$struct" "$stat_nr_embedded_flexible_arrays" "$nr_embedded_flexible_arrays"
-		test -n "$VERBOSE" && pahole $struct
+		test -n "$VERBOSE" && pahole $struct $vmlinux
 		FAILED=1
 	fi
 
 	if [ "$nr_flexible_arrays" != "$stat_nr_flexible_arrays" ] ; then
 		test -n "$VERBOSE" && printf "struct %s: The number of flexible arrays (%s) doesn't match the number of members marked as such (%s)\n" \
 			"$struct" "$stat_nr_flexible_arrays" "$nr_flexible_arrays"
-		test -n "$VERBOSE" && pahole $struct
+		test -n "$VERBOSE" && pahole $struct $vmlinux
 		FAILED=1
 	fi
 
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH dwarves 1/2] tests/flexible_arrays: redirect stderr to avoid warnings
       [not found]   ` <CA+JHD923mvOrr9JoKeVkeB1k2PTGSHsi7=6HPrV4tVNF1R=GWA@mail.gmail.com>
@ 2024-10-24 13:01     ` Alan Maguire
  2024-10-24 13:45       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Maguire @ 2024-10-24 13:01 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Arnaldo Carvalho de Melo, dwarves

On 24/10/2024 13:13, Arnaldo Carvalho de Melo wrote:
> 
> On Thu, Oct 24, 2024, 8:26 AM Alan Maguire <alan.maguire@oracle.com
> <mailto:alan.maguire@oracle.com>> wrote:
> 
>     With recent kernel, saw
> 
>       2: Flexible arrays accounting: WARNING: still unsuported
>     BTF_KIND_DECL_TAG(bpf_fastcall) for bpf_cast_to_kern_ctx already
>     with attribute (bpf_kfunc), ignoring
>     WARNING: still unsuported BTF_KIND_DECL_TAG(bpf_fastcall) for
>     bpf_rdonly_cast already with attribute (bpf_kfunc), ignoring
>     Ok
> 
>     Redirect pahole output to avoid seeing the stderr messaging.
> 
> 
> 
> This is something I kinda expect from these tests, now I want to get
> hold of such a vmlinux to understand what's needed to address the warning. 
>  
> Maybe have a quiet mode for testing just what's supported in a released
> version when tested by packagers?
> 
> Maybe not, as knowing that they have a kernel with a feature unsupported
> by pahole may be important and should elicit measures to either get a
> newer version of pahole or disable a still experimental feature in their
> kernel? 
> 
> WDYT?
> 

Good point on the visibility of warnings being useful. We have VERBOSE
already so it seems like having QUIET (implying stderr > /dev/null)
would be easiest to add at this stage rather than having to add multiple
levels to VERBOSE. Maybe QUIET isn't even needed though as the above is
still clearly a test pass, and the messaging doesn't interfere with test
success.

Probably best to drop this one for now anyway..
> 
> 
>     Signed-off -by: Alan Maguire <alan.maguire@oracle.com
>     <mailto:alan.maguire@oracle.com>>
>     ---
>      tests/flexible_arrays.sh | 2 +-
>      1 file changed, 1 insertion(+), 1 deletion(-)
> 
>     diff --git a/tests/flexible_arrays.sh b/tests/flexible_arrays.sh
>     index 7c21253..e9e3cb0 100755
>     --- a/tests/flexible_arrays.sh
>     +++ b/tests/flexible_arrays.sh
>     @@ -20,7 +20,7 @@ pretty=$(mktemp /tmp/flexible_arrays.data.sh
>     <http://flexible_arrays.data.sh>.XXXXXX.c)
> 
>      echo -n "Flexible arrays accounting: "
> 
>     -for struct in $(pahole -F btf --sizes --
>     with_embedded_flexible_array $vmlinux | cut -f1) ; do
>     +for struct in $(pahole -F btf --sizes --
>     with_embedded_flexible_array $vmlinux 2>/dev/null| cut -f1) ; do
>             pahole $struct > $pretty
> 
>             # We need to check for just one tab before the comment as
>     when expanding unnamed
>     -- 
>     2.43.5
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH dwarves 1/2] tests/flexible_arrays: redirect stderr to avoid warnings
  2024-10-24 13:01     ` Alan Maguire
@ 2024-10-24 13:45       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-24 13:45 UTC (permalink / raw)
  To: Alan Maguire; +Cc: Arnaldo Carvalho de Melo, dwarves

On Thu, Oct 24, 2024 at 02:01:21PM +0100, Alan Maguire wrote:
> On 24/10/2024 13:13, Arnaldo Carvalho de Melo wrote:
> > 
> > On Thu, Oct 24, 2024, 8:26 AM Alan Maguire <alan.maguire@oracle.com
> > <mailto:alan.maguire@oracle.com>> wrote:
> > 
> >     With recent kernel, saw
> > 
> >       2: Flexible arrays accounting: WARNING: still unsuported
> >     BTF_KIND_DECL_TAG(bpf_fastcall) for bpf_cast_to_kern_ctx already
> >     with attribute (bpf_kfunc), ignoring
> >     WARNING: still unsuported BTF_KIND_DECL_TAG(bpf_fastcall) for
> >     bpf_rdonly_cast already with attribute (bpf_kfunc), ignoring
> >     Ok
> > 
> >     Redirect pahole output to avoid seeing the stderr messaging.
> > 
> > 
> > 
> > This is something I kinda expect from these tests, now I want to get
> > hold of such a vmlinux to understand what's needed to address the warning. 
> >  
> > Maybe have a quiet mode for testing just what's supported in a released
> > version when tested by packagers?
> > 
> > Maybe not, as knowing that they have a kernel with a feature unsupported
> > by pahole may be important and should elicit measures to either get a
> > newer version of pahole or disable a still experimental feature in their
> > kernel? 
> > 
> > WDYT?
> > 
> 
> Good point on the visibility of warnings being useful. We have VERBOSE
> already so it seems like having QUIET (implying stderr > /dev/null)
> would be easiest to add at this stage rather than having to add multiple
> levels to VERBOSE. Maybe QUIET isn't even needed though as the above is
> still clearly a test pass, and the messaging doesn't interfere with test
> success.
> 
> Probably best to drop this one for now anyway..

That is what I did, agreed.

I adapted the second one to this fact and applied it, thanks!

- Arnaldo

> > 
> > 
> >     Signed-off -by: Alan Maguire <alan.maguire@oracle.com
> >     <mailto:alan.maguire@oracle.com>>
> >     ---
> >      tests/flexible_arrays.sh | 2 +-
> >      1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> >     diff --git a/tests/flexible_arrays.sh b/tests/flexible_arrays.sh
> >     index 7c21253..e9e3cb0 100755
> >     --- a/tests/flexible_arrays.sh
> >     +++ b/tests/flexible_arrays.sh
> >     @@ -20,7 +20,7 @@ pretty=$(mktemp /tmp/flexible_arrays.data.sh
> >     <http://flexible_arrays.data.sh>.XXXXXX.c)
> > 
> >      echo -n "Flexible arrays accounting: "
> > 
> >     -for struct in $(pahole -F btf --sizes --
> >     with_embedded_flexible_array $vmlinux | cut -f1) ; do
> >     +for struct in $(pahole -F btf --sizes --
> >     with_embedded_flexible_array $vmlinux 2>/dev/null| cut -f1) ; do
> >             pahole $struct > $pretty
> > 
> >             # We need to check for just one tab before the comment as
> >     when expanding unnamed
> >     -- 
> >     2.43.5
> > 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-24 13:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-24 11:26 [PATCH dwarves 0/2] flexible_arrays tests fixes Alan Maguire
2024-10-24 11:26 ` [PATCH dwarves 1/2] tests/flexible_arrays: redirect stderr to avoid warnings Alan Maguire
     [not found]   ` <CA+JHD923mvOrr9JoKeVkeB1k2PTGSHsi7=6HPrV4tVNF1R=GWA@mail.gmail.com>
2024-10-24 13:01     ` Alan Maguire
2024-10-24 13:45       ` Arnaldo Carvalho de Melo
2024-10-24 11:26 ` [PATCH dwarves 2/2] tests/flexible_arrays: print flex array struct from same vmlinux Alan Maguire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox