Skip to content

gen-test-helper.sh: use --list and don't overwrite the binary - #678

Open
jmr wants to merge 2 commits into
uutils:mainfrom
jmr:gnu-test-helper-list
Open

jmr wants to merge 2 commits into
uutils:mainfrom
jmr:gnu-test-helper-list

Conversation

@jmr

@jmr jmr commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #668 (--list) and my review comments on #517.

  • gen-test-helper.sh: get utility names from --list: take the utility list from the multicall binary instead of the directory names under src/uu/. The list then matches what was built (feature subsets),
    and utility names no longer have to match crate directories (e.g. setarch's i386/linux32 aliases). For the current tree the resulting list is unchanged.
  • gen-test-helper.sh: remove existing entries before writing: cat > .test-helpers/<util> follows an existing symlink or hard link, so a leftover link to target/release/util-linux causes the wrapper
    script to be written into the release binary itself, breaking every GNU test until the next build. Remove each entry before writing it.

jmr added 2 commits October 23, 2026 09:29
run-tests.sh runs the util-linux test suite on the utilities listed by
gen-test-helper.sh, which derived them from the directory names under
src/uu/. That assumes every crate directory is a utility built into the
binary and that each utility is named after its directory. Neither holds
in general: a build may enable only some features, and a crate can
provide several utility names (e.g. setarch and its i386/linux32/...
aliases), as noted in the review of uutils#517.

Use the multicall binary's new --list flag instead, so the list matches
what was actually built. run-tests.sh already builds the binary before
calling gen-test-helper.sh; fail with a clear message if it's missing.

For the current tree, the resulting utility list is unchanged.
`cat > .test-helpers/<util>` opens the existing path for writing. If
that path is a symlink or hard link to target/release/util-linux, e.g.
left over from experimenting with linking the multicall binary instead
of generating wrappers, the wrapper script is written into the release
binary itself (and into its hard-linked copy under target/release/deps).
The binary then becomes a script that execs itself, so every GNU test
run by run-tests.sh breaks, since run-tests.sh builds before calling
this script. Only the next cargo build repairs it.

Remove each entry before writing it, so a fresh file is always created.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant