Running outside of GitLab will likely not have the variable set and
hence the execution would fail. To make sure we always start with a
clean scratch dir (which may or may not be the best thing), create it
with 'mktemp'. The main reason for a temporary directory is to ensure a
clean environment for the job every time run_integration function is
run. For repeated interactive use case, it is imperative that the
developer takes care of their environment.
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
# should also be a non-fatal error
run_cmd_quiet sudo virsh --quiet net-start default || true
+ # SCRATCH_DIR is normally set inside the GitLab CI job to /tmp/scratch.
+ # However, for local executions inside a VM we need to make sure some
+ # scratch directory exists and also that it is created outside of /tmp for
+ # storage space reasons (if multiple project repos are to be cloned).
+ SCRATCH_DIR="${SCRATCH_DIR:=$GIT_ROOT/ci/scratch)}"
+
+ test ! -d "$SCRATCH_DIR" && run_cmd mkdir "$SCRATCH_DIR"
run_cmd cd "$SCRATCH_DIR"
run_cmd git clone --depth 1 https://gitlab.com/libvirt/libvirt-tck.git
run_cmd cd libvirt-tck