On Tue, 12 May 2020, Arkadiusz Hiler <[email protected]> wrote:
> Running sparse on each commit in the provided range can be very time
> consuming for large series.
>
> With --fast switch we treat the whole range as a single change that gets
> checked for any new sparse errors.

Thanks, pushed with the leading spaces switched to tabs.

BR,
Jani.


>
> Cc: Jani Nikula <[email protected]>
> Signed-off-by: Arkadiusz Hiler <[email protected]>
> ---
>  dim     | 21 ++++++++++++++++++---
>  dim.rst |  8 +++++---
>  2 files changed, 23 insertions(+), 6 deletions(-)
>
> diff --git a/dim b/dim
> index 1e61fe2..5264049 100755
> --- a/dim
> +++ b/dim
> @@ -1786,8 +1786,14 @@ function _restore_head_on_exit
>  
>  function dim_sparse
>  {
> -     local range rv sr prev_sr prev_remapped diff_result remap_log commits
> +     local range rv sr prev_sr prev_remapped diff_result remap_log commits 
> fast prev_rev
>  
> +    if [ "$1" == "--fast" ]; then
> +        fast=1
> +        shift
> +    fi
> +
> +    prev_rev="HEAD~"
>       range=$(rangeish "${1:-}")
>       remap_log=$DIM_PREFIX/maintainer-tools/remap-log
>  
> @@ -1806,6 +1812,13 @@ function dim_sparse
>       make olddefconfig > /dev/null 2>&1
>       make -j8 drivers/gpu/drm/ > /dev/null 2>&1
>  
> +    if [ "$fast" == 1 ]; then
> +        prev_rev="${commits[0]}~"
> +        commits=( "${commits[-1]}" )
> +
> +        echo "Fast mode used, each commit won't be checked separately."
> +    fi
> +
>       for commit in "${commits[@]}"; do
>               touch --no-create $(git diff --name-only $commit~...$commit)
>               prev_sr="$(make C=1 -j$(nproc) drivers/gpu/drm/ 2>&1 
> 1>/dev/null)"
> @@ -1814,10 +1827,12 @@ function dim_sparse
>               make olddefconfig > /dev/null 2>&1
>               sr="$(make C=1 -j$(nproc) drivers/gpu/drm/ 2>&1 1>/dev/null)"
>  
> -             prev_remapped="$(echo "$prev_sr" | $remap_log <(git diff HEAD~ 
> | $remap_log))"
> +             prev_remapped="$(echo "$prev_sr" | $remap_log <(git diff 
> $prev_rev | $remap_log))"
>               diff_result="$(diff -u <(echo "$prev_remapped" | sort) <(echo 
> "$sr" | sort) || true)"
>  
> -             echo "Commit: $(git log -n1 --format='%s' $commit)"
> +        if [ "$fast" != 1 ]; then
> +            echo "Commit: $(git log -n1 --format='%s' $commit)"
> +        fi
>               if [ -n "$diff_result" ]; then
>                       echo "$diff_result" | grep -E '^[+-]' | grep -E -v 
> '^[+-]{3}'
>               else
> diff --git a/dim.rst b/dim.rst
> index 792c99f..22d6f56 100644
> --- a/dim.rst
> +++ b/dim.rst
> @@ -79,13 +79,15 @@ filtering. Current profiles are "default", "branch", 
> "drm-intel", and
>  "drm-misc". The "branch" profile maps the current git branch to the 
> appropriate
>  profile, or if the branch is not known, to "default".
>  
> -sparse [*commit-ish* [.. *commit-ish*]]
> ----------------------------------------
> -Run sparse on the files changed by the given commit range.
> +sparse [--fast] [*commit-ish* [.. *commit-ish*]]
> +------------------------------------------------
> +Run sparse for each commit in the given commit range.
>  
>  If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is 
> passed
>  instead of a range, the range commit-ish..HEAD is used.
>  
> +If --fast is passed we treat the whole range as a single change.
> +
>  checker
>  -------
>  Run sparse on drm/i915.

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dim-tools mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dim-tools

Reply via email to