(address . guix-patches@gnu.org)
Hello,
This patch adds some propagated inputs to the reprotest package so that
most tests can run in a pure shell. I observed some issues running this
package in a pure shell when reviewing issue 69991 (which updates
diffoscope). Some of the new propagated inputs have already been listed
as native inputs, but I did not remove them under the assumption that
these programs are actually needed for the build machine. There are 3
tests which still do not work in a pure shell.
The fileordering and user_group tests both require setuid programs. Both
require fusermount and user_group requires sudo. I do not think it is
possible to make these tests work within a pure shell because a package
cannot provide setuid programs (only an operating system can).
The domain_host test does not work in a pure shell due to a dependency
on a program named domainname. I was unable to locate a package which
provides this command. The closest I could find is the inetutils package
which provides dnsdomainname but I do not think this is sufficient for
the test to run correctly. The domainname command is used in
reprotest/build.py line 243:
```python
_ = _.prepend_to_build_command(*"unshare -r --uts".split(),
"sh", "-ec", r"""
hostname {1}
domainname "{2}"
""".format(build.aux_tree, hostname, domainname) + '"$@"', "-")
```
It looks to me like this is trying to set both the hostname and the
domainname, which makes sense if it wants to test for these settings as
a cause of non-determinism. The hostname command supports setting, but
the dnsdomainname command only supports retrieving the domain name.
Additionally, this patch adds a new build phase to call fusermount3
instead of fusermount, which is the name of the command provided by
Guix's fuse package. This does not make it work in a pure shell but it
does make it work in an operating system that provides the suid version
of the binary.
Summary:
Tests working in pure shell:
- aslr
- build_path
- environment
- exec_path
- home
- kernel
- locales
- num_cpus
- time
- timezone
- umask
Tests work with appropriate suid programs provided:
- fileordering
- user_group
Tests that do not work on any Guix system:
- domain_host
To try reprotest in a pure shell, create the following makefile in an
empty directory:
```make
destination:
echo foo > destination
clean:
rm -f destination
```
Then, run the following command to try the working tests. If you want to
see the test report a problem you will need to change the recipe to be
non-deterministic. For example, use `date` instead of `echo foo` in
order to see the time test report a problem. Note that make is an
additional package in the shell because this is the build system that
happens to be used, but it would not make sense to add this as a
mandatory input to the package because some people might use reprotest
without using make. If you remove one of the propagated inputs then at
least one of these tests will crash, with the exception of findutils and
diffoscope which are used by reprotest outside the context of a specific
test (to get the hashes of multiple files and display diffs to the user,
respectively).
```shell
guix shell --pure reprotest make -- bash -c 'cd /tmp/test && reprotest
"make clean && make" destination --variations="+environment,
+build_path, +kernel, +aslr, +num_cpus, +time, +home, +locales,
+exec_path, +timezone, +umask"'
```
You can try the suid-dependent tests with the same Makefile. The sudo
and fuse-2 packages need to be installed; the default %setuid-programs
variable includes the relevant binaries. Remove the `--pure` flag from
the shell invocation and change the `--variations` flag in the reprotest
variations to have the value `"+fileordering, +user_group"`.
Regards,
Skyler