Skip to contentSkip to conversation

test-pkg: Force checking dependencies.

PATCH New aduskett at gmail.com 3 participants 3 messages Jan 2, 2019 – Jan 3, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 test-pkg: Force checking dependencies.

From: Adam Duskett <[email protected]>

Currently, if a user runs "make" while specifying a specific package (IE: make -p foo), the Makefile logic skips checking to see if all the dependencies are selected in the specified packages config file. This behavior is useful to test simple packages which do not have "complex" dependencies.

However; if a developer uses test-pkg -p ${package_name} to check their package, the package may pass all the checks, but would have otherwise failed with a simple "make" because the developer may have failed to add a select line in packages config file, even if there is a new dependency in the packages Makefile.

Pass the environment variable "BR_FORCE_CHECK_DEPENDENCIES" to the Makefile in the test-pkg script, and check it's value in the Makefile. If the value is "YES" force checking for dependency issues.

---
Changes v1 -> v2:
- Change FORCE_CHECK_DEPENDENCIES to BR_FORCE_CHECK_DEPENDENCIES (Thomas)
- Only set BR_FORCE_CHECK_DEPENDENCIES=YES on line 155 of test-pkg (Yann)

 Makefile       | 9 ++++++++-
 utils/test-pkg | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)
Makefile +8 -1
index c5b78b3274..47df9e4842 100644
@@ -550,9 +550,16 @@ include $(BR2_EXTERNAL_MKS)
 #
 # Only trigger the check for default builds. If the user forces building
 # a package, even if not enabled in the configuration, we want to accept
-# it.
+# it. However; we also want to be able to force checking the dependencies
+# if the user so desires. Forcing a dependency check is useful in the case
+# of test-pkg, as we want to make sure during testing, that a package has
+# all the dependencies selected in the config file.
 #
 ifeq ($(MAKECMDGOALS),)
+BR_FORCE_CHECK_DEPENDENCIES = YES
+endif
+
+ifeq ($(BR_FORCE_CHECK_DEPENDENCIES),YES)
 
 define CHECK_ONE_DEPENDENCY
 ifeq ($$($(2)_TYPE),target)
utils/test-pkg +1 -1
index e4f68ed061..1995fa8578 100755
@@ -152,7 +152,7 @@ build_one() {
     fi
 
     # shellcheck disable=SC2086
-    if ! make O="${dir}" ${pkg} >> "${dir}/logfile" 2>&1; then
+    if ! BR_FORCE_CHECK_DEPENDENCIES=YES make O="${dir}" ${pkg} >> "${dir}/logfile" 2>&1; then
         return 2
     fi
 
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/1 test-pkg: Force checking dependencies.

Adam, All,

On 2019-01-02 10:49 -0500, aduskett at gmail.com spake thusly:

Quoted 13 lines

From: Adam Duskett <[email protected]>

Currently, if a user runs "make" while specifying a specific package (IE: make -p foo), the Makefile logic skips checking to see if all the dependencies are selected in the specified packages config file. This behavior is useful to test simple packages which do not have "complex" dependencies.

However; if a developer uses test-pkg -p ${package_name} to check their package, the package may pass all the checks, but would have otherwise failed with a simple "make" because the developer may have failed to add a select line in packages config file, even if there is a new dependency in the packages Makefile.

Quoted 5 lines

Pass the environment variable "BR_FORCE_CHECK_DEPENDENCIES" to the Makefile in the test-pkg script, and check it's value in the Makefile. If the value is "YES" force checking for dependency issues.

Regards,
Yann E. MORIN.

Quoted 51 lines

---
Changes v1 -> v2:
- Change FORCE_CHECK_DEPENDENCIES to BR_FORCE_CHECK_DEPENDENCIES (Thomas)
- Only set BR_FORCE_CHECK_DEPENDENCIES=YES on line 155 of test-pkg (Yann)

 Makefile       | 9 ++++++++-
 utils/test-pkg | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)
Makefile +8 -1
index c5b78b3274..47df9e4842 100644
@@ -550,9 +550,16 @@ include $(BR2_EXTERNAL_MKS)
 #
 # Only trigger the check for default builds. If the user forces building
 # a package, even if not enabled in the configuration, we want to accept
-# it.
+# it. However; we also want to be able to force checking the dependencies
+# if the user so desires. Forcing a dependency check is useful in the case
+# of test-pkg, as we want to make sure during testing, that a package has
+# all the dependencies selected in the config file.
 #
 ifeq ($(MAKECMDGOALS),)
+BR_FORCE_CHECK_DEPENDENCIES = YES
+endif
+
+ifeq ($(BR_FORCE_CHECK_DEPENDENCIES),YES)
 
 define CHECK_ONE_DEPENDENCY
 ifeq ($$($(2)_TYPE),target)
utils/test-pkg +1 -1
index e4f68ed061..1995fa8578 100755
@@ -152,7 +152,7 @@ build_one() {
     fi
 
     # shellcheck disable=SC2086
-    if ! make O="${dir}" ${pkg} >> "${dir}/logfile" 2>&1; then
+    if ! BR_FORCE_CHECK_DEPENDENCIES=YES make O="${dir}" ${pkg} >> "${dir}/logfile" 2>&1; then
         return 2
     fi
 
Signature · 6 lines
2.20.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH v2 1/1 test-pkg: Force checking dependencies.

In reply to aduskett at gmail.com

Hello,

Quoted 17 lines · aduskett at gmail.com

From: Adam Duskett <[email protected]>

Currently, if a user runs "make" while specifying a specific package (IE: make -p foo), the Makefile logic skips checking to see if all the dependencies are selected in the specified packages config file. This behavior is useful to test simple packages which do not have "complex" dependencies.

However; if a developer uses test-pkg -p ${package_name} to check their package, the package may pass all the checks, but would have otherwise failed with a simple "make" because the developer may have failed to add a select line in packages config file, even if there is a new dependency in the packages Makefile.

Pass the environment variable "BR_FORCE_CHECK_DEPENDENCIES" to the Makefile in the test-pkg script, and check it's value in the Makefile. If the value is "YES" force checking for dependency issues.

Quoted 5 lines

---
Changes v1 -> v2:
- Change FORCE_CHECK_DEPENDENCIES to BR_FORCE_CHECK_DEPENDENCIES (Thomas)
- Only set BR_FORCE_CHECK_DEPENDENCIES=YES on line 155 of test-pkg (Yann)

Applied to master, thanks. Note: for the commit title, please use "utils/test-pkg" for the prefix, and don't use an uppercase letter after the prefix. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com