test/integration/projects/create-pkg-config: Add
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m16s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m37s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m27s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m24s
CI / Packaging test (push) Successful in 0s

create-pkg-config's output is not covered by any test, even though the
template and the Requires cleanup produce exact text that pkg-config
consumes, so regressions in the generated file went unnoticed for a long
time.

Add an integration test that runs create-pkg-config with a full option set,
with space- and comma-mixed Requires input, and with a
Requires.private-only input, and compares the output against a reference
file.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-09-08 22:08:20 +02:00
commit cb07ccdb7a
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
3 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,19 @@
TOPDIR = ../../../../..
OUTPUT = test-out.txt
REFERENCE = test-expected.txt
include $(TOPDIR)/make/proj.mk
include $(TOPDIR)/make/test-jw-pkg.mk
all:
$(OUTPUT): Makefile test.sh
bash ./test.sh $(TEST_CMD_LINE) > $(OUTPUT).tmp
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,31 @@
============= Running: jw-pkg.py -t ../../../../.. --log-level info projects create-pkg-config -n jw-pkg -s jw-pkg test -p /usr -v 1.0 --cflags=-I/usr/include --libflags=-L/usr/lib -ljw-pkg -r jw-core >= 1.0, jw-base -R jw-devel
prefix = /usr
exec_prefix = ${prefix}
includedir = ${prefix}/include
libdir = ${exec_prefix}/lib
Name: jw-pkg
Description: jw-pkg test
Version: 1.0
Cflags: -I/usr/include
Libs: -L/usr/lib -ljw-pkg
Requires: jw-core >= 1.0, jw-base
Requires.private: jw-devel============= Running: jw-pkg.py -t ../../../../.. --log-level info projects create-pkg-config -n jw-pkg -p /usr -v 1.0 -r foo bar>=2.0, baz
prefix = /usr
exec_prefix = ${prefix}
includedir = ${prefix}/include
libdir = ${exec_prefix}/lib
Name: jw-pkg
Description:
Version: 1.0
Requires: foo, bar >= 2.0, baz============= Running: jw-pkg.py -t ../../../../.. --log-level info projects create-pkg-config -n jw-pkg -p /usr -v 1.0 -R qux
prefix = /usr
exec_prefix = ${prefix}
includedir = ${prefix}/include
libdir = ${exec_prefix}/lib
Name: jw-pkg
Description:
Version: 1.0
Requires.private: qux

View file

@ -0,0 +1,28 @@
#!/bin/bash
# shellcheck disable=SC2048,SC2086
# Unquoted $* is intentional — the jw-pkg command line
export LC_ALL="C"
set -euo pipefail
jw_pkg_py="$*"
run()
{
local log_cmd
# shellcheck disable=SC2001
log_cmd=$(echo "$*" | sed 's|.*python3[0-9.]*\s\+\(\.\.\/\)*scripts/||')
printf '============= Running: %s\n' "$log_cmd"
"$@"
}
run $jw_pkg_py projects create-pkg-config \
-n jw-pkg -s 'jw-pkg test' -p /usr -v 1.0 \
--cflags=-I/usr/include --libflags=-L/usr/lib\ -ljw-pkg \
-r 'jw-core >= 1.0, jw-base' -R 'jw-devel'
run $jw_pkg_py projects create-pkg-config \
-n jw-pkg -p /usr -v 1.0 -r 'foo bar>=2.0, baz'
run $jw_pkg_py projects create-pkg-config \
-n jw-pkg -p /usr -v 1.0 -R 'qux'