[Toybox] [RFC] mkroot: Possible solution to running tests in a vacum: Use the host bash in a chroot

Oliver Webb aquahobbyist at proton.me
Wed Mar 20 10:38:04 PDT 2024


A target for the 0.9 release is the test suite running under mkroot, Which is also required
for passwd to be re-promoted (We need to test it in a vacuum). Since toysh in it's current
state isn't good enough to run test.sh, a possible solution until it does become good enough
is to use the host systems bash. Copying the binary into the filesystem and running test.sh
with it.

The main downside of this is that you have to look for the dynamic libraries bash wants and
copy them into the fs directory, and doing a chroot requires root permissions. Also it is very
clearly not a permanent fix (None of this is needed once toysh is ready), just enough to get
tests for commands like passwd and chsh running. Another downside of chroot-ing is you can't
emulate things that depend on drivers or nommu.

Attached is a mkroot package (Not a patch), that sets up a environment to run the test suite
under a chroot in. (./mkroot/mkroot.sh testwhost && sudo chroot root/host/fs /test command_name).
It's not something I'm actually expecting to be merged, but that doesn't mean it's not potentially
useful for testing the commands that modify /etc/passwd and friends.

Also when making this I spotted some things in the build infrastructure we will need to work around
in a airlock-ed test suite, test.sh needs configure, and portability.sh needs something for CC or
else it will throw a fit.

-   Oliver Webb <aquahobbyist at proton.me>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testwhost
Type: application/octet-stream
Size: 1253 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240320/8599363c/attachment.obj>


More information about the Toybox mailing list