Repository navigation
toolchain, llvm: test that one package builds hello-world (#805's intent, per arch#183) - #1557
bryan-minimal wants to merge 2 commits into
Conversation
… intent) pkgs#805 wanted a box with one compiler package to build hello-world, and did it by adding binutils and linux_headers to the compilers' runtime_deps. The registry spec (gominimal/arch#183) rules the other way: a compiler names only its own parts, and the `toolchain` group supplies the assembler, linker, libc and kernel headers. So the promise moves to `toolchain` and is now tested: - toolchain hello_c: `cc` builds and runs a C program with only the group and a shell; - toolchain hello_cxx_linux_headers: `g++` with <linux/types.h>, #805's missing-header case; - llvm hello_clang_toolchain: plain `clang h.c` (the system ld, #805's clang case) with `toolchain` as a test dep, as rust's default_linker tests already do. Tests are not in the spec hash, so nothing rebuilds. gcc already installs `cc`. gcc's "TODO: Some of these need to be runtime_deps" comments are left for after gcc 16 (#1545), which rewrites that recipe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
norrietaylor
left a comment
There was a problem hiding this comment.
Scope matches the title. The diff adds three tests and two comments, and it changes no runtime_deps. Clobber none: git log on both files shows no recent fix reverted. Correctness one defect: hello_c runs cc, and no package in this tree installs cc. The PR body says that gcc installs cc on main. packages/gcc/build.sh:80 still has that symlink commented out at this head. The printf escaping in all three tests renders to valid C and C++ when I trace it by hand. The clang test follows the existing hello_clang_lld test, which already finds the GCC installation. Not checked: no test ran, because that needs a build. The CLI version was not readable in this sandbox.
| class = 'Standalone, | ||
| test_deps = [bash-bootstrap, coreutils], | ||
| cmds = [ | ||
| ["/bin/bash", "-c", "printf '#include <stdio.h>\\nint main(void){puts(\"hello c\");return 0;}\\n' > h.c && cc h.c -o h && [ \"$(./h)\" = 'hello c' ]"], |
There was a problem hiding this comment.
medium · hello_c runs cc, and no package in this tree installs cc. The comment says "gcc installs it", and the PR body says the same about main. packages/gcc/build.sh:80 still has the symlink commented out under a # TODO, and rg finds no other usr/bin/cc in packages/. The test will fail with cc: command not found when build-bot runs it. The rust default_linker_* tests do not prove cc exists, because bootstrap.toml sets default-linker = "gcc". Add the cc symlink to gcc (this rebuilds gcc), or call gcc here and correct the comment. This is the only cc call in a test in the repo. Not checked by a build.
| hello_c = | ||
| { | ||
| class = 'Standalone, | ||
| test_deps = [bash-bootstrap, coreutils], |
There was a problem hiding this comment.
nit · Both toolchain tests list coreutils in test_deps, and the commands use only bash builtins (printf, [) and the compiler. The comment above says "nothing beyond the group and a shell". The rust default_linker_rustc test at packages/rust/build.ncl:99 uses [bash-bootstrap, toolchain] with no coreutils. Drop coreutils from lines 32 and 42 and its import, so the test proves the one-package promise. If the compiler driver needs it, say so in the comment.
The standalone test failed on both arches: `cc` does not exist (packages/gcc/build.sh leaves the link as a TODO). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
norrietaylor
left a comment
There was a problem hiding this comment.
Scope matches the title. The diff adds three standalone tests and two comments. It changes no runtime_deps, build_deps, cmd or outputs, so no closure grows.
Clobber none. git log on both files shows no recent fix reverted.
Correctness I rendered the three test sources by hand through the Nickel and printf escaping. Each gives valid C or C++ and the expected output string. The second commit replaced cc with gcc in hello_c, and the comment now agrees with packages/gcc/build.sh:80. That answers the earlier cc thread. The bare gcc and g++ calls follow the lua tests, which do the same with toolchain as a test dep. packages/claude/build.ncl is a second cmd = "" package with tests. packages/llvm/build.sh sets no CLANG_DEFAULT_LINKER, so plain clang h.c links through ld from binutils, and hello_clang_toolchain fails without toolchain.
Two items are not findings here. The open thread on coreutils in the toolchain test_deps still applies at lines 32 and 42, and the comment at line 27 still says "nothing beyond the group and a shell". The PR body still says that gcc installs cc and that hello_c runs cc. Correct the body before the merge.
Not checked: the tests did not run, because that needs a build. The CLI version is not known, because the harness denied the command.
| # linux_headers). A compiler package names only its own parts; a box that compiles | ||
| # lists `toolchain` (gominimal/arch#183: the group supplies binutils and the headers, | ||
| # not each compiler's runtime_deps). pkgs#805 asked for "add one package, build | ||
| # hello-world"; this is that package, and its tests are that promise. |
There was a problem hiding this comment.
nit · The last sentence of the header comment tells the story of the issue, not what the package is. The sentences before it already say what toolchain supplies and why. Delete the sentence, or keep only a short pointer to the tests. The comment at line 37 has the same #805 narration in a smaller form. The llvm comment is acceptable, because it explains the test dep choice.
Carries the intent of #805: one package should be enough to build hello-world. It doesn't take #805's approach, which the registry spec now rules against.
#805 added
binutilsandlinux_headersto thegcc/llvmruntime_deps (andtoolchaintorust's). gominimal/arch#183 (D-25, build §3) instead gives a compiler package only its own parts, and has thetoolchaingroup supply the assembler, linker, libc and kernel headers. So the "one package" istoolchain, and this PR makes that a tested promise:toolchainhello_ccccompiles, links (binutils) and runs C with only the group plus bash and coreutilsgcc h.c:cannot execute 'as'toolchainhello_cxx_linux_headersg++with<linux/types.h>llvmhello_clang_toolchainclang h.cthrough the systemld, withtoolchainas a test deprustdefault_linker_rustc/_cargotoolchainas a test deplinker 'cc' not foundcc(fix(gcc,llvm,rust): let each compiler build hello-world from its own closure #805's other gcc fix).# TODO: Some of these need to be runtime_depscomments. gcc 16 rewrites that recipe; under the spec they become "deliberately not runtime_deps; see toolchain".I rendered the test sources locally from the Nickel strings, through the shell
printf, to check the escaping. Nothing was compiled here; build-bot runs the tests.🤖 Generated with Claude Code
Summary by CodeRabbit