public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH dwarves 0/2] tests: reproducible_build/btf_functions fix
@ 2024-10-02 11:33 Alan Maguire
  2024-10-02 11:33 ` [PATCH dwarves 1/2] tests/reproducible_build: fix vmlinux finding logic Alan Maguire
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alan Maguire @ 2024-10-02 11:33 UTC (permalink / raw)
  To: acme; +Cc: dwarves, Alan Maguire

Patch 1 fixes specification of vmlinux in the reproducible_build test
to support env var, command line parameter and pahole-based discovery.
Patch 2 reduces verbosity of btf_functions test.

Alan Maguire (2):
  tests/reproducible_build: fix vmlinux finding logic
  tests/btf_functions: reduce verbosity of test

 tests/btf_functions.sh      | 54 ++++++++++++++++++++-----------------
 tests/reproducible_build.sh |  4 +--
 2 files changed, 31 insertions(+), 27 deletions(-)

-- 
2.43.5


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

* [PATCH dwarves 1/2] tests/reproducible_build: fix vmlinux finding logic
  2024-10-02 11:33 [PATCH dwarves 0/2] tests: reproducible_build/btf_functions fix Alan Maguire
@ 2024-10-02 11:33 ` Alan Maguire
  2024-10-02 11:33 ` [PATCH dwarves 2/2] tests/btf_functions: reduce verbosity of test Alan Maguire
  2024-10-03 14:39 ` [PATCH dwarves 0/2] tests: reproducible_build/btf_functions fix Arnaldo Carvalho de Melo
  2 siblings, 0 replies; 5+ messages in thread
From: Alan Maguire @ 2024-10-02 11:33 UTC (permalink / raw)
  To: acme; +Cc: dwarves, Alan Maguire

In updating the logic that finds the path for vmlinux, it is useful
to support a few different options

1. command-line parameter specification
2. retrieval via pahole option
3. environment variable based retrieval

Options 2 and 3 are useful for the case where the script is run
via the tests script.  When adding support for 3 I incorrectly
specified

vmlinx=${vmlinux:-1}

...which should have been

vmlinux=${vmlinux:-$1}

i.e. assign var vmlinux to the env var vmlinux if set, and if that
is not set, use the first parameter for the vmlinux value.  If neither
are set we can then fall back to the pahole option.

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

diff --git a/tests/reproducible_build.sh b/tests/reproducible_build.sh
index 19ef227..c595636 100755
--- a/tests/reproducible_build.sh
+++ b/tests/reproducible_build.sh
@@ -4,12 +4,12 @@
 # Test if BTF generated serially matches reproducible parallel DWARF loading + serial BTF encoding
 # Arnaldo Carvalho de Melo <acme@redhat.com> (C) 2024-
 
+vmlinux=${vmlinux:-$1}
+
 if [ -z "$vmlinux" ] ; then
 	vmlinux=$(pahole --running_kernel_vmlinux)
 fi
 
-vmlinux=${vmlinux:-1}
-
 if [ ! -f "$vmlinux" ] ; then
 	echo "$vmlinux file not available, please specify another"
 	exit 2
-- 
2.43.5


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

* [PATCH dwarves 2/2] tests/btf_functions: reduce verbosity of test
  2024-10-02 11:33 [PATCH dwarves 0/2] tests: reproducible_build/btf_functions fix Alan Maguire
  2024-10-02 11:33 ` [PATCH dwarves 1/2] tests/reproducible_build: fix vmlinux finding logic Alan Maguire
@ 2024-10-02 11:33 ` Alan Maguire
  2024-10-03 14:56   ` Arnaldo Carvalho de Melo
  2024-10-03 14:39 ` [PATCH dwarves 0/2] tests: reproducible_build/btf_functions fix Arnaldo Carvalho de Melo
  2 siblings, 1 reply; 5+ messages in thread
From: Alan Maguire @ 2024-10-02 11:33 UTC (permalink / raw)
  To: acme; +Cc: dwarves, Alan Maguire, Arnaldo Carvalho de Melo

when in non-verbose mode, emit a single line describing test + result.

Non-verbose output now looks like this:

  1: Validation of BTF encoding of functions; this may take some time: Ok

Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
 tests/btf_functions.sh | 54 +++++++++++++++++++++++-------------------
 1 file changed, 29 insertions(+), 25 deletions(-)

diff --git a/tests/btf_functions.sh b/tests/btf_functions.sh
index fbe68f9..5794be9 100755
--- a/tests/btf_functions.sh
+++ b/tests/btf_functions.sh
@@ -45,15 +45,14 @@ outdir=$(mktemp -d /tmp/btf_functions.sh.XXXXXX)
 
 trap cleanup EXIT
 
-test -n "$VERBOSE" && printf "Encoding..."
+echo -n "Validation of BTF encoding of functions; this may take some time: "
+test -n "$VERBOSE" && printf "\nEncoding..."
 
 pahole --btf_features=default --btf_encode_detached=$outdir/vmlinux.btf --verbose $vmlinux |\
 	grep "skipping BTF encoding of function" > ${outdir}/skipped_fns
 
 test -n "$VERBOSE" && printf "done.\n"
 
-echo "Validation of BTF encoding of functions; this may take some time..."
-
 funcs=$(pfunct --format_path=btf $outdir/vmlinux.btf |sort)
 
 # all functions from DWARF; some inline functions are not inlined so include them too
@@ -93,12 +92,13 @@ while IFS= read -r btf ; do
 	fi
 done < $outdir/btf.funcs
 
-echo "Matched $exact functions exactly."
-echo "Matched $inline functions with inlines."
-echo "Matched $const_insensitive functions with multiple const/non-const instances."
-echo "Ok"
-
-echo "Validation of skipped function logic..."
+if [[ -n "$VERBOSE" ]]; then
+	echo "Matched $exact functions exactly."
+	echo "Matched $inline functions with inlines."
+	echo "Matched $const_insensitive functions with multiple const/non-const instances."
+	echo "Ok"
+	echo "Validation of skipped function logic..."
+fi
 
 skipped_cnt=$(wc -l ${outdir}/skipped_fns | awk '{ print $1}')
 
@@ -107,8 +107,6 @@ if [[ "$skipped_cnt" == "0" ]]; then
 	exit 0
 fi
 
-echo "Validating skipped functions are absent from BTF..."
-
 skipped_fns=$(awk '{print $1}' $outdir/skipped_fns)
 for s in $skipped_fns ; do
 	# Ensure the skipped function are not in BTF
@@ -119,10 +117,11 @@ for s in $skipped_fns ; do
 	fi
 done
 
-echo "Skipped encoding $skipped_cnt functions in BTF."
-echo "Ok"
-
-echo "Validating skipped functions have incompatible return values..."
+if [[ -n "$VERBOSE" ]]; then
+	echo "Skipped encoding $skipped_cnt functions in BTF."
+	echo "Ok"
+	echo "Validating skipped functions have incompatible return values..."
+fi
 
 return_mismatches=$(awk '/return type mismatch/ { print $1 }' $outdir/skipped_fns)
 return_count=0
@@ -140,10 +139,11 @@ for r in $return_mismatches ; do
 	return_count=$((return_count+1))
 done
 
-echo "Found $return_count functions with multiple incompatible return values."
-echo "Ok"
-
-echo "Validating skipped functions have incompatible params/counts..."
+if [[ -n "$VERBOSE" ]]; then
+	echo "Found $return_count functions with multiple incompatible return values."
+	echo "Ok"
+	echo "Validating skipped functions have incompatible params/counts..."
+fi
 
 param_mismatches=$(awk '/due to param / { print $1 }' $outdir/skipped_fns)
 
@@ -168,8 +168,10 @@ for p in $param_mismatches ; do
 		if [[ -n "$inlined" ]]; then
 			multiple_inline=$((multiple_inline+1))
 		else
-			echo "WARN: '${p}()' has only one prototype; if it was subject to late optimization, pfunct may not reflect inconsistencies pahole found."
-			echo "Full skip message from pahole: $skipmsg"
+			if [[ -n "$VERBOSE" ]]; then
+				echo "WARN: '${p}()' has only one prototype; if it was subject to late optimization, pfunct may not reflect inconsistencies pahole found."
+				echo "Full skip message from pahole: $skipmsg"
+			fi
 			warnings=$((warnings+1))
 		fi
 	else
@@ -177,10 +179,12 @@ for p in $param_mismatches ; do
 	fi
 done
 
-echo "Found $multiple instances with multiple instances with incompatible parameters."
-echo "Found $multiple_inline instances where inline functions were not inlined and had incompatible parameters."
-echo "Found $optimized instances where the function name suggests optimizations led to inconsistent parameters."
-echo "Found $warnings instances where pfunct did not notice inconsistencies."
+if [[ -n "$VERBOSE" ]]; then
+	echo "Found $multiple instances with multiple instances with incompatible parameters."
+	echo "Found $multiple_inline instances where inline functions were not inlined and had incompatible parameters."
+	echo "Found $optimized instances where the function name suggests optimizations led to inconsistent parameters."
+	echo "Found $warnings instances where pfunct did not notice inconsistencies."
+fi
 echo "Ok"
 
 exit 0
-- 
2.43.5


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

* Re: [PATCH dwarves 0/2] tests: reproducible_build/btf_functions fix
  2024-10-02 11:33 [PATCH dwarves 0/2] tests: reproducible_build/btf_functions fix Alan Maguire
  2024-10-02 11:33 ` [PATCH dwarves 1/2] tests/reproducible_build: fix vmlinux finding logic Alan Maguire
  2024-10-02 11:33 ` [PATCH dwarves 2/2] tests/btf_functions: reduce verbosity of test Alan Maguire
@ 2024-10-03 14:39 ` Arnaldo Carvalho de Melo
  2 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-03 14:39 UTC (permalink / raw)
  To: Alan Maguire; +Cc: dwarves

On Wed, Oct 02, 2024 at 12:33:24PM +0100, Alan Maguire wrote:
> Patch 1 fixes specification of vmlinux in the reproducible_build test
> to support env var, command line parameter and pahole-based discovery.
> Patch 2 reduces verbosity of btf_functions test.

Thanks, applied.

- Arnaldo

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

* Re: [PATCH dwarves 2/2] tests/btf_functions: reduce verbosity of test
  2024-10-02 11:33 ` [PATCH dwarves 2/2] tests/btf_functions: reduce verbosity of test Alan Maguire
@ 2024-10-03 14:56   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-03 14:56 UTC (permalink / raw)
  To: Alan Maguire; +Cc: dwarves, Arnaldo Carvalho de Melo

On Wed, Oct 02, 2024 at 12:33:26PM +0100, Alan Maguire wrote:
> when in non-verbose mode, emit a single line describing test + result.
> 
> Non-verbose output now looks like this:
> 
>   1: Validation of BTF encoding of functions; this may take some time: Ok

Thanks, looks great now!

I added this to the commit log message so that we see how a full
tests/tests runs looks like:

Committer testing:

  acme@x1:~/git/pahole$ time tests/tests
    1: Validation of BTF encoding of functions; this may take some time: Ok
    2: Pretty printing of files using DWARF type information: Ok
    3: Parallel reproducible DWARF Loading/Serial BTF encoding: Ok
  /home/acme/git/pahole
 
  real  10m54.784s
  user  9m43.335s
  sys   5m14.034s
  acme@x1:~/git/pahole$ grep -m1 "model name" /proc/cpuinfo
  model name    : 13th Gen Intel(R) Core(TM) i7-1365U
  acme@x1:~/git/pahole$

Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>

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

end of thread, other threads:[~2024-10-03 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-02 11:33 [PATCH dwarves 0/2] tests: reproducible_build/btf_functions fix Alan Maguire
2024-10-02 11:33 ` [PATCH dwarves 1/2] tests/reproducible_build: fix vmlinux finding logic Alan Maguire
2024-10-02 11:33 ` [PATCH dwarves 2/2] tests/btf_functions: reduce verbosity of test Alan Maguire
2024-10-03 14:56   ` Arnaldo Carvalho de Melo
2024-10-03 14:39 ` [PATCH dwarves 0/2] tests: reproducible_build/btf_functions fix Arnaldo Carvalho de Melo

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