[PATCH v2] dim: Add warncheck subcommand

Arkadiusz Hiler arkadiusz.hiler at intel.com
Fri May 25 06:08:29 UTC 2018


This subcommand runs 'make W=1' on the provided range.

Cc: Daniel Vetter <daniel at ffwll.ch>
Cc: Jani Nikula <jani.nikula at linux.intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
 dim     | 34 ++++++++++++++++++++++++++++++++++
 dim.rst |  7 +++++++
 2 files changed, 41 insertions(+)

diff --git a/dim b/dim
index d7c11a2bfa48..b4366f147bdb 100755
--- a/dim
+++ b/dim
@@ -1601,6 +1601,40 @@ function dim_sparse
 	return $rv
 }
 
+function dim_warncheck
+{
+	_restore_head_on_exit
+
+	local range make_output make_rc commits
+
+	range=$(rangeish "${1:-}")
+	commits=( $(git rev-list --reverse $range) )
+
+	git checkout --detach  ${commits[0]}~ > /dev/null 2>&1
+
+	if ! make -j$(nproc) W=1 > /dev/null 2>&1; then
+		echoerr "The base for the provided range does not build cleanly."
+		dim_cite HEAD
+		warn_or_fail "This may cause noise for all the following revisions"
+	fi
+
+	for commit in "${commits[@]}"; do
+		git checkout --detach $commit >/dev/null 2>&1
+
+		set +e
+		make_output="$(make W=1 2>&1)"
+		make_rc=$?
+		set -e
+
+		if [ "$make_rc" -ne 0 ]; then
+			echoerr "Commit: $(dim_cite HEAD)"
+			echoerr "$make_output"
+
+			warn_or_fail "This may cause noise for all the following revisions"
+		fi
+	done
+}
+
 function dim_checker
 {
 	rm -f drivers/gpu/drm/i915/*.o drivers/gpu/drm/i915/*.ko
diff --git a/dim.rst b/dim.rst
index f7ca4ebdf0eb..5ef1c00a87fc 100644
--- a/dim.rst
+++ b/dim.rst
@@ -87,6 +87,13 @@ Run sparse on the files changed by 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.
 
+warncheck [*commit-ish* [.. *commit-ish*]]
+------------------------------------------
+Runs incremental make W=1 on 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.
+
 checker
 -------
 Run sparse on drm/i915.
-- 
2.14.3



More information about the dim-tools mailing list