test: HostFlatpak asks about projects in a directory of its own
In the Flatpak, HostFlatpak makes two projects in the sandbox's /tmp, one there and one through a link in the fixture's build/ that leads there, and asks whether the host sees them. They had fixed names, /tmp/crafter-build-host-flatpak and crafter-build-host-flatpak-linked beside it, and every sandbox of the app has the same /tmp, so two runs at once asked about, and removed, the same projects. Both are now in a directory the test makes there, a PrivateDirectory, which the link leads to, and which goes afterwards with the link, or, when the test is killed, when a later one is made, once it has not changed for a minute. The test still names /tmp rather than the TMPDIR it is given, since the sandbox's /tmp is what it asks the host about, and AGENTS.template.md's entry for it says it makes a directory of its own there now.
This commit is contained in:
parent
ab8935826d
commit
0602e282b2
2 changed files with 12 additions and 3 deletions
|
|
@ -167,7 +167,7 @@ These were decided deliberately. Do not undo them without the maintainer's say-s
|
|||
- The linter loads `libclang` at runtime by name. `CRAFTER_BUILD_LIBCLANG` pins an exact path and must fail loudly when wrong, never fall back to another library.
|
||||
- crafter-build's Flatpak has `--talk-name=org.freedesktop.Flatpak`, and the permission is the whole sandbox's: anything that runs there can run commands on the host through `flatpak-spawn --host`. That is every process of crafter-build's sandbox: crafter-build itself, every `project.cpp` it loads with its scripts, the builds of its dependencies and pragma dependencies, the programs `-r` and `test` start, and whatever `flatpak run --command=` and `flatpak enter` start in it, the debuggers of the README's Debugging section and the programs under them included. crafter-build's own code uses it only through `HostCommand` in `:Platform`, which builds the command lines of `RunHostFlatpak`, `RunHostFlatpakBuilder` and `HostFlatpakUnavailable`'s probes, for the host's `flatpak` and `flatpak-builder` behind `install` and `bundle`; add no other host command to crafter-build. `RunHostFlatpak` is exported for the tests, and gives a `project.cpp` nothing the sandbox does not. The trust model allows the permission because `--filesystem=host` already lets sandboxed code write `~/.bashrc`, `~/.config/autostart` and `~/.config/systemd/user`: it makes running something on the host immediate, not newly possible, for everything the sandbox runs.
|
||||
- CI creates a release for each release tag with the workflow's own token, pushes nothing to git, and signs the Flatpak repo with the key mounted from the runner host. Do not add secrets to the workflow or echo the environment in it.
|
||||
- Tests write only under `fs::temp_directory_path()` and the fixture's own `bin/` and `build/`, and in the caches of what they run, unless they point `XDG_CACHE_HOME` elsewhere: crafter-build's, what a build puts there, and wasmtime's, the modules the wasm tests run. Keep it that way. Two tests write elsewhere, and both remove what they make: `tests/HeadlessCompositor`, which makes its compositors' directories in a directory of its own in `$XDG_RUNTIME_DIR`, or in `/tmp` when that is not a directory, and has one made in `/tmp` itself, as crafter-build makes it where there is no `$XDG_RUNTIME_DIR`, because a socket's path holds 107 bytes and a temp directory's path can use them up, and a later run removes what a killed run of it left once that has not changed for a minute (`PrivateDirectory`); and `tests/HostFlatpak`, which in the Flatpak makes its two projects in the sandbox's `/tmp`, the place it asks the host about, under fixed names, so that its next run that makes them removes what a killed one left.
|
||||
- Tests write only under `fs::temp_directory_path()` and the fixture's own `bin/` and `build/`, and in the caches of what they run, unless they point `XDG_CACHE_HOME` elsewhere: crafter-build's, what a build puts there, and wasmtime's, the modules the wasm tests run. Keep it that way. Two tests write elsewhere, and both remove what they make, and a later run removes what a killed one left once that has not changed for a minute (`PrivateDirectory`): `tests/HeadlessCompositor`, which makes its compositors' directories in a directory of its own in `$XDG_RUNTIME_DIR`, or in `/tmp` when that is not a directory, and has one made in `/tmp` itself, as crafter-build makes it where there is no `$XDG_RUNTIME_DIR`, because a socket's path holds 107 bytes and a temp directory's path can use them up; and `tests/HostFlatpak`, which in the Flatpak makes a directory of its own in the sandbox's `/tmp`, the place it asks the host about.
|
||||
|
||||
## CI and publishing
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue