tools: group scripts by what runs them

tools/windows/   .ps1   (pwsh, so usable from Linux and macOS too)
  tools/posix/     .sh
  tools/python/    .py
  tools/           .c and .pl

The .c and .pl files stay at the top level because they are not
host-specific: the build compiles or invokes them on every platform.

Call sites updated in the Makefile, ports/mk/port.mk, docs and the
project memory. The one thing that does not survive a move on its own is
a script deriving the repo root from its own location -- all nine
PowerShell tools used Split-Path $PSScriptRoot -Parent, and memory-sync.sh
used dirname/.., both of which quietly become tools/ one level deeper.
Two levels now.

Two pre-existing Windows failures surfaced while verifying, both real and
neither caused by the move:

  - schfs_fsck.c did not compile under mingw at all: --extract uses
    POSIX mkdir(path,mode), symlink() and link(), none of which mingw
    has. That took the whole tool with it, and `make schfs-check` with
    it. mkdir maps to _mkdir; symlink and link fail loudly rather than
    writing a regular file in their place, because an extracted tree
    that differs from the image while reporting success defeats the
    point of --extract.
  - the round-trip test then failed at `ln -s`, since Git Bash cannot
    create symlinks without developer mode. It skips with a message now.
    Not a fudge: mkschfs's mingw build cannot see a symlink either, so
    the test would have compared a tree with none against an image with
    none and called it a pass -- coverage reporting itself as present
    while being absent.

Verified on Windows: build clean, all seven bootcheck suites green,
make schfs-check passes.
This commit is contained in:
Nexoniarz 2026-08-09 14:38:02 +02:00
commit 754d96ebc5
26 changed files with 127 additions and 39 deletions

View file

@ -1,38 +0,0 @@
#!/bin/sh
# Build the synthetic test tree used by schfs_roundtrip.sh into $1.
# Kept separate so the tree can be recreated for debugging without running
# the whole round-trip.
set -e
TREE=${1:?usage: mktree.sh <dir>}
rm -rf "$TREE"
mkdir -p "$TREE/bin" "$TREE/etc/conf.d" "$TREE/empty-dir" "$TREE/a/b/c/d/e/f/g"
: > "$TREE/etc/empty-file"
echo "hello schfs" > "$TREE/etc/motd"
printf 'x' > "$TREE/etc/one-byte"
dd if=/dev/zero bs=4096 count=1 2>/dev/null | tr '\0' 'A' > "$TREE/etc/exactly-4096"
cp "$TREE/etc/exactly-4096" "$TREE/etc/block-plus-one"
printf 'B' >> "$TREE/etc/block-plus-one"
dd if=/dev/zero bs=1000 count=37 2>/dev/null | tr '\0' 'C' > "$TREE/bin/multiblock"
cp "$TREE/bin/multiblock" "$TREE/bin/multiblock-twin"
dd if=/dev/zero bs=1000 count=37 2>/dev/null | tr '\0' 'D' > "$TREE/bin/decoy"
ln -s ../etc/motd "$TREE/bin/motd-link"
ln -s /nowhere "$TREE/bin/dangling-link"
echo deep > "$TREE/a/b/c/d/e/f/g/deep.txt"
echo one > "$TREE/etc/conf.d/one"
echo spaced > "$TREE/etc/a file with spaces"
echo dotted > "$TREE/etc/.hidden"
LONG=$(printf 'n%.0s' $(seq 1 255))
echo long > "$TREE/etc/$LONG"
mkdir -p "$TREE/many"
i=0
while [ $i -lt 300 ]; do
echo "file $i" > "$TREE/many/f$i"
i=$((i + 1))
done