summaryrefslogtreecommitdiffstats
path: root/controller
blob: 938bab5206e56d2d07f1fe34b6a9fc6c15f56718 (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
#!/bin/bash

. config.sh || { echo >&2 "sorry, but 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 workdir=$(mktemp -d "/tmp/.dtf.XXXXXX") || die "can not create workdir"

    pushd "$workdir"
    tar -xf /var/tmp/dtf.tar.gz

    pushd dtf
    for i in *.log; do
        pwd
        local task_id="${i%%.log}"
        local mydir=""
        while read dirname; do
            test -z "$mydir" && mydir="$dirname"
        done <<<"$(tar xvf "$task_id.tar.gz")"

        rm "$task_id.tar.gz"

        mv "$mydir" "$task_id.dir"
    done


    popd
    popd

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

prereq_resultdir

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

./run_remote \
    --distro="$distro" \
    --distro-version="$distro_ver" \
    --workdir="$workdir"

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

./runner/result_stats "$resultdir"