From 8b3f4c69dae7912ae6dcf210a8370447b5aaa728 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 23 Sep 2026 16:40:39 +0200 Subject: [PATCH] test/integration/projects/pkg-requires: Add Add an integration test for pkg-requires --skip-excluded with a fixture project tree: excl-never lists the platform name "centos" in [build] exclude and is not excluded from the build on the test platforms, excl-all is excluded from the build everywhere, and dep-target is a plain dependency target. The test verifies that a platform name in [build] exclude is not treated as a project, that an excluded jw dependency is not reported with --skip-excluded, that an excluded seed is neither considered nor output, and that without the flag the excluded projects are reported with their dependencies. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.87.0 Signed-off-by: Jan Lindemann --- .../jw-pkg/projects/pkg-requires/Makefile | 28 +++++++++++ .../pkg-requires/proj/dep-target/VERSION | 1 + .../proj/dep-target/make/project.conf | 10 ++++ .../pkg-requires/proj/excl-all/VERSION | 1 + .../proj/excl-all/make/project.conf | 18 ++++++++ .../pkg-requires/proj/excl-never/VERSION | 1 + .../proj/excl-never/make/project.conf | 19 ++++++++ .../projects/pkg-requires/test-expected.txt | 8 ++++ .../jw-pkg/projects/pkg-requires/test.sh | 46 +++++++++++++++++++ 9 files changed, 132 insertions(+) create mode 100644 test/integration/jw-pkg/projects/pkg-requires/Makefile create mode 100644 test/integration/jw-pkg/projects/pkg-requires/proj/dep-target/VERSION create mode 100644 test/integration/jw-pkg/projects/pkg-requires/proj/dep-target/make/project.conf create mode 100644 test/integration/jw-pkg/projects/pkg-requires/proj/excl-all/VERSION create mode 100644 test/integration/jw-pkg/projects/pkg-requires/proj/excl-all/make/project.conf create mode 100644 test/integration/jw-pkg/projects/pkg-requires/proj/excl-never/VERSION create mode 100644 test/integration/jw-pkg/projects/pkg-requires/proj/excl-never/make/project.conf create mode 100644 test/integration/jw-pkg/projects/pkg-requires/test-expected.txt create mode 100644 test/integration/jw-pkg/projects/pkg-requires/test.sh diff --git a/test/integration/jw-pkg/projects/pkg-requires/Makefile b/test/integration/jw-pkg/projects/pkg-requires/Makefile new file mode 100644 index 00000000..1978278a --- /dev/null +++ b/test/integration/jw-pkg/projects/pkg-requires/Makefile @@ -0,0 +1,28 @@ +TOPDIR = ../../../../.. + +OUTPUT = test-out.txt +REFERENCE = test-expected.txt + +# Relative topdir keeps the rendered project paths relocatable; dropping the +# log position keeps the error output free of volatile line numbers. The +# fixture tree under ./proj provides the topdir and the projects root; the +# last -t wins over the global one. +TEST_CMD_ARGS = --topdir-format relative --log-flags prio,stderr \ + -t ./proj/excl-never -p ./proj + +include $(TOPDIR)/make/proj.mk +include $(TOPDIR)/make/test-jw-pkg.mk + +all: + +$(OUTPUT): Makefile test.sh \ + $(wildcard proj/*) $(wildcard proj/*/make/project.conf) \ + $(wildcard proj/*/VERSION) + bash ./test.sh $(TEST_CMD_LINE) > $(OUTPUT).tmp 2>&1 + diff $(REFERENCE) $(OUTPUT).tmp + mv $(OUTPUT).tmp $(OUTPUT) + +test: $(OUTPUT) +clean: test.integration.in-tree.clean +test.integration.in-tree.clean: + rm -f $(OUTPUT) $(OUTPUT).tmp diff --git a/test/integration/jw-pkg/projects/pkg-requires/proj/dep-target/VERSION b/test/integration/jw-pkg/projects/pkg-requires/proj/dep-target/VERSION new file mode 100644 index 00000000..82694261 --- /dev/null +++ b/test/integration/jw-pkg/projects/pkg-requires/proj/dep-target/VERSION @@ -0,0 +1 @@ +1.0.0-1 diff --git a/test/integration/jw-pkg/projects/pkg-requires/proj/dep-target/make/project.conf b/test/integration/jw-pkg/projects/pkg-requires/proj/dep-target/make/project.conf new file mode 100644 index 00000000..43d39ad8 --- /dev/null +++ b/test/integration/jw-pkg/projects/pkg-requires/proj/dep-target/make/project.conf @@ -0,0 +1,10 @@ +[summary] +Test fixture: plain dependency target + +[description] +Fixture for pkg-requires --skip-excluded: a project without [build] +exclude. + +[global] +group = "Testing" +subpackages = run diff --git a/test/integration/jw-pkg/projects/pkg-requires/proj/excl-all/VERSION b/test/integration/jw-pkg/projects/pkg-requires/proj/excl-all/VERSION new file mode 100644 index 00000000..82694261 --- /dev/null +++ b/test/integration/jw-pkg/projects/pkg-requires/proj/excl-all/VERSION @@ -0,0 +1 @@ +1.0.0-1 diff --git a/test/integration/jw-pkg/projects/pkg-requires/proj/excl-all/make/project.conf b/test/integration/jw-pkg/projects/pkg-requires/proj/excl-all/make/project.conf new file mode 100644 index 00000000..34c38b14 --- /dev/null +++ b/test/integration/jw-pkg/projects/pkg-requires/proj/excl-all/make/project.conf @@ -0,0 +1,18 @@ +[summary] +Test fixture: excluded from the build on all platforms + +[description] +Fixture for pkg-requires --skip-excluded: [build] exclude = all. + +[global] +group = "Testing" +subpackages = run + +[build] +exclude = all + +[pkg.requires.os] +run = bar-foo-qux + +[pkg.requires.jw] +run = dep-target-run diff --git a/test/integration/jw-pkg/projects/pkg-requires/proj/excl-never/VERSION b/test/integration/jw-pkg/projects/pkg-requires/proj/excl-never/VERSION new file mode 100644 index 00000000..82694261 --- /dev/null +++ b/test/integration/jw-pkg/projects/pkg-requires/proj/excl-never/VERSION @@ -0,0 +1 @@ +1.0.0-1 diff --git a/test/integration/jw-pkg/projects/pkg-requires/proj/excl-never/make/project.conf b/test/integration/jw-pkg/projects/pkg-requires/proj/excl-never/make/project.conf new file mode 100644 index 00000000..bc22cde3 --- /dev/null +++ b/test/integration/jw-pkg/projects/pkg-requires/proj/excl-never/make/project.conf @@ -0,0 +1,19 @@ +[summary] +Test fixture: [build] exclude lists a platform name + +[description] +Fixture for pkg-requires --skip-excluded: [build] exclude contains a +platform name (centos), not a project name. + +[global] +group = "Testing" +subpackages = run + +[build] +exclude = centos + +[pkg.requires.os] +run = foo-bar-baz + +[pkg.requires.jw] +run = excl-all-run, dep-target-run diff --git a/test/integration/jw-pkg/projects/pkg-requires/test-expected.txt b/test/integration/jw-pkg/projects/pkg-requires/test-expected.txt new file mode 100644 index 00000000..0ef52900 --- /dev/null +++ b/test/integration/jw-pkg/projects/pkg-requires/test-expected.txt @@ -0,0 +1,8 @@ +============= Running: jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr -t ./proj/excl-never -p ./proj projects pkg-requires --quote --skip-excluded --hide-self --syntax names-only --delimiter run excl-never +"foo-bar-baz" "dep-target-run" +============= Running: jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr -t ./proj/excl-never -p ./proj projects pkg-requires --quote --hide-self --syntax names-only --delimiter run excl-never +"foo-bar-baz" "excl-all-run" "dep-target-run" +============= Running: jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr -t ./proj/excl-never -p ./proj projects pkg-requires --quote --skip-excluded --hide-self --syntax names-only --delimiter run excl-all + +============= Running: jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr -t ./proj/excl-never -p ./proj projects pkg-requires --quote --hide-self --syntax names-only --delimiter run excl-all +"bar-foo-qux" "dep-target-run" diff --git a/test/integration/jw-pkg/projects/pkg-requires/test.sh b/test/integration/jw-pkg/projects/pkg-requires/test.sh new file mode 100644 index 00000000..8efcbdd2 --- /dev/null +++ b/test/integration/jw-pkg/projects/pkg-requires/test.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# shellcheck disable=SC2048,SC2086 +# Unquoted $* is intentional — the jw-pkg command line + +export LC_ALL="C" +set -euo pipefail + +jw_pkg_py="$*" + +# Print a header and run a command whose output is part of the expected +# result. Under `set -e` a non-zero exit aborts the test. +run() +{ + local log_cmd + # shellcheck disable=SC2001 + log_cmd=$(echo "$*" | sed 's|.*python3[0-9.]*\s\+\(\.\.\/\)*scripts/||') + printf '============= Running: %s\n' "$log_cmd" + "$@" +} + +# The topdir (-t ./proj/excl-never) and the projects root (-p ./proj) are +# part of the test command line (see the Makefile); the last -t wins over +# the global one. excl-never lists the platform name "centos" in [build] +# exclude and is therefore not excluded from the build here; excl-all is +# excluded on every platform. + +# -- the platform name in [build] exclude must not be treated as a project; +# -- the excluded jw dependency is not reported +run $jw_pkg_py projects pkg-requires \ + --quote --skip-excluded --hide-self --syntax names-only --delimiter " " \ + run excl-never + +# -- without --skip-excluded, the excluded jw dependency is reported +run $jw_pkg_py projects pkg-requires \ + --quote --hide-self --syntax names-only --delimiter " " \ + run excl-never + +# -- an excluded seed is neither considered nor output +run $jw_pkg_py projects pkg-requires \ + --quote --skip-excluded --hide-self --syntax names-only --delimiter " " \ + run excl-all + +# -- without --skip-excluded, the excluded seed's dependencies are reported +run $jw_pkg_py projects pkg-requires \ + --quote --hide-self --syntax names-only --delimiter " " \ + run excl-all