aboutsummaryrefslogtreecommitdiffstats
path: root/jjb/common/include-agl-run-test-prepare.sh
blob: 9bbb679d1ba4c21e725bd320e07a06acc90c5a32 (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
# (c) 2016 Jan-Simon Moeller dl9pf(at)gmx.de
# License GPLv2

################################################################################
## Run SHORT CI test
################################################################################
set -x

#ls -alh
#pwd
#set

cd $REPODIR

# clone repo for templates and related utils, add to $PATH for later use
if [ ! -e releng-scripts ]; then
    git clone --branch release https://git.automotivelinux.org/AGL/releng-scripts
else
    (cd releng-scripts; git remote update; git checkout -f origin/release)
fi

if [ -e releng-scripts/utils ]; then
    export PATH=$PATH:$PWD/releng-scripts/utils
    RELENG=$PWD/releng-scripts
fi

declare -A agl_lava_releng_aliases
agl_lava_releng_aliases=(
    [raspberrypi3]="bcm2837-rpi-3-b-32;raspberrypi3"
    [qemux86-64]="qemu;qemux86-64"
    [qemuarm64]="qemu;qemuarm64"
    [m3ulcb-nogfx]="r8a7796-m3ulcb;m3ulcb"
    [porter-nogfx]="renesas-porter;porter"
    [dra7xx-evm]="dra7-evm;dra7xx-evm"
    [intel-corei7-64]="upsquare;upsquare"
)

OFS=${IFS}
IFS=';'
arr=(${agl_lava_releng_aliases[$MACHINE]})
IFS=${OFS}
lava_device=${arr[0]}
releng_device=${arr[1]}
# And agl_device=${MACHINE}

if [ -z "${lava_device}" -o -z "${releng_device}" ]; then
    echo "Board not supported: $MACHINE"
    exit 0
fi

CREATE_ARGS=""
CREATE_ARGS+="--machine ${releng_device} "

if [[ $TARGETBRANCH ]] && [[ x"master" != x"$TARGETBRANCH" ]] ; then
CREATE_ARGS+="--branch $TARGETBRANCH "
fi

# If it's a release build
if [[ $RELEASE_BRANCH ]] && [[ $RELEASE_VERSION ]]; then
    CREATE_ARGS+="--build-type release $RELEASE_BRANCH $RELEASE_VERSION "
fi
# If it's a CI build
if [[ $GERRIT_CHANGE_NUMBER ]] && [[ $GERRIT_PATCHSET_NUMBER ]]; then
    CREATE_ARGS+="--build-type ci $GERRIT_CHANGE_NUMBER $GERRIT_PATCHSET_NUMBER "
fi

$RELENG/utils/job-prereq.py ${CREATE_ARGS}
if [ $? -ne 0 ]; then
    echo "Board not supported by releng-scripts: job-prereq.py"
    exit 0
fi
# First call to job-prereq suceeded, other should suceed as they use the same args.
export DEVICE_DTB=`$RELENG/utils/job-prereq.py ${CREATE_ARGS} --dtb`
export DEVICE_KERNEL=`$RELENG/utils/job-prereq.py ${CREATE_ARGS} --kernel`
export DEVICE_INITRAMFS=`$RELENG/utils/job-prereq.py ${CREATE_ARGS} --initrd`
export DEVICE_NBDROOT=`$RELENG/utils/job-prereq.py ${CREATE_ARGS} --nbdroot`

# echo NEXT is rsync
#exit 0