Skip to contentSkip to conversation

flexible_arrays tests fixes

PATCH In review Alan Maguire 2 participants 5 messages Oct 24, 2024 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover flexible_arrays tests fixes

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(-)
Signature · 1 line
2.43.5
#1 lore raw

PATCH 1/2 tests/flexible_arrays: redirect stderr to avoid warnings

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.

---
 tests/flexible_arrays.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/flexible_arrays.sh +1 -1
index 7c21253..e9e3cb0 100755
@@ -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
Signature · 1 line
2.43.5

A message that is not in the archive (sent off-list or not yet received): CA+JHD923mvOrr9JoKeVkeB1k2PTGSHsi7=6HPrV4tVNF1R=GWA@mail.gmail.com

#3 lore raw

Re: [PATCH dwarves 1/2] tests/flexible_arrays: redirect stderr to avoid warnings

Quoted 23 lines · Arnaldo Carvalho de Melo

On Thu, Oct 24, 2024, 8:26 AM Alan Maguire <[email protected] <mailto:[email protected]>> 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?

Quoted 7 lines

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

Quoted 28 lines

Signed-off -by: Alan Maguire <[email protected] <mailto:[email protected]>>
---
 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

#4 lore raw

Re: [PATCH dwarves 1/2] tests/flexible_arrays: redirect stderr to avoid warnings

Quoted 32 lines · Alan Maguire
Quoted 23 lines · Arnaldo Carvalho de Melo

On Thu, Oct 24, 2024, 8:26 AM Alan Maguire <[email protected] <mailto:[email protected]>> 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?

Quoted 7 lines

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?

Quoted 8 lines

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

Quoted 28 lines
Quoted 28 lines

Signed-off -by: Alan Maguire <[email protected] <mailto:[email protected]>>
---
 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

#5 lore raw

PATCH 2/2 tests/flexible_arrays: print flex array struct from same vmlinux

In reply to Alan Maguire

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

---
 tests/flexible_arrays.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/flexible_arrays.sh +3 -3
index e9e3cb0..086db22 100755
@@ -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
 
Signature · 1 line
2.43.5