diff options
-rwxr-xr-x | controller/run_remote | 27 | ||||
-rwxr-xr-x | tester/run | 10 |
2 files changed, 26 insertions, 11 deletions
diff --git a/controller/run_remote b/controller/run_remote index 0f7ccc3..0b405aa 100755 --- a/controller/run_remote +++ b/controller/run_remote @@ -1,15 +1,17 @@ #!/bin/bash -. config/config.sh || { - echo >&2 "sorry, but config/config.sh not found" +srcdir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) || exit 1 + +. "$srcdir/config/config.sh" || { + echo >&2 "sorry, but $srcdir/config/config.sh not found" exit 1 } longopts="verbose,help,force,testid:,listonly" -run_playbook=${run_playbook-ansible/fedora.yml} +run_playbook=${run_playbook-$srcdir/ansible/fedora.yml} -opt_workdir=/var/tmp/dbt-results +opt_workdir= opt_distro=fedora opt_openstack_instance="$DTF_OPENSTACK_ID" opt_distro_ver=20 @@ -67,16 +69,27 @@ done test -z "$opt_taskdir" && die "you must specify --taskdir" -credsfile="$(readlink -f "./private/os/$opt_openstack_instance.yml")" +credsfile="$(readlink -f "$srcdir/private/os/$opt_openstack_instance.yml")" test -z "$credsfile" && die "--ansible-creds option must be specified" test ! -f "$credsfile" && die "file $credsfile not found" -config_os_file="$(readlink -f "./config/os/$opt_openstack_instance.sh")" +config_os_file="$(readlink -f "$srcdir/config/os/$opt_openstack_instance.sh")" test ! -r "$config_os_file" && die "file $config_os_file not found" . "$config_os_file" config_os_id="$opt_distro$opt_distro_ver" +workdir_prereq() +{ + if test -z "$opt_workdir"; then + opt_workdir="$(mktemp -d "/tmp/dtf-remoterun-workdir-XXXXXX")" \ + || die "can't create workdir '$opt_workdir'" + echo "temporary workdir created: $opt_workdir" + elif test ! -d "$opt_workdir"; then + mkdir -p "$opt_workdir" || die "can't create workdir '$opt_workdir'" + fi +} + tarball() ( testsuite_name="$(basename "$opt_taskdir")" @@ -84,6 +97,8 @@ tarball() "$opt_taskdir/run" --dist | gzip > "$opt_workdir/$testsuite_name.tar.gz" ) +workdir_prereq + testsuite_name="$(tarball)" || die "can not create dist tarball" export ANSIBLE_HOST_KEY_CHECKING=False @@ -11,7 +11,7 @@ export DTF_RESULTDIR=${DTF_RESULTDIR-/var/tmp/dtf} # when exists per-testsuite config.sh, source it here test -r "$srcdir/config.sh" && . "$srcdir/config.sh" -export dtf_resultxml_file=/var/tmp/dtf.xml +export dtf_resultxml_file="$DTF_RESULTDIR/dtf.xml" export dtf_option_verbose=0 export dtf_option_force=0 @@ -72,7 +72,7 @@ run() ( cd "$dtf_workdir" - outlog="$DTF_RESULTDIR/$dtf_test_id.log" + outlog="$DTF_RESULTDIR/tasks/$dtf_test_id.log" output_wrapper="cat > $outlog" test $dtf_option_verbose = 1 \ @@ -102,12 +102,12 @@ run() rv=$? test -n "$DTF_RESULT_TARBALL" \ - && cp "$DTF_RESULT_TARBALL" "$DTF_RESULTDIR/$dtf_test_id.tar.gz" + && cp "$DTF_RESULT_TARBALL" "$DTF_RESULTDIR/tasks/$dtf_test_id.tar.gz" { echo "---" echo "exit_status: $rv" echo "finished: \"$(date)\"" - } >> "$DTF_RESULTDIR/$dtf_test_id.result" + } >> "$DTF_RESULTDIR/tasks/$dtf_test_id.result" exit $rv ) 2>&1 | eval "$output_wrapper" @@ -126,7 +126,7 @@ prepare_resultdir() rm -rf "$DTF_RESULTDIR" || die "can not remove $DTF_RESULTDIR" fi - mkdir -p "$DTF_RESULTDIR" || die "can not create $DTF_RESULTDIR" + mkdir -p "$DTF_RESULTDIR/tasks" || die "can not create $DTF_RESULTDIR" } show_help() |