Source: u-boot
Severity: wishlist
Tags: patch

Make decision about testing tools more explicit
>From 02c61e76b4c689567bd64a0c3cf34ad3a5f874d2 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <nico...@debian.org>
Date: Sat, 9 Jan 2021 20:46:51 +0100
Subject: Make decision about testing tools more explicit

Replace a shell test with a Make condition so that the logs reflect
the decision.  Also, the two reasons for which tests may not be
available are now explicit.

diff --git a/debian/rules b/debian/rules
index 19a61e3cb7..2b8945363e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -27,6 +27,8 @@ endif
 comma := ,
 LDFLAGS := $(patsubst -Wl$(comma)%,%,$(LDFLAGS))
 
+notools := $(filter pkg.uboot.notools,$(DEB_BUILD_PROFILES))
+
 # limit builds to only certain subarchitectures
 # e.g. pkg.uboot.subarch.rockchip will only build rockchip targets.
 ifeq (,$(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES)))
@@ -48,10 +50,9 @@ configs/am335x_boneblack_defconfig: 
configs/am335x_evm_defconfig
 
 override_dh_auto_build-arch: TOOLSDIR := debian/build/tools
 override_dh_auto_build-arch: TARGETARCH := $(DEB_HOST_ARCH)
-ifeq (,$(filter pkg.uboot.notools,$(DEB_BUILD_PROFILES)))
-override_dh_auto_build-arch: build-targets build-tools
-else
 override_dh_auto_build-arch: build-targets
+ifeq ($(notools),)
+  override_dh_auto_build-arch: build-tools
 endif
 
 override_dh_auto_build-indep: TOOLSDIR := debian/build/tools
@@ -135,13 +136,12 @@ build-tools:
        $(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment 
--remove-section=.note $(TOOLSDIR)/tools/mksunxiboot
        $(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment 
--remove-section=.note $(TOOLSDIR)/tools/dumpimage
 
-override_dh_auto_test:
-ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
-       # only run tests on native builds
-       if [ -e debian/build/tools/tools/mkimage ] ; then \
-               BASEDIR=debian/build/tools test/image/test-imagetools.sh ;\
-       fi
-endif
+# Only test when tools are built and native.
+override_dh_auto_test-arch:
+  ifeq ($(notools)$(cross_build_tools),)
+       BASEDIR=$(TOOLSDIR) test/image/test-imagetools.sh
+  endif
+override_dh_auto_test-indep:
 
 override_dh_strip:
        # dh_strip tries to strip the cross compiled qemu images, which doesn't

Reply via email to