aboutsummaryrefslogtreecommitdiff
path: root/tcwg-binutils.yaml
blob: 3fe504b54ba7c02ae56f48e962c8f746d2598692 (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
- job:
    name: tcwg-binutils
    project-type: matrix
    defaults: global
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            linaro:
                - job-build
                - job-cancel
        - build-discarder:
            days-to-keep: 30
            num-to-keep: 30
    parameters:
        - string:
            name: binutils_rev
            default: 'refs/remotes/origin/master'
            description: 'binutils revision to build'
        - string:
            name: target_list
            default: 'aarch64-linux-gnu aarch64_be-linux-gnu aarch64-none-elf aarch64_be-none-elf arm-linux-gnueabi arm-linux-gnueabihf armv8l-linux-gnueabihf arm-netbsdelf arm-none-eabi arm-none-nacl arm-none-symbianelf arm-pe arm-vxworks arm-wince-pe armeb-linux-gnueabihf tcwg-x86_64-cam tcwg-x86_32-build tcwg-apm_64-build tcwg-apm_32-build tcwg-tk1_32-build'
            description: 'List of targets to test'
        - string:
            name: bfd_list
            default: '--enable-64-bit-bfd=no --enable-64-bit-bfd=yes'
            description: 'Type of BFD to enable: --enable-64-bit-bfd=yes --enable-64-bit-bfd=no'
        - string:
            name: scripts_branch
            default: master
            description: 'Jenkins-scripts branch to use'
        - bool:
            name: dont_fail
            default: false
            description: 'Do not fail the build'
        - string:
            name: log_name
            default: '${JOB_NAME}-${BUILD_NUMBER}/${builder_type}.$target.$bfd'
            description: 'Logname directory on logserver'
        - string:
            name: log_server
            default: dev-01.tcwglab:/home/tcwg-buildslave/logs
            description: 'Log_Server'
    disabled: false
    node: tcwg-coordinator
    retry-count: 3
    concurrent: true
    display-name: 'TCWG BBB Binutils-GDB'
    scm:
        - git:
            url: https://git-us.linaro.org/toolchain/binutils-gdb.git
            refspec: +refs/heads/master:refs/remotes/origin/master
            branches:
                - ${binutils_rev}
            skip-tag: true
            shallow-clone: false
            reference-repo: /home/tcwg-buildslave/snapshots-ref/binutils-gdb.git
            wipe-workspace: false
    axes:
        - axis:
            type: slave
            name: label
            values:
                - tcwg-x86_64-cam
                - tcwg-x86_32-build
                - tcwg-apm_64-build
                - tcwg-apm_32-build
                - tcwg-tk1_32-build
        - axis:
            type: dynamic
            name: bfd
            values:
                - bfd_list
        - axis:
            type: dynamic
            name: target
            values:
                - target_list
    execution-strategy:
        combination-filter: |
            ((label==~/tcwg-x86_.*/) && ! (target==~/tcwg-.*/)) || (target==label)
        sequential: false
    wrappers:
        - timeout:
            timeout: 600
        - timestamps
        - ssh-agent-credentials:
            # tcwg-buildslave user id
            users:
                - 'e0958a95-204f-4c14-a66c-5e2be6c5d50a'
        - build-name:
            name: '#${BUILD_NUMBER}-${ENV,var="binutils_rev"}'
    builders:
        - shell: |
            #!/bin/bash

            set -ex

            rm -rf jenkins-scripts
            git clone -b $scripts_branch --depth 1 https://git-us.linaro.org/toolchain/jenkins-scripts

            ./jenkins-scripts/start-container-docker.sh --label $label --node $NODE_NAME --distro trusty --task build --prefix build_ > build-container.sh
            . ./build-container.sh
            BUILD_SHELL="build_container_exec bash"
            $BUILD_SHELL -c "echo \"Build session is up; ulimit config:\"; ulimit -a"

            builder_type=$(print_type_for_label $label)

            # Remove container on exit
            trap "build_container_cleanup" EXIT HUP INT QUIT TRAP KILL PIPE TERM

            case $target in
                arm-wince-pe|arm-pe|arm-epoc-pe|arm-aout|arm-coff)
                    lto=
                    ;;
                *)
                    lto=--enable-lto
                    ;;
            esac

            case $target in
                tcwg-*) target_opt="" ;;
                *) target_opt="--target $target" ;;
            esac

            rm -rf build-$target || true
            mkdir -p build-$target
            cd build-$target
            result=0
            jobs=$(nproc --all)
            echo BUILD STARTED $(date)
            echo WORKSPACE: ${WORKSPACE}

            # Build our own version of dejagnu, using abe to try to
            # avoid problems with the system's version
            ${BUILD_SHELL} -c "git clone https://git.linaro.org/toolchain/abe.git"
            ${BUILD_SHELL} -c "cd abe && ./configure --with-git-reference-dir=/home/tcwg-buildslave/snapshots-ref"
            ${BUILD_SHELL} -c "cd abe && ./abe.sh --build dejagnu"
            djpath=$(${BUILD_SHELL} -c "ls -d $PWD/abe/./builds/destdir/*/bin")
            [ -x $djpath/runtest ] || (echo "DejaGnu not built in the expected location: $djpath/runtest" && exit 1)

            # If configure or build fails, the execution will stop
            # because of 'set -e'. But for 'make check' we want to
            # execute all the tests, and report if there were some
            # errors.
            ${BUILD_SHELL} -c "../configure $lto --enable-plugins --disable-gprof --disable-gdb --disable-sim --disable-libdecnumber --disable-readline --prefix=`pwd`/install $target_opt ${bfd}"
            ${BUILD_SHELL} -c "make all -j$jobs"
            ${BUILD_SHELL} -c "PATH=$djpath:$PATH make check -j$jobs -k" || result=1

            # For the moment, only build gdb (do not run the tests).
            # Do this in a different subdir.
            # GDB is no longer supported on arm-vxworks
            case ${target} in
              arm-vxworks) ;;
              *)
                ${BUILD_SHELL} -c "mkdir build-gdb && cd build-gdb && ../../configure --with-gnu-ld --enable-plugins --enable-tui --disable-gas --disable-binutils --disable-ld --disable-gold --disable-gprof $target_opt ${bfd}"
                ${BUILD_SHELL} -c "cd build-gdb && make all -j$jobs"
                ;;
            esac

            sums=`find . -name "*.sum"`
            set +x
            echo '############################################'
            echo 'See unexpected results below:'
            echo '############################################'
            [ x"$sums" != x ] && egrep '^FAIL:|^XPASS:' $sums || true
            echo '############################################'
            echo 'See ends of sumfiles below:'
            echo '############################################'
            [ x"$sums" != x ] && tail $sums

            set -x
            # Split $logserver into "server:path".
            basedir="${log_server#*:}"
            log_server="${log_server%:*}"
            eval dir=${log_name}
            ssh ${log_server} mkdir -p ${basedir}/${dir}
            # gcc-compare-results handles only .xz files, so compress
            # them before upload. Since the file are created inside a
            # container, the uid/gid may differ from the host's and
            # cause permission errors during compression. Copy them,
            # so that xz can operate.
            rm -rf artifacts
            mkdir -p artifacts
            cp ${sums} artifacts/
            for sum in ${sums}
            do
                log=$(echo $sum | sed 's/.sum/.log/')
                cp $log artifacts/
            done
            xz artifacts/*.sum artifacts/*.log
            scp artifacts/*.sum.xz artifacts/*.log.xz ${log_server}:${basedir}/${dir}/

            echo BUILD FINISHED $(date)

            # Cleanup to save disk space
            cd ..
            du -sh build-$target
            rm -rf build-$target || true

            if $dont_fail; then
                result="0"
            fi
            exit $result
    publishers:
        - email-ext:
            recipients: 'christophe.lyon@linaro.org'
            matrix-trigger: only-parent