blob: 6c7b37d7fa88261f6ca642dac8c5f3bfd01cf677 (
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#/bin/bash
# $@: Jenkins labels, typically tcwg-t[kx]1_{32/64}-test
# Returns node from one of the labels with least number of running containers.
print_node_with_least_containers ()
{
set -euf -o pipefail
local tester_labels="$@"
local tester
local testers
local load_value
local tester_min_load_name=""
local tester_min_load_value="999"
testers=$(
set -euf -o pipefail
local label
for label in $tester_labels; do
wget -O - https://ci.linaro.org/label/$label/api/json?pretty=true 2>/dev/null | grep nodeName | cut -d: -f 2 | sed -e 's/"//g'
done)
for tester in $testers; do
load_value=$(docker -H ${tester}.tcwglab:2375 ps | wc -l || echo 999)
if [ $load_value -lt $tester_min_load_value ]; then
tester_min_load_name=$tester
tester_min_load_value=$load_value
fi
done
echo $tester_min_load_name
}
# $1: Jenkins tcwg-*-build label
# Prints out architecture for container image
print_arch_for_label ()
{
set -euf -o pipefail
local label="$1"
case $label in
tcwg-x86_64-*) echo amd64 ;;
tcwg-x86_32-*) echo i386 ;;
tcwg-tx1_64-*|tcwg-apm_64-*) echo arm64 ;;
tcwg-tk1_32-*|tcwg-tx1_32-*|tcwg-apm_32-*) echo armhf ;;
*) echo "ERROR: Unsupported label: $label" 1>&2; exit 1 ;;
esac
}
# $1: Jenkins tcwg-*-build label
# Prints out host type
print_type_for_label ()
{
set -euf -o pipefail
echo "$1" | sed -e "s/^tcwg-\(.*\)-build\$/\1/"
}
# $1: Jenkins $NODE_NAME
# Prints DNS hostname
print_host_for_node ()
{
set -euf -o pipefail
local NODE="$1"
local ID=$(echo ${NODE} | sed 's/.*-\([0-9][0-9]\)$/\1/')
case ${NODE} in
tcwg-apm-0[1-2]) echo apm-${ID}.tcwglab ;;
tcwg-apm-0[3-4]) echo test-armv8-$(echo "${ID}" | sed -e 'y/34/12/').tcwglab ;;
tcwg-bmk-*) echo dev-01.tcwglab ;;
tcwg-tk1-0[1-5]) echo ${NODE}.tcwglab ;;
tcwg-tx1-0[1-5]) echo ${NODE}.tcwglab ;;
tcwg-x86_64-build-0[1-8]) echo build-${ID}.tcwglab ;;
tcwg-x86_64-dev-0[1-2]) echo dev-${ID}.tcwglab ;;
tcwg-x86_64-dev-0[1-2]-short)
ID=$(echo ${NODE} | sed 's/.*-\([0-9][0-9]\)-short$/\1/')
NAME=dev-${ID}.tcwglab
;;
*) echo "Error: unsupported NODE value: ${NODE}" 1>&2; exit 1 ;;
esac
}
# $1: target triplet
# Prints tester label for remote cross-testing
print_tester_label_for_target ()
{
set -euf -o pipefail
local target="$1"
case "$target" in
aarch64-linux*) echo "tcwg-tx1_64-test" ;;
armv8l-linux*) echo "tcwg-tx1_32-test" ;;
arm-linux*) echo "tcwg-tk1_32-test" ;;
esac
}
|