summaryrefslogtreecommitdiffstats
path: root/controller
blob: 7f628d6247023da461325ee52409189d96ca77d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash

. config/config.sh || {
    echo >&2 "sorry, but config/config.sh not found"
    exit 1
}

# (still) local variables
distro=fedora
distro_ver=20
arch=x86_64
starttime=$(date -u +%Y%m%d_%H%M%S_%N)

die() { echo "$@";  exit 1; }

prereq_resultdir()
{
    test -d "$DTF_DATABASE" || mkdir -p "$DTF_DATABASE"
}

unpack_results()
{
    local where="$1"
    local tmp_results_dir="$2"

    local workdir=$(mktemp -d "/tmp/.dtf.XXXXXX") || die "can not create workdir"

    { pushd "$workdir" >/dev/null \
      && tar -xf "$tmp_results_dir/dtf.tar.gz" \
      && pushd dtf >/dev/null
    } || die "can not unpack results"

    for i in *.log; do
        local task_id="${i%%.log}"
        local mydir=""

        # First item in tarball is the "main" directory
        while read dirname; do
            test -z "$mydir" && mydir="$dirname"
        done <<<"$(tar xvf "$task_id.tar.gz")"

        # Give the unpacked results better name
        rm "$task_id.tar.gz"
        mv "$mydir" "$task_id.dir"
    done

    { popd && popd ; } > /dev/null

    { mkdir -p "$(dirname "$where")" \
      && mv "$workdir/dtf" "$where" ;
    } || die "can not create resultdir"
}

prereq_resultdir

workdir=$(mktemp -d "/var/tmp/dtf_postgresql_setup-XXXXXX")

./run_remote \
    --distro="$distro" \
    --distro-version="$distro_ver" \
    --workdir="$workdir" \
    --openstack-instance="$DTF_OPENSTACK_ID" \
|| die "can not perform run_remote"

resultdir="$DTF_DATABASE/$distro/$distro_ver/$arch"
unpack_results "$resultdir/result_$starttime" "$workdir"

./runner/result_stats "$resultdir" > "$resultdir/results.html"

rsync -r "${DTF_DATABASE%%/}/" "${DTF_PRESENTER_PLACE%%/}"