Closed chrisd8088 closed 4 years ago
I broke this off from #431 because I didn't want to have too many notes in each PR's description; they're fairly long as it is independently. And this one was already getting a bit long in the tooth, what with the XDG work. Anyway, that was my thinking on that ... mostly so the merge commit notes don't have to be too long.
This PR adds functional test scripts for Linux, adjusts a number of Mac-specific syscall wrappers and
FileSystemRunners
to be either POSIX-generic or have Linux-specific equivalents, makes some minor updates to align Linux packaging details with other platforms, and refactors the setup of the cache, config, and data directories on POSIX platforms to support (in the Linux case only) the XDG Base Directory Specification.It should be possible to review either commit-by-commit or as a single set of changes; the former might be slightly easier, though.
The (partial) support for the XDG specification comprises the majority of the changes in this PR, and is motivated by the fact that the functional tests depend on the value returned by
GetDataRootForScalarImplementation()
inLinuxPlatform.Shared.cs
, and we currently return the value of either a custom environment variable or a default of/var/run/scalar
, which may not be accessible to a non-root user and thus cause the tests to fail. While we could return a simple$HOME/.scalar
response, following the XDG specification allows us to make parallel changes so that on Linux we utilize the relevant locations for all three types of files, which by default will be:~/.cache/scalar
~/.config/scalar
~/.local/share/scalar
Although our implementation is not 100% complete (yet), it does permit runs of the functional test suite on Linux, and moreover allows for runs which avoid polluting these locations by defining the relevant
$XDG_{CACHE,CONFIG,DATA}_HOME
environment variables.What remains to be done, if desired, is described in a comment in
LinuxPlatform.cs
as well as the description for commit 9e859dfd28e5e0478fa1a7de9dbfe865129062b9:We also slightly refactor the
CloneTests.CloneWithDefaultLocalCacheLocation()
functional test, which runs on POSIX platforms only, so as to ensure it passes on Linux regardless of whether the$XDG_CACHE_HOME
environment variable is set or not. This change depends on the introduction of aScalarTestConfig.DefaultLocalCacheRoot
accessor which returns the appropriate cache path on each platform.