summaryrefslogtreecommitdiff
path: root/tcwg-benchmark.sh
blob: 567763d2a1015450bb64ded24d6b58b777171c4e (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
set -ex

usage ()
{
    echo "ERROR: Unsupported options: $@"
    exit 1
}

while [ $# -ge 1 ]; do
    case "$1" in
	--toolchain_url) toolchain_url="$2" ;;
	--bench_list) bench_list="$2" ;;
	--config) config="$2" ;;
	--cflags) cflags="$2" ;;
	--sysroot) sysroot="$2" ;;
	--fileserver) fileserver="$2" ;;
	--forceinstall) forceinstall="$2" ;;
	--scripts_branch) scripts_branch="$2" ;;
	--label) label="$2" ;;
	--build_number) BUILD_NUMBER="$2" ;;
	--node_name) NODE_NAME="$2" ;;
	--workspace) WORKSPACE="$2" ;;
	*) usage "$@" ;;
    esac
    shift 2
done

wget --progress=dot:giga --no-check-certificate ${toolchain_url}
tarball=$(basename ${toolchain_url})
tar xf ${tarball}
toolchaindir=$(echo ${tarball} | sed 's/.tar.xz//')
ccpath=$(find $WORKSPACE/$toolchaindir -name "*-gcc")
ccprefix=$(echo $ccpath | sed -e 's/-gcc$/-/')

# Slaves for this job are virtual slaves on dev-01,
# convert the slave name into the target board name
boardname=$(echo ${NODE_NAME} | sed 's/-bmk//').tcwglab
boardname="tcwg-benchmark@${boardname}"

ssh $boardname rm -rf bmk-scripts
ssh $boardname git clone https://git-us.linaro.org/toolchain/bmk-scripts

./start-container-docker.sh --arch amd64 --node $NODE_NAME --distro trusty --task build --prefix build_ > build-container.sh
. ./build-container.sh

# Make sure to cleanup build container if something goes
# wrong when preparing the test environment
trap "cleanup_all_containers" EXIT

build_container_exec ssh -t $boardname bmk-scripts/run.sh \
                     --bench $(printf '%q' "$bench_list") \
                     --config ${config} \
                     --cflags $(printf '%q' "$cflags") \
                     --ccprefix $build_container_host:$build_container_port:$ccprefix \
                     ${sysroot:+--sysroot "$sysroot"} \
                     --toolchain gnu \
                     --resultsdest ${fileserver}:results/${NODE_NAME}-123-0/${BUILD_NUMBER} \
                     --nodename ${NODE_NAME} \
                     --forceinstall ${forceinstall} \
                     --verbose true

exit 0