make: Streamline test and check targets for all directories #52

Merged
Jan Lindemann merged 16 commits from jan/feature/20260724-make-streamline-test-and-check-targets-for-all-directories into master 2026-07-24 13:54:43 +02:00 AGit

This PR presents a series of commits which make the "check" and "test" targets work across the codebase in a more streamlined fashion, and introduces a few new checks and tests, and fixes their fallout.

py-run.mk: Remove dead code

Remove disabled included statements which are not going to be enabled anymore.

py-defs.mk: Allow inclusion without defs.mk

py-defs.mk uses the variables ECHO and SED defined in defs.mk. The complexity this introduces doesn't justify the reduced redundancy, though, so this commit defines them redundantly in py-defs.mk and to allow inclusion without prior defs.mk.

py-check.mk: Add file

Add py-check.mk and use it from py-topdir.mk and py-rules.mk. This removes redundant check definitions, making sure that that checks run from a repo's subdirectory match the checks run from its toplevel directory.

lib: Fix misplaced "# export" markers

A couple of "# export" markers after function prototypes have been pushed along with the closing parenthesis onto the wrong line by the code formatter, fix that.

py-check.mk: Add target py-check-bad-patterns

Add target py-check-bad-patterns, which currently looks for leftover breakpoints and orphaned "export" comments on the closing line of a function prototype.

py-path.mk: Add target py-path

Add target py-path to py-path.mk. At this point, it's mostly introduced for documentation purposes, giving people and machines a defined, easily accessible and omni-present way to determine how Python imports should be resolved.

rules.mk / defs.mk: Disable BUILD_MAKEDIR

BUILD_MAKEDIR is a variable which exists for consistency's sake. On the other hand, nor jw-pkg nor any downstream package ever copies makefile snippets during build time. The rule introduced by BUILD_MAKEDIR is quite costly in terms of performance and makes caching harder to understand. This commit disables the variable.

cmds.projects.CmdBuild: Support --dep-flavours

CmdBuild supports the targets all, clean and pkg-*. It uses builtin dependency flavours matching those targets to resolve build order. To make it more flexible in general, and allow it to support more targets, e.g. "check" and "test", this commit adds a --dep-flavours option.

projects-dir.mk: Add target test

projects-dir.mk lacks a "test" target, fix that.

projects-dir.mk: Support check targets

Add support for the targets "check" and "check-post" to projects-dir.mk to make them usable from inside the projects directory.

Note that "check-pre" is intentionally left out: Running "make check" in a project before its prerequisite projects have built their init.py files will fail due to broken import resolution.

install-files.mk: Add missing target "test"

install-files.mk lacks a "test" target, so this commit adds a stub.

ldlibpath.mk: Don't include py-path.mk anylonger

For backwards compatibility, ldlibpath.mk kept py-path.mk included. The projects depending on that have been fixed by now and this is no longer needed. So, move it to the py-defs.mk where it belongs and has narrower scope.

test/integration/jw-pkg/projects: Add directory

Add a directory for integration tests of "jw-pkg projects".

test/integration/jw-pkg/projects/cache: Add directory

Add tests for jw-pkg.py calls run during makefile caching. Broken caching can compromise the build without causing it to fail entirely, i.e. in non-obvious ways.

This PR presents a series of commits which make the "check" and "test" targets work across the codebase in a more streamlined fashion, and introduces a few new checks and tests, and fixes their fallout. #### py-run.mk: Remove dead code Remove disabled included statements which are not going to be enabled anymore. #### py-defs.mk: Allow inclusion without defs.mk py-defs.mk uses the variables ECHO and SED defined in defs.mk. The complexity this introduces doesn't justify the reduced redundancy, though, so this commit defines them redundantly in py-defs.mk and to allow inclusion without prior defs.mk. #### py-check.mk: Add file Add py-check.mk and use it from py-topdir.mk and py-rules.mk. This removes redundant check definitions, making sure that that checks run from a repo's subdirectory match the checks run from its toplevel directory. #### lib: Fix misplaced "# export" markers A couple of "# export" markers after function prototypes have been pushed along with the closing parenthesis onto the wrong line by the code formatter, fix that. #### py-check.mk: Add target py-check-bad-patterns Add target py-check-bad-patterns, which currently looks for leftover breakpoints and orphaned "export" comments on the closing line of a function prototype. #### py-path.mk: Add target py-path Add target py-path to py-path.mk. At this point, it's mostly introduced for documentation purposes, giving people and machines a defined, easily accessible and omni-present way to determine how Python imports should be resolved. #### rules.mk / defs.mk: Disable BUILD_MAKEDIR BUILD_MAKEDIR is a variable which exists for consistency's sake. On the other hand, nor jw-pkg nor any downstream package ever copies makefile snippets during build time. The rule introduced by BUILD_MAKEDIR is quite costly in terms of performance and makes caching harder to understand. This commit disables the variable. #### cmds.projects.CmdBuild: Support --dep-flavours CmdBuild supports the targets all, clean and pkg-*. It uses builtin dependency flavours matching those targets to resolve build order. To make it more flexible in general, and allow it to support more targets, e.g. "check" and "test", this commit adds a --dep-flavours option. #### projects-dir.mk: Add target test projects-dir.mk lacks a "test" target, fix that. #### projects-dir.mk: Support check targets Add support for the targets "check" and "check-post" to projects-dir.mk to make them usable from inside the projects directory. Note that "check-pre" is intentionally left out: Running "make check" in a project before its prerequisite projects have built their __init__.py files will fail due to broken import resolution. #### install-files.mk: Add missing target "test" install-files.mk lacks a "test" target, so this commit adds a stub. #### ldlibpath.mk: Don't include py-path.mk anylonger For backwards compatibility, ldlibpath.mk kept py-path.mk included. The projects depending on that have been fixed by now and this is no longer needed. So, move it to the py-defs.mk where it belongs and has narrower scope. #### test/integration/jw-pkg/projects: Add directory Add a directory for integration tests of "jw-pkg projects". #### test/integration/jw-pkg/projects/cache: Add directory Add tests for jw-pkg.py calls run during makefile caching. Broken caching can compromise the build without causing it to fail entirely, i.e. in non-obvious ways.
Jan Lindemann scheduled this pull request to auto merge when all checks succeed 2026-07-24 11:34:54 +02:00
Jan Lindemann force-pushed jan/feature/20260724-make-streamline-test-and-check-targets-for-all-directories from 6f17623f70
Some checks failed
CI / Packaging - Kali Linux (pull_request) Failing after 4m10s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Failing after 4m6s
CI / Packaging test (pull_request) Failing after 0s
to 57658a377f
Some checks failed
CI / Packaging - Kali Linux (pull_request) Failing after 4m2s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Failing after 4m5s
CI / Packaging test (pull_request) Failing after 0s
2026-07-24 13:08:45 +02:00
Compare
Jan Lindemann force-pushed jan/feature/20260724-make-streamline-test-and-check-targets-for-all-directories from 57658a377f
Some checks failed
CI / Packaging - Kali Linux (pull_request) Failing after 4m2s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Failing after 4m5s
CI / Packaging test (pull_request) Failing after 0s
to a4306ad0c5
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m11s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m12s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m45s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m53s
CI / Packaging test (push) Successful in 0s
2026-07-24 13:46:16 +02:00
Compare
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
janware/jw-pkg!52
No description provided.