test/integration/projects/pkg-requires: Add
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m53s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 8m4s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 5m23s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 7m34s
CI / Packaging test (push) Successful in 0s

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 <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-09-23 16:40:39 +02:00
commit 8b3f4c69da
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
9 changed files with 132 additions and 0 deletions

View file

@ -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

View file

@ -0,0 +1 @@
1.0.0-1

View file

@ -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

View file

@ -0,0 +1 @@
1.0.0-1

View file

@ -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

View file

@ -0,0 +1 @@
1.0.0-1

View file

@ -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

View file

@ -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"

View file

@ -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