Skip to content

Commit 9b93ebe

Browse files
committed
Merge FEATURE-ci-freebsd-selected-make: Propagate selected make to configure
2 parents c2d5c62 + d106753 commit 9b93ebe

3 files changed

Lines changed: 157 additions & 2 deletions

File tree

‎scripts/check-v3-installed-consumer.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def package_lane(args, source, output, mode, inventory):
3434
env.pop('V3_TLS_LIBS', None)
3535
env['CXX'] = args.compiler
3636
env['CC'] = args.cc
37+
env['MAKE'] = args.make
3738
pkgdirs = [root / 'lib/pkgconfig' for root in args.prerequisite_prefix] + args.pkg_config_dir
3839
env.update(PKG_CONFIG_PATH='', PKG_CONFIG_LIBDIR=os.pathsep.join(path.as_posix() for path in pkgdirs))
3940
env['CPPFLAGS'] = shlex.join(['-I' + (root / 'include').as_posix() for root in args.prerequisite_prefix])
@@ -60,6 +61,7 @@ def package_lane(args, source, output, mode, inventory):
6061
command([args.make, '-j' + str(args.jobs)], build, env)
6162
command([args.make, 'install'], build, env)
6263
runtime_env = runtime_environment(audit.clean_environment(), prefix, args.provider_prefix, args.prerequisite_prefix, args.toolchain_prefix)
64+
runtime_env['MAKE'] = args.make
6365
runtime_env.update(PKG_CONFIG_PATH='', PKG_CONFIG_LIBDIR=os.pathsep.join(path.as_posix() for path in [prefix / 'lib/pkgconfig'] + pkgdirs))
6466
runtime_env.update({key: env[key] for key in ('V3_TLS_CFLAGS', 'V3_TLS_LIBS') if key in env})
6567
runtime_env['V3_PROVIDER_PREFIX'] = str(args.provider_prefix)

‎scripts/test-v3-installed-consumer.py‎

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import json
77
import os
88
from pathlib import Path
9+
import shutil
910
import signal
1011
import socket
1112
import subprocess
@@ -23,6 +24,87 @@
2324
import package_traffic as traffic
2425

2526

27+
@unittest.skipIf(os.name == 'nt', 'POSIX make lookup fixture; native Windows is CI owned')
28+
class InstalledMakeTest(unittest.TestCase):
29+
"""Run the package lane through real Automake dependency bootstrapping."""
30+
@classmethod
31+
def setUpClass(cls):
32+
cls.temp = tempfile.TemporaryDirectory()
33+
cls.addClassCleanup(cls.temp.cleanup)
34+
cls.root = Path(cls.temp.name).resolve()
35+
cls.gnu_make = shutil.which('gmake') or shutil.which('make')
36+
version = subprocess.check_output([cls.gnu_make, '--version'], text=True)
37+
if 'GNU Make' not in version:
38+
raise RuntimeError('selected-make fixture requires GNU make')
39+
cls.source = cls.root / 'source'
40+
cls.source.mkdir()
41+
(cls.source / 'configure.ac').write_text('''AC_INIT([selected-make], [1.0])
42+
AM_INIT_AUTOMAKE([foreign])
43+
AC_PROG_CC
44+
AC_ARG_ENABLE([v3-tls])
45+
AC_ARG_ENABLE([examples])
46+
AC_CONFIG_FILES([Makefile])
47+
AC_OUTPUT
48+
''')
49+
(cls.source / 'Makefile.am').write_text('''noinst_PROGRAMS = probe
50+
probe_SOURCES = probe.c probe.h
51+
all-local:
52+
\t@printf '%s\\n' "$$MAKE" > all-make
53+
install-exec-local:
54+
\t@printf '%s\\n' "$$MAKE" > install-make
55+
check-v3-native-linkage:
56+
\t@printf '%s\\n' "$$MAKE" > check-make
57+
\t@echo selected-make-fixture-complete
58+
\t@exit 23
59+
check-headers check-hygiene check-v3-installed-package-fixtures:
60+
\t@:
61+
''')
62+
(cls.source / 'probe.c').write_text('#include "probe.h"\nint main(void) { return PROBE; }\n')
63+
(cls.source / 'probe.h').write_text('#define PROBE 0\n')
64+
subprocess.run(['autoreconf', '--install', '--force'], cwd=cls.source,
65+
check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
66+
spec = importlib.util.spec_from_file_location('installed_make_runner',
67+
Path(__file__).with_name('check-v3-installed-consumer.py'))
68+
cls.runner = importlib.util.module_from_spec(spec)
69+
spec.loader.exec_module(cls.runner)
70+
71+
def exercise_selection(self, selection, *, broken_default=False, ambient_make=None):
72+
root = self.root / self._testMethodName
73+
root.mkdir()
74+
tools = root / 'tools'
75+
tools.mkdir()
76+
bad_make = tools / 'unselected-make'
77+
bad_make.write_text('#!/bin/sh\necho unselected-make >&2\nexit 1\n')
78+
bad_make.chmod(0o755)
79+
(tools / 'make').symlink_to(bad_make if broken_default else self.gnu_make)
80+
(tools / 'gmake').symlink_to(self.gnu_make)
81+
args = SimpleNamespace(make=selection, compiler=shutil.which('c++'), cc=shutil.which('cc'),
82+
jobs=1, prerequisite_prefix=[], pkg_config_dir=[], provider_prefix=root,
83+
toolchain_prefix=None, optimized=False)
84+
environment = dict(os.environ, PATH=str(tools) + os.pathsep + os.environ['PATH'])
85+
environment.pop('MAKE', None)
86+
if ambient_make:
87+
environment['MAKE'] = str(bad_make)
88+
# Stop at the fixture's check target, after real configure/build/install.
89+
with patch.dict(os.environ, environment, clear=True), \
90+
self.assertRaisesRegex(RuntimeError, 'selected-make-fixture-complete'):
91+
self.runner.package_lane(args, self.source, root, 'no', matrix.load())
92+
build = root / 'tls-no/build'
93+
self.assertTrue((build / '.deps/probe.Po').is_file())
94+
self.assertIn('probe.h', (build / '.deps/probe.Po').read_text())
95+
for phase in ('all', 'install', 'check'):
96+
self.assertEqual((build / (phase + '-make')).read_text().strip(), selection)
97+
98+
def test_selected_make_bootstraps_dependencies_with_unusable_default(self):
99+
self.exercise_selection('gmake', broken_default=True)
100+
101+
def test_absolute_make_overrides_ambient_make(self):
102+
self.exercise_selection(self.gnu_make, broken_default=True, ambient_make=True)
103+
104+
def test_default_make_overrides_ambient_make(self):
105+
self.exercise_selection('make', ambient_make=True)
106+
107+
26108
class InstalledShellTest(unittest.TestCase):
27109
"""Controlled process boundary; these are not native Windows receipts."""
28110
def setUp(self):
@@ -39,7 +121,7 @@ def setUp(self):
39121
spec = importlib.util.spec_from_file_location('installed_shell_runner', Path(__file__).with_name('check-v3-installed-consumer.py'))
40122
self.runner = importlib.util.module_from_spec(spec)
41123
spec.loader.exec_module(self.runner)
42-
self.args = SimpleNamespace(compiler='selected-cxx', cc='selected-cc',
124+
self.args = SimpleNamespace(compiler='selected-cxx', cc='selected-cc', make='make',
43125
prerequisite_prefix=[], pkg_config_dir=[], provider_prefix=self.root, optimized=False)
44126
self.popen = subprocess.Popen
45127
self.converted_configure = (self.root / 'configure').as_posix()
@@ -125,7 +207,7 @@ def test_optimized_package_configure_selects_release_flags_without_changing_defa
125207
for optimized, flags in ((False, '-O0 -g'), (True, '-O3 -g')):
126208
with self.subTest(optimized=optimized):
127209
output = root / str(optimized); output.mkdir()
128-
args = SimpleNamespace(compiler='selected-cxx', cc='selected-cc',
210+
args = SimpleNamespace(compiler='selected-cxx', cc='selected-cc', make='make',
129211
prerequisite_prefix=[], pkg_config_dir=[], provider_prefix=root,
130212
optimized=optimized)
131213
with self.assertRaises(RuntimeError):
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# FEATURE-ci-freebsd-selected-make: propagate the selected make into package configure
2+
3+
Status: Complete (local) — validated and finalized into v3; native CI remains pending.
4+
Base: local `v3` at `c2d5c626f456f218676a6d840c8ed1442aa28438`.
5+
6+
FreeBSD package job `120468733763` and archive job `120469466638` passed
7+
`--make gmake` to the installed-consumer driver, then failed real
8+
`config.status` dependency-fragment bootstrapping with the suggestion to use
9+
`MAKE="gmake"`. Their effective configure environment was not logged. Source
10+
inspection established that the driver selected `args.make` for build/install
11+
commands but omitted it from configure's environment.
12+
13+
The package lane now sets `MAKE` to exactly `args.make` for configure, build,
14+
install and the merged check environment. The runtime environment also keeps
15+
that selection, so an inherited `MAKE` cannot replace it during the merge.
16+
The CLI default remains `make`; named GNU make and absolute selections are
17+
preserved. Dependency tracking, compiler/provider flags, TLS selection,
18+
Windows shell/path/prefix handling and process ownership remain unchanged.
19+
20+
Action items:
21+
22+
- [x] Create the isolated Groundwork worktree from the exact local v3 base; preserve other work.
23+
- [x] Read the existing literal failure journal and actual FreeBSD error before diagnosis.
24+
- [x] Establish RED through the production `package_lane` and a real Autoconf/Automake C project.
25+
- [x] Propagate the selected make into configure and subsequent lane environments.
26+
- [x] Verify named `gmake` with an unusable default `make`, absolute make with conflicting ambient `MAKE`, and default `make` with conflicting ambient `MAKE`.
27+
- [x] Verify actual generated dependency fragments and compile/header dependencies, plus make selection inside build/install/check recipes.
28+
- [x] Keep the regression in the existing installed-consumer test script and fixture/distribution registration.
29+
- [x] Run the affected Python preservation tests, syntax and diff checks; retain raw configure evidence and source bindings.
30+
- [x] Caller: complete Groundwork validation and local finalization into `v3`.
31+
- [ ] CI / v3 PR: fresh native FreeBSD package/archive execution; other nonlocal execution remains CI owned.
32+
33+
Acceptance evidence: the original driver and the repaired driver execute the
34+
same final regression fixture. All three original-driver cases fail in real
35+
`config.status` with the automatic dependency-tracking error. All three fixed
36+
cases successfully configure, compile and install, then reach the fixture's
37+
deliberately failing check target. The tests require the check marker,
38+
`.deps/probe.Po` containing `probe.h`, and exact `MAKE` values in all three
39+
recipe receipts. This bounded fixture stops before package consumer/runtime
40+
work and is not a package matrix or native FreeBSD receipt.
41+
42+
The three new integration tests and 22 existing Windows-shell, optimization
43+
and matrix contract tests pass. Python compilation and `git diff --check`
44+
pass. No Python linter is configured in repository guidance. The fixture
45+
uses local Autoconf 2.71, Automake 1.16.5, GNU Make 4.3, GCC 13.3.0 and
46+
Python 3.12.3. POSIX make-lookup integration is skipped on Windows; existing
47+
Windows shell contracts continue to execute. No full baseline suite or
48+
unrelated investigation was run. Closed Darwin/Linux/Windows concurrency
49+
uncertainty remains closed; no new incidental failure occurred.
50+
51+
Primary journal, exact commands, raw RED/GREEN output, generated configure,
52+
config.log/config.status, command receipts, dependency/recipe artifacts and
53+
source SHA-256 bindings are retained in the main repository's ignored
54+
`.debug/ci-freebsd-selected-make-zgo8kkt1/`. `baseline-actual-configure/` and
55+
`fixed-actual-configure/` retain the same final test source binding and the
56+
original/repaired executed drivers. Native FreeBSD proof remains incomplete
57+
and is CI / v3 PR owned under AGENTS.md; it does not block local completion.
58+
59+
Project notes / task-executor memory: v3 is Autotools/C++20; this Python-only
60+
repair needs no full library build/provider setup. Focused checks use
61+
`python3 scripts/test-v3-installed-consumer.py InstalledMakeTest InstalledShellTest InstalledShellPSTest MatrixTest`
62+
and `python3 -m py_compile` for changed scripts. The real fixture is generated
63+
with `autoreconf --install --force` and invokes the production lane and
64+
Commands runner without mocking configure or make. Git metadata mutations
65+
need the existing sandbox escalation; Groundwork's identity helper resolves
66+
the task worktree/branch. The installed fixture target and EXTRA_DIST already
67+
include this test script, so no build-system registration change is needed.
68+
69+
Groundwork validation passed at `2e5beffbb8acf227356ea4e9528a949e4b1887ae`
70+
(1 iteration, 0 fixed, 0 unworked; all eight applicable reviewers approved).
71+
Native FreeBSD and other nonlocal checks remain incomplete and CI/v3-PR owned.

0 commit comments

Comments
 (0)