[libvirt] [PATCH v2] tests: Avoid writing into $HOME during virsh-snapshot
Andrea Bolognani
abologna at redhat.com
Thu Apr 4 15:06:06 UTC 2019
On Thu, 2019-04-04 at 09:41 -0500, Eric Blake wrote:
> In a constrained CI environment, where it is intentional that attempts
> to write outside the current directory will fail, virsh-snapshot was
> failing:
>
> @@ -1,2 +1,3 @@
> error: invalid argument: parent s3 for snapshot s2 not found
> error: marker
> +error: Failed to create '/home/travis/.cache/libvirt/virsh': Permission denied
> FAIL virsh-snapshot (exit status: 1)
>
> But we've already solved the problem in virsh-uriprecedence: tell
> virsh to use XDG locations pointing to somewhere we can write rather
> than its default of falling back to $HOME with the test being at risk
> of breaking due to the user's environment and/or unacceptably altering
> the user's normal cache. Hoist that solution into test-lib.sh, so
> that all scripts can use it as needed. While at it, fix a latent typo
> where XDG_RUNTIME_HOME was set to a literal relative directory name
> "XDG_CACHE_HOME" (the typo did not affect virsh-uriprecedence, but
> could matter to other clients).
>
> Fixes: 280a2b41
> Fixes: 398de147
> Reported-by: Daniel P. Berrangé <berrange at redhat.com>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>
> in v2:
> - fix typo in XDG_RUNTIME_HOME [Andrea]
> - fix 'make distcheck' by using actual per-test tempdir (tests/lv-TEST.XXX/)
> rather than tests/ as the XDG root [Andrea]
>
> tests/test-lib.sh | 13 +++++++++++++
> tests/virsh-snapshot | 2 ++
> tests/virsh-uriprecedence | 12 +-----------
> 3 files changed, 16 insertions(+), 11 deletions(-)
Reviewed-by: Andrea Bolognani <abologna at redhat.com>
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list